Commit fd0326f2 authored by Josh Hay's avatar Josh Hay Committed by Jeff Kirsher

ixgbe: autoneg variable refactoring

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: default avatarJosh Hay <joshua.a.hay@intel.com>
Tested-by: default avatarPhil Schmitt <phillip.j.schmitt@intel.com>
parent 99b76642
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw, static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset, static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
u8 *eeprom_data); u8 *eeprom_data);
...@@ -633,15 +632,15 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw, ...@@ -633,15 +632,15 @@ static s32 ixgbe_check_mac_link_82598(struct ixgbe_hw *hw,
* ixgbe_setup_mac_link_82598 - Set MAC link speed * ixgbe_setup_mac_link_82598 - Set MAC link speed
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if auto-negotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed * @autoneg_wait_to_complete: true when waiting for completion is needed
* *
* Set the link speed in the AUTOC register and restarts link. * Set the link speed in the AUTOC register and restarts link.
**/ **/
static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed, bool autoneg, ixgbe_link_speed speed,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
bool autoneg = false;
s32 status = 0; s32 status = 0;
ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC); u32 curr_autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
...@@ -685,14 +684,12 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw, ...@@ -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 * ixgbe_setup_copper_link_82598 - Set the PHY autoneg advertised field
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true if waiting is needed to complete * @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. * 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, static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
s32 status; s32 status;
...@@ -1311,4 +1308,3 @@ struct ixgbe_info ixgbe_82598_info = { ...@@ -1311,4 +1308,3 @@ struct ixgbe_info ixgbe_82598_info = {
.eeprom_ops = &eeprom_ops_82598, .eeprom_ops = &eeprom_ops_82598,
.phy_ops = &phy_ops_82598, .phy_ops = &phy_ops_82598,
}; };
...@@ -45,21 +45,17 @@ static void ixgbe_enable_tx_laser_multispeed_fiber(struct ixgbe_hw *hw); ...@@ -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 void ixgbe_flap_tx_laser_multispeed_fiber(struct ixgbe_hw *hw);
static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw, static s32 ixgbe_start_mac_link_82599(struct ixgbe_hw *hw,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete); bool autoneg_wait_to_complete);
static s32 ixgbe_verify_fw_version_82599(struct ixgbe_hw *hw); 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) ...@@ -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 * ixgbe_setup_mac_link_multispeed_fiber - Set MAC link speed
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed * @autoneg_wait_to_complete: true when waiting for completion is needed
* *
* Set the link speed in the AUTOC register and restarts link. * Set the link speed in the AUTOC register and restarts link.
**/ **/
static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
s32 status = 0; s32 status = 0;
...@@ -527,6 +521,7 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ...@@ -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 esdp_reg = IXGBE_READ_REG(hw, IXGBE_ESDP);
u32 i = 0; u32 i = 0;
bool link_up = false; bool link_up = false;
bool autoneg = false;
/* Mask off requested but non-supported speeds */ /* Mask off requested but non-supported speeds */
status = hw->mac.ops.get_link_capabilities(hw, &link_speed, 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, ...@@ -563,7 +558,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
status = ixgbe_setup_mac_link_82599(hw, status = ixgbe_setup_mac_link_82599(hw,
IXGBE_LINK_SPEED_10GB_FULL, IXGBE_LINK_SPEED_10GB_FULL,
autoneg,
autoneg_wait_to_complete); autoneg_wait_to_complete);
if (status != 0) if (status != 0)
return status; return status;
...@@ -616,7 +610,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ...@@ -616,7 +610,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
status = ixgbe_setup_mac_link_82599(hw, status = ixgbe_setup_mac_link_82599(hw,
IXGBE_LINK_SPEED_1GB_FULL, IXGBE_LINK_SPEED_1GB_FULL,
autoneg,
autoneg_wait_to_complete); autoneg_wait_to_complete);
if (status != 0) if (status != 0)
return status; return status;
...@@ -645,7 +638,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ...@@ -645,7 +638,6 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
if (speedcnt > 1) if (speedcnt > 1)
status = ixgbe_setup_mac_link_multispeed_fiber(hw, status = ixgbe_setup_mac_link_multispeed_fiber(hw,
highest_link_speed, highest_link_speed,
autoneg,
autoneg_wait_to_complete); autoneg_wait_to_complete);
out: out:
...@@ -665,13 +657,12 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw, ...@@ -665,13 +657,12 @@ static s32 ixgbe_setup_mac_link_multispeed_fiber(struct ixgbe_hw *hw,
* ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed * ixgbe_setup_mac_link_smartspeed - Set MAC link speed using SmartSpeed
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed * @autoneg_wait_to_complete: true when waiting for completion is needed
* *
* Implements the Intel SmartSpeed algorithm. * Implements the Intel SmartSpeed algorithm.
**/ **/
static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, 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) bool autoneg_wait_to_complete)
{ {
s32 status = 0; s32 status = 0;
...@@ -702,7 +693,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ...@@ -702,7 +693,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
/* First, try to get link with full advertisement */ /* First, try to get link with full advertisement */
hw->phy.smart_speed_active = false; hw->phy.smart_speed_active = false;
for (j = 0; j < IXGBE_SMARTSPEED_MAX_RETRIES; j++) { 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); autoneg_wait_to_complete);
if (status != 0) if (status != 0)
goto out; goto out;
...@@ -737,7 +728,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ...@@ -737,7 +728,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
/* Turn SmartSpeed on to disable KR support */ /* Turn SmartSpeed on to disable KR support */
hw->phy.smart_speed_active = true; 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); autoneg_wait_to_complete);
if (status != 0) if (status != 0)
goto out; goto out;
...@@ -763,7 +754,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ...@@ -763,7 +754,7 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
/* We didn't get link. Turn SmartSpeed back off. */ /* We didn't get link. Turn SmartSpeed back off. */
hw->phy.smart_speed_active = false; 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); autoneg_wait_to_complete);
out: out:
...@@ -777,13 +768,12 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw, ...@@ -777,13 +768,12 @@ static s32 ixgbe_setup_mac_link_smartspeed(struct ixgbe_hw *hw,
* ixgbe_setup_mac_link_82599 - Set MAC link speed * ixgbe_setup_mac_link_82599 - Set MAC link speed
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed * @autoneg_wait_to_complete: true when waiting for completion is needed
* *
* Set the link speed in the AUTOC register and restarts link. * Set the link speed in the AUTOC register and restarts link.
**/ **/
static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed, bool autoneg, ixgbe_link_speed speed,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
s32 status = 0; s32 status = 0;
...@@ -798,6 +788,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ...@@ -798,6 +788,7 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
u32 i; u32 i;
ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN; ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
bool got_lock = false; bool got_lock = false;
bool autoneg = false;
/* Check to see if speed passed in is supported. */ /* Check to see if speed passed in is supported. */
status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities, status = hw->mac.ops.get_link_capabilities(hw, &link_capabilities,
...@@ -910,14 +901,12 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw, ...@@ -910,14 +901,12 @@ static s32 ixgbe_setup_mac_link_82599(struct ixgbe_hw *hw,
* ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field * ixgbe_setup_copper_link_82599 - Set the PHY autoneg advertised field
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true if waiting is needed to complete * @autoneg_wait_to_complete: true if waiting is needed to complete
* *
* Restarts link on PHY and MAC based on settings passed in. * Restarts link on PHY and MAC based on settings passed in.
**/ **/
static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw, static s32 ixgbe_setup_copper_link_82599(struct ixgbe_hw *hw,
ixgbe_link_speed speed, ixgbe_link_speed speed,
bool autoneg,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
s32 status; s32 status;
......
...@@ -156,7 +156,7 @@ static int ixgbe_get_settings(struct net_device *netdev, ...@@ -156,7 +156,7 @@ static int ixgbe_get_settings(struct net_device *netdev,
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
ixgbe_link_speed supported_link; ixgbe_link_speed supported_link;
u32 link_speed = 0; u32 link_speed = 0;
bool autoneg; bool autoneg = false;
bool link_up; bool link_up;
hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg); hw->mac.ops.get_link_capabilities(hw, &supported_link, &autoneg);
...@@ -333,10 +333,10 @@ static int ixgbe_set_settings(struct net_device *netdev, ...@@ -333,10 +333,10 @@ static int ixgbe_set_settings(struct net_device *netdev,
return err; return err;
/* this sets the link speed and restarts auto-neg */ /* this sets the link speed and restarts auto-neg */
hw->mac.autotry_restart = true; 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) { if (err) {
e_info(probe, "setup link failed with code %d\n", 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 { } else {
/* in this case we currently only support 10Gb/FULL */ /* in this case we currently only support 10Gb/FULL */
......
...@@ -4012,7 +4012,7 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw) ...@@ -4012,7 +4012,7 @@ static int ixgbe_non_sfp_link_config(struct ixgbe_hw *hw)
goto link_cfg_out; goto link_cfg_out;
if (hw->mac.ops.setup_link) 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: link_cfg_out:
return ret; return ret;
} }
...@@ -5755,7 +5755,7 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter) ...@@ -5755,7 +5755,7 @@ static void ixgbe_sfp_link_config_subtask(struct ixgbe_adapter *adapter)
if ((!speed) && (hw->mac.ops.get_link_capabilities)) if ((!speed) && (hw->mac.ops.get_link_capabilities))
hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg); hw->mac.ops.get_link_capabilities(hw, &speed, &autoneg);
if (hw->mac.ops.setup_link) 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->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
adapter->link_check_timeout = jiffies; adapter->link_check_timeout = jiffies;
......
...@@ -2822,7 +2822,7 @@ struct ixgbe_mac_operations { ...@@ -2822,7 +2822,7 @@ struct ixgbe_mac_operations {
void (*disable_tx_laser)(struct ixgbe_hw *); void (*disable_tx_laser)(struct ixgbe_hw *);
void (*enable_tx_laser)(struct ixgbe_hw *); void (*enable_tx_laser)(struct ixgbe_hw *);
void (*flap_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 (*check_link)(struct ixgbe_hw *, ixgbe_link_speed *, bool *, bool);
s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *, s32 (*get_link_capabilities)(struct ixgbe_hw *, ixgbe_link_speed *,
bool *); bool *);
......
...@@ -72,11 +72,10 @@ static s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw) ...@@ -72,11 +72,10 @@ static s32 ixgbe_get_invariants_X540(struct ixgbe_hw *hw)
* ixgbe_setup_mac_link_X540 - Set the auto advertised capabilitires * ixgbe_setup_mac_link_X540 - Set the auto advertised capabilitires
* @hw: pointer to hardware structure * @hw: pointer to hardware structure
* @speed: new link speed * @speed: new link speed
* @autoneg: true if autonegotiation enabled
* @autoneg_wait_to_complete: true when waiting for completion is needed * @autoneg_wait_to_complete: true when waiting for completion is needed
**/ **/
static s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw, static s32 ixgbe_setup_mac_link_X540(struct ixgbe_hw *hw,
ixgbe_link_speed speed, bool autoneg, ixgbe_link_speed speed,
bool autoneg_wait_to_complete) bool autoneg_wait_to_complete)
{ {
return hw->phy.ops.setup_link_speed(hw, speed, return hw->phy.ops.setup_link_speed(hw, speed,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment