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

From: Théo Lebrun

Date: Thu Nov 19 2026 - 11:20:14 EST


On Thu Nov 19, 2026 at 12:54 PM CET, Nicolai Buchwitz wrote:
> On 18.11.2026 21:53, Théo Lebrun wrote:
>> + 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->ctx->num_queues; ++q)
>> + netdev_tx_reset_queue(netdev_get_tx_queue(bp->netdev,
>> + q));
>> + }
>
> The queues we just dropped never get their BQL reset, not on close or
> open either. So after shrinking and growing again they can stay stuck.

Good catch.

> Maybe just reset all max_num_queues here and in macb_close()?

That's the safe solution, agreed.

>> + ret = netif_set_real_num_queues(bp->netdev, num_queues, num_queues);
>> + if (ret) {
>> + if (running) {
>> + macb_free(new_ctx);
>> + kfree(new_ctx);
>> + macb_context_swap_end(bp, NULL);
>
> swap_start() cleared TE, so HW is back at the ring start. Doesn't this
> needs a gem_shuffle_tx_rings() like link_up does, otherwise Tx stalls?

Argh! I had missed (or forgotten) this implicit behavior when clearing
the TE bit of NCR. Yes gem_shuffle_tx_rings() is meant for that.

Thanks,

--
Théo Lebrun, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com