Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: jiang.biao2@zte.com.cn
Cc: manish.chopra@qlogic.com, sony.chacko@qlogic.com,
	rajesh.borundia@qlogic.com, netdev@vger.kernel.org,
	li.fengmao@zte.com.cn
Subject: Re: [Patch] netxen_nic: Bugfix for wrong RUNNING status of NX3031 NICs with no link
Date: Thu, 02 Jan 2014 03:24:23 -0500 (EST)	[thread overview]
Message-ID: <20140102.032423.2130522873875479421.davem@davemloft.net> (raw)
In-Reply-To: <OFFF20C6AD.9ACCA9A7-ON48257C54.00238C88-48257C54.0023F52A@zte.com.cn>

From: jiang.biao2@zte.com.cn
Date: Thu, 2 Jan 2014 14:32:32 +0800

> From: Li Fengmao <li.fengmao@zte.com.cn>
> 
> Ifconfig command displays RUNNING status when there is no link on
> NX3031 NICs. The problem is caused by the wrong calling order of
> netif_carrier_off() and register_netdev() in netxen_setup_netdev(),
> dev->reg_state is initialized to NETREG_UNINITIALIZED before
> registering network device, so the linkwatch_fire_event() will not
> be called to notify the link change event in netif_carrier_off(),
> and the operational status of network device will be set to
> IF_OPER_UNKNOWN. In that case, the IFF_RUNNING flags will be set,
> which result in the wrong RUNNING status in the result of ifconfig
> command.
> 
> It can be solved by calling netif_carrier_off() after
> register_netdev() in netxen_setup_netdev() to ensure the
> notification of the link change event. And then the operational
> status of device will be set to IF_OPER_DOWN correctly.
> 
> Steps to reproduce the bug:
> 1. Prepare a NX3031 NIC with no network cable on it.
> 2. Reboot the system. (e.g exec reboot command)
> 3. Activate the interface. (e.g ifconfig eth0 up)
> 4. The operstatus of the NX3031 NIC will be RUNNING in the result of
> ifconfig command.
> 
> Signed-off-by: Li Fengmao <li.fengmao@zte.com.cn>
> Reviewed-by: Long Chun <long.chun@zte.com.cn>
> Reviewed-by: Wang Liang <wang.liang82@zte.com.cn>
> Reviewed-by: Cai Qu <cai.qu@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>

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.

  reply	other threads:[~2014-01-02  8:24 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 [this message]
2014-01-02  9:16   ` jiang.biao2
2014-01-02 18:00     ` Ben Hutchings
     [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=20140102.032423.2130522873875479421.davem@davemloft.net \
    --to=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