BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jason Xing" <kerneljasonxing@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v3 3/5] xsk: drain continuation descs after overflow in xsk_build_skb()
Date: Mon, 18 May 2026 06:34:08 +0000	[thread overview]
Message-ID: <20260518063408.5F995C2BCC6@smtp.kernel.org> (raw)
In-Reply-To: <20260517063311.28921-4-kerneljasonxing@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The commit message claims the function returns `-EOVERFLOW` after draining is complete, but the code merely uses `continue;`.
--

commit 5c0ce4e27ce234e8586a243e61aed44e90c34548
Author: Jason Xing <kerneljasonxing@gmail.com>

xsk: drain continuation descs after overflow in xsk_build_skb()

This patch adds a drain_cont flag to xdp_sock to properly drain leftover
continuation descriptors when a multi-buffer packet exceeds MAX_SKB_FRAGS.
The main TX loop handles these leftover descriptors individually by returning
them to the completion queue with standard backpressure mechanisms.

Closes: https://lore.kernel.org/all/20260425041726.85FB3C2BCB2@smtp.kernel.org/

> When the last fragment
> (without XDP_PKT_CONTD) is processed, the flag is cleared and the
> function returns -EOVERFLOW so the next call starts with a fresh
> budget for normal packets.

Is this description accurate?

> diff --git a/net/xdp/xsk.c b/net/xdp/xsk.c
> index 0a6203c425766..298194b7335e1 100644
> --- a/net/xdp/xsk.c
> +++ b/net/xdp/xsk.c

[ ... ]

> @@ -1062,6 +1064,23 @@ static int __xsk_generic_xmit(struct sock *sk)
>  			goto out;
>  		}
>  
> +		if (unlikely(xs->drain_cont)) {
> +			unsigned long flags;
> +			u32 idx;
> +
> +			spin_lock_irqsave(&xs->pool->cq_prod_lock, flags);
> +			idx = xskq_get_prod(xs->pool->cq);
> +			xskq_prod_write_addr(xs->pool->cq, idx, desc.addr);
> +			xskq_prod_submit_n(xs->pool->cq, 1);
> +			spin_unlock_irqrestore(&xs->pool->cq_prod_lock, flags);
> +
> +			xs->tx->invalid_descs++;
> +			xskq_cons_release(xs->tx);
> +			if (!xp_mb_desc(&desc))
> +				xs->drain_cont = false;
> +			continue;

Looking at the implementation here, the code clears the flag and executes
a continue statement, which proceeds to the next descriptor using the
remaining budget instead of returning -EOVERFLOW.

Could the code and the commit message be out of sync?

> +		}
> +
>  		skb = xsk_build_skb(xs, &desc);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260517063311.28921-1-kerneljasonxing@gmail.com?part=3

  reply	other threads:[~2026-05-18  6:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17  6:33 [PATCH net v3 0/5] xsk: fix meta and publish of cq issues Jason Xing
2026-05-17  6:33 ` [PATCH net v3 1/5] xsk: cache csum_start/csum_offset to fix TOCTOU in xsk_skb_metadata() Jason Xing
2026-05-18  6:34   ` sashiko-bot
2026-05-18  9:06     ` Jason Xing
2026-05-17  6:33 ` [PATCH net v3 2/5] xsk: fix buffer leak in xsk_drop_skb() for AF_XDP multi-buffer Tx Jason Xing
2026-05-21 12:03   ` Maciej Fijalkowski
2026-05-17  6:33 ` [PATCH net v3 3/5] xsk: drain continuation descs after overflow in xsk_build_skb() Jason Xing
2026-05-18  6:34   ` sashiko-bot [this message]
2026-05-18  9:09     ` Jason Xing
2026-05-19 21:19   ` Stanislav Fomichev
2026-05-19 23:20     ` Jason Xing
2026-05-17  6:33 ` [PATCH net v3 4/5] xsk: drain continuation descs on invalid descriptor in __xsk_generic_xmit() Jason Xing
2026-05-17  6:33 ` [PATCH net v3 5/5] selftests/xsk: drain CQ to wait for TX completion Jason Xing
2026-05-18  6:34   ` sashiko-bot
2026-05-18  9:19     ` Jason Xing

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=20260518063408.5F995C2BCC6@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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