netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [PATCH RFC 1/4] virtio_net: pass vi around
Date: Fri, 24 Oct 2014 17:10:23 +0300	[thread overview]
Message-ID: <20141024141023.GA7939@redhat.com> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1C9DE6C2@AcuExch.aculab.com>

On Fri, Oct 24, 2014 at 10:02:15AM +0000, David Laight wrote:
> 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@redhat.com>
> > ---
> >  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;
> ...

It's a matter of style, isn't it?
We have dev to hand, it seems cleaner to just pass it around.

-- 
MST

  reply	other threads:[~2014-10-24 14:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-23 21:27 [PATCH RFC 1/4] virtio_net: pass vi around Michael S. Tsirkin
2014-10-23 21:28 ` [PATCH RFC 2/4] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr Michael S. Tsirkin
2014-10-23 21:28   ` [PATCH RFC 3/4] virtio_net: stricter short buffer length checks Michael S. Tsirkin
2014-10-23 21:28     ` [PATCH RFC 4/4] virtio_net: bigger header when VERSION_1 is set Michael S. Tsirkin
2014-10-28  0:28       ` Rusty Russell
2014-10-28  0:27   ` [PATCH RFC 2/4] virtio_net: get rid of virtio_net_hdr/skb_vnet_hdr Rusty Russell
2014-10-24 10:02 ` [PATCH RFC 1/4] virtio_net: pass vi around David Laight
2014-10-24 14:10   ` Michael S. Tsirkin [this message]
2014-10-28  0:27 ` Rusty Russell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141024141023.GA7939@redhat.com \
    --to=mst@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).