[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260130040009.707764-1-kuba@kernel.org>
Date: Thu, 29 Jan 2026 20:00:09 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: maxime.chevallier@...tlin.com
Cc: Jakub Kicinski <kuba@...nel.org>,
daniel@...rotopia.org,
christophe.leroy@...roup.eu,
kabel@...nel.org,
kory.maincent@...tlin.com,
f.fainelli@...il.com,
vladimir.oltean@....com,
netdev@...r.kernel.org,
horms@...nel.org,
mwojtas@...omium.org,
o.rempel@...gutronix.de,
romain.gantois@...tlin.com,
herve.codina@...tlin.com,
dimitri.fedrau@...bherr.com,
hkallweit1@...il.com,
nicveronese@...il.com,
linux-kernel@...r.kernel.org,
edumazet@...gle.com,
pabeni@...hat.com,
thomas.petazzoni@...tlin.com,
andrew@...n.ch,
davem@...emloft.net,
linux@...linux.org.uk
Subject: Re: [net-next,v2,01/12] net: phy: phy_port: Correctly recompute the port's linkmodes
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
net: phy: phy_port: Correctly recompute the port's linkmodes
This patch changes phy_port_update_supported() from OR'ing medium-specific
modes into port->supported to AND'ing (filtering) port->supported against
the accumulated medium modes.
Fixes: 589e934d2735 ("net: phy: Introduce PHY ports representation")
> diff --git a/drivers/net/phy/phy_port.c b/drivers/net/phy/phy_port.c
> index ec93c8ca051e..68a0068220ed 100644
> --- a/drivers/net/phy/phy_port.c
> +++ b/drivers/net/phy/phy_port.c
> @@ -118,11 +118,14 @@ void phy_port_update_supported(struct phy_port *port)
> int i;
>
> for_each_set_bit(i, &port->mediums, __ETHTOOL_LINK_MEDIUM_LAST) {
> - linkmode_zero(supported);
> - phy_caps_medium_get_supported(supported, i, port->pairs);
> - linkmode_or(port->supported, port->supported, supported);
> + __ETHTOOL_DECLARE_LINK_MODE_MASK(med_supported) = {0};
> +
> + phy_caps_medium_get_supported(med_supported, i, port->pairs);
> + linkmode_or(supported, supported, med_supported);
> }
>
> + linkmode_and(port->supported, port->supported, supported);
When port->supported starts empty (all zeros), this AND operation will
always produce an empty result regardless of what modes are in supported.
Tracing the call path of_phy_ports() -> phy_of_parse_port() -> phy_add_port()
-> phy_port_update_supported(): phy_of_parse_port() creates the port via
phy_port_alloc() which zeros port->supported, and phy_of_parse_port()
only sets port->mediums and port->pairs without populating port->supported.
The attach_mdi_port() callbacks for drivers like dp83822 and marvell10g
also do not set port->supported before phy_port_update_supported() runs.
Does this leave port->supported empty for ports described in device tree?
The docstring above this function at line 112 states "Any mode that was
manually set in the port's supported list remains set" - but for the DT
path where port->supported starts at zero, the AND with zero produces
zero regardless of what medium modes were computed.
--
pw-bot: cr
Powered by blists - more mailing lists