Re: [PATCH net-next v9 2/3] net: macb: implement ethtool_ops.get|set_channels()
From: Nicolai Buchwitz
Date: Sat Nov 28 2026 - 07:53:00 EST
Hi Théo
[...]
@@ -3405,16 +3427,28 @@ 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.
+ */
- old_ctx = bp->ctx;
- WRITE_ONCE(bp->ctx, new_ctx);
- wmb(); /* ensure IRQ enabled below read the new context */
- macb_init_buffers(bp);
+ if (new_ctx) {
+ old_ctx = bp->ctx;
+ WRITE_ONCE(bp->ctx, new_ctx);
+ wmb(); /* ensure IRQ enabled below read the new context */
+
+ macb_init_buffers(bp);
+
+ /* Clear DQL (only on successful context swap). */
+ for (q = 0; q < bp->max_num_queues; ++q)
+ netdev_tx_reset_queue(netdev_get_tx_queue(bp->netdev,
+ q));
+ } else {
+ gem_shuffle_tx_rings(bp);
+ }
Under load the frame at txq->tail can already be sent, so index 0
has TX_USED after the shuffle. Doesn't Tx stall there?
Maybe reclaim completed frames before the shuffle?
[...]
Thanks,
Nicolai