ixgbe: fix ethtool -A|a behavior
authorDon Skidmore <donald.c.skidmore@intel.com>
Tue, 31 Mar 2009 21:35:05 +0000 (21:35 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 2 Apr 2009 08:02:32 +0000 (01:02 -0700)
We were basicly ignoring ethtool users request for FC autoneg
and replying to queries with a "best guess".  This patch
enables the driver to store if we want to enable/disable
autoneg FC and do the correct behavior.

Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ixgbe/ixgbe_82598.c
drivers/net/ixgbe/ixgbe_common.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbe/ixgbe_type.h

index ed265a7a898faea70408ae635c92328ae54003a7..de4db0dc78795c925882d11a9c830cbd416e4102 100644 (file)
@@ -411,7 +411,8 @@ static s32 ixgbe_setup_fc_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
 
        /* Decide whether to use autoneg or not. */
        hw->mac.ops.check_link(hw, &speed, &link_up, false);
-       if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL))
+       if (!hw->fc.disable_fc_autoneg && hw->phy.multispeed_fiber &&
+           (speed == IXGBE_LINK_SPEED_1GB_FULL))
                ret_val = ixgbe_fc_autoneg(hw);
 
        if (ret_val)
index 8cfd3fd309a03036dc1ad4ec357e8cbd7d74ce12..63ab6671d08e34b5cf0d54a0aa269a40c5d983a4 100644 (file)
@@ -1937,7 +1937,8 @@ s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
 
        /* Decide whether to use autoneg or not. */
        hw->mac.ops.check_link(hw, &speed, &link_up, false);
-       if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL))
+       if (!hw->fc.disable_fc_autoneg && hw->phy.multispeed_fiber &&
+           (speed == IXGBE_LINK_SPEED_1GB_FULL))
                ret_val = ixgbe_fc_autoneg(hw);
 
        if (ret_val)
index 34b4a84d2e77f01bbc68acb76030986315e237bc..55970ec72de3ac60159c999e2eb59f62339b95ba 100644 (file)
@@ -234,7 +234,16 @@ static void ixgbe_get_pauseparam(struct net_device *netdev,
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
 
-       pause->autoneg = (hw->fc.current_mode == ixgbe_fc_full ? 1 : 0);
+       /*
+        * Flow Control Autoneg isn't on if
+        *  - we didn't ask for it OR
+        *  - it failed, we know this by tx & rx being off
+        */
+       if (hw->fc.disable_fc_autoneg ||
+           (hw->fc.current_mode == ixgbe_fc_none))
+               pause->autoneg = 0;
+       else
+               pause->autoneg = 1;
 
        if (hw->fc.current_mode == ixgbe_fc_rx_pause) {
                pause->rx_pause = 1;
@@ -252,8 +261,12 @@ static int ixgbe_set_pauseparam(struct net_device *netdev,
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
 
-       if ((pause->autoneg == AUTONEG_ENABLE) ||
-           (pause->rx_pause && pause->tx_pause))
+       if (pause->autoneg != AUTONEG_ENABLE)
+               hw->fc.disable_fc_autoneg = true;
+       else
+               hw->fc.disable_fc_autoneg = false;
+
+       if (pause->rx_pause && pause->tx_pause)
                hw->fc.requested_mode = ixgbe_fc_full;
        else if (pause->rx_pause && !pause->tx_pause)
                hw->fc.requested_mode = ixgbe_fc_rx_pause;
index ae2af45eb8f1a3dcff6ccd93ba58b2f6d8ceebbe..286ecc0e6ab75148c8ff08513c1776fe68f5cf04 100644 (file)
@@ -3167,10 +3167,12 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
 
        /* default flow control settings */
        hw->fc.requested_mode = ixgbe_fc_full;
+       hw->fc.current_mode = ixgbe_fc_full;    /* init for ethtool output */
        hw->fc.high_water = IXGBE_DEFAULT_FCRTH;
        hw->fc.low_water = IXGBE_DEFAULT_FCRTL;
        hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
        hw->fc.send_xon = true;
+       hw->fc.disable_fc_autoneg = false;
 
        /* enable itr by default in dynamic mode */
        adapter->itr_setting = 1;
index 2b2ecba7b6094d909ba21dcdd56dd68b58808796..030ff0a9ea6757079e75f020679f42360d1b76d9 100644 (file)
@@ -2005,6 +2005,7 @@ struct ixgbe_fc_info {
        u16 pause_time; /* Flow Control Pause timer */
        bool send_xon; /* Flow control send XON */
        bool strict_ieee; /* Strict IEEE mode */
+       bool disable_fc_autoneg; /* Turn off autoneg FC mode */
        enum ixgbe_fc_mode current_mode; /* FC mode in effect */
        enum ixgbe_fc_mode requested_mode; /* FC mode requested by caller */
 };