From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: <intel-wired-lan@lists.osuosl.org>,
Michal Kubiak <michal.kubiak@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"Jesper Dangaard Brouer" <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Simon Horman <horms@kernel.org>, <bpf@vger.kernel.org>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next 09/16] idpf: remove SW marker handling from NAPI
Date: Thu, 13 Mar 2025 17:50:33 +0100 [thread overview]
Message-ID: <fcb3cf6d-7d5c-407b-aa20-63e2590cf56f@intel.com> (raw)
In-Reply-To: <Z8rbkpRca35brvij@boxer>
From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Date: Fri, 7 Mar 2025 12:42:10 +0100
> On Wed, Mar 05, 2025 at 05:21:25PM +0100, Alexander Lobakin wrote:
>> From: Michal Kubiak <michal.kubiak@intel.com>
>>
>> SW marker descriptors on completion queues are used only when a queue
>> is about to be destroyed. It's far from hotpath and handling it in the
>> hotpath NAPI poll makes no sense.
[...]
>> +/**
>> + * idpf_wait_for_sw_marker_completion - wait for SW marker of disabled Tx queue
>> + * @txq: disabled Tx queue
>> + */
>> +void idpf_wait_for_sw_marker_completion(struct idpf_tx_queue *txq)
>> +{
>> + struct idpf_compl_queue *complq = txq->txq_grp->complq;
>> + struct idpf_splitq_4b_tx_compl_desc *tx_desc;
>> + s16 ntc = complq->next_to_clean;
>> + unsigned long timeout;
>> + bool flow, gen_flag;
>> + u32 pos = ntc;
>> +
>> + if (!idpf_queue_has(SW_MARKER, txq))
>> + return;
>> +
>> + flow = idpf_queue_has(FLOW_SCH_EN, complq);
>> + gen_flag = idpf_queue_has(GEN_CHK, complq);
>> +
>> + timeout = jiffies + msecs_to_jiffies(IDPF_WAIT_FOR_MARKER_TIMEO);
>> + tx_desc = flow ? &complq->comp[pos].common : &complq->comp_4b[pos];
>> + ntc -= complq->desc_count;
>
> could we stop this logic? it was introduced back in the days as comparison
> against 0 for wrap case was faster, here as you said it doesn't have much
> in common with hot path.
+1
>
>> +
>> + do {
>> + struct idpf_tx_queue *tx_q;
>> + int ctype;
>> +
>> + ctype = idpf_parse_compl_desc(tx_desc, complq, &tx_q,
>> + gen_flag);
>> + if (ctype == IDPF_TXD_COMPLT_SW_MARKER) {
>> + idpf_queue_clear(SW_MARKER, tx_q);
>> + if (txq == tx_q)
>> + break;
>> + } else if (ctype == -ENODATA) {
>> + usleep_range(500, 1000);
>> + continue;
>> + }
>> +
>> + pos++;
>> + ntc++;
>> + if (unlikely(!ntc)) {
>> + ntc -= complq->desc_count;
>> + pos = 0;
>> + gen_flag = !gen_flag;
>> + }
>> +
>> + tx_desc = flow ? &complq->comp[pos].common :
>> + &complq->comp_4b[pos];
>> + prefetch(tx_desc);
>> + } while (time_before(jiffies, timeout));
>
> what if timeout expires and you didn't find the marker desc? why do you
Then we'll print "failed to receive marker" and that's it. Usually that
happens only if HW went out for cigarettes and won't come back until
a full power cycle. In that case, timeout prevents the kernel from hanging.
> need timer? couldn't you scan the whole ring instead?
Queue destroy marker is always the last written descriptor, there's no
point in scanning the whole ring.
The marker arrives as the CP receives the virtchnl message, queues the
queue (lol) for destroying and sends the marker. This may take up to
several msecs, but you never know.
So you anyway need a loop with some sane sleeps (here it's 500-1000 usec
and it usually takes 2-3 iterations).
>
>> +
>> + idpf_tx_update_complq_indexes(complq, ntc, gen_flag);
>> +}
Thanks,
Olek
next prev parent reply other threads:[~2025-03-13 16:51 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-05 16:21 [PATCH net-next 00/16] idpf: add XDP support Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 01/16] libeth: convert to netmem Alexander Lobakin
2025-03-06 0:13 ` Mina Almasry
2025-03-11 17:22 ` Alexander Lobakin
2025-03-11 17:43 ` Mina Almasry
2025-03-05 16:21 ` [PATCH net-next 02/16] libeth: support native XDP and register memory model Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 03/16] libeth: add a couple of XDP helpers (libeth_xdp) Alexander Lobakin
2025-03-11 14:05 ` Maciej Fijalkowski
2025-03-17 15:26 ` Alexander Lobakin
2025-03-19 16:19 ` Maciej Fijalkowski
2025-04-01 13:11 ` Alexander Lobakin
2025-04-08 13:38 ` Alexander Lobakin
2025-04-08 13:22 ` Alexander Lobakin
2025-04-08 13:51 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 04/16] libeth: add XSk helpers Alexander Lobakin
2025-03-07 10:15 ` Maciej Fijalkowski
2025-03-12 17:03 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 05/16] idpf: fix Rx descriptor ready check barrier in splitq Alexander Lobakin
2025-03-07 10:17 ` Maciej Fijalkowski
2025-03-12 17:10 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 06/16] idpf: a use saner limit for default number of queues to allocate Alexander Lobakin
2025-03-07 10:32 ` Maciej Fijalkowski
2025-03-12 17:22 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 07/16] idpf: link NAPIs to queues Alexander Lobakin
2025-03-07 10:28 ` Eric Dumazet
2025-03-12 17:16 ` Alexander Lobakin
2025-03-18 17:10 ` Alexander Lobakin
2025-03-07 10:51 ` Maciej Fijalkowski
2025-03-12 17:25 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 08/16] idpf: make complq cleaning dependent on scheduling mode Alexander Lobakin
2025-03-07 11:11 ` Maciej Fijalkowski
2025-03-13 16:16 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 09/16] idpf: remove SW marker handling from NAPI Alexander Lobakin
2025-03-07 11:42 ` Maciej Fijalkowski
2025-03-13 16:50 ` Alexander Lobakin [this message]
2025-03-05 16:21 ` [PATCH net-next 10/16] idpf: add support for nointerrupt queues Alexander Lobakin
2025-03-07 12:10 ` Maciej Fijalkowski
2025-03-13 16:19 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 11/16] idpf: prepare structures to support XDP Alexander Lobakin
2025-03-07 1:12 ` Jakub Kicinski
2025-03-12 14:00 ` [Intel-wired-lan] " Alexander Lobakin
2025-03-07 13:27 ` Maciej Fijalkowski
2025-03-17 14:50 ` Alexander Lobakin
2025-03-19 16:29 ` Maciej Fijalkowski
2025-04-08 13:42 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 12/16] idpf: implement XDP_SETUP_PROG in ndo_bpf for splitq Alexander Lobakin
2025-03-07 14:16 ` Maciej Fijalkowski
2025-03-17 14:58 ` Alexander Lobakin
2025-03-19 16:23 ` Maciej Fijalkowski
2025-03-05 16:21 ` [PATCH net-next 13/16] idpf: use generic functions to build xdp_buff and skb Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 14/16] idpf: add support for XDP on Rx Alexander Lobakin
2025-03-11 15:50 ` Maciej Fijalkowski
2025-04-08 13:28 ` Alexander Lobakin
2025-04-08 15:53 ` Maciej Fijalkowski
2025-03-05 16:21 ` [PATCH net-next 15/16] idpf: add support for .ndo_xdp_xmit() Alexander Lobakin
2025-03-11 16:08 ` Maciej Fijalkowski
2025-04-08 13:31 ` Alexander Lobakin
2025-03-05 16:21 ` [PATCH net-next 16/16] idpf: add XDP RSS hash hint Alexander Lobakin
2025-03-11 15:28 ` [PATCH net-next 00/16] idpf: add XDP support Alexander Lobakin
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=fcb3cf6d-7d5c-407b-aa20-63e2590cf56f@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=michal.kubiak@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.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;
as well as URLs for NNTP newsgroup(s).