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]
Date:	Wed, 22 Jun 2011 02:01:50 -0500
From:	Amit Salecha <amit.salecha@...gic.com>
To:	Stephen Hemminger <shemminger@...tta.com>,
	David Miller <davem@...emloft.net>
CC:	Anirban Chakraborty <anirban.chakraborty@...gic.com>,
	netdev <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 5/7] qlcnic: fix default operating state of
 interface

> -----Original Message-----
> From: Stephen Hemminger [mailto:shemminger@...tta.com]
> 
> David Miller <davem@...emloft.net> wrote:
> 
> > From: Anirban Chakraborty <anirban.chakraborty@...gic.com>
> > Date: Thu, 16 Jun 2011 13:37:36 -0700
> >
> > > From: Amit Kumar Salecha <amit.salecha@...gic.com>
> > >
> > > Currently interface shows status as RUNNING, even if there is no
> link.
> > > To fix this, netif_carrier_off should be called after
> register_netdev().
> > >
> > > netif_carrier_off calls linkwatch_fire_event(dev); only if netdev
> is registered,
> > > otherwise it skips. linkwatch_fire_event set default state of nic
> interface.
> > >
> > > Signed-off-by: Amit Kumar Salecha <amit.salecha@...gic.com>
> > > Signed-off-by: Anirban Chakraborty <anirban.chakraborty@...gic.com>
> >
> > You cannot do this.
> >
> > The exact second that register_netdev() is called, the device can
> > be brought up asynchronously and the link brought into the up state.
> >
> > Your netif_carrier_off() call will race with this.
> >
> > This is why no other (properly functioning) driver does what you're
> > trying to do here.
> 
> The proper place to do this is in the open() routine.
> When device is not open, the carrier state is undefined; and devices
> that are trying to save power turn off PHY when device is not in use.
> 
> Therefore the open() routine should ensure that the carrier is in
> the proper state when returning. Just doing something like:
> 
> static int qlcnic_open() {
> ...
> 	netif_carrier_off()
> 
>         err = __qlcnic_up();
> 	...
> }
> 
> static int __qlcnic_up() {
> 	...
> 	(lots of tests)
> 	...
> 
>         netif_carrier_on();
> 	adapter->reset_context = 0;
> 	set_bit(__QLCNIC_DEV_UP, &adapter->state);
> 	return 0;
> }

netif_carrier_off() is ok, should be call from qlcnic_open().
netif_carrier_on() will be call during asynchronous notification from fw.

-Thanks.

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ