mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 23:20:05 +00:00
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
|
||||
* 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) {
|
||||
case IXGBE_DEV_ID_X540T:
|
||||
case IXGBE_DEV_ID_X540T1:
|
||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||
return 0;
|
||||
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) {
|
||||
case IXGBE_DEV_ID_82599_T3_LOM:
|
||||
case IXGBE_DEV_ID_X540T:
|
||||
case IXGBE_DEV_ID_X540T1:
|
||||
supported = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return IXGBE_ERR_FC_NOT_SUPPORTED;
|
||||
break;
|
||||
}
|
||||
|
||||
return supported;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -234,7 +258,7 @@ static s32 ixgbe_setup_fc(struct ixgbe_hw *hw)
|
||||
IXGBE_GSSR_MAC_CSR_SM);
|
||||
|
||||
} 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,
|
||||
MDIO_MMD_AN, reg_cu);
|
||||
}
|
||||
@ -2392,7 +2416,7 @@ void ixgbe_fc_autoneg(struct ixgbe_hw *hw)
|
||||
|
||||
/* Autoneg flow control on copper adapters */
|
||||
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);
|
||||
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_dma_generic(struct ixgbe_hw *hw, u32 regval);
|
||||
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);
|
||||
|
||||
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_hw *hw = &adapter->hw;
|
||||
|
||||
if (hw->fc.disable_fc_autoneg)
|
||||
pause->autoneg = 0;
|
||||
else
|
||||
if (ixgbe_device_supports_autoneg_fc(hw) &&
|
||||
!hw->fc.disable_fc_autoneg)
|
||||
pause->autoneg = 1;
|
||||
else
|
||||
pause->autoneg = 0;
|
||||
|
||||
if (hw->fc.current_mode == ixgbe_fc_rx_pause) {
|
||||
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 */
|
||||
if ((pause->autoneg == AUTONEG_ENABLE) &&
|
||||
(ixgbe_device_supports_autoneg_fc(hw) != 0))
|
||||
!ixgbe_device_supports_autoneg_fc(hw))
|
||||
return -EINVAL;
|
||||
|
||||
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);
|
||||
hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
|
||||
hw->fc.send_xon = true;
|
||||
hw->fc.disable_fc_autoneg =
|
||||
(ixgbe_device_supports_autoneg_fc(hw) == 0) ? false : true;
|
||||
hw->fc.disable_fc_autoneg = ixgbe_device_supports_autoneg_fc(hw);
|
||||
|
||||
#ifdef CONFIG_PCI_IOV
|
||||
/* assign number of SR-IOV VFs */
|
||||
|
Loading…
x
Reference in New Issue
Block a user