From: Nicolai Buchwitz <nb@tipi-net.de>
To: netdev-bot+sashiko@kernel.org
Cc: opendmb@gmail.com, florian.fainelli@broadcom.com,
bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com,
justin.chen@broadcom.com, pierremarinleclercq88@gmail.com,
f.fainelli@gmail.com
Subject: Re: [PATCH net-next v5 7/8] net: bcmgenet: allow the MTU to be changed
Date: Thu, 15 Oct 2026 10:55:28 +0200 [thread overview]
Message-ID: <c8c99d1dd1e07a2467bc334f08fe920e@tipi-net.de> (raw)
In-Reply-To: <179198777717.434549.10480959692013383148@kernel.org>
On 14.10.2026 16:22, netdev-bot+sashiko@kernel.org wrote:
> [...]
> [Severity: Medium]
> This is a pre-existing issue that this patch did not introduce, but
> this
> patch adds a new caller that reaches it.
>
> bcmgenet_netif_stop() drops the return value of bcmgenet_dma_teardown()
> and then frees the RX pages anyway:
>
> bcmgenet_netif_stop()
> bcmgenet_dma_teardown(priv); /* -ETIMEDOUT ignored */
> ...
> bcmgenet_fini_dma(priv)
> bcmgenet_free_rx_buffers(priv);
> bcmgenet_destroy_rx_page_pools(priv);
>
> Suppose bcmgenet_rdma_disable() times out because DMA_STATUS never
> acknowledges the disable. Could the RDMA engine then keep writing into
> pages that have already gone back to the page pool?
In theory. bcmgenet_close() and suspend walk the same path today and I
have never seen the disable time out on a BCM2711, so I would rather not
rework the teardown on something I cannot trigger.
> [...]
> [Severity: Medium]
> Does this restart lose the user's TX interrupt coalescing setting?
>
> bcmgenet_set_coalesce() writes ec->tx_max_coalesced_frames straight
> into
> the DMA_MBUF_DONE_THRESH register of each TDMA ring and keeps no
> software
> copy. bcmgenet_get_coalesce() reads the value back from ring 0.
>
> This path rebuilds the TX rings with a hard-coded threshold:
>
> bcmgenet_init_dma()
> bcmgenet_init_tx_queues()
> bcmgenet_init_tx_ring()
> bcmgenet_tdma_ring_writel(priv, index, 1,
> DMA_MBUF_DONE_THRESH);
>
> bcmgenet_init_rx_coalesce() reapplies the RX coalescing, but nothing
> restores the TX value.
>
> Take "ethtool -C ethX tx-frames N" followed by an MTU change across
> ETH_DATA_LEN, such as 1500 to 3000. Would ethtool -c then report
> tx-frames 1?
It would, but IMHO suspend and resume drop the setting the same way
today,
so should be fixed in net rather than here.
> [...]
> [Severity: High]
> This isn't a bug introduced by this patch, but datapath_up now tracks
> exactly this state. Should bcmgenet_suspend() check it as well?
>
> Suppose bcmgenet_init_dma() fails in bcmgenet_resume(). The interface
> then stays netif_running() and detached:
>
> - the earlier bcmgenet_fini_dma() has already deleted the NAPIs
> - rx_cbs and tx_cbs are freed but not set to NULL
> - the clock is gated
>
> bcmgenet_resume()
> ret = bcmgenet_init_dma(priv, false);
> if (ret) {
> netdev_err(dev, "failed to initialize DMA\n");
> goto out_clk_disable;
> }
> ...
> out_clk_disable:
> if (priv->internal_phy)
> bcmgenet_power_down(priv, GENET_POWER_PASSIVE);
> clk_disable_unprepare(priv->clk);
>
> On the next system suspend, bcmgenet_suspend() checks only
> netif_running(dev). Both of its branches reach
> bcmgenet_disable_tx_napi():
> the WoL branch directly, the other branch through
> bcmgenet_netif_stop().
>
> The TX NAPIs were deleted with SCHED and NPSVC still set. Would
> napi_disable_locked() then wait here forever?
>
> while (val & (NAPIF_STATE_SCHED | NAPIF_STATE_NPSVC)) {
> usleep_range(20, 200);
> val = READ_ONCE(n->state);
> }
>
> If suspend ever got past that point, bcmgenet_tx_reclaim_all() would
> walk
> the freed tx_cbs. bcmgenet_fini_dma() would also kfree() rx_cbs and
> tx_cbs
> a second time, with the block unclocked.
>
> bcmgenet_change_mtu() already handles this state ("A datapath left down
> by
> a failed resume has nothing to reprogram either"). bcmgenet_suspend()
> only
> gets the assignment, not an early return.
>
> If the interface is closed after the failed resume, the new guard skips
> bcmgenet_netif_stop(). bcmgenet_close() still calls
> bcmgenet_power_down()
> and clk_disable_unprepare(priv->clk) unconditionally. The failed resume
> already balanced the clock, so does this underflow the clock's enable
> and
> prepare counts?
>
> Could bcmgenet_suspend() skip the teardown when !priv->datapath_up?
> Could
> the driver also track that the failed resume already gated the clock,
> so
> close and suspend_noirq do not disable it again?
Yes, still pre-existing as you say. It goes into the same net series as
the dangling rx_cbs/tx_cbs which make the second teardown a double free.
I will check the clock counts there too.
next prev parent reply other threads:[~2026-10-15 8:55 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 14:20 [PATCH net-next v5 0/8] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 1/8] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 2/8] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 3/8] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 4/8] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 5/8] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 6/8] net: bcmgenet: pad transmit frames out of the packet ready window Nicolai Buchwitz
2026-10-14 14:22 ` netdev-bot+sashiko
2026-10-15 8:48 ` Nicolai Buchwitz
2026-10-13 14:20 ` [PATCH net-next v5 7/8] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-10-14 14:22 ` netdev-bot+sashiko
2026-10-15 8:55 ` Nicolai Buchwitz [this message]
2026-10-13 14:20 ` [PATCH net-next v5 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-10-14 14:22 ` netdev-bot+sashiko
2026-10-15 8:56 ` Nicolai Buchwitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c8c99d1dd1e07a2467bc334f08fe920e@tipi-net.de \
--to=nb@tipi-net.de \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=f.fainelli@gmail.com \
--cc=florian.fainelli@broadcom.com \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=pierremarinleclercq88@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox