From: Your Name <alessandro.d@gmail.com>
To: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Cc: Alessandro Decina <alessandro.d@gmail.com>,
netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Alexei Starovoitov <ast@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Daniel Borkmann <daniel@iogearbox.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Paolo Abeni <pabeni@redhat.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Tirthendu Sarkar <tirthendu.sarkar@intel.com>,
Tony Nguyen <anthony.l.nguyen@intel.com>,
bpf@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [Intel-wired-lan] [PATCH net v2 1/1] i40e: xsk: advance next_to_clean on status descriptors
Date: Thu, 23 Oct 2025 04:39:29 +1100 [thread overview]
Message-ID: <aPkW0U5xG3ZOekI0@lima-default> (raw)
In-Reply-To: <aPkRoCQikecxLxTS@boxer>
On Wed, Oct 22, 2025 at 07:17:20PM +0200, Maciej Fijalkowski wrote:
> On Wed, Oct 22, 2025 at 12:32:00AM +0700, Alessandro Decina wrote:
>
> Hi Alessandro,
Hey,
Thanks for the review!
>
> > Whenever a status descriptor is received, i40e processes and skips over
> > it, correctly updating next_to_process but forgetting to update
> > next_to_clean. In the next iteration this accidentally causes the
> > creation of an invalid multi-buffer xdp_buff where the first fragment
> > is the status descriptor.
> >
> > If then a skb is constructed from such an invalid buffer - because the
> > eBPF program returns XDP_PASS - a panic occurs:
>
> can you elaborate on the test case that would reproduce this? I suppose
> AF_XDP ZC with jumbo frames, doing XDP_PASS, but what was FDIR setup that
> caused status descriptors?
Doesn't have to be jumbo or multi-frag, anything that does XDP_PASS
reproduces, as long as status descriptors are posted.
See the scenarios here https://lore.kernel.org/netdev/aPkDtuVgbS4J-Og_@lima-default/
As for what's causing the status descriptors, I haven't been able to
figure that out. I just know that I periodically get
I40E_RX_PROG_STATUS_DESC_FD_FILTER_STATUS. Happy to dig deeper if you
have any ideas!
> > diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> > index 9f47388eaba5..dbc19083bbb7 100644
> > --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> > +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> > @@ -441,13 +441,18 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
> > dma_rmb();
> >
> > if (i40e_rx_is_programming_status(qword)) {
> > + u16 ntp;
> > +
> > i40e_clean_programming_status(rx_ring,
> > rx_desc->raw.qword[0],
> > qword);
> > bi = *i40e_rx_bi(rx_ring, next_to_process);
> > xsk_buff_free(bi);
> > - if (++next_to_process == count)
> > + ntp = next_to_process++;
> > + if (next_to_process == count)
> > next_to_process = 0;
> > + if (next_to_clean == ntp)
> > + next_to_clean = next_to_process;
>
> I wonder if this is more readable?
>
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_xsk.c b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> index 9f47388eaba5..36f412a2d836 100644
> --- a/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> +++ b/drivers/net/ethernet/intel/i40e/i40e_xsk.c
> @@ -446,6 +446,10 @@ int i40e_clean_rx_irq_zc(struct i40e_ring *rx_ring, int budget)
> qword);
> bi = *i40e_rx_bi(rx_ring, next_to_process);
> xsk_buff_free(bi);
> + if (next_to_clean == next_to_process) {
> + if (++next_to_clean == count)
> + next_to_clean = 0;
> + }
> if (++next_to_process == count)
> next_to_process = 0;
> continue;
>
> > continue;
> > }
Probably because I've looked at it for longer, I find my version clearer
(I think I copied it from another driver actually). But I don't really
mind, happy to switch to yours if you prefer!
Ciao
Alessandro
next prev parent reply other threads:[~2025-10-22 17:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 17:31 [Intel-wired-lan] [PATCH net v2 0/1] i40e: xsk: advance next_to_clean on status descriptors Alessandro Decina
2025-10-21 17:32 ` [Intel-wired-lan] [PATCH net v2 1/1] " Alessandro Decina
2025-10-22 3:11 ` Jason Xing
2025-10-22 5:41 ` Sarkar, Tirthendu
2025-10-22 7:28 ` Jason Xing
2025-10-22 16:28 ` Your Name
2025-10-23 6:11 ` Sarkar, Tirthendu
2025-10-22 16:17 ` Alessandro Decina
2025-10-22 6:41 ` Loktionov, Aleksandr
2025-10-22 17:17 ` Maciej Fijalkowski
2025-10-22 17:39 ` Your Name [this message]
2025-11-03 15:14 ` Maciej Fijalkowski
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=aPkW0U5xG3ZOekI0@lima-default \
--to=alessandro.d@gmail.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=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=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=sdf@fomichev.me \
--cc=tirthendu.sarkar@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).