Re: [PATCH net-next v7 1/3] net: macb: cache ENST config across link down/up

From: Nicolai Buchwitz

Date: Thu Nov 19 2026 - 06:50:22 EST


On 18.11.2026 21:53, Théo Lebrun wrote:
Currently, ENST is not explicitly restored across interface close/open.
If HW keeps its register state then ENST is kept, otherwise it is lost;
but we do not write the ENST schedule again on open.

This causes trouble if the config is not compatible with the new open
and link-up. The two issues that can occur are a link speed change (as
all timings are configured in a unit relative to the link speed) or a
change in the # of queues.

The latter is the main reason we do this change before implementing
ethtool -L support.

If on link-up, the cached ENST config is invalid (link speed changed),
then we drop the cached config, log a warning and explicitly override
all ENST timings previously configured in the registers. If it is
valid, we explicitly re-apply it.

Take this opportunity to replace a kmalloc in
macb_taprio_setup_replace() with a simple and tiny (104b) stack value.

Drop the old hack of checking for pm_runtime_suspended(), which has
little value because we could race with the runtime_suspend() call.

Synchronise our config using the existing bp->mac_cfg_lock mutex, taken
by macb_taprio_setup_replace() and macb_taprio_destroy(). To avoid an
ABBA deadlock between bp->mac_cfg_lock and phydev->lock taken by
phylink_ethtool_ksettings_get(), cache the link speed as bp->speed_mbps.

Signed-off-by: Théo Lebrun <theo.lebrun@xxxxxxxxxxx>

[...]

Reviewed-by: Nicolai Buchwitz <nb@xxxxxxxxxxx>