mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: netdev-bot+sashiko@kernel.org
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,
	f.fainelli@gmail.com
Subject: Re: [PATCH net 2/4] net: bcmgenet: restart DIM from the default profile on ring init
Date: Fri, 20 Nov 2026 21:16:57 +0100	[thread overview]
Message-ID: <8b3c7fb8c73f1f5b224052752969eda4@tipi-net.de> (raw)
In-Reply-To: <179512026414.3136.5512333445190926749@kernel.org>

On 19.11.2026 21:31, netdev-bot+sashiko@kernel.org wrote:
> [...]

> [Severity: High]
> Can the same stuck DIM state still happen through Wake-on-LAN
> suspend/resume?
> 
> The reset only runs from bcmgenet_init_dim(). Its only caller is
> bcmgenet_init_rx_ring(), which is reached through bcmgenet_init_dma().
> 
> The WoL branch of bcmgenet_suspend() goes through the same cancel that
> the commit message describes for close:
> 
> bcmgenet_suspend()
>     if (device_may_wakeup(d) && priv->wolopts) {
>         ...
>         bcmgenet_disable_rx_napi(priv);
>         disable_irq(priv->irq1);
>         ...
>     }
> 
> bcmgenet_disable_rx_napi()
>     napi_disable(&ring->napi);
>     cancel_work_sync(&ring->dim.dim.work);
> 
> Suppose the last net_dim() call set dim->state = DIM_APPLY_NEW_PROFILE
> and scheduled the work just before this point. The work is cancelled,
> and bcmgenet_dim_work() never runs. It is the only place that moves the
> state back to DIM_START_MEASURE.
> 
> On resume, the fast path in bcmgenet_resume() re-enables RX NAPI 
> without
> reinitializing the rings:
> 
> bcmgenet_resume()
>     if (priv->tx_cbs && (reg & CMD_RX_EN)) {
>         /* Successfully exited WoL, just resume data flows */
>         ...
>         bcmgenet_enable_rx_napi(priv);
> 
> That means bcmgenet_init_dim() is not called, so the new memset and
> profile_ix reset never run. After that, every net_dim() call hits:
> 
>     case DIM_APPLY_NEW_PROFILE:
>         break;
> 
> Adaptive RX coalescing stays frozen until the next ifdown/ifup. Also,
> profile_ix already points at the new profile, while the
> DMA_MBUF_DONE_THRESH and DMA_RING0_TIMEOUT registers still hold the old
> values.
> 
> Toggling adaptive coalescing through ethtool doesn't seem to recover
> from this, since bcmgenet_set_ring_rx_coalesce() never touches
> dim.state.
> 
> Would it work better to reset ring->dim.dim.state, and re-sync
> profile_ix, in bcmgenet_disable_rx_napi() right after
> cancel_work_sync()? That would cover both close and WoL suspend.
> 
> The later patches in this series ("net: bcmgenet: reset the Rx discard
> count with the ring" and "net: systemport: accumulate the DIM packet 
> and
> byte counters") don't touch this path, so the gap is still there at the
> end of the series.
> 
>>  	dim->event_ctr = 0;
>>  	dim->packets = 0;
>>  	dim->bytes = 0;

Valid point. I will use flush_work() instead, which is IMHO a better 
fit.
It applies the pending profile, so profile_ix and the hardware stay in
sync, and it covers both close and WoL suspend.

--
pw-bot: cr

  reply	other threads:[~2026-11-20 20:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 19:55 [PATCH net 0/4] net: bcmgenet, systemport: DIM and Rx discard fixes Nicolai Buchwitz
2026-11-18 19:55 ` [PATCH net 1/4] net: bcmgenet: accumulate the DIM packet and byte counters Nicolai Buchwitz
2026-11-18 19:58   ` Florian Fainelli
2026-11-18 19:55 ` [PATCH net 2/4] net: bcmgenet: restart DIM from the default profile on ring init Nicolai Buchwitz
2026-11-18 20:00   ` Florian Fainelli
2026-11-19 20:31   ` netdev-bot+sashiko
2026-11-20 20:16     ` Nicolai Buchwitz [this message]
2026-11-18 19:55 ` [PATCH net 3/4] net: bcmgenet: reset the Rx discard count with the ring Nicolai Buchwitz
2026-11-18 20:00   ` Florian Fainelli
2026-11-18 19:55 ` [PATCH net 4/4] net: systemport: accumulate the DIM packet and byte counters Nicolai Buchwitz
2026-11-18 20:00   ` Florian Fainelli
2026-11-19 20:31   ` netdev-bot+sashiko

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=8b3c7fb8c73f1f5b224052752969eda4@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.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=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

all inboxes | Powered by JetHome®