Re: [PATCH 2/4] virtio_net: pass well-formed sg to virtqueue_add_inbuf()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 29, 2014 at 04:56:43PM +0930, Rusty Russell wrote:
> This is the only place which doesn't hand virtqueue_add_inbuf or
> virtqueue_add_outbuf a well-formed, well-terminated sg.  Fix it,
> so we can make virtio_add_* simpler.
> 
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
> ---
>  drivers/net/virtio_net.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 8a852b5f215f..63299b04cdf2 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -590,6 +590,8 @@ static int add_recvbuf_big(struct receive_queue *rq, gfp_t gfp)
>  	offset = sizeof(struct padded_vnet_hdr);
>  	sg_set_buf(&rq->sg[1], p + offset, PAGE_SIZE - offset);
>  
> +	sg_mark_end(&rq->sg[MAX_SKB_FRAGS + 2 - 1]);
> +
>  	/* chain first in list head */
>  	first->private = (unsigned long)list;
>  	err = virtqueue_add_inbuf(rq->vq, rq->sg, MAX_SKB_FRAGS + 2,

Not that performance of add_recvbuf_big actually mattered anymore, but
in fact this can be done in virtnet_probe if we like.


Anyway

Acked-by: Michael S. Tsirkin <mst@xxxxxxxxxx>

> -- 
> 1.9.1

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]