diff mbox series

[RFC,v2,3/8] net: phylink: call mac_an_restart for SGMII/QSGMII inband interfaces too

Message ID 20191217221831.10923-4-olteanv@gmail.com
State RFC
Delegated to: David Miller
Headers show
Series Convert Felix DSA switch to PHYLINK | expand

Commit Message

Vladimir Oltean Dec. 17, 2019, 10:18 p.m. UTC
From: Vladimir Oltean <vladimir.oltean@nxp.com>

It doesn't quite make sense why restarting the AN process should be
unique to 802.3z (1000Base-X) modes. It is valid to put an SGMII PCS in
in-band AN mode, therefore also make PHYLINK re-trigger an
auto-negotiation if needed.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
---
 drivers/net/phy/phylink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Russell King (Oracle) Dec. 17, 2019, 11:25 p.m. UTC | #1
On Wed, Dec 18, 2019 at 12:18:26AM +0200, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> It doesn't quite make sense why restarting the AN process should be
> unique to 802.3z (1000Base-X) modes. It is valid to put an SGMII PCS in
> in-band AN mode, therefore also make PHYLINK re-trigger an
> auto-negotiation if needed.

The question I'd ask is how is that actually achieved on the link?

It makes sense for 1000base-X because either end can drop the ACK bit
to cause a renegotiation to occur, but it makes no sense for SGMII.

In SGMII:
1) there is no advertisement from the MAC to the PHY
2) the PHY is merely informing the MAC of the results of negotiation

Attempting to trigger a renegotiation at the MAC end does nothing
useful for SGMII, it doesn't cause the PHY to renegotiate with its
link partner.

The whole point of SGMII over 1000base-X is that the PHY informs the
MAC using in-band signalling what the results of negotiation were on
the media side of the PHY. SGMII provides no way to control the
advertisement.
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index f9ad794cfee1..0e563c22d725 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -358,7 +358,9 @@  static void phylink_mac_config_up(struct phylink *pl,
 static void phylink_mac_an_restart(struct phylink *pl)
 {
 	if (pl->link_config.an_enabled &&
-	    phy_interface_mode_is_8023z(pl->link_config.interface))
+	    (phy_interface_mode_is_8023z(pl->link_config.interface) ||
+	     pl->link_config.interface == PHY_INTERFACE_MODE_SGMII ||
+	     pl->link_config.interface == PHY_INTERFACE_MODE_QSGMII))
 		pl->ops->mac_an_restart(pl->config);
 }