Re: [PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend
From: netdev-bot+sashiko
Date: Mon Nov 23 2026 - 17:44:47 EST
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The patch fixes the profile-index/hardware mismatch only in
bcmgenet_init_dim().
--
net: bcmgenet: keep DIM from getting stuck after close or suspend
The patch moves net_dim() so it runs before napi_complete_done() in the
RX poll, and it flushes the DIM work on close/suspend instead of
cancelling it. It also resets the DIM state in bcmgenet_init_dim() and
starts profile_ix from the default profile, so that it matches what
bcmgenet_init_rx_coalesce() programs into the hardware.
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 4d2be2a21ed1b..f702916e7bfaf 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
[ ... ]
> @@ -2702,8 +2703,11 @@ static void bcmgenet_init_dim(struct bcmgenet_rx_ring *ring,
> {
> struct bcmgenet_net_dim *dim = &ring->dim;
>
> + memset(&dim->dim, 0, sizeof(dim->dim));
> INIT_WORK(&dim->dim.work, cb);
> dim->dim.mode = DIM_CQ_PERIOD_MODE_START_FROM_EQE;
> + /* Match the profile bcmgenet_init_rx_coalesce() programs */
> + dim->dim.profile_ix = NET_DIM_DEF_PROFILE_EQE;
[Severity: Medium]
Does the same profile index mismatch still happen through the ethtool
path?
bcmgenet_init_dim() only runs from bcmgenet_init_rx_ring(), which means
on open or resume. The default profile is also written to the hardware
at runtime by bcmgenet_set_ring_rx_coalesce(), and that path does not
touch ring->dim.dim:
drivers/net/ethernet/broadcom/genet/bcmgenet.c:bcmgenet_set_ring_rx_coalesce() {
...
if (ec->use_adaptive_rx_coalesce && !ring->dim.use_dim) {
moder = net_dim_get_def_rx_moderation(ring->dim.dim.mode);
usecs = moder.usec;
pkts = moder.pkts;
}
ring->dim.use_dim = ec->use_adaptive_rx_coalesce;
bcmgenet_set_rx_coalesce(ring, usecs, pkts);
}
Here is one sequence on a running interface. DIM moves to profile 3.
Then the user runs "ethtool -C ethX adaptive-rx off" followed by
"ethtool -C ethX adaptive-rx on". The hardware now has the default EQE
profile, but profile_ix, tune_state, steps, prev_stats and start_sample
still hold the values from before adaptive-rx was turned off.
On the next net_dim(), net_dim_decision() steps from the stale
profile_ix. bcmgenet_dim_work() then programs a profile that is a
neighbour of 3 instead of a neighbour of the default.
If tune_state is DIM_PARKING_ON_TOP and traffic is steady, no work gets
queued at all. The hardware then stays on the default profile while DIM
believes another profile is active.
This looks like the "profile index no longer matches the hardware"
state the commit message describes, reached here without any close or
suspend. Would it make sense to reset ring->dim.dim (state and
profile_ix) in bcmgenet_set_ring_rx_coalesce() whenever the default
profile is programmed?
A related case: when adaptive-rx is already on, any "ethtool -C" call
skips the default-profile branch. It writes the static
rx_coalesce_usecs/rx_max_coalesced_frames into every RX ring, while DIM
keeps its old profile_ix.
bcmgenet_get_coalesce() reports ring 0's hardware values. So in that
case, could rings other than ring 0 end up with ring 0's DIM-chosen
values while their own DIM state points somewhere else?
> dim->event_ctr = 0;
> dim->packets = 0;
> dim->bytes = 0;
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261120-nb-genet-dim-stats-net-v2-0-1a7cece7dd1a%40tipi-net.de