Re: [PATCH net-next v5 7/8] net: bcmgenet: allow the MTU to be changed

From: Nicolai Buchwitz

Date: Sat Oct 17 2026 - 02:26:49 EST


On 17.10.2026 03:24, Jakub Kicinski wrote:
On Tue, 13 Oct 2026 16:20:36 +0200 Nicolai Buchwitz wrote:
+ ret = bcmgenet_init_dma(priv, true);
+ if (ret) {
+ /* Retry the size that was allocated a moment ago */
+ WRITE_ONCE(dev->mtu, old_mtu);
+ priv->rx_buf_len = bcmgenet_rx_buf_len(old_mtu);
+ bcmgenet_set_mtu_regs(priv, old_mtu);
+ if (bcmgenet_init_dma(priv, true)) {

This will fail under memory pressure leaving the device inoperable.

Aye, I'll allocate the new rings before freeing the old ones, then a
failed MTU change just returns -ENOMEM and the rollback can go.


+ priv->datapath_up = true;

Hallmark of a bad design

Agreed, and redundant anyway once fini_dma() NULLs rx_cbs/tx_cbs. I have
a net series for that, on which I will rebuild this patch.

Thanks,
Nicolai