mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Haiyang Zhang <haiyangz@microsoft.com>
To: Greg KH <greg@kroah.com>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"driverdev-devel@linuxdriverproject.org" 
	<driverdev-devel@linuxdriverproject.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH net-next] Add support for netvsc build without CONFIG_SYSFS flag
Date: Thu, 8 May 2014 15:13:19 +0000	[thread overview]
Message-ID: <67b9b573b20f4cc2b6fe75fe84ee48e1@DFM-DB3MBX15-06.exchange.corp.microsoft.com> (raw)
In-Reply-To: <20140508091304.GB24820@kroah.com>



> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: Thursday, May 8, 2014 5:13 AM
> To: Haiyang Zhang
> Cc: davem@davemloft.net; netdev@vger.kernel.org; olaf@aepfle.de;
> jasowang@redhat.com; driverdev-devel@linuxdriverproject.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH net-next] Add support for netvsc build without
> CONFIG_SYSFS flag
> 
> On Wed, May 07, 2014 at 03:45:04PM -0700, Haiyang Zhang wrote:
> > This change ensures the driver can be built successfully without the
> > CONFIG_SYSFS flag.
> > MS-TFS: 182270
> >
> > Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
> > Reviewed-by: K. Y. Srinivasan <kys@microsoft.com>
> > ---
> >  drivers/net/hyperv/hyperv_net.h   |    2 ++
> >  drivers/net/hyperv/netvsc_drv.c   |   12 +++++++++++-
> >  drivers/net/hyperv/rndis_filter.c |    4 ++--
> >  3 files changed, 15 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/net/hyperv/hyperv_net.h
> > b/drivers/net/hyperv/hyperv_net.h index 4b7df5a..23b96bc 100644
> > --- a/drivers/net/hyperv/hyperv_net.h
> > +++ b/drivers/net/hyperv/hyperv_net.h
> > @@ -87,6 +87,8 @@ struct ndis_recv_scale_cap { /*
> > NDIS_RECEIVE_SCALE_CAPABILITIES */  #define HASH_KEYLEN
> > NDIS_RSS_HASH_SECRET_KEY_MAX_SIZE_REVISION_2
> >  extern u8 netvsc_hash_key[];
> >
> > +extern unsigned int netvsc_num_queue;
> > +
> >  struct ndis_recv_scale_param { /* NDIS_RECEIVE_SCALE_PARAMETERS */
> >  	struct ndis_obj_header hdr;
> >
> > diff --git a/drivers/net/hyperv/netvsc_drv.c
> > b/drivers/net/hyperv/netvsc_drv.c index 939e3af..07896f3 100644
> > --- a/drivers/net/hyperv/netvsc_drv.c
> > +++ b/drivers/net/hyperv/netvsc_drv.c
> > @@ -52,6 +52,8 @@ static int ring_size = 128;  module_param(ring_size,
> > int, S_IRUGO);  MODULE_PARM_DESC(ring_size, "Ring buffer size (# of
> > pages)");
> >
> > +unsigned int netvsc_num_queue = 1;
> > +
> >  static void do_set_multicast(struct work_struct *w)  {
> >  	struct net_device_context *ndevctx = @@ -639,9 +641,11 @@ int
> > netvsc_recv_callback(struct hv_device *device_obj,
> >  		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
> >  				       packet->vlan_tci);
> >
> > +#ifdef CONFIG_SYSFS
> >  	skb_record_rx_queue(skb, packet->channel->
> >  			    offermsg.offer.sub_channel_index %
> >  			    net->real_num_rx_queues);
> > +#endif
> 
> Why is this a sysfs-only function?  It should have nothing to do with sysfs, right?
> So why would the driver care?

Without CONFIG_SYSFS the multi-receive queues are not allocated, see below, and 
the variable real_num_rx_queues is not defined, so we skip this function.

In alloc_netdev_mqs(), file "net/core/dev.c":
#ifdef CONFIG_SYSFS
        dev->num_rx_queues = rxqs;
        dev->real_num_rx_queues = rxqs;
        if (netif_alloc_rx_queues(dev))
                goto free_all;
#endif

> Don't put #ifdef in drivers, it's unmaintainable over time, if this really is a sysfs-
> only function, this should already be handled automatically in a .h file
> somewhere.

OK, I will move the #ifdef into hyperv_net.h.

Thanks,
- Haiyang


  reply	other threads:[~2014-05-08 15:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 22:45 Haiyang Zhang
2014-05-08  9:13 ` Greg KH
2014-05-08 15:13   ` Haiyang Zhang [this message]
2014-05-08 19:07     ` Greg KH
2014-05-08 19:47       ` Haiyang Zhang

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=67b9b573b20f4cc2b6fe75fe84ee48e1@DFM-DB3MBX15-06.exchange.corp.microsoft.com \
    --to=haiyangz@microsoft.com \
    --cc=davem@davemloft.net \
    --cc=driverdev-devel@linuxdriverproject.org \
    --cc=greg@kroah.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olaf@aepfle.de \
    /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

all inboxes | Powered by JetHome®