From: "Łukasz Stelmach" <l.stelmach@samsung.com>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: "Bartłomiej Żolnierkiewicz" <b.zolnierkie@samsung.com>,
"Marek Szyprowski" <m.szyprowski@samsung.com>,
"Łukasz Stelmach" <l.stelmach@samsung.com>
Subject: [PATCH v2] net: phy: Prevent reporting advertised modes when autoneg is off
Date: Thu, 15 Oct 2020 10:44:35 +0200 [thread overview]
Message-ID: <20201015084435.24368-1-l.stelmach@samsung.com> (raw)
In-Reply-To: CGME20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84@eucas1p2.samsung.com
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@samsung.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
next parent reply other threads:[~2020-10-15 8:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20201015084513eucas1p234e2fa7a42b973ee7feafbdac6267a84@eucas1p2.samsung.com>
2020-10-15 8:44 ` Łukasz Stelmach [this message]
2020-10-16 18:09 ` [PATCH v2] net: phy: Prevent reporting advertised modes when autoneg is off Andrew Lunn
[not found] ` <CGME20201016193736eucas1p1eb94190e16b194f473ade8c49ca34275@eucas1p1.samsung.com>
2020-10-16 19:37 ` Lukasz Stelmach
2020-10-16 21:00 ` Andrew Lunn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201015084435.24368-1-l.stelmach@samsung.com \
--to=l.stelmach@samsung.com \
--cc=andrew@lunn.ch \
--cc=b.zolnierkie@samsung.com \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).