]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ixgbe: Make ixgbe_fc_autoneg return void and always set current_mode
authorAlexander Duyck <alexander.h.duyck@intel.com>
Wed, 28 Mar 2012 08:03:48 +0000 (08:03 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 4 May 2012 10:19:29 +0000 (03:19 -0700)
This change makes it so that ixgbe_fc_autoneg is a void and always sets the
current_mode.  Previously if the link was down we would return an error,
however there is no harm in simply treating a link down case as a case in
which autoneg simply failed.  This allows us to rely on the return value of
the ixgbe_fc_enable call now since there should be no cases where it
returns an error that would normally be ignored.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
drivers/net/ethernet/intel/ixgbe/ixgbe_common.c
drivers/net/ethernet/intel/ixgbe/ixgbe_common.h
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h

index 6175845df11d7a74e92fefc1b9a5fa17521f76db..badcf821d89aa94efcbe78816f15975ee13b6c92 100644 (file)
@@ -363,9 +363,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
        }
 
        /* Negotiate the fc mode to use */
-       ret_val = ixgbe_fc_autoneg(hw);
-       if (ret_val == IXGBE_ERR_FLOW_CONTROL)
-               goto out;
+       ixgbe_fc_autoneg(hw);
 
        /* Disable any previous flow control settings */
        fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
index e2b0519ff8cf3d38a2fc1d8b277ff76dd94a68e6..9854d948f135ac8734ac8187a9574f56c8a5ca78 100644 (file)
@@ -1940,9 +1940,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num)
 
 #endif /* CONFIG_DCB */
        /* Negotiate the fc mode to use */
-       ret_val = ixgbe_fc_autoneg(hw);
-       if (ret_val == IXGBE_ERR_FLOW_CONTROL)
-               goto out;
+       ixgbe_fc_autoneg(hw);
 
        /* Disable any previous flow control settings */
        mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN);
@@ -2051,15 +2049,12 @@ out:
  *  Compares our advertised flow control capabilities to those advertised by
  *  our link partner, and determines the proper flow control mode to use.
  **/
-s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
+void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
 {
        s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
        ixgbe_link_speed speed;
        bool link_up;
 
-       if (hw->fc.disable_fc_autoneg)
-               goto out;
-
        /*
         * AN should have completed when the cable was plugged in.
         * Look for reasons to bail out.  Bail out if:
@@ -2069,11 +2064,12 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
         * Since we're being called from an LSC, link is already known to be up.
         * So use link_up_wait_to_complete=false.
         */
+       if (hw->fc.disable_fc_autoneg)
+               goto out;
+
        hw->mac.ops.check_link(hw, &speed, &link_up, false);
-       if (!link_up) {
-               ret_val = IXGBE_ERR_FLOW_CONTROL;
+       if (!link_up)
                goto out;
-       }
 
        switch (hw->phy.media_type) {
        /* Autoneg flow control on fiber adapters */
@@ -2104,7 +2100,6 @@ out:
                hw->fc.fc_was_autonegged = false;
                hw->fc.current_mode = hw->fc.requested_mode;
        }
-       return ret_val;
 }
 
 /**
@@ -2116,7 +2111,7 @@ out:
 static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw)
 {
        u32 pcs_anadv_reg, pcs_lpab_reg, linkstat;
-       s32 ret_val;
+       s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
 
        /*
         * On multispeed fiber at 1g, bail out if
@@ -2126,10 +2121,8 @@ static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw)
 
        linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
        if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) ||
-           (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) {
-               ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
+           (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1))
                goto out;
-       }
 
        pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
        pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP);
@@ -2153,7 +2146,7 @@ out:
 static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw)
 {
        u32 links2, anlp1_reg, autoc_reg, links;
-       s32 ret_val;
+       s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
 
        /*
         * On backplane, bail out if
@@ -2161,21 +2154,13 @@ static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw)
         * - we are 82599 and link partner is not AN enabled
         */
        links = IXGBE_READ_REG(hw, IXGBE_LINKS);
-       if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) {
-               hw->fc.fc_was_autonegged = false;
-               hw->fc.current_mode = hw->fc.requested_mode;
-               ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
+       if ((links & IXGBE_LINKS_KX_AN_COMP) == 0)
                goto out;
-       }
 
        if (hw->mac.type == ixgbe_mac_82599EB) {
                links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2);
-               if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) {
-                       hw->fc.fc_was_autonegged = false;
-                       hw->fc.current_mode = hw->fc.requested_mode;
-                       ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED;
+               if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0)
                        goto out;
-               }
        }
        /*
         * Read the 10g AN autoc and LP ability registers and resolve
index f992777e67a8093f616c85989f9ea6e754e0e6f1..9e8a1c05df6e5879c8e32d2b1f22871006228b07 100644 (file)
@@ -78,7 +78,7 @@ s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw);
 s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw);
 s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
 s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num);
-s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw);
+void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
 
 s32 ixgbe_validate_mac_addr(u8 *mac_addr);
 s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
index d82e25c321ffe19feda4fa91548ceae4a60df249..5337260bed5ba4b91276ee3064a4419d3a0d04f2 100644 (file)
@@ -2981,7 +2981,6 @@ struct ixgbe_info {
 #define IXGBE_ERR_OVERTEMP                      -26
 #define IXGBE_ERR_FC_NOT_NEGOTIATED             -27
 #define IXGBE_ERR_FC_NOT_SUPPORTED              -28
-#define IXGBE_ERR_FLOW_CONTROL                  -29
 #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE        -30
 #define IXGBE_ERR_PBA_SECTION                   -31
 #define IXGBE_ERR_INVALID_ARGUMENT              -32