Subject: Re: [EXT] Re: Phylink flow control support on ports with MLO_AN_FIXED auto negotiation

From: Russell King - ARM Linux admin <[email-masked]>
Date: Sun, 31 Jan 2021 12:19:50 +0000

On Sun, Jan 31, 2021 at 11:12:14AM +0000, Russell King - ARM Linux admin wrote:
> I discussed it with Andrew earlier last year, and his response was:
> 
>  DT configuration of pause for fixed link probably is sufficient. I don't
>  remember it ever been really discussed for DSA. It was a Melanox
>  discussion about limiting pause for the CPU. So I think it is safe to
>  not implement ethtool -A, at least until somebody has a real use case
>  for it.
> 
> So I chose not to support it - no point supporting features that people
> aren't using. If you have a "real use case" then it can be added.

This patch may be sufficient - I haven't fully considered all the
implications of changing this though.

 drivers/net/phy/phylink.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 7e0fdc17c8ee..2ee0d4dcf9a5 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -673,7 +673,6 @@ static void phylink_resolve(struct work_struct *w)
 		switch (pl->cur_link_an_mode) {
 		case MLO_AN_PHY:
 			link_state = pl->phy_state;
-			phylink_apply_manual_flow(pl, &link_state);
 			mac_config = link_state.link;
 			break;
 
@@ -698,11 +697,12 @@ static void phylink_resolve(struct work_struct *w)
 				link_state.pause = pl->phy_state.pause;
 				mac_config = true;
 			}
-			phylink_apply_manual_flow(pl, &link_state);
 			break;
 		}
 	}
 
+	phylink_apply_manual_flow(pl, &link_state);
+
 	if (mac_config) {
 		if (link_state.interface != pl->link_config.interface) {
 			/* The interface has changed, force the link down and
@@ -1639,9 +1639,6 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
 
 	ASSERT_RTNL();
 
-	if (pl->cur_link_an_mode == MLO_AN_FIXED)
-		return -EOPNOTSUPP;
-
 	if (!phylink_test(pl->supported, Pause) &&
 	    !phylink_test(pl->supported, Asym_Pause))
 		return -EOPNOTSUPP;
@@ -1684,7 +1681,7 @@ int phylink_ethtool_set_pauseparam(struct phylink *pl,
 	/* Update our in-band advertisement, triggering a renegotiation if
 	 * the advertisement changed.
 	 */
-	if (!pl->phydev)
+	if (!pl->phydev && pl->cur_link_an_mode != MLO_AN_FIXED)
 		phylink_change_inband_advert(pl);
 
 	mutex_unlock(&pl->state_mutex);

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!