Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: maxime.chevallier@bootlin.com
Cc: davem@davemloft.net, andrew+netdev@lunn.ch, kuba@kernel.org,
	edumazet@kernel.org, willemb@google.com, pabeni@redhat.com,
	linux@armlinux.org.uk, kabel@kernel.org,
	sebastian.hesselbarth@gmail.com, gregory.clement@bootlin.com,
	hkallweit1@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	thomas.petazzoni@bootlin.com, devicetree@vger.kernel.org,
	conor+dt@kernel.org, krzk+dt@kernel.org, robh@kernel.org,
	christophe.leroy@csgroup.eu, herve.codina@bootlin.com,
	f.fainelli@gmail.com, vladimir.oltean@nxp.com,
	kory.maincent@bootlin.com, o.rempel@pengutronix.de,
	nicveronese@gmail.com, horms@kernel.org,
	marcin.s.wojtas@gmail.com, daniel@makrotopia.org,
	dimitri.fedrau@liebherr.com, frank.wunderlich@linux.dev,
	p.ameruoso@live.it, f@lex.la
Subject: Re: [PATCH net-next 12/12] ARM: dts: turris-omnia: Describe the WAN port multiplexer
Date: Sat, 05 Dec 2026 12:18:41 +0000	[thread overview]
Message-ID: <179647312185.3146.15300730201608877367@kernel.org> (raw)
In-Reply-To: <20261204110622.1106492-13-maxime.chevallier@bootlin.com>

Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.

Critical: 0 · High: 1 · Medium: 2 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [High] This DTS removes `sfp = <&sfp>` from &eth2 and adds `mii-mux-
  handle = <&wan_mux>`.
- [Medium] The patch deletes the DTS comment describing the U-Boot fixup
  but does not make the DT robust against that fixup.
- [Medium] ARM: dts: turris-omnia: wan_mux breaks mvneta_mdio_probe() WoL
  and speed_up
- [Low] The commit message says "The sfp node is always enabled, and we
  follow the module at runtime." That is only partly true.

--

ARM: dts: turris-omnia: Describe the WAN port multiplexer

This commit describes the Turris Omnia WAN port mux (NXP CBTL02042A)
with the new mii-mux-auto binding. The sfp node is now always enabled.
The sfp reference moves from eth2 to port@0 of the mux, and eth2 gets a
mii-mux-handle.

> Now that we have a binding for these muxes, let's describe that one. The
> sfp node is always enabled, and we follow the module at runtime.

[Severity: Low]
Is "we follow the module at runtime" fully accurate?

The earlier commit in this series, "net: phylink: Support an SFP cage
behind a phy_mux", notes that phylink only reports modules it has
accepted to the mux, in phylink_sfp_set_present():

	pl->sfp_mod_present = present;
	if (pl->mux_sfp_port)
		phy_mux_port_set_available(pl->mux_sfp_port, present);

The CBTL02042A switches to the cage for any inserted module, though.
Suppose an unsupported module is plugged in. Wouldn't the mux keep port@1
(the 88E1514) selected while the MAC SerDes is physically wired to the
cage? Link state would then come from a PHY that is no longer in the data
path.

Could the commit message mention this limitation? This is the commit that
turns the behaviour on for real hardware.

> diff --git a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> index 83fe00abd6523..0501686e26427 100644
> --- a/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> +++ b/arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts
> @@ -103,13 +103,24 @@ sfp: sfp {
>  		los-gpios = <&pcawan 3 GPIO_ACTIVE_HIGH>;
>  		mod-def0-gpios = <&pcawan 4 GPIO_ACTIVE_LOW>;
>  		maximum-power-milliwatt = <3000>;
> +	};
>  
> -		/*
> -		 * For now this has to be enabled at boot time by U-Boot when
> -		 * a SFP module is present. Read more in the comment in the
> -		 * eth2 node below.
> -		 */
> -		status = "disabled";
> +	wan_mux: mii-mux {
> +		compatible = "mii-mux-auto";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		port@0 {
> +			reg = <0>;
> +			sfp = <&sfp>;
> +			takes-precedence;
> +		};

[ ... ]

> @@ -199,16 +210,12 @@ &eth2 {
>  	 * eth2 is connected via a multiplexor to both the SFP cage and to
>  	 * ethernet-phy@1. The multiplexor switches the signal to SFP cage when
>  	 * a SFP module is present, as determined by the mode-def0 GPIO.
> -	 *
> -	 * Until kernel supports this configuration properly, in case SFP module
> -	 * is present, U-Boot has to enable the sfp node above, remove phy
> -	 * handle and add managed = "in-band-status" property.
>  	 */

[Severity: Medium]
Is the new DT robust against the U-Boot fixup that this comment described?

According to the removed text, U-Boot does the following when a module is
present at boot:

- enables the sfp node
- removes eth2's phy-handle
- adds managed = "in-band-status"

U-Boot builds that are already deployed will keep doing this. This patch
also drops sfp = <&sfp> from eth2, which is what made that fixup work.

Now take a kernel without mux support (CONFIG_PHY_MUX=n, or an older
kernel booted with this DTB). phylink_attach_mux() returns early:

	if (pl->mux || !IS_ENABLED(CONFIG_PHY_MUX))
		return 0;

fwnode_get_phy_node() then finds no phy-handle, because U-Boot deleted it.
phylink_register_mux_sfp() finds no SFP either, because eth2 no longer has
an sfp property.

Doesn't eth2 then end up with neither a PHY nor an SFP upstream? By that
point the analog switch has already routed comphy5 to the cage, and the
sfp driver holds TX_DISABLE asserted. That is the boot-with-module case
that worked before this patch.

On a mux-capable kernel, the injected managed = "in-band-status" leaves
eth2 in MLO_AN_INBAND for the whole uptime. If the module is removed
later, the 88E1514 path runs with a different MAC AN mode than it would
after a boot without a module.

Is it intended that the AN mode depends on whether a module was present at
boot, rather than on the selected mux port?

>  	status = "okay";
>  	phy-mode = "sgmii";
>  	phy-handle = <&phy1>;
> +	mii-mux-handle = <&wan_mux>;
>  	phys = <&comphy5 2>;
> -	sfp = <&sfp>;

[Severity: Medium]
Does mvneta cope with the deferred PHY attachment this enables on eth2?

With PHY_MUX and MII_MUX_AUTO enabled, the phylink phy_mux support
earlier in this series leaves pl->phydev NULL after
phylink_fwnode_phy_connect() for a MAC with a mii-mux-handle. The PHY
only shows up once the mux state machine selects a port, which happens
asynchronously after phylink_start().

mvneta_open() calls mvneta_mdio_probe() before mvneta_start_dev(), and
mvneta_mdio_probe() queries WoL right after connecting:

	phylink_ethtool_get_wol(pp->phylink, &wol);
	device_set_wakeup_capable(&pp->dev->dev, !!wol.supported);

mvneta_phylink_ops has no mac_wol_set, so phylink_ethtool_get_wol()
only consults pl->phydev, and that is still NULL at this point.
wol.supported stays 0 and dev->power.can_wakeup is cleared, even
though the 88E1514 behind port@1 supports WoL through
m88e1318_get_wol() and m88e1318_set_wol().

Nothing sets can_wakeup again once phy_mux_state_machine() selects
port@1. A later WoL request reaches mvneta_ethtool_set_wol(), where
phylink_ethtool_set_wol() can now succeed on the attached PHY.
However, device_set_wakeup_enable() fails with -EINVAL in
device_wakeup_enable() because can_wakeup is false, and
mvneta_ethtool_set_wol() ignores that return value. The PHY ends up
armed for WoL, but device_may_wakeup() stays false, so
mvneta_stop_dev() never calls phylink_speed_down().

mvneta_start_dev() has the same ordering problem:

	phylink_start(pp->phylink);

	/* We may have called phylink_speed_down before */
	phylink_speed_up(pp->phylink);

phy_mux_start() only queues mux->state_work through phy_mux_trigger(),
so pl->phydev is still NULL when phylink_speed_up() runs, and the call
does nothing. Suppose can_wakeup were fixed on its own. Wouldn't the
PHY then stay at whatever speed phylink_speed_down() picked, even after
the next interface up?

This patch is the one that puts a mii-mux-handle on an mvneta port, so
this is where the regression becomes visible. Should mvneta
re-evaluate its wakeup capability, and redo the speed_up, once the mux
attaches a PHY? Or should phylink give MAC drivers a hook when the
selected PHY changes? Either way, it seems that needs to land before or
together with this DT change.

[Severity: High]
Can removing sfp = <&sfp> break the WAN port on kernels built without
CONFIG_PHY_MUX?

Without it, the cage is only reachable through the mux port. PHY_MUX is a
bool with no default, and MII_MUX_AUTO only exists under it.
mvebu_v7_defconfig and multi_v7_defconfig both build this board with
MVNETA and SFP, but neither enables these options.

With PHY_MUX=n, the stub in include/linux/phy_mux.h returns NULL:

fwnode_phy_mux_find_sfp_port(const struct fwnode_handle *fwnode)
{
	return NULL;
}

so phylink_register_mux_sfp() falls back to eth2's own node:

	if (!sfp_fwnode)
		return phylink_register_sfp(pl, fwnode);

That fallback looks for an sfp property on eth2, and this patch removed
it. Because the sfp node is now always enabled, sfp_probe() still binds
and keeps TX_DISABLE asserted:

	sfp->state = sfp_get_state(sfp) | SFP_F_TX_DISABLE;

No upstream ever attaches, so SFP modules on the WAN port would stop
working. Before this patch, a module present at boot worked: U-Boot
enabled the sfp node and eth2 had sfp = <&sfp>. Older kernels booted with
this DTB hit the same problem.

A second case: PHY_MUX=y, but the mii-mux-auto driver is not bound when
the interface is opened (MII_MUX_AUTO=n, module not loaded yet, or a
failed probe). What happens then?

fwnode_phy_mux_attach() returns its initial -EPROBE_DEFER when no
registered mux matches. phylink_attach_mux() converts that:

	return ret == -EPROBE_DEFER ? -ENODEV : ret;

phylink_fwnode_phy_connect() returns that error before it tries eth2's
phy-handle:

	ret = phylink_attach_mux(pl, fwnode, flags);
	if (ret)
		return ret;

So mvneta_open()->mvneta_mdio_probe()->phylink_of_phy_connect()->
phylink_fwnode_phy_connect() fails, and mvneta_open() bails out:

	ret = mvneta_mdio_probe(pp);
	if (ret < 0) {
		netdev_err(dev, "cannot probe MDIO bus\n");
		goto err_free_dead_hp;

Wouldn't the WAN interface then fail to open at all, copper included?
Nothing retries after -ENODEV.

Would keeping sfp = <&sfp> on eth2 avoid the non-mux regression?
phylink_register_mux_sfp() prefers the mux's SFP port when one is found,
so the property should be harmless on mux-capable kernels.

Should the defconfigs also enable PHY_MUX and MII_MUX_AUTO?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204110622.1106492-1-maxime.chevallier%40bootlin.com


      reply	other threads:[~2026-12-05 12:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 11:06 [PATCH net-next 00/12] net: phy: Introduce MII multiplexers Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 01/12] dt-bindings: net: Add Ethernet " Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 02/12] net: phy: Introduce phy_mux, a MII multiplexer representation Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 03/12] net: phy: Don't create the sysfs links for PHYs behind a mux Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 04/12] net: phy: phy_mux: Allow attaching a mux to a net_device Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 05/12] net: phy: phy_mux: Add port selection logic Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 06/12] net: phy: phy_mux: Support SFP cage ports Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 07/12] net: phylink: Factor out phylink_clear_phydev() Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 08/12] net: phy: phy_mux: Add phy_mux_set_mac_managed_pm() Maxime Chevallier
2026-12-04 11:06 ` [PATCH net-next 09/12] net: phylink: Support PHYs reached through a phy_mux Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 10/12] net: phylink: Support an SFP cage behind " Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 11/12] net: phy: mux: Add the mii-mux-auto driver Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko
2026-12-04 11:06 ` [PATCH net-next 12/12] ARM: dts: turris-omnia: Describe the WAN port multiplexer Maxime Chevallier
2026-12-05 12:18   ` netdev-bot+sashiko [this message]

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=179647312185.3146.15300730201608877367@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=christophe.leroy@csgroup.eu \
    --cc=conor+dt@kernel.org \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dimitri.fedrau@liebherr.com \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=f@lex.la \
    --cc=frank.wunderlich@linux.dev \
    --cc=gregory.clement@bootlin.com \
    --cc=herve.codina@bootlin.com \
    --cc=hkallweit1@gmail.com \
    --cc=horms@kernel.org \
    --cc=kabel@kernel.org \
    --cc=kory.maincent@bootlin.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marcin.s.wojtas@gmail.com \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicveronese@gmail.com \
    --cc=o.rempel@pengutronix.de \
    --cc=p.ameruoso@live.it \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemb@google.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