[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1388685624.9947.7.camel@bwh-desktop.uk.level5networks.com>
Date: Thu, 2 Jan 2014 18:00:24 +0000
From: Ben Hutchings <bhutchings@...arflare.com>
To: <jiang.biao2@....com.cn>
CC: David Miller <davem@...emloft.net>, <li.fengmao@....com.cn>,
<manish.chopra@...gic.com>, <netdev@...r.kernel.org>,
<rajesh.borundia@...gic.com>, <sony.chacko@...gic.com>
Subject: Re: [Patch] netxen_nic: Bugfix for wrong RUNNING status of NX3031
NICs with no link
On Thu, 2014-01-02 at 17:16 +0800, jiang.biao2@....com.cn wrote:
> > You cannot do this, because at the very exact moment you call
> > register_netdevice() the device can be brought up and once the
> > device is up the link can be brought up.
>
> > Therefore if you invoke netif_carrier_off() right after
> > register_netdevice(), it can cancel out a legitimate
> > netif_carrier_on() call.
>
> register_netdevice() should be call in probe(), at that time, is
> it impossible to bring up device because the driver loading has
> not finished?
So far as the networking core is concerned, when register_netdevice() is
called the device is ready to use. But you can do:
rtnl_lock();
register_netdevice();
netif_carrier_off();
rtnl_unlock();
However, as I said before, the current order in netxen_nic works and
only older kernel versions require you to call netif_carrier_off() after
registering the device.
> Even that, the netif_carrier_off() will be called before
> netif_carrier_on(), and that will not be a problem.
>
> Besides, the other net drivers(e.g igb, e1000, e1000e) I saw all
> call netif_carrier_off() after register_netdev(). There is no such
> problems in these drivers.
It is not easy to hit the race condition but it is real.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
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