Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: netdev-bot+sashiko@kernel.org
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 06/12] net: phy: phy_mux: Support SFP cage ports
Date: Sun, 6 Dec 2026 15:46:57 +0100	[thread overview]
Message-ID: <82e368d2-d19f-4045-a748-40e5f093192a@bootlin.com> (raw)
In-Reply-To: <179647311238.3146.3730324098600663207@kernel.org>



On 12/5/26 13:18, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 5 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 2 · Low: 3
> 
> 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).
> 
> - [Medium] When a port switch fails, nothing is selected and the mux core
>   never retries.
> - [Medium] net: phy: phy_mux_detach() races with unregister, free, and
>   attach
> - [Low] This patch changes phy_mux_start() from synchronous to deferred
>   selection without saying so.
> - [Low] In include/linux/phy_mux.h, the kernel-doc for struct
>   phy_mux_port::interface says "The MII mode the link runs in when this…
> - [Low] net: phy: commit message overstates auto-mux scope and omits
>   design



> [Severity: Medium]
> What happens when the switch to the new port fails?
> 
> phy_mux_state_machine() and phy_mux_port_set_available() both ignore the
> return value of phy_mux_select(). phy_mux_select() deselects the old port
> before it tries the new one, and nothing is rolled back:
> 
> phy_mux_select() {
>     ...
> 	if (mux->current_port) {
> 		__phy_mux_deselect_port(mux, mux->current_port);
> 		mux->current_port = NULL;
> 	}
>     ...
> 	ret = __phy_mux_select_port(mux, port);
> 	if (ret)
> 		return ret;
>     ...
> }
> 
> For a PHY port, __phy_mux_deselect_port() also calls phy_suspend()
> through phy_mux_phy_power_down() and clears netdev->phydev.
> 
> The phylink parent added later in this series makes the switch back to
> copper after an SFP module removal reachable:
> 
> phylink_sfp_module_remove()
>   phy_mux_port_set_available(sfp, false)
>     phy_mux_trigger()
>       phy_mux_state_machine()
>         phy_mux_select()
>           __phy_mux_deselect_port(SFP)
>           __phy_mux_select_port(PHY)
>             phylink_mux_select()
>               phylink_bringup_phy()
> 
> phylink_bringup_phy() can fail in phylink_validate_phy(). It can also
> fail when phy_eee_rx_clock_stop() hits an MDIO error, or return -EBUSY if
> pl->phydev is still set.
> 
> A PHY port's available flag is set once in phy_mux_register_port() and
> never changes. A repeated phy_mux_port_set_available() call with the same
> value returns early.
> 
> Can this leave current_port NULL, with no port selected while the copper
> cable is still connected, and nothing retrying until ifdown/ifup or the
> next SFP event? Should the error at least be logged, or should
> phy_mux_choose_port() fall back to another available port?
> 
> Before this patch, phy_mux_select() was only called with current_port
> NULL from phy_mux_start(), or with port NULL from phy_mux_stop(). A
> deselect followed by a failed select could not happen then.

For now the only kind of switch supported forces the switch to SFP regardless
of what is inserted. If the module inserted is incompatible then yeah nothing
works, nothing we can do here.

Proper error handling for this will come with user-configurable muxes, where it
will be necessary

Maxime


  reply	other threads:[~2026-12-06 14:47 UTC|newest]

Thread overview: 27+ 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-06 14:30     ` Maxime Chevallier
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-06 14:37     ` Maxime Chevallier
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-06 14:43     ` Maxime Chevallier
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-06 14:46     ` Maxime Chevallier [this message]
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-06 14:49     ` Maxime Chevallier
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

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=82e368d2-d19f-4045-a748-40e5f093192a@bootlin.com \
    --to=maxime.chevallier@bootlin.com \
    --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=netdev-bot+sashiko@kernel.org \
    --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