aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Keller <jacob.e.keller@intel.com>2014-02-21 20:23:56 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2014-03-20 03:04:40 -0400
commitee98b577e7711d5890ded2c7b05578a29512bd39 (patch)
treeecb4f66402eece60ba866e8d2a148a1543b8a571
parent8036d29f409f6a1d54ac409ede273197c4914e3f (diff)
ixgbe: fix ixgbe_setup_mac_link_82599 autoc variables
This patch fixes flow control autonegotiation for KR/KX/K4 interfaces. When setting up MAC link, the cached autoc value and current autoc value were being incorrectly used to determine whether link reset is required. This resulted in the driver ignoring and discarding flow control negotiation changes that occur since the caching happened, as well as when the mac was being setup. This patch also splits the assignments for the 3 autoc variables into their own block, and adds a comment explaining what each one means, in order to help keep logic more straightforward while reading the code. CC: Arun Sharma <asharma@fb.com> Reported-by: Sourav Chatterjee <sourav.chatterjee@intel.com> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
index ef808bcec276..e0fe8e88fbfa 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
@@ -1031,15 +1031,19 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
1031 ixgbe_link_speed speed, 1031 ixgbe_link_speed speed,
1032 bool autoneg_wait_to_complete) 1032 bool autoneg_wait_to_complete)
1033{ 1033{
1034 bool autoneg = false;
1034 s32 status = 0; 1035 s32 status = 0;
1035 u32 autoc, pma_pmd_1g, link_mode, start_autoc; 1036 u32 pma_pmd_1g, link_mode, links_reg, i;
1036 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2); 1037 u32 autoc2 = IXGBE_READ_REG(hw, IXGBE_AUTOC2);
1037 u32 orig_autoc = 0;
1038 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK; 1038 u32 pma_pmd_10g_serial = autoc2 & IXGBE_AUTOC2_10G_SERIAL_PMA_PMD_MASK;
1039 u32 links_reg;
1040 u32 i;
1041 ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; 1039 ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
1042 bool autoneg = false; 1040
1041 /* holds the value of AUTOC register at this current point in time */
1042 u32 current_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1043 /* holds the cached value of AUTOC register */
1044 u32 orig_autoc = 0;
1045 /* temporary variable used for comparison purposes */
1046 u32 autoc = current_autoc;
1043 1047
1044 /* Check to see if speed passed in is supported. */ 1048 /* Check to see if speed passed in is supported. */
1045 status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, 1049 status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities,
@@ -1056,12 +1060,10 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
1056 1060
1057 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/ 1061 /* Use stored value (EEPROM defaults) of AUTOC to find KR/KX4 support*/
1058 if (hw->mac.orig_link_settings_stored) 1062 if (hw->mac.orig_link_settings_stored)
1059 autoc = hw->mac.orig_autoc; 1063 orig_autoc = hw->mac.orig_autoc;
1060 else 1064 else
1061 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); 1065 orig_autoc = autoc;
1062 1066
1063 orig_autoc = autoc;
1064 start_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
1065 link_mode = autoc & IXGBE_AUTOC_LMS_MASK; 1067 link_mode = autoc & IXGBE_AUTOC_LMS_MASK;
1066 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK; 1068 pma_pmd_1g = autoc & IXGBE_AUTOC_1G_PMA_PMD_MASK;
1067 1069
@@ -1101,7 +1103,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
1101 } 1103 }
1102 } 1104 }
1103 1105
1104 if (autoc != start_autoc) { 1106 if (autoc != current_autoc) {
1105 /* Restart link */ 1107 /* Restart link */
1106 status = hw->mac.ops.prot_autoc_write(hw, autoc, false); 1108 status = hw->mac.ops.prot_autoc_write(hw, autoc, false);
1107 if (status) 1109 if (status)