ixgbe: fix 82599 KR downshift coexistence with LESM FW module
authorEmil Tantilov <emil.s.tantilov@intel.com>
Fri, 18 Mar 2011 08:18:32 +0000 (08:18 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 14 Apr 2011 02:22:44 +0000 (19:22 -0700)
Disable KR to KX4/KX downshift on 82599 backplane devices when
LESM (Link Establishment State Machine) is enabled in FW. Those
features cannot co-exist as they both manipulate the same registers.

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Acked-by: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Phillip Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ixgbe/ixgbe_82599.c
drivers/net/ixgbe/ixgbe_type.h

index 09934a82eb30fb4a8af4015668c6451fa32aecf9..d195278c62e331f137a463c355dd4b4d3bd3cdf0 100644 (file)
@@ -61,6 +61,7 @@ static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
                                          bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
+static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw);
 
 static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
 {
@@ -86,7 +87,8 @@ static void ixgbe_init_mac_link_ops_82599(struct ixgbe_hw *hw)
                if ((mac->ops.get_media_type(hw) ==
                     ixgbe_media_type_backplane) &&
                    (hw->phy.smart_speed == ixgbe_smart_speed_auto ||
-                    hw->phy.smart_speed == ixgbe_smart_speed_on))
+                    hw->phy.smart_speed == ixgbe_smart_speed_on) &&
+                    !ixgbe_verify_lesm_fw_enabled_82599(hw))
                        mac->ops.setup_link = &ixgbe_setup_mac_link_smartspeed;
                else
                        mac->ops.setup_link = &ixgbe_setup_mac_link_82599;
@@ -2028,6 +2030,48 @@ fw_version_out:
        return status;
 }
 
+/**
+ *  ixgbe_verify_lesm_fw_enabled_82599 - Checks LESM FW module state.
+ *  @hw: pointer to hardware structure
+ *
+ *  Returns true if the LESM FW module is present and enabled. Otherwise
+ *  returns false. Smart Speed must be disabled if LESM FW module is enabled.
+ **/
+static bool ixgbe_verify_lesm_fw_enabled_82599(struct ixgbe_hw *hw)
+{
+       bool lesm_enabled = false;
+       u16 fw_offset, fw_lesm_param_offset, fw_lesm_state;
+       s32 status;
+
+       /* get the offset to the Firmware Module block */
+       status = hw->eeprom.ops.read(hw, IXGBE_FW_PTR, &fw_offset);
+
+       if ((status != 0) ||
+           (fw_offset == 0) || (fw_offset == 0xFFFF))
+               goto out;
+
+       /* get the offset to the LESM Parameters block */
+       status = hw->eeprom.ops.read(hw, (fw_offset +
+                                    IXGBE_FW_LESM_PARAMETERS_PTR),
+                                    &fw_lesm_param_offset);
+
+       if ((status != 0) ||
+           (fw_lesm_param_offset == 0) || (fw_lesm_param_offset == 0xFFFF))
+               goto out;
+
+       /* get the lesm state word */
+       status = hw->eeprom.ops.read(hw, (fw_lesm_param_offset +
+                                    IXGBE_FW_LESM_STATE_1),
+                                    &fw_lesm_state);
+
+       if ((status == 0) &&
+           (fw_lesm_state & IXGBE_FW_LESM_STATE_ENABLED))
+               lesm_enabled = true;
+
+out:
+       return lesm_enabled;
+}
+
 static struct ixgbe_mac_operations mac_ops_82599 = {
        .init_hw                = &ixgbe_init_hw_generic,
        .reset_hw               = &ixgbe_reset_hw_82599,
index cd1c2b62ec496b5b6339b794d6be55f9c7ee7711..e00356a25ee1af3e701acd47c80ab40c25f61293 100644 (file)
 #define IXGBE_SAN_MAC_ADDR_PORT1_OFFSET  0x3
 #define IXGBE_DEVICE_CAPS_ALLOW_ANY_SFP  0x1
 #define IXGBE_DEVICE_CAPS_FCOE_OFFLOADS  0x2
+#define IXGBE_FW_LESM_PARAMETERS_PTR     0x2
+#define IXGBE_FW_LESM_STATE_1            0x1
+#define IXGBE_FW_LESM_STATE_ENABLED      0x8000 /* LESM Enable bit */
 #define IXGBE_FW_PASSTHROUGH_PATCH_CONFIG_PTR   0x4
 #define IXGBE_FW_PATCH_VERSION_4   0x7