[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201015084435.24368-1-l.stelmach@samsung.com>
Date: Thu, 15 Oct 2020 10:44:35 +0200
From: Łukasz Stelmach <l.stelmach@...sung.com>
To: Andrew Lunn <andrew@...n.ch>,
Heiner Kallweit <hkallweit1@...il.com>,
Russell King <linux@...linux.org.uk>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Bartłomiej Żolnierkiewicz
<b.zolnierkie@...sung.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Łukasz Stelmach <l.stelmach@...sung.com>
Subject: [PATCH v2] net: phy: Prevent reporting advertised modes when
autoneg is off
Do not report advertised link modes (local and remote) when
autonegotiation is turned off. mii_ethtool_get_link_ksettings() exhibits
the same behaviour and this patch aims at unifying the behavior of both
functions.
Signed-off-by: Łukasz Stelmach <l.stelmach@...sung.com>
---
Changes in v2:
- clear lp_advertising
- set ETHTOOL_LINK_MODE_TP_BIT and ETHTOOL_LINK_MODE_MII_BIT in advertising
drivers/net/phy/phy.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 35525a671400..6ede9c1c138c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -315,8 +315,17 @@ void phy_ethtool_ksettings_get(struct phy_device *phydev,
struct ethtool_link_ksettings *cmd)
{
linkmode_copy(cmd->link_modes.supported, phydev->supported);
- linkmode_copy(cmd->link_modes.advertising, phydev->advertising);
- linkmode_copy(cmd->link_modes.lp_advertising, phydev->lp_advertising);
+ if (phydev->autoneg) {
+ linkmode_copy(cmd->link_modes.advertising, phydev->advertising);
+ linkmode_copy(cmd->link_modes.lp_advertising, phydev->lp_advertising);
+ } else {
+ linkmode_zero(cmd->link_modes.lp_advertising);
+ linkmode_zero(cmd->link_modes.advertising);
+ linkmode_set_bit(ETHTOOL_LINK_MODE_TP_BIT,
+ cmd->link_modes.advertising);
+ linkmode_set_bit(ETHTOOL_LINK_MODE_MII_BIT,
+ cmd->link_modes.advertising);
+ }
cmd->base.speed = phydev->speed;
cmd->base.duplex = phydev->duplex;
--
2.26.2
Powered by blists - more mailing lists