Message ID | OFAE440C7C.FE33E30C-ON48257C54.0013C383-48257C54.0013F43B@zte.com.cn |
---|---|
State | Rejected, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 2014-01-02 at 11:37 +0800, jiang.biao2@zte.com.cn wrote: > 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. [...] This was fixed in Linux 3.7. The driver should not be changed. (This change may be worthwhile in an out-of-tree version for older kernel versions, but beware of races with opening of the device.) Ben.
--- drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 2013-09-26 09:51:39.115903504 +0800 +++ drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c 2013-09-26 09:53:13.868903522 +0800 @@ -1404,13 +1404,13 @@ netxen_setup_netdev(struct netxen_adapte if (netxen_read_mac_addr(adapter)) dev_warn(&pdev->dev, "failed to read mac addr\n"); - netif_carrier_off(netdev); - err = register_netdev(netdev); if (err) { dev_err(&pdev->dev, "failed to register net device\n"); return err; } + + netif_carrier_off(netdev); return 0; }