Re: [PATCH net-next v6 1/2] net: macb: implement ethtool_ops.get|set_channels()

From: Nicolai Buchwitz

Date: Sun Nov 15 2026 - 14:39:43 EST


Hi Théo

On 13.11.2026 18:32, Théo Lebrun wrote:

[...]

@@ -3351,16 +3374,21 @@ static void macb_context_swap_end(struct macb *bp,

lockdep_assert_held(&bp->mac_cfg_lock);

- /* Swap contexts & give buffer pointers to HW. */
+ /* Swap contexts & give buffer pointers to HW.
+ * !new_ctx means that the swap failed and we keep the old context.
+ */
+
+ if (new_ctx) {
+ old_ctx = bp->ctx;
+ WRITE_ONCE(bp->ctx, new_ctx);
+ wmb(); /* ensure IRQ enabled below read the new context */
+ }

- old_ctx = bp->ctx;
- WRITE_ONCE(bp->ctx, new_ctx);
- wmb(); /* ensure IRQ enabled below read the new context */
macb_init_buffers(bp);

The NULL case reuses the old rings without mog_init_rings(). The HW
restarts at descriptor 0 but head/tail don't, so Tx stalls after a
failed ethtool -L? macb_hresp_error_task() reinits the rings first.

[...]

Regards,
Nicolai