Commit cbdbb58b authored by Jamie Gloudon's avatar Jamie Gloudon Committed by Jakub Kicinski

e1000e: Enable Link Partner Advertised Support

This enables link partner advertised support to show link modes and
pause frame use.
Signed-off-by: default avatarJamie Gloudon <jamie.gloudon@gmx.fr>
Tested-by: default avatarNaama Meir <naamax.meir@linux.intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20230103230653.1102544-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 12c1604a
...@@ -110,9 +110,9 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { ...@@ -110,9 +110,9 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
static int e1000_get_link_ksettings(struct net_device *netdev, static int e1000_get_link_ksettings(struct net_device *netdev,
struct ethtool_link_ksettings *cmd) struct ethtool_link_ksettings *cmd)
{ {
u32 speed, supported, advertising, lp_advertising, lpa_t;
struct e1000_adapter *adapter = netdev_priv(netdev); struct e1000_adapter *adapter = netdev_priv(netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
u32 speed, supported, advertising;
if (hw->phy.media_type == e1000_media_type_copper) { if (hw->phy.media_type == e1000_media_type_copper) {
supported = (SUPPORTED_10baseT_Half | supported = (SUPPORTED_10baseT_Half |
...@@ -120,7 +120,9 @@ static int e1000_get_link_ksettings(struct net_device *netdev, ...@@ -120,7 +120,9 @@ static int e1000_get_link_ksettings(struct net_device *netdev,
SUPPORTED_100baseT_Half | SUPPORTED_100baseT_Half |
SUPPORTED_100baseT_Full | SUPPORTED_100baseT_Full |
SUPPORTED_1000baseT_Full | SUPPORTED_1000baseT_Full |
SUPPORTED_Asym_Pause |
SUPPORTED_Autoneg | SUPPORTED_Autoneg |
SUPPORTED_Pause |
SUPPORTED_TP); SUPPORTED_TP);
if (hw->phy.type == e1000_phy_ife) if (hw->phy.type == e1000_phy_ife)
supported &= ~SUPPORTED_1000baseT_Full; supported &= ~SUPPORTED_1000baseT_Full;
...@@ -192,10 +194,16 @@ static int e1000_get_link_ksettings(struct net_device *netdev, ...@@ -192,10 +194,16 @@ static int e1000_get_link_ksettings(struct net_device *netdev,
if (hw->phy.media_type != e1000_media_type_copper) if (hw->phy.media_type != e1000_media_type_copper)
cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID; cmd->base.eth_tp_mdix_ctrl = ETH_TP_MDI_INVALID;
lpa_t = mii_stat1000_to_ethtool_lpa_t(adapter->phy_regs.stat1000);
lp_advertising = lpa_t |
mii_lpa_to_ethtool_lpa_t(adapter->phy_regs.lpa);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
supported); supported);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising,
advertising); advertising);
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.lp_advertising,
lp_advertising);
return 0; return 0;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
/* Copyright(c) 1999 - 2018 Intel Corporation. */ /* Copyright(c) 1999 - 2018 Intel Corporation. */
#include "e1000.h" #include "e1000.h"
#include <linux/ethtool.h>
static s32 e1000_wait_autoneg(struct e1000_hw *hw); static s32 e1000_wait_autoneg(struct e1000_hw *hw);
static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset, static s32 e1000_access_phy_wakeup_reg_bm(struct e1000_hw *hw, u32 offset,
...@@ -1011,6 +1012,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1011,6 +1012,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
*/ */
mii_autoneg_adv_reg &= mii_autoneg_adv_reg &=
~(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); ~(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
phy->autoneg_advertised &=
~(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
break; break;
case e1000_fc_rx_pause: case e1000_fc_rx_pause:
/* Rx Flow control is enabled, and Tx Flow control is /* Rx Flow control is enabled, and Tx Flow control is
...@@ -1024,6 +1027,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1024,6 +1027,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
*/ */
mii_autoneg_adv_reg |= mii_autoneg_adv_reg |=
(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
phy->autoneg_advertised |=
(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
break; break;
case e1000_fc_tx_pause: case e1000_fc_tx_pause:
/* Tx Flow control is enabled, and Rx Flow control is /* Tx Flow control is enabled, and Rx Flow control is
...@@ -1031,6 +1036,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1031,6 +1036,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
*/ */
mii_autoneg_adv_reg |= ADVERTISE_PAUSE_ASYM; mii_autoneg_adv_reg |= ADVERTISE_PAUSE_ASYM;
mii_autoneg_adv_reg &= ~ADVERTISE_PAUSE_CAP; mii_autoneg_adv_reg &= ~ADVERTISE_PAUSE_CAP;
phy->autoneg_advertised |= ADVERTISED_Asym_Pause;
phy->autoneg_advertised &= ~ADVERTISED_Pause;
break; break;
case e1000_fc_full: case e1000_fc_full:
/* Flow control (both Rx and Tx) is enabled by a software /* Flow control (both Rx and Tx) is enabled by a software
...@@ -1038,6 +1045,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) ...@@ -1038,6 +1045,8 @@ static s32 e1000_phy_setup_autoneg(struct e1000_hw *hw)
*/ */
mii_autoneg_adv_reg |= mii_autoneg_adv_reg |=
(ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP); (ADVERTISE_PAUSE_ASYM | ADVERTISE_PAUSE_CAP);
phy->autoneg_advertised |=
(ADVERTISED_Pause | ADVERTISED_Asym_Pause);
break; break;
default: default:
e_dbg("Flow control param set incorrectly\n"); e_dbg("Flow control param set incorrectly\n");
......
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