ixgbe: autoneg variable refactoring
authorJosh Hay <joshua.a.hay@intel.com>
Sat, 15 Dec 2012 03:28:30 +0000 (03:28 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Fri, 1 Feb 2013 05:57:19 +0000 (21:57 -0800)
Removes the autoneg parameter from the setup_link functions.
Adds local variable autoneg to setup_link functions to be passed
to get_link_capabilities functions if needed.

Signed-off-by: Josh Hay <joshua.a.hay@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_82598.c
drivers/net/ethernet/intel/ixgbe/ixgbe_82599.c
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
drivers/net/ethernet/intel/ixgbe/ixgbe_x540.c

index dd1f0cf4af733c0326d9d02535e2445e430db8a1..7fd3833c7ecfc0dafd6ba7f69e12387c174079bd 100644 (file)
@@ -41,7 +41,6 @@
 
 static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
                                          ixgbe_link_speed speed,
-                                         bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
                                        u8 *eeprom_data);
@@ -633,15 +632,15 @@ out:
  *  ixgbe_setup_mac_link_82598 - Set MAC link speed
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if auto-negotiation enabled
  *  @autoneg_wait_to_complete: true when waiting for completion is needed
  *
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
-                                           ixgbe_link_speed speed, bool autoneg,
-                                           bool autoneg_wait_to_complete)
+                                     ixgbe_link_speed speed,
+                                     bool autoneg_wait_to_complete)
 {
+       bool             autoneg           = false;
        s32              status            = 0;
        ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
        u32              curr_autoc        = IXGBE_READ_REG(hw, IXGBE_AUTOC);
@@ -685,14 +684,12 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
  *  ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true if waiting is needed to complete
  *
  *  Sets the link speed in the AUTOC register in the MAC and restarts link.
  **/
 static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
                                                ixgbe_link_speed speed,
-                                               bool autoneg,
                                                bool autoneg_wait_to_complete)
 {
        s32 status;
@@ -1311,4 +1308,3 @@ struct ixgbe_info ixgbe_82598_info = {
        .eeprom_ops             = &eeprom_ops_82598,
        .phy_ops                = &phy_ops_82598,
 };
-
index 6ad82cb0730173d8b34a153605abbe617213cb36..335046175950e42f5d927f65b2d56eb44098f421 100644 (file)
@@ -45,21 +45,17 @@ static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
 static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
 static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
                                                 ixgbe_link_speed speed,
-                                                bool autoneg,
                                                 bool autoneg_wait_to_complete);
 static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
                                            ixgbe_link_speed speed,
-                                           bool autoneg,
                                            bool autoneg_wait_to_complete);
 static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
                                      bool autoneg_wait_to_complete);
 static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
                                ixgbe_link_speed speed,
-                               bool autoneg,
                                bool autoneg_wait_to_complete);
 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
                                          ixgbe_link_speed speed,
-                                         bool autoneg,
                                          bool autoneg_wait_to_complete);
 static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw);
 
@@ -510,14 +506,12 @@ static void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw)
  *  ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true when waiting for completion is needed
  *
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
                                           ixgbe_link_speed speed,
-                                          bool autoneg,
                                           bool autoneg_wait_to_complete)
 {
        s32 status = 0;
@@ -527,6 +521,7 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
        u32 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
        u32 i = 0;
        bool link_up = false;
+       bool autoneg = false;
 
        /* Mask off requested but non-supported speeds */
        status = hw->mac.ops.get_link_capabilities(hw, &link_speed,
@@ -563,7 +558,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 
                status = ixgbe_setup_mac_link_82599(hw,
                                                    IXGBE_LINK_SPEED_10GB_FULL,
-                                                   autoneg,
                                                    autoneg_wait_to_complete);
                if (status != 0)
                        return status;
@@ -616,7 +610,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
 
                status = ixgbe_setup_mac_link_82599(hw,
                                                    IXGBE_LINK_SPEED_1GB_FULL,
-                                                   autoneg,
                                                    autoneg_wait_to_complete);
                if (status != 0)
                        return status;
@@ -645,7 +638,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
        if (speedcnt > 1)
                status = ixgbe_setup_mac_link_multispeed_fiber(hw,
                                                               highest_link_speed,
-                                                              autoneg,
                                                               autoneg_wait_to_complete);
 
 out:
@@ -665,13 +657,12 @@ out:
  *  ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true when waiting for completion is needed
  *
  *  Implements the Intel SmartSpeed algorithm.
  **/
 static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
-                                    ixgbe_link_speed speed, bool autoneg,
+                                    ixgbe_link_speed speed,
                                     bool autoneg_wait_to_complete)
 {
        s32 status = 0;
@@ -702,7 +693,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
        /* First, try to get link with full advertisement */
        hw->phy.smart_speed_active = false;
        for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) {
-               status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+               status = ixgbe_setup_mac_link_82599(hw, speed,
                                                    autoneg_wait_to_complete);
                if (status != 0)
                        goto out;
@@ -737,7 +728,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
 
        /* Turn SmartSpeed on to disable KR support */
        hw->phy.smart_speed_active = true;
-       status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+       status = ixgbe_setup_mac_link_82599(hw, speed,
                                            autoneg_wait_to_complete);
        if (status != 0)
                goto out;
@@ -763,7 +754,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
 
        /* We didn't get link.  Turn SmartSpeed back off. */
        hw->phy.smart_speed_active = false;
-       status = ixgbe_setup_mac_link_82599(hw, speed, autoneg,
+       status = ixgbe_setup_mac_link_82599(hw, speed,
                                            autoneg_wait_to_complete);
 
 out:
@@ -777,14 +768,13 @@ out:
  *  ixgbe_setup_mac_link_82599 - Set MAC link speed
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true when waiting for completion is needed
  *
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
-                               ixgbe_link_speed speed, bool autoneg,
-                               bool autoneg_wait_to_complete)
+                                     ixgbe_link_speed speed,
+                                     bool autoneg_wait_to_complete)
 {
        s32 status = 0;
        u32 autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
@@ -798,6 +788,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
        u32 i;
        ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
        bool got_lock = false;
+       bool autoneg = false;
 
        /* Check to see if speed passed in is supported. */
        status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities,
@@ -910,14 +901,12 @@ out:
  *  ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true if waiting is needed to complete
  *
  *  Restarts link on PHY and MAC based on settings passed in.
  **/
 static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
                                          ixgbe_link_speed speed,
-                                         bool autoneg,
                                          bool autoneg_wait_to_complete)
 {
        s32 status;
index 1513b1052ee2f3616cae4931397605b97c317c34..216203ece6ed2dfedc8fe2510833b1e5feabbd45 100644 (file)
@@ -156,7 +156,7 @@ static int ixgbe_get_settings(struct net_device *netdev,
        struct ixgbe_hw *hw = &adapter->hw;
        ixgbe_link_speed supported_link;
        u32 link_speed = 0;
-       bool autoneg;
+       bool autoneg = false;
        bool link_up;
 
        hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg);
@@ -333,10 +333,10 @@ static int ixgbe_set_settings(struct net_device *netdev,
                        return err;
                /* this sets the link speed and restarts auto-neg */
                hw->mac.autotry_restart = true;
-               err = hw->mac.ops.setup_link(hw, advertised, true, true);
+               err = hw->mac.ops.setup_link(hw, advertised, true);
                if (err) {
                        e_info(probe, "setup link failed with code %d\n", err);
-                       hw->mac.ops.setup_link(hw, old, true, true);
+                       hw->mac.ops.setup_link(hw, old, true);
                }
        } else {
                /* in this case we currently only support 10Gb/FULL */
index d9142899676dd6eb8120cc8098945840e9a04e70..ac41361f932f656a245161cfb043a8a693f06a0b 100644 (file)
@@ -4012,7 +4012,7 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
                goto link_cfg_out;
 
        if (hw->mac.ops.setup_link)
-               ret = hw->mac.ops.setup_link(hw, speed, autoneg, link_up);
+               ret = hw->mac.ops.setup_link(hw, speed, link_up);
 link_cfg_out:
        return ret;
 }
@@ -5755,7 +5755,7 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
        if ((!speed) && (hw->mac.ops.get_link_capabilities))
                hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
        if (hw->mac.ops.setup_link)
-               hw->mac.ops.setup_link(hw, speed, autoneg, true);
+               hw->mac.ops.setup_link(hw, speed, true);
 
        adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
        adapter->link_check_timeout = jiffies;
index 85f76cc3500da081c5bf1ce1c899252ae86b719b..0bdcc88cbf50b810577a3dd923c7f7f05d462b4c 100644 (file)
@@ -2822,7 +2822,7 @@ struct ixgbe_mac_operations {
        void (*disable_tx_laser)(struct ixgbe_hw *);
        void (*enable_tx_laser)(struct ixgbe_hw *);
        void (*flap_tx_laser)(struct ixgbe_hw *);
-       s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool, bool);
+       s32 (*setup_link)(struct ixgbe_hw *, ixgbe_link_speed, bool);
        s32 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
        s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
                                     bool *);
index 4ec501936b2f320db5ec4cf5dcbb684d5c03ebb6..2fa58437a42f4ba17b007ca3e3565275f3f6eede 100644 (file)
@@ -72,12 +72,11 @@ static s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw)
  *  ixgbe_setup_mac_link_X540 - Set the auto advertised capabilitires
  *  @hw: pointer to hardware structure
  *  @speed: new link speed
- *  @autoneg: true if autonegotiation enabled
  *  @autoneg_wait_to_complete: true when waiting for completion is needed
  **/
 static s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw,
-                                     ixgbe_link_speed speed, bool autoneg,
-                                     bool autoneg_wait_to_complete)
+                                    ixgbe_link_speed speed,
+                                    bool autoneg_wait_to_complete)
 {
        return hw->phy.ops.setup_link_speed(hw, speed,
                                            autoneg_wait_to_complete);