๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27378

Re: [PATCH net-next 12/12] ARM: dts: turris-omnia: Describe the WAN port multiplexer

#27378
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 12:18
252 lines
18261 bytes
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
Technical Details
Message-ID: <179647312185.3146.15300730201608877367@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377983-linux-kernel-netdev=dewy.ru
References: <20261204110622.1106492-13-maxime.chevallier@bootlin.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377983-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179647312185.3146.15300730201608877367@kernel.org>
References: <20261204110622.1106492-13-maxime.chevallier@bootlin.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3023417"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ueuFrpyhIcjcNG62kRUzUYjrhmI= sha256:HtyS+mVy7fS3IF1u5Q9vv1StkAfihudrx3Qy9cqolQo=
	sha1:1sUdQrdWhHlPqqQWKELFVAif9Vc= sha256:BunUuOVChIRGvUqerA9Wgdt6kNoo6I24npqB8pINl1Q=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id B0C7C117E1C; Sat,  5 Dec 2026 15:19:41 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.639
X-Spam-Status: No, score=-3.639 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.14, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id w4f0t6TRhs3r;
	Sat,  5 Dec 2026 15:19:38 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377983-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5847E117E17; Sat,  5 Dec 2026 15:19:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 226272CC69; Sat,  5 Dec 2026 12:19:14 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796473130;
	b=PNgkFHRNNXd29ZMpfgLV07N3S5tdzQEGrvcIKcXiHtibDT6SJ06zu2vgJJFGpNupGWq3
	 qXZfpk1GosloNKk0GKGyEeqhVgDkRXekynAvBZCYPONfBgFPTWXueuQzDMIT+97L254hH
	 +cL3L1EYTmxOArUnhRviYM1jwdH7M5sMaScuhpdy+lVMMmDv4gMc5AIMZWyJVL0/c6tsR
	 ajqdQp/O7Y8R/CL+IZaHVnyMNaGE/yF2OK6YIbpge9tG5xk5TNhoKTfKN4TmyoNKuGSnn
	 ndAb3GpoxuvnxEUTMk9kwIsXQqY3QBWmibzzumQylK0ESc1iBNLlUErld80XyAzgbew==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796473130;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=s03rAisyimu6KIZv/5ucW0Z25EQVUuAtsAfpLcUDCuI=;
	b=OVK03lV9ausnWvVD0ia1GiT/XnYW4DfrnHL5vaoVga/6r3jA19M+npSqiixPnmv2Iysw
	 GfBrh9Hm7kaAfvxiqw3u35xg4vSLP+igwKcpkOjXK4xt1HQHXAopeorwioMJPUwRDzUiF
	 38o62cCvGFa9Tj+94DgSyytxO3qeEO2wll8xigeWhtu3S1+6lreMLTH5qISI7p+zY4ACx
	 wc+qDUL3EQyh4UiM5DdowbxWEZXvvD+SoCj3EeL46PIpVlehAjH6WLBpq9+jwAXYEJwQN
	 KxomwVEu9cR1PZdBsx2Zdg4jl0KDlC8auaGdA5Rk+hYXTM/7LpgSRkhgWwy/+0JfRmQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=abmGMjTX;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C59660A2603;
	Sat,  5 Dec 2026 12:18:50 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=abmGMjTX
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796473124;
	b=juau4HULArQrU631DBmdKby89S6858GX7Bp7LsjCMlzez5KtekQcVy/OSSb5YjOJLw0q
	 eEUBGLYQxNlzWrkKScqFrxc4BtoYtwlDz2B3K4vP43OgvOioT4WYVoGTKQXAW/wJ8pg3s
	 Fqj/4mrWJI+3NAn8B30wUeDJ7s735RY6+gOqcE+Mp8cNYkrOaLgyZIXVyX2w0G0Wol7uu
	 ZtYFAV1eIt/bdGr69qFMNZgumGOeNMMKQ+vrSeVwz7hWKIysRifeYGOUlESX5Um4eDecl
	 T+i391I5XbAyd4A/fRQW0RmysQnbutzDSt3NnlhBv87wUhU3nLp0j77M41u+D4HjStA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796473124;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=s03rAisyimu6KIZv/5ucW0Z25EQVUuAtsAfpLcUDCuI=;
	b=j73tTS/opB4yF+2qZem/BhPdUDmpENs87auNJOaFG2bPRRlRue+c0o6iahXwqCbyXj83
	 8ffnryMeLL6+taREJiurpajGqvjhgVxczdEMAyl/mUjwmb6On+PyhHfm7MWJ5q0hPlUJu
	 Wj7dYu8KV3g2Wmzk65DazDIXRnQAMvkOn2WpfTl0LpG3ddtxUggsiWll1fECw/yk5QZJs
	 wAJ6IloQU9GRuAu+ixA+gOT/4nLPTK0W59eof6HVQ879j2Y5PyCdBRz+tcbtY4qN8hEFO
	 yxw115CBZyVho0hpXHWKLuyaFGdKkpK4NkwDKdoK3CO6glY2B5AHIkk3UkWmJRp9Bzg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=abmGMjTX;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D58C60A3804;
	Sat,  5 Dec 2026 12:18:44 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FF321F00A10;
	Sat,  5 Dec 2026 12:18:42 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796473124;
	bh=s03rAisyimu6KIZv/5ucW0Z25EQVUuAtsAfpLcUDCuI=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=abmGMjTXejntRomDqtz5IxopTuoTt0LSHKFgKCHdD/MsNpn59NIrvbOe2otQiMPn0
	 HV/56+aYN6GzUJyroA/ddB8EXByUB5ZcA3PeTh8b1oc1LzOepUuwmnsB1anUXXqi3M
	 CwGke63ub0GX2oSU+6q9IICy1o2Dhw+Mdf8UcsNnN7bGAKg0Whoe8AQ3220BiO5Bt0
	 /6AlUahCJf1Wzlf23rFQLizbwb1ihAtBLxflqOsElemhWKyx8xFRQ734SDGfcrkQb0
	 F1oTNEMmyh3giBdJTxN0zCZxujphkt3h1AYjSD7lTSOqRiJQW2Cdi5nY5sht5GabjQ
	 cLxTCzdoGXTpw==
X-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
X-In-Reply-To: <20261204110622.1106492-13-maxime.chevallier@bootlin.com>
X-sashiko-severity: High
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list