RE: [PATCH RFC 1/4] virtio_net: pass vi around

From: David Laight
Date: Fri Oct 24 2014 - 06:04:26 EST


From: Michael S. Tsirkin

> Too many places poke at [rs]q->vq->vdev->priv just to get
> the the vi structure. Let's just pass the pointer around: seems
> cleaner, and might even be faster.
>
> Signed-off-by: Michael S. Tsirkin <mst@xxxxxxxxxx>
> ---
> drivers/net/virtio_net.c | 36 +++++++++++++++++++-----------------
> 1 file changed, 19 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 57cbc7d..36f3dfc 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
...
> static struct sk_buff *receive_big(struct net_device *dev,
> + struct virtnet_info *vi,

Do you need to pass 'dev' here?
Looks like it is obtainable from vi->dev (as below).

David

> struct receive_queue *rq,
> void *buf,
> unsigned int len)
> {
> struct page *page = buf;
> - struct sk_buff *skb = page_to_skb(rq, page, 0, len, PAGE_SIZE);
> + struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, PAGE_SIZE);
...
> -static void receive_buf(struct receive_queue *rq, void *buf, unsigned int len)
> +static void receive_buf(struct virtnet_info *vi, struct receive_queue *rq,
> + void *buf, unsigned int len)
> {
> - struct virtnet_info *vi = rq->vq->vdev->priv;
> struct net_device *dev = vi->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/