From: "Daniel Zahka" <daniel.zahka@gmail.com>
To: "Harshitha Ramamurthy" <hramamurthy@google.com>,
"Daniel Zahka" <daniel.zahka@gmail.com>
Cc: "Alexander Duyck" <alexanderduyck@fb.com>,
"Jakub Kicinski" <kuba@kernel.org>, <kernel-team@meta.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 4/4] eth: mpnic: add a NAPI depletion check
Date: Mon, 05 Oct 2026 07:42:38 -0400 [thread overview]
Message-ID: <DLWVLSLYA73P.W5X67Q4ROUK@gmail.com> (raw)
In-Reply-To: <CAEAWyHdJQsKgHmZSAA3M12jpKhgb_pq7QmBRW59CU-Q_JT8cwg@mail.gmail.com>
On Fri Oct 2, 2026 at 8:53 PM EDT, Harshitha Ramamurthy wrote:
> On Thu, Oct 1, 2026 at 9:41 AM Daniel Zahka <daniel.zahka@gmail.com> wrote:
[...]
> +void mpnic_napi_depletion_check(struct mpnic_net *mpn)
>> +{
>> + int i, j, t;
>> +
>> + for (i = 0; i < mpn->num_napi; i++) {
>> + struct mpnic_napi_vector *nv = mpn->napi[i];
>> +
>> + for (t = nv->txt_count, j = 0; j < nv->rxt_count; j++, t++) {
>> + /* Check if BDs posted covers a max sized frame
>> + * + 1 BD held by RDE as a spare
>> + * + 1 BD of extra safety margin
>> + */
>
> Curious how the "+ 1 BD of extra safety margin" was decided. I
> understand the "+ 1 BD held by RDE as a spare" is because of HW
> behaviour but wondering about the extra buffer descriptor - if it came
> from testing or guarding against something specific.
>
The extra +1 isn't strictly necessary. The real lower bound is
MPNIC_RX_HPQ_DROP_THRS + 1, which was derived from the design of the
device and our napi poll implementation. I added an extra BD count
because the actual bound doesn't matter as long as its conservative.
Perhaps that's a bit superstitious.
>> + if (mpnic_desc_used(&nv->qt[t].sub0) <
>> + MPNIC_RX_HPQ_DROP_THRS + 2 ||
>> + mpnic_desc_used(&nv->qt[t].sub1) <
>> + MPNIC_RX_PPQ_DROP_THRS + 2) {
>> + mpnic_nv_irq_trigger(nv);
>> + break;
>> + }
>> + }
>> + }
>> +
>> + mpnic_wrfl(mpn->mpd);
>> +}
>> diff --git a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.h b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.h
>> index 9397010557eb..767d87a36c35 100644
>> --- a/drivers/net/ethernet/meta/mpnic/mpnic_txrx.h
>> +++ b/drivers/net/ethernet/meta/mpnic/mpnic_txrx.h
>> @@ -148,6 +148,7 @@ int mpnic_set_netif_queues(struct mpnic_net *mpn);
>> void mpnic_reset_netif_queues(struct mpnic_net *mpn);
>> void mpnic_napi_enable(struct mpnic_net *mpn);
>> void mpnic_napi_disable(struct mpnic_net *mpn);
>> +void mpnic_napi_depletion_check(struct mpnic_net *mpn);
>> void mpnic_enable(struct mpnic_net *mpn);
>> void mpnic_disable(struct mpnic_net *mpn);
>> void mpnic_wait_all_queues_idle(struct mpnic_dev *mpd);
>>
>> --
>> 2.52.0
>>
>>
next prev parent reply other threads:[~2026-10-05 11:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 16:38 [PATCH net-next 0/4] mpnic: add NAPI buffer depletion check Daniel Zahka
2026-10-01 16:38 ` [PATCH net-next 1/4] eth: mpnic: use WRITE_ONCE() for BDQ head and tail updates Daniel Zahka
2026-10-01 16:38 ` [PATCH net-next 2/4] eth: mpnic: add a service task Daniel Zahka
2026-10-01 16:39 ` [PATCH net-next 3/4] eth: mpnic: set Rx buffer minimums using page size and mtu Daniel Zahka
2026-10-03 0:50 ` Harshitha Ramamurthy
2026-10-05 11:15 ` Daniel Zahka
2026-10-01 16:39 ` [PATCH net-next 4/4] eth: mpnic: add a NAPI depletion check Daniel Zahka
2026-10-03 0:53 ` Harshitha Ramamurthy
2026-10-05 11:42 ` Daniel Zahka [this message]
2026-10-01 16:45 ` [PATCH net-next 0/4] mpnic: add NAPI buffer " netdev-bot+sinfo
2026-10-01 18:26 ` Daniel Zahka
2026-10-03 0:54 ` Harshitha Ramamurthy
2026-10-06 0:00 ` patchwork-bot+netdevbpf
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=DLWVLSLYA73P.W5X67Q4ROUK@gmail.com \
--to=daniel.zahka@gmail.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.