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: Don Skidmore <donald.c.skidmore@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
This commit is contained in:
parent
e507d0cdb3
commit
73d80953df
|
@ -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->phy.media_type) {
|
||||||
|
case ixgbe_media_type_fiber:
|
||||||
|
hw->mac.ops.check_link(hw, &speed, &link_up, false);
|
||||||
|
/* if link is down, assume supported */
|
||||||
|
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) {
|
switch (hw->device_id) {
|
||||||
|
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||||
case IXGBE_DEV_ID_X540T:
|
case IXGBE_DEV_ID_X540T:
|
||||||
case IXGBE_DEV_ID_X540T1:
|
case IXGBE_DEV_ID_X540T1:
|
||||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
supported = true;
|
||||||
return 0;
|
break;
|
||||||
default:
|
default:
|
||||||
return IXGBE_ERR_FC_NOT_SUPPORTED;
|
break;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return supported;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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)
|
||||||
|
|
||||||
/* 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);
|
||||||
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,
|
||||||
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,
|
||||||
|
|
||||||
/* 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)
|
||||||
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 */
|
||||||
|
|
Loading…
Reference in New Issue