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

From: netdev-bot+sashiko

Date: Thu Nov 26 2026 - 11:45:30 EST


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

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

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] In macb_mac_link_up()
(drivers/net/ethernet/cadence/macb_main.c), when the link comes back…

--

net: macb: cache ENST config across link down/up

The macb driver now keeps the ENST (taprio offload) config in bp->enst
and writes it again on every link-up. If the link speed has changed, the
cached config is dropped with a warning. The commit also caches the link
speed in bp->speed_mbps, serialises the taprio paths with
bp->mac_cfg_lock, and removes the pm_runtime_suspended() check.

> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 9f6111661b40d..1e06666921160 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c

[ ... ]

> @@ -1009,6 +1048,15 @@ static void macb_mac_link_up(struct phylink_config *config,
>
> spin_unlock_irqrestore(&bp->lock, flags);
>
> + if (bp->enst.speed_mbps && speed != bp->enst.speed_mbps) {
> + netdev_warn(bp->netdev,
> + "TAPRIO dropped because link speed changed\n");
> +
> + memset(&bp->enst, 0, sizeof(bp->enst));
> + }
> +
> + macb_apply_enst_config(bp);
> +

[Severity: Medium]
After the link comes back at a different speed, the cache is zeroed.
macb_apply_enst_config() then sets the disable bits for every queue and
writes 0 to the per-queue timing registers. ENST_CONTROL is not enabled
again, because of this check:

if (bp->enst.queue_mask)
gem_writel(bp, ENST_CONTROL, bp->enst.queue_mask);

>From then on the MAC applies no gate control at all. Only a netdev_warn()
reports this.

Does the taprio qdisc still report a fully offloaded schedule in this
state? netdev->num_tc and tc_to_txq are left as they were, since only
macb_taprio_destroy() calls netdev_reset_tc(). In offload mode the taprio
core does not call ndo_setup_tc again on link changes, so nothing
reprograms the hardware.

Can the schedule ever come back without the user reinstalling the qdisc?
struct macb_enst stores only on/off times already converted to bytes for
one speed:

config.queues[queue_id].on_time_bytes =
enst_ns_to_hw_units(entry->interval, bp->speed_mbps);
config.queues[queue_id].off_time_bytes =
enst_ns_to_hw_units(off, bp->speed_mbps);

macb_taprio_setup_replace() discards the nanosecond intervals from
tc_taprio_qopt_offload. Because of that, macb_mac_link_up() cannot
recompute or re-check the schedule for the new speed. It also cannot
restore it if the link later comes back at the original speed, for
example after a temporary PHY downshift or a cable swap.

Would it work to keep the ns intervals in bp->enst, then re-validate and
recompute the byte values on each link-up? The schedule would then
survive whenever it still fits the new speed.

> if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC)) {
> macb_set_tx_clk(bp, speed);
> gem_shuffle_tx_rings(bp);

[ ... ]

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261124-macb-set-channels-v8-0-770cf8e50e6d%40bootlin.com