lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ec503f90e3914e2786e0f0d0f7dc0796@DFM-DB3MBX15-06.exchange.corp.microsoft.com>
Date:	Thu, 8 May 2014 19:47:52 +0000
From:	Haiyang Zhang <haiyangz@...rosoft.com>
To:	Greg KH <greg@...ah.com>
CC:	"davem@...emloft.net" <davem@...emloft.net>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"olaf@...fle.de" <olaf@...fle.de>,
	"jasowang@...hat.com" <jasowang@...hat.com>,
	"driverdev-devel@...uxdriverproject.org" 
	<driverdev-devel@...uxdriverproject.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH net-next] Add support for netvsc build without
 CONFIG_SYSFS flag



> -----Original Message-----
> From: Greg KH [mailto:greg@...ah.com]
> Sent: Thursday, May 8, 2014 3:07 PM
> To: Haiyang Zhang
> Cc: davem@...emloft.net; netdev@...r.kernel.org; olaf@...fle.de;
> jasowang@...hat.com; driverdev-devel@...uxdriverproject.org; linux-
> kernel@...r.kernel.org
> Subject: Re: [PATCH net-next] Add support for netvsc build without
> CONFIG_SYSFS flag
> 
> On Thu, May 08, 2014 at 03:13:19PM +0000, Haiyang Zhang wrote:
> >
> >
> > > -----Original Message-----
> > > From: Greg KH [mailto:greg@...ah.com]
> > > Sent: Thursday, May 8, 2014 5:13 AM
> > > To: Haiyang Zhang
> > > Cc: davem@...emloft.net; netdev@...r.kernel.org; olaf@...fle.de;
> > > jasowang@...hat.com; driverdev-devel@...uxdriverproject.org; linux-
> > > kernel@...r.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@...rosoft.com>
> > > > Reviewed-by: K. Y. Srinivasan <kys@...rosoft.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
> 
> Then you need to structure your driver better :)

I have submitted an update patch.

Thanks,
- Haiyang

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ