qlcnic: report valid speed and duplex status when link is down
authorSony Chacko <sony.chacko@qlogic.com>
Fri, 3 Feb 2012 13:45:42 +0000 (13:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 4 Feb 2012 20:59:30 +0000 (15:59 -0500)
Report valid link statistics when link is down.

Signed-off-by: Sony Chacko <sony.chacko@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ethtool.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_init.c

index cc228cf3d84bcfdf480d85332c4e6ab97ef13713..6b2cf8bd16c39d956fb577b0c22e09abbeb55fce 100644 (file)
@@ -155,7 +155,6 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
 {
        struct qlcnic_adapter *adapter = netdev_priv(dev);
        int check_sfp_module = 0;
-       u16 pcifn = adapter->ahw->pci_func;
 
        /* read which mode */
        if (adapter->ahw->port_type == QLCNIC_GBE) {
@@ -194,10 +193,8 @@ qlcnic_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
                        goto skip;
                }
 
-               val = QLCRD32(adapter, P3P_LINK_SPEED_REG(pcifn));
-               ethtool_cmd_speed_set(ecmd, P3P_LINK_SPEED_MHZ *
-                                     P3P_LINK_SPEED_VAL(pcifn, val));
-               ecmd->duplex = DUPLEX_FULL;
+               ethtool_cmd_speed_set(ecmd, SPEED_UNKNOWN);
+               ecmd->duplex = DUPLEX_UNKNOWN;
                ecmd->autoneg = AUTONEG_DISABLE;
        } else
                return -EIO;
index 38669583840ce0a9e9f3ad31cd0d0d02a7b95bd6..41d85efee422c79c620d7c5cca5d36006c88617b 100644 (file)
@@ -1369,7 +1369,13 @@ qlcnic_handle_linkevent(struct qlcnic_adapter *adapter,
 
        adapter->module_type = module;
        adapter->link_autoneg = autoneg;
-       adapter->link_speed = link_speed;
+
+       if (link_status) {
+               adapter->link_speed = link_speed;
+       } else {
+               adapter->link_speed = SPEED_UNKNOWN;
+               adapter->link_duplex = DUPLEX_UNKNOWN;
+       }
 }
 
 static void