netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off
       [not found] <CGME20201027114743eucas1p23c4a5e6762ce18509296cf23435e7268@eucas1p2.samsung.com>
@ 2020-10-27 11:43 ` Łukasz Stelmach
  2020-10-27 18:21   ` Andrew Lunn
  2020-10-30  2:58   ` Jakub Kicinski
  0 siblings, 2 replies; 3+ messages in thread
From: Łukasz Stelmach @ 2020-10-27 11:43 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel
  Cc: Bartłomiej Żolnierkiewicz, Marek Szyprowski,
	Łukasz Stelmach

Unify the set of information returned by mii_ethtool_get_link_ksettings(),
mii_ethtool_gset() and phy_ethtool_ksettings_get(). Make the mii_*()
functions report advertised settings when autonegotiation if disabled.

Suggested-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
---
Resending according to last Anddrew Lunn's request last week.

This is the third version of ("net: phy: Prevent reporting advertised
modes when autoneg is off")  patch[1] that started as change for phy.c
to make phy_ethtool_ksettings_get() work like mii_*() below. After
suggestions from Russell King came v2[2].

Following Andrew Lunn's suggestions[2] to report advertised parameters even
when autonegotiation is off I decided to drop changes to phy.c and make
appropriate to mii.c

Changes in v3:
  - drop changes to phy.c
  - introduce changes to mii.c

Changes in v2:
  - clear lp_advertising
  - set ETHTOOL_LINK_MODE_TP_BIT and ETHTOOL_LINK_MODE_MII_BIT in advertising

[1] https://lore.kernel.org/lkml/20201014125650.12137-1-l.stelmach@samsung.com/ 
[2] https://lore.kernel.org/lkml/20201015084435.24368-1-l.stelmach@samsung.com/

 drivers/net/mii.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mii.c b/drivers/net/mii.c
index f6a97c859f3a..e71ebb933266 100644
--- a/drivers/net/mii.c
+++ b/drivers/net/mii.c
@@ -84,15 +84,16 @@ int mii_ethtool_gset(struct mii_if_info *mii, struct ethtool_cmd *ecmd)
  		ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000);
 		stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000);
 	}
+
+	ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE);
+	if (mii->supports_gmii)
+		ecmd->advertising |=
+			mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
+
 	if (bmcr & BMCR_ANENABLE) {
 		ecmd->advertising |= ADVERTISED_Autoneg;
 		ecmd->autoneg = AUTONEG_ENABLE;
 
-		ecmd->advertising |= mii_get_an(mii, MII_ADVERTISE);
-		if (mii->supports_gmii)
-			ecmd->advertising |=
-					mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
-
 		if (bmsr & BMSR_ANEGCOMPLETE) {
 			ecmd->lp_advertising = mii_get_an(mii, MII_LPA);
 			ecmd->lp_advertising |=
@@ -171,14 +172,15 @@ void mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
 		ctrl1000 = mii->mdio_read(dev, mii->phy_id, MII_CTRL1000);
 		stat1000 = mii->mdio_read(dev, mii->phy_id, MII_STAT1000);
 	}
+
+	advertising |= mii_get_an(mii, MII_ADVERTISE);
+	if (mii->supports_gmii)
+		advertising |= mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
+
 	if (bmcr & BMCR_ANENABLE) {
 		advertising |= ADVERTISED_Autoneg;
 		cmd->base.autoneg = AUTONEG_ENABLE;
 
-		advertising |= mii_get_an(mii, MII_ADVERTISE);
-		if (mii->supports_gmii)
-			advertising |= mii_ctrl1000_to_ethtool_adv_t(ctrl1000);
-
 		if (bmsr & BMSR_ANEGCOMPLETE) {
 			lp_advertising = mii_get_an(mii, MII_LPA);
 			lp_advertising |=
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off
  2020-10-27 11:43 ` [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off Łukasz Stelmach
@ 2020-10-27 18:21   ` Andrew Lunn
  2020-10-30  2:58   ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2020-10-27 18:21 UTC (permalink / raw)
  To: Łukasz Stelmach
  Cc: Heiner Kallweit, Russell King, David S. Miller, Jakub Kicinski,
	netdev, linux-kernel, Bartłomiej Żolnierkiewicz,
	Marek Szyprowski

On Tue, Oct 27, 2020 at 12:43:17PM +0100, Łukasz Stelmach wrote:
> Unify the set of information returned by mii_ethtool_get_link_ksettings(),
> mii_ethtool_gset() and phy_ethtool_ksettings_get(). Make the mii_*()
> functions report advertised settings when autonegotiation if disabled.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off
  2020-10-27 11:43 ` [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off Łukasz Stelmach
  2020-10-27 18:21   ` Andrew Lunn
@ 2020-10-30  2:58   ` Jakub Kicinski
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-10-30  2:58 UTC (permalink / raw)
  To: Łukasz Stelmach
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	netdev, linux-kernel, Bartłomiej Żolnierkiewicz,
	Marek Szyprowski

On Tue, 27 Oct 2020 12:43:17 +0100 Łukasz Stelmach wrote:
> Unify the set of information returned by mii_ethtool_get_link_ksettings(),
> mii_ethtool_gset() and phy_ethtool_ksettings_get(). Make the mii_*()
> functions report advertised settings when autonegotiation if disabled.
> 
> Suggested-by: Andrew Lunn <andrew@lunn.ch>
> Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-30  2:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20201027114743eucas1p23c4a5e6762ce18509296cf23435e7268@eucas1p2.samsung.com>
2020-10-27 11:43 ` [PATCH v3 RESEND] net: mii: Report advertised link capabilities when autonegotiation is off Łukasz Stelmach
2020-10-27 18:21   ` Andrew Lunn
2020-10-30  2:58   ` Jakub Kicinski

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).