Commit 73d80953 authored by Don Skidmore's avatar Don Skidmore Committed by Jeff Kirsher

ixgbe: fix fc autoneg ethtool reporting.

Originally ixgbe_device_supports_autoneg_fc() was only expected to
be called by copper devices.  This would lead to false information
to be displayed via ethtool.

v2: changed ixgbe_device_supports_autoneg_fc() to a bool function,
    it returns bool.  Based on feedback from David Miller
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent e507d0cd
...@@ -65,17 +65,41 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw); ...@@ -65,17 +65,41 @@ static s32 ixgbe_disable_pcie_master(struct ixgbe_hw *hw);
* function check the device id to see if the associated phy supports * function check the device id to see if the associated phy supports
* autoneg flow control. * autoneg flow control.
**/ **/
s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw) bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw)
{ {
bool supported = false;
ixgbe_link_speed speed;
bool link_up;
switch (hw->device_id) { switch (hw->phy.media_type) {
case IXGBE_DEV_ID_X540T: case ixgbe_media_type_fiber:
case IXGBE_DEV_ID_X540T1: hw->mac.ops.check_link(hw, &speed, &link_up, false);
case IXGBE_DEV_ID_82599_T3_LOM: /* if link is down, assume supported */
return 0; if (link_up)
supported = speed == IXGBE_LINK_SPEED_1GB_FULL ?
true : false;
else
supported = true;
break;
case ixgbe_media_type_backplane:
supported = true;
break;
case ixgbe_media_type_copper:
/* only some copper devices support flow control autoneg */
switch (hw->device_id) {
case IXGBE_DEV_ID_82599_T3_LOM:
case IXGBE_DEV_ID_X540T:
case IXGBE_DEV_ID_X540T1:
supported = true;
break;
default:
break;
}
default: default:
return IXGBE_ERR_FC_NOT_SUPPORTED; break;
} }
return supported;
} }
/** /**
...@@ -234,7 +258,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw) ...@@ -234,7 +258,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
IXGBE_GSSR_MAC_CSR_SM); IXGBE_GSSR_MAC_CSR_SM);
} else if ((hw->phy.media_type == ixgbe_media_type_copper) && } else if ((hw->phy.media_type == ixgbe_media_type_copper) &&
(ixgbe_device_supports_autoneg_fc(hw) == 0)) { ixgbe_device_supports_autoneg_fc(hw)) {
hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE, hw->phy.ops.write_reg(hw, MDIO_AN_ADVERTISE,
MDIO_MMD_AN, reg_cu); MDIO_MMD_AN, reg_cu);
} }
...@@ -2392,7 +2416,7 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw) ...@@ -2392,7 +2416,7 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
/* Autoneg flow control on copper adapters */ /* Autoneg flow control on copper adapters */
case ixgbe_media_type_copper: case ixgbe_media_type_copper:
if (ixgbe_device_supports_autoneg_fc(hw) == 0) if (ixgbe_device_supports_autoneg_fc(hw))
ret_val = ixgbe_fc_autoneg_copper(hw); ret_val = ixgbe_fc_autoneg_copper(hw);
break; break;
......
...@@ -80,7 +80,7 @@ s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw); ...@@ -80,7 +80,7 @@ s32 ixgbe_disable_rx_buff_generic(struct ixgbe_hw *hw);
s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw); s32 ixgbe_enable_rx_buff_generic(struct ixgbe_hw *hw);
s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval); s32 ixgbe_enable_rx_dma_generic(struct ixgbe_hw *hw, u32 regval);
s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw); s32 ixgbe_fc_enable_generic(struct ixgbe_hw *hw);
s32 ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw); bool ixgbe_device_supports_autoneg_fc(struct ixgbe_hw *hw);
void ixgbe_fc_autoneg(struct ixgbe_hw *hw); void ixgbe_fc_autoneg(struct ixgbe_hw *hw);
s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask); s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
......
...@@ -355,10 +355,11 @@ static void ixgbe_get_pauseparam(struct net_device *netdev, ...@@ -355,10 +355,11 @@ static void ixgbe_get_pauseparam(struct net_device *netdev,
struct ixgbe_adapter *adapter = netdev_priv(netdev); struct ixgbe_adapter *adapter = netdev_priv(netdev);
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
if (hw->fc.disable_fc_autoneg) if (ixgbe_device_supports_autoneg_fc(hw) &&
pause->autoneg = 0; !hw->fc.disable_fc_autoneg)
else
pause->autoneg = 1; pause->autoneg = 1;
else
pause->autoneg = 0;
if (hw->fc.current_mode == ixgbe_fc_rx_pause) { if (hw->fc.current_mode == ixgbe_fc_rx_pause) {
pause->rx_pause = 1; pause->rx_pause = 1;
...@@ -384,7 +385,7 @@ static int ixgbe_set_pauseparam(struct net_device *netdev, ...@@ -384,7 +385,7 @@ static int ixgbe_set_pauseparam(struct net_device *netdev,
/* some devices do not support autoneg of link flow control */ /* some devices do not support autoneg of link flow control */
if ((pause->autoneg == AUTONEG_ENABLE) && if ((pause->autoneg == AUTONEG_ENABLE) &&
(ixgbe_device_supports_autoneg_fc(hw) != 0)) !ixgbe_device_supports_autoneg_fc(hw))
return -EINVAL; return -EINVAL;
fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE); fc.disable_fc_autoneg = (pause->autoneg != AUTONEG_ENABLE);
......
...@@ -4721,8 +4721,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter) ...@@ -4721,8 +4721,7 @@ static int ixgbe_sw_init(struct ixgbe_adapter *adapter)
ixgbe_pbthresh_setup(adapter); ixgbe_pbthresh_setup(adapter);
hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE; hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
hw->fc.send_xon = true; hw->fc.send_xon = true;
hw->fc.disable_fc_autoneg = hw->fc.disable_fc_autoneg = ixgbe_device_supports_autoneg_fc(hw);
(ixgbe_device_supports_autoneg_fc(hw) == 0) ? false : true;
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV
/* assign number of SR-IOV VFs */ /* assign number of SR-IOV VFs */
......
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