From: "Russell King (Oracle)" <linux@armlinux.org.uk>
To: Alexander Duyck <alexander.duyck@gmail.com>
Cc: netdev@vger.kernel.org, andrew@lunn.ch, hkallweit1@gmail.com,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
maxime.chevallier@bootlin.com
Subject: Re: [net PATCH 1/2] net: phy: Cleanup handling of recent changes to phy_lookup_setting
Date: Thu, 3 Apr 2025 15:55:45 +0100 [thread overview]
Message-ID: <Z-6hcQGI8tgshtMP@shell.armlinux.org.uk> (raw)
In-Reply-To: <174354300640.26800.16674542763242575337.stgit@ahduyck-xeon-server.home.arpa>
On Tue, Apr 01, 2025 at 02:30:06PM -0700, Alexander Duyck wrote:
> From: Alexander Duyck <alexanderduyck@fb.com>
>
> The blamed commit introduced an issue where it was limiting the link
> configuration so that we couldn't use fixed-link mode for any settings
> other than twisted pair modes 10G or less. As a result this was causing the
> driver to lose any advertised/lp_advertised/supported modes when setup as a
> fixed link.
>
> To correct this we can add a check to identify if the user is in fact
> enabling a TP mode and then apply the mask to select only 1 of each speed
> for twisted pair instead of applying this before we know the number of bits
> set.
>
> Fixes: de7d3f87be3c ("net: phylink: Use phy_caps_lookup for fixed-link configuration")
> Signed-off-by: Alexander Duyck <alexanderduyck@fb.com>
> ---
> drivers/net/phy/phylink.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 16a1f31f0091..380e51c5bdaa 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -713,17 +713,24 @@ static int phylink_parse_fixedlink(struct phylink *pl,
> phylink_warn(pl, "fixed link specifies half duplex for %dMbps link?\n",
> pl->link_config.speed);
>
> - linkmode_zero(pl->supported);
> - phylink_fill_fixedlink_supported(pl->supported);
> -
> + linkmode_fill(pl->supported);
> linkmode_copy(pl->link_config.advertising, pl->supported);
> phylink_validate(pl, pl->supported, &pl->link_config);
>
> c = phy_caps_lookup(pl->link_config.speed, pl->link_config.duplex,
> pl->supported, true);
> - if (c)
> + if (c) {
> linkmode_and(match, pl->supported, c->linkmodes);
>
> + /* Compatbility with the legacy behaviour:
> + * Report one single BaseT mode.
> + */
> + phylink_fill_fixedlink_supported(mask);
> + if (linkmode_intersects(match, mask))
> + linkmode_and(match, match, mask);
> + linkmode_zero(mask);
> + }
> +
I'm still wondering about the wiseness of exposing more than one link
mode for something that's supposed to be fixed-link.
For gigabit fixed links, even if we have:
phy-mode = "1000base-x";
speed = <1000>;
full-duplex;
in DT, we still state to ethtool:
Supported link modes: 1000baseT/Full
Advertised link modes: 1000baseT/Full
Link partner advertised link modes: 1000baseT/Full
Link partner advertised auto-negotiation: No
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
despite it being a 1000base-X link. This is perfectly reasonable,
because of the origins of fixed-links - these existed as a software
emulated baseT PHY no matter what the underlying link was.
So, is getting the right link mode for the underlying link important
for fixed-links? I don't think it is. Does it make sense to publish
multiple link modes for a fixed-link? I don't think it does, because
if multiple link modes are published, it means that it isn't fixed.
As for arguments about the number of lanes, that's a property of the
PHY_INTERFACE_MODE_xxx. There's a long history of this, e.g. MII/RMII
is effectively a very early illustration of reducing the number of
lanes, yet we don't have separate link modes for these.
So, I'm still uneasy about this approach.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
next prev parent reply other threads:[~2025-04-03 14:55 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 21:29 [net PATCH 0/2] Fixes for net/phy/phylink.c Alexander Duyck
2025-04-01 21:30 ` [net PATCH 1/2] net: phy: Cleanup handling of recent changes to phy_lookup_setting Alexander Duyck
2025-04-02 7:00 ` Maxime Chevallier
2025-04-02 14:21 ` Alexander H Duyck
2025-04-02 17:17 ` Jakub Kicinski
2025-04-02 17:30 ` Russell King (Oracle)
2025-04-02 22:37 ` Alexander Duyck
2025-04-03 14:55 ` Russell King (Oracle) [this message]
2025-04-03 15:29 ` Maxime Chevallier
2025-04-03 16:34 ` Andrew Lunn
2025-04-03 21:53 ` Alexander Duyck
2025-04-03 23:19 ` Russell King (Oracle)
2025-04-04 15:56 ` Alexander Duyck
2025-04-04 16:33 ` Andrew Lunn
2025-04-04 22:46 ` Alexander Duyck
2025-04-05 9:43 ` Russell King (Oracle)
2025-04-05 14:51 ` Andrew Lunn
2025-04-05 20:41 ` Alexander Duyck
2025-04-05 20:53 ` Andrew Lunn
2025-04-05 9:10 ` Russell King (Oracle)
2025-04-05 15:43 ` Andrew Lunn
2025-04-05 15:52 ` Andrew Lunn
2025-04-05 16:19 ` Alexander Duyck
2025-04-05 20:23 ` Alexander Duyck
2025-04-03 23:26 ` Russell King (Oracle)
2025-04-04 1:46 ` Andrew Lunn
2025-04-04 7:16 ` Russell King (Oracle)
2025-04-04 16:18 ` Alexander Duyck
2025-04-07 17:01 ` Jakub Kicinski
2025-04-07 18:20 ` Alexander Duyck
2025-04-07 19:34 ` Andrew Lunn
2025-04-07 23:01 ` Alexander Duyck
2025-04-01 21:30 ` [net PATCH 2/2] net: phylink: Set advertising based on phy_lookup_setting in ksettings_set Alexander Duyck
2025-04-02 18:02 ` Russell King (Oracle)
2025-04-02 22:34 ` Alexander Duyck
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=Z-6hcQGI8tgshtMP@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=alexander.duyck@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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).