Re: [PATCH net-next v19 4/6] net: dsa: mxl862xx: add devlink flash_update and info_get

From: Andrew Lunn

Date: Sun Oct 04 2026 - 10:49:21 EST


On Sat, Oct 03, 2026 at 04:52:37PM +0100, Daniel Golle wrote:
> Implement "devlink dev flash" for firmware upgrade and "devlink dev
> info" for version reporting. info reports the chip part number and
> revision as the asic.id and asic.rev fixed versions, and the firmware
> version as both the running and the stored version, since the switch
> boots its firmware from its own flash; a zero part number or an all-zero
> version is omitted rather than published as a bogus match for userspace.
>
> flash validates the image and its payload CRCs, reboots the switch into
> its MCUboot loader with SYS_MISC_FW_UPDATE, transfers the image over the
> SB PDI clause-22 SMDIO protocol, and reboots into the new firmware once
> the loader has verified it. For the duration the driver closes and
> detaches the user ports so userspace cannot reopen them, closes the
> conduit, and blocks firmware API access under the MDIO bus lock so
> nothing reaches the bus after the switch has left for MCUboot. A blocked
> write reports success, so a bridge tearing its ports down over a flash
> does not see port_vlan_del() fail and leak its VLAN group. A transfer
> that fails leaves the switch in the loader; the next patch recovers it
> from there.
>
> MCUboot offers no in-place path back, so the driver reinitialises with a
> deferred re-probe scheduled through device_schedule_reprobe() from the
> previous patch, which runs in the driver core off the devlink caller's
> locks and without pinning the driver module. ->shutdown() and
> .remove() take the devlink instance lock up front, since neither goes
> through devlink and dsa_unregister_switch() frees the user netdevs
> before devlink_unregister() would: this waits out a transfer in flight,
> for as long as the transfer's own timeouts allow, rather than cutting
> it in half, and refuses a flash that starts once teardown has begun. A
> flash is refused as well until the DSA tree has finished its setup,
> since devlink registers the switch before the core creates the user
> ports.
>
> Assisted-by: LLM
> Signed-off-by: Daniel Golle <daniel@xxxxxxxxxxxxxx>

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Andrew