From: netdev-bot+sashiko@kernel.org
To: nb@tipi-net.de
Cc: opendmb@gmail.com, florian.fainelli@broadcom.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, justin.chen@broadcom.com,
pgynther@google.com, bcm-kernel-feedback-list@broadcom.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend
Date: Mon, 23 Nov 2026 22:44:42 +0000 [thread overview]
Message-ID: <179547388219.3135.3983701344870558554@kernel.org> (raw)
In-Reply-To: <20261120-nb-genet-dim-stats-net-v2-1-1a7cece7dd1a@tipi-net.de>
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
next prev parent reply other threads:[~2026-11-23 22:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 22:42 [PATCH net v2 0/5] net: bcmgenet, systemport: DIM and Rx discard fixes Nicolai Buchwitz
2026-11-20 22:42 ` [PATCH net v2 1/5] net: bcmgenet: keep DIM from getting stuck after close or suspend Nicolai Buchwitz
2026-11-21 0:19 ` Florian Fainelli
2026-11-23 22:44 ` netdev-bot+sashiko [this message]
2026-11-20 22:42 ` [PATCH net v2 2/5] net: bcmgenet: accumulate the DIM packet and byte counters Nicolai Buchwitz
2026-11-20 22:42 ` [PATCH net v2 3/5] net: bcmgenet: reset the Rx discard count with the ring Nicolai Buchwitz
2026-11-20 22:42 ` [PATCH net v2 4/5] net: systemport: restart DIM from the default profile on start Nicolai Buchwitz
2026-11-20 22:42 ` [PATCH net v2 5/5] net: systemport: accumulate the DIM packet and byte counters 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=179547388219.3135.3983701344870558554@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=justin.chen@broadcom.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nb@tipi-net.de \
--cc=netdev@vger.kernel.org \
--cc=opendmb@gmail.com \
--cc=pabeni@redhat.com \
--cc=pgynther@google.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