From: Ben Hutchings <bhutchings@solarflare.com>
To: <jiang.biao2@zte.com.cn>
Cc: David Miller <davem@davemloft.net>, <li.fengmao@zte.com.cn>,
<manish.chopra@qlogic.com>, <netdev@vger.kernel.org>,
<rajesh.borundia@qlogic.com>, <sony.chacko@qlogic.com>
Subject: Re: [Patch] netxen_nic: Bugfix for wrong RUNNING status of NX3031 NICs with no link
Date: Thu, 2 Jan 2014 18:00:24 +0000 [thread overview]
Message-ID: <1388685624.9947.7.camel@bwh-desktop.uk.level5networks.com> (raw)
In-Reply-To: <OFEE191896.FD28476A-ON48257C54.003205EE-48257C54.0032F33D@zte.com.cn>
On Thu, 2014-01-02 at 17:16 +0800, jiang.biao2@zte.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.
next prev parent reply other threads:[~2014-01-02 18:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 6:32 [Patch] netxen_nic: Bugfix for wrong RUNNING status of NX3031 NICs with no link jiang.biao2
2014-01-02 8:24 ` David Miller
2014-01-02 9:16 ` jiang.biao2
2014-01-02 18:00 ` Ben Hutchings [this message]
[not found] ` <OF9AC42061.4BF09F2E-ON48257C55.00253C5A-48257C55.0027274D@zte.com.cn>
2014-01-03 7:18 ` =?iso-2022-jp-3?B?GyRCRXobJChQJTsbKEI6?= " David Miller
2014-01-06 20:24 ` 答复: " Ben Hutchings
[not found] ` <OFB91B6321.D74C0B57-ON48257C54.00308F8C-48257C54.0030D7E7@zte.com.cn>
2014-01-02 17:33 ` =?iso-2022-jp-3?B?GyRCRXobJChQJTsbKEI6?= " David Miller
-- strict thread matches above, loose matches on Subject: below --
2014-01-02 3:37 jiang.biao2
2014-01-02 14:47 ` Ben Hutchings
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=1388685624.9947.7.camel@bwh-desktop.uk.level5networks.com \
--to=bhutchings@solarflare.com \
--cc=davem@davemloft.net \
--cc=jiang.biao2@zte.com.cn \
--cc=li.fengmao@zte.com.cn \
--cc=manish.chopra@qlogic.com \
--cc=netdev@vger.kernel.org \
--cc=rajesh.borundia@qlogic.com \
--cc=sony.chacko@qlogic.com \
/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