mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
igc: Fix ambiguity in the ethtool advertising
The 'ethtool_convert_link_mode_to_legacy_u32' method does not allow us to
advertise 2500M speed support and TP (twisted pair) properly. Convert to
'ethtool_link_ksettings_test_link_mode' to advertise supported speed and
eliminate ambiguity.
Fixes: 8c5ad0dae9
("igc: Add ethtool support")
Suggested-by: Dima Ruinskiy <dima.ruinskiy@intel.com>
Suggested-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Signed-off-by: Sasha Neftin <sasha.neftin@intel.com>
Tested-by: Naama Meir <naamax.meir@linux.intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Link: https://lore.kernel.org/r/20231019203641.3661960-1-jacob.e.keller@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a9beb7e81b
commit
e7684d29ef
@ -1817,7 +1817,7 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,
|
||||
struct igc_adapter *adapter = netdev_priv(netdev);
|
||||
struct net_device *dev = adapter->netdev;
|
||||
struct igc_hw *hw = &adapter->hw;
|
||||
u32 advertising;
|
||||
u16 advertised = 0;
|
||||
|
||||
/* When adapter in resetting mode, autoneg/speed/duplex
|
||||
* cannot be changed
|
||||
@ -1842,18 +1842,33 @@ igc_ethtool_set_link_ksettings(struct net_device *netdev,
|
||||
while (test_and_set_bit(__IGC_RESETTING, &adapter->state))
|
||||
usleep_range(1000, 2000);
|
||||
|
||||
ethtool_convert_link_mode_to_legacy_u32(&advertising,
|
||||
cmd->link_modes.advertising);
|
||||
/* Converting to legacy u32 drops ETHTOOL_LINK_MODE_2500baseT_Full_BIT.
|
||||
* We have to check this and convert it to ADVERTISE_2500_FULL
|
||||
* (aka ETHTOOL_LINK_MODE_2500baseX_Full_BIT) explicitly.
|
||||
*/
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising, 2500baseT_Full))
|
||||
advertising |= ADVERTISE_2500_FULL;
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
2500baseT_Full))
|
||||
advertised |= ADVERTISE_2500_FULL;
|
||||
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
1000baseT_Full))
|
||||
advertised |= ADVERTISE_1000_FULL;
|
||||
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
100baseT_Full))
|
||||
advertised |= ADVERTISE_100_FULL;
|
||||
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
100baseT_Half))
|
||||
advertised |= ADVERTISE_100_HALF;
|
||||
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
10baseT_Full))
|
||||
advertised |= ADVERTISE_10_FULL;
|
||||
|
||||
if (ethtool_link_ksettings_test_link_mode(cmd, advertising,
|
||||
10baseT_Half))
|
||||
advertised |= ADVERTISE_10_HALF;
|
||||
|
||||
if (cmd->base.autoneg == AUTONEG_ENABLE) {
|
||||
hw->mac.autoneg = 1;
|
||||
hw->phy.autoneg_advertised = advertising;
|
||||
hw->phy.autoneg_advertised = advertised;
|
||||
if (adapter->fc_autoneg)
|
||||
hw->fc.requested_mode = igc_fc_default;
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user