diff options
| author | Alexander Duyck <alexander.h.duyck@intel.com> | 2012-03-28 04:03:48 -0400 |
|---|---|---|
| committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-05-04 06:19:29 -0400 |
| commit | 786e9a5f590f367fffad4c528c97d1f1e155a0ef (patch) | |
| tree | ec3a983e0061838fc11fa61a10ca78b4ff117d91 /drivers | |
| parent | d0bfcdfd484229c63c16cf5787a9e4211a61cc26 (diff) | |
ixgbe: Make ixgbe_fc_autoneg return void and always set current_mode
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>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | 4 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | 37 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | 2 | ||||
| -rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | 1 |
4 files changed, 13 insertions, 31 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c index 6175845df11d..badcf821d89a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c | |||
| @@ -363,9 +363,7 @@ static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
| 363 | } | 363 | } |
| 364 | 364 | ||
| 365 | /* Negotiate the fc mode to use */ | 365 | /* Negotiate the fc mode to use */ |
| 366 | ret_val = ixgbe_fc_autoneg(hw); | 366 | ixgbe_fc_autoneg(hw); |
| 367 | if (ret_val == IXGBE_ERR_FLOW_CONTROL) | ||
| 368 | goto out; | ||
| 369 | 367 | ||
| 370 | /* Disable any previous flow control settings */ | 368 | /* Disable any previous flow control settings */ |
| 371 | fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL); | 369 | fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c index e2b0519ff8cf..9854d948f135 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.c | |||
| @@ -1940,9 +1940,7 @@ s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num) | |||
| 1940 | 1940 | ||
| 1941 | #endif /* CONFIG_DCB */ | 1941 | #endif /* CONFIG_DCB */ |
| 1942 | /* Negotiate the fc mode to use */ | 1942 | /* Negotiate the fc mode to use */ |
| 1943 | ret_val = ixgbe_fc_autoneg(hw); | 1943 | ixgbe_fc_autoneg(hw); |
| 1944 | if (ret_val == IXGBE_ERR_FLOW_CONTROL) | ||
| 1945 | goto out; | ||
| 1946 | 1944 | ||
| 1947 | /* Disable any previous flow control settings */ | 1945 | /* Disable any previous flow control settings */ |
| 1948 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); | 1946 | mflcn_reg = IXGBE_READ_REG(hw, IXGBE_MFLCN); |
| @@ -2051,15 +2049,12 @@ out: | |||
| 2051 | * Compares our advertised flow control capabilities to those advertised by | 2049 | * Compares our advertised flow control capabilities to those advertised by |
| 2052 | * our link partner, and determines the proper flow control mode to use. | 2050 | * our link partner, and determines the proper flow control mode to use. |
| 2053 | **/ | 2051 | **/ |
| 2054 | s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) | 2052 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw) |
| 2055 | { | 2053 | { |
| 2056 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | 2054 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
| 2057 | ixgbe_link_speed speed; | 2055 | ixgbe_link_speed speed; |
| 2058 | bool link_up; | 2056 | bool link_up; |
| 2059 | 2057 | ||
| 2060 | if (hw->fc.disable_fc_autoneg) | ||
| 2061 | goto out; | ||
| 2062 | |||
| 2063 | /* | 2058 | /* |
| 2064 | * AN should have completed when the cable was plugged in. | 2059 | * AN should have completed when the cable was plugged in. |
| 2065 | * Look for reasons to bail out. Bail out if: | 2060 | * Look for reasons to bail out. Bail out if: |
| @@ -2069,11 +2064,12 @@ s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw) | |||
| 2069 | * Since we're being called from an LSC, link is already known to be up. | 2064 | * Since we're being called from an LSC, link is already known to be up. |
| 2070 | * So use link_up_wait_to_complete=false. | 2065 | * So use link_up_wait_to_complete=false. |
| 2071 | */ | 2066 | */ |
| 2067 | if (hw->fc.disable_fc_autoneg) | ||
| 2068 | goto out; | ||
| 2069 | |||
| 2072 | hw->mac.ops.check_link(hw, &speed, &link_up, false); | 2070 | hw->mac.ops.check_link(hw, &speed, &link_up, false); |
| 2073 | if (!link_up) { | 2071 | if (!link_up) |
| 2074 | ret_val = IXGBE_ERR_FLOW_CONTROL; | ||
| 2075 | goto out; | 2072 | goto out; |
| 2076 | } | ||
| 2077 | 2073 | ||
| 2078 | switch (hw->phy.media_type) { | 2074 | switch (hw->phy.media_type) { |
| 2079 | /* Autoneg flow control on fiber adapters */ | 2075 | /* Autoneg flow control on fiber adapters */ |
| @@ -2104,7 +2100,6 @@ out: | |||
| 2104 | hw->fc.fc_was_autonegged = false; | 2100 | hw->fc.fc_was_autonegged = false; |
| 2105 | hw->fc.current_mode = hw->fc.requested_mode; | 2101 | hw->fc.current_mode = hw->fc.requested_mode; |
| 2106 | } | 2102 | } |
| 2107 | return ret_val; | ||
| 2108 | } | 2103 | } |
| 2109 | 2104 | ||
| 2110 | /** | 2105 | /** |
| @@ -2116,7 +2111,7 @@ out: | |||
| 2116 | static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) | 2111 | static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) |
| 2117 | { | 2112 | { |
| 2118 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; | 2113 | u32 pcs_anadv_reg, pcs_lpab_reg, linkstat; |
| 2119 | s32 ret_val; | 2114 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
| 2120 | 2115 | ||
| 2121 | /* | 2116 | /* |
| 2122 | * On multispeed fiber at 1g, bail out if | 2117 | * On multispeed fiber at 1g, bail out if |
| @@ -2126,10 +2121,8 @@ static s32 ixgbe_fc_autoneg_fiber(struct ixgbe_hw *hw) | |||
| 2126 | 2121 | ||
| 2127 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); | 2122 | linkstat = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA); |
| 2128 | if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || | 2123 | if ((!!(linkstat & IXGBE_PCS1GLSTA_AN_COMPLETE) == 0) || |
| 2129 | (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) { | 2124 | (!!(linkstat & IXGBE_PCS1GLSTA_AN_TIMED_OUT) == 1)) |
| 2130 | ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | ||
| 2131 | goto out; | 2125 | goto out; |
| 2132 | } | ||
| 2133 | 2126 | ||
| 2134 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); | 2127 | pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA); |
| 2135 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); | 2128 | pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP); |
| @@ -2153,7 +2146,7 @@ out: | |||
| 2153 | static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) | 2146 | static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) |
| 2154 | { | 2147 | { |
| 2155 | u32 links2, anlp1_reg, autoc_reg, links; | 2148 | u32 links2, anlp1_reg, autoc_reg, links; |
| 2156 | s32 ret_val; | 2149 | s32 ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; |
| 2157 | 2150 | ||
| 2158 | /* | 2151 | /* |
| 2159 | * On backplane, bail out if | 2152 | * On backplane, bail out if |
| @@ -2161,21 +2154,13 @@ static s32 ixgbe_fc_autoneg_backplane(struct ixgbe_hw *hw) | |||
| 2161 | * - we are 82599 and link partner is not AN enabled | 2154 | * - we are 82599 and link partner is not AN enabled |
| 2162 | */ | 2155 | */ |
| 2163 | links = IXGBE_READ_REG(hw, IXGBE_LINKS); | 2156 | links = IXGBE_READ_REG(hw, IXGBE_LINKS); |
| 2164 | if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) { | 2157 | if ((links & IXGBE_LINKS_KX_AN_COMP) == 0) |
| 2165 | hw->fc.fc_was_autonegged = false; | ||
| 2166 | hw->fc.current_mode = hw->fc.requested_mode; | ||
| 2167 | ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | ||
| 2168 | goto out; | 2158 | goto out; |
| 2169 | } | ||
| 2170 | 2159 | ||
| 2171 | if (hw->mac.type == ixgbe_mac_82599EB) { | 2160 | if (hw->mac.type == ixgbe_mac_82599EB) { |
| 2172 | links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); | 2161 | links2 = IXGBE_READ_REG(hw, IXGBE_LINKS2); |
| 2173 | if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) { | 2162 | if ((links2 & IXGBE_LINKS2_AN_SUPPORTED) == 0) |
| 2174 | hw->fc.fc_was_autonegged = false; | ||
| 2175 | hw->fc.current_mode = hw->fc.requested_mode; | ||
| 2176 | ret_val = IXGBE_ERR_FC_NOT_NEGOTIATED; | ||
| 2177 | goto out; | 2163 | goto out; |
| 2178 | } | ||
| 2179 | } | 2164 | } |
| 2180 | /* | 2165 | /* |
| 2181 | * Read the 10g AN autoc and LP ability registers and resolve | 2166 | * Read the 10g AN autoc and LP ability registers and resolve |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h index f992777e67a8..9e8a1c05df6e 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_common.h | |||
| @@ -78,7 +78,7 @@ s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw); | |||
| 78 | s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw); | 78 | s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw); |
| 79 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); | 79 | s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); |
| 80 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num); | 80 | s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw, s32 packetbuf_num); |
| 81 | s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw); | 81 | void ixgbe_fc_autoneg(struct ixgbe_hw *hw); |
| 82 | 82 | ||
| 83 | s32 ixgbe_validate_mac_addr(u8 *mac_addr); | 83 | s32 ixgbe_validate_mac_addr(u8 *mac_addr); |
| 84 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); | 84 | s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h index d82e25c321ff..5337260bed5b 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h | |||
| @@ -2981,7 +2981,6 @@ struct ixgbe_info { | |||
| 2981 | #define IXGBE_ERR_OVERTEMP -26 | 2981 | #define IXGBE_ERR_OVERTEMP -26 |
| 2982 | #define IXGBE_ERR_FC_NOT_NEGOTIATED -27 | 2982 | #define IXGBE_ERR_FC_NOT_NEGOTIATED -27 |
| 2983 | #define IXGBE_ERR_FC_NOT_SUPPORTED -28 | 2983 | #define IXGBE_ERR_FC_NOT_SUPPORTED -28 |
| 2984 | #define IXGBE_ERR_FLOW_CONTROL -29 | ||
| 2985 | #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 | 2984 | #define IXGBE_ERR_SFP_SETUP_NOT_COMPLETE -30 |
| 2986 | #define IXGBE_ERR_PBA_SECTION -31 | 2985 | #define IXGBE_ERR_PBA_SECTION -31 |
| 2987 | #define IXGBE_ERR_INVALID_ARGUMENT -32 | 2986 | #define IXGBE_ERR_INVALID_ARGUMENT -32 |
