From: Zefir Kurtisi <zefir.kurtisi@gmail.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: claudiu.manoil@nxp.com, wei.fang@nxp.com, xiaoning.wang@nxp.com,
davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
Zefir Kurtisi <zefir.kurtisi@westermo.com>
Subject: Re: [PATCH] net: enetc: fix sirq-storm by clearing IDR registers
Date: Fri, 27 Feb 2026 14:03:54 +0100 [thread overview]
Message-ID: <53f850f9-8f05-49ba-9247-ef2f823cc2b2@gmail.com> (raw)
In-Reply-To: <20260227115708.lkpbea3b24ztdsgl@skbuf>
On 2/27/26 12:57, Vladimir Oltean wrote:
> On Fri, Feb 27, 2026 at 12:28:17PM +0100, Zefir Kurtisi wrote:
>> While I was debugging the issue I extended enetc with features that still
>> might be useful; the first change was to selectively process only the
>> pending BDs instead of looping over all available, saving a significant
>> number of unneeded calls to enetc_clean_rx/tx_ring(); the second adds a
>> fail-safe mechanism for potentially other issues taking the same code path
>> based on the fact that now a BD is only processed when its IDR is active,
>> which means there must be BDs available to process.
>
> We'll perform our own investigation of what is happening when
> transmitting short frames. It will take some time.
>
> But I'm not sure I understand what you mean about processing a BD ring
> when its interrupt is active. NAPI (Documentation/networking/napi.rst)
> works on the basic premise that a single hardirq is sufficient to process
> a very large batch of frames, and keeping hardirqs enabled is detrimential
> to performance. Instead, NAPI (re-)schedules softirqs until there are no
> further frames to process, and only then re-enables the hardirq.
>
> Perhaps I didn't understand very well what you mean, but it sounds like
> you want to circumvent NAPI, essentially. When enetc_poll() is called,
> you seem to assume it's the first time it's been called after enetc_msix()
> has called napi_schedule(). But it's not. It can also reschedule itself,
> when the work done is equal to the NAPI budget (complete==false), with
> the hardirq _still_ masked.
>
> The correct NAPI behaviour _is_ for the hardirq to be masked for a very
> long while, when subject to continuous streams of traffic.
The change proposed does in no way change how and when interrupts are
re-enabled or NAPI is re-scheduled. What it does is:
assume there are completed RX frames, but no completed TX frames:
SIRXIDR=0x0001, SITXIDR=0x0000
enetc_poll today does:
* enetc_clean_tx_ring(0) -> nop
* read TB0CIR and find out it did not progress
* enetc_clean_tx_ring(2) -> nop
* enetc_clean_tx_ring(4) -> nop
* enetc_clean_tx_ring(6) -> nop
* enetc_clean_rx_ring(0)
Proposal instead: as long as SITXIDR==0x0000, limit to
* enetc_clean_rx_ring(0)
IRQ remains masked until NAPI is completed, behaviour is same as before.
If there was an RX burst and NAPI is re-scheduled multiple times and
during that time a TX BD completes, the SITXIDR would get the related
bit set and TX BD would be processed in enetc_poll - all before the
interrupt is re-armed.
But if the improvement is not obvious, it maybe does not justify adding
the change - in the end it spares some function calls and register
reads, which might not be that significant.
Cheers,
Zefir
prev parent reply other threads:[~2026-02-27 13:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-20 13:29 [PATCH] net: enetc: fix sirq-storm by clearing IDR registers Zefir Kurtisi
2026-02-23 16:32 ` Vladimir Oltean
2026-02-26 12:00 ` Vladimir Oltean
2026-02-26 19:28 ` Zefir Kurtisi
2026-02-26 19:51 ` Vladimir Oltean
2026-02-27 11:28 ` Zefir Kurtisi
2026-02-27 11:57 ` Vladimir Oltean
2026-02-27 13:03 ` Zefir Kurtisi [this message]
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=53f850f9-8f05-49ba-9247-ef2f823cc2b2@gmail.com \
--to=zefir.kurtisi@gmail.com \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=vladimir.oltean@nxp.com \
--cc=wei.fang@nxp.com \
--cc=xiaoning.wang@nxp.com \
--cc=zefir.kurtisi@westermo.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