Re: [PATCH 09/16] virtio_net: use simplified virtqueue accessors.
From: Wanlong Gao
Date: Wed Feb 20 2013 - 05:11:04 EST
On 02/19/2013 03:56 PM, Rusty Russell wrote:
> We never add buffers with input and output parts, so use the new accessors.
>
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Reviewed-by: Wanlong Gao <gaowanlong@xxxxxxxxxxxxxx>
> ---
> drivers/net/virtio_net.c | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index dbd5cd1..8ca69c0 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -443,7 +443,7 @@ static int add_recvbuf_small(struct receive_queue *rq, gfp_t gfp)
>
> skb_to_sgvec(skb, rq->sg + 1, 0, skb->len);
>
> - err = virtqueue_add_buf(rq->vq, rq->sg, 0, 2, skb, gfp);
> + err = virtqueue_add_inbuf(rq->vq, rq->sg, 2, skb, gfp);
> if (err < 0)
> dev_kfree_skb(skb);
>
> @@ -488,8 +488,8 @@ static int add_recvbuf_big(struct receive_queue *rq, gfp_t gfp)
>
> /* chain first in list head */
> first->private = (unsigned long)list;
> - err = virtqueue_add_buf(rq->vq, rq->sg, 0, MAX_SKB_FRAGS + 2,
> - first, gfp);
> + err = virtqueue_add_inbuf(rq->vq, rq->sg, MAX_SKB_FRAGS + 2,
> + first, gfp);
> if (err < 0)
> give_pages(rq, first);
>
> @@ -507,7 +507,7 @@ static int add_recvbuf_mergeable(struct receive_queue *rq, gfp_t gfp)
>
> sg_init_one(rq->sg, page_address(page), PAGE_SIZE);
>
> - err = virtqueue_add_buf(rq->vq, rq->sg, 0, 1, page, gfp);
> + err = virtqueue_add_inbuf(rq->vq, rq->sg, 1, page, gfp);
> if (err < 0)
> give_pages(rq, page);
>
> @@ -710,8 +710,7 @@ static int xmit_skb(struct send_queue *sq, struct sk_buff *skb)
> sg_set_buf(sq->sg, &hdr->hdr, sizeof hdr->hdr);
>
> num_sg = skb_to_sgvec(skb, sq->sg + 1, 0, skb->len) + 1;
> - return virtqueue_add_buf(sq->vq, sq->sg, num_sg,
> - 0, skb, GFP_ATOMIC);
> + return virtqueue_add_outbuf(sq->vq, sq->sg, num_sg, skb, GFP_ATOMIC);
> }
>
> static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev)
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/