mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: testwrzwrz@gmail.com
Cc: magnus.karlsson@intel.com, maciej.fijalkowski@intel.com,
	kerneljasonxing@gmail.com, sdf@fomichev.me, hawk@kernel.org,
	stable@vger.kernel.org, netdev@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	kuba@kernel.org
Subject: Re: [PATCH net v2 2/2] selftests/bpf: cover AF_XDP multi-buffer TX software checksum
Date: Sun, 25 Oct 2026 14:46:55 +0000	[thread overview]
Message-ID: <179293961591.3134.5478895656850588086@kernel.org> (raw)
In-Reply-To: <20261024141157.59301-3-testwrzwrz@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 (1) · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] generate_packet() in
  tools/testing/selftests/bpf/prog_tests/xdp_metadata.c fills the…

Pre-existing issues:
- [Medium] The freplace check in test_xdp_metadata() never retries.

--

selftests/bpf: cover AF_XDP multi-buffer TX software checksum

This commit extends test_xdp_metadata to send a UDP packet once as a
single TX descriptor and once split across two descriptors with
XDP_PKT_CONTD. The existing metadata and checksum checks run for both.
It adds a bind_flags argument to open_xsk(), a split_len argument to
generate_packet() and a num argument to complete_tx().

> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> index 5c31054ad4a4c..1cf70fb800fba 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c

[ ... ]

> @@ -133,36 +135,36 @@ static void close_xsk(struct xsk *xsk)

[ ... ]

> -	eth = data;
> +	memset(pkt, 0, sizeof(pkt));
> +	eth = (void *)pkt;
>  	iph = (void *)(eth + 1);
>  	udph = (void *)(iph + 1);
>  
> -	memcpy(eth->h_dest, "\x00\x00\x00\x00\x00\x02", ETH_ALEN);
> -	memcpy(eth->h_source, "\x00\x00\x00\x00\x00\x01", ETH_ALEN);
> +	memcpy(eth->h_dest, RX_MAC, ETH_ALEN);
> +	memcpy(eth->h_source, TX_MAC, ETH_ALEN);

[Severity: Medium]
Should RX_MAC and TX_MAC be copied here? In this file they are text
strings meant for the ip link commands:

#define TX_MAC "00:00:00:00:00:01"
#define RX_MAC "00:00:00:00:00:02"

With ETH_ALEN as the length, memcpy() copies the first six ASCII
characters, "00:00:". Both h_dest and h_source then become
30:30:3a:30:30:3a.

The old binary literals matched the addresses set on veTX and veRX. Now
every AF_XDP frame that generate_packet() builds has a destination MAC
that doesn't match veRX. That covers the single-descriptor packet, the
new multi-buffer packet and the freplace packet. Won't eth_type_trans()
on the receive side mark these frames PACKET_OTHERHOST?

The test still passes because rx() in progs/xdp_metadata.c only filters
on the UDP destination port:

	if (udp->dest != bpf_htons(8080))
		return XDP_PASS;

Was this change meant to be part of a patch that only adds the
multi-buffer case? Keeping the "\x00\x00\x00\x00\x00\x02" and
"\x00\x00\x00\x00\x00\x01" literals would avoid the problem.

>  	eth->h_proto = htons(ETH_P_IP);

[ ... ]

> @@ -518,7 +564,7 @@ void test_xdp_metadata(void)
>  		goto out;
>  
>  	/* Send packet to trigger . */
> -	if (!ASSERT_GE(generate_packet(&tx_xsk, AF_XDP_CONSUMER_PORT), 0,
> +	if (!ASSERT_GE(generate_packet(&tx_xsk, AF_XDP_CONSUMER_PORT, 0), 0,
>  		       "generate freplace packet"))
>  		goto out;

[Severity: Medium]
This isn't a bug introduced by this patch, but the polling loop after
this send in test_xdp_metadata() never seems to run:

	int retries = 10;
	...
	while (!retries--) {
		if (bpf_obj2->bss->called)
			break;
		usleep(10);
	}
	ASSERT_GT(bpf_obj2->bss->called, 0, "not called");

On the first check retries is 10, so !retries-- is false and the loop
body is skipped. The assertion then runs right after sendto() and the
netns switch.

freplace_rx() increments called from the veth NAPI receive path, which
runs in NET_RX softirq. If that softirq is deferred to ksoftirqd, can
this assertion fail without a single retry?

Should the condition be retries-- > 0 instead?

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261024141157.59301-1-testwrzwrz%40gmail.com

  reply	other threads:[~2026-10-25 14:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-24  9:12 [PATCH net] xsk: defer software checksum until the skb is complete Rongzheng Wang
2026-10-24  9:15 ` netdev-bot+sinfo
2026-10-24 11:35   ` 王荣峥
2026-10-24 12:25 ` Jason Xing
2026-10-24 14:11 ` [PATCH net v2 0/2] xsk: fix multi-buffer TX software checksum Rongzheng Wang
2026-10-24 14:11   ` [PATCH net v2 1/2] xsk: defer software checksum until the skb is complete Rongzheng Wang
2026-10-25  2:51     ` Jason Xing
2026-10-25  3:43       ` Rongzheng Wang
2026-10-24 14:11   ` [PATCH net v2 2/2] selftests/bpf: cover AF_XDP multi-buffer TX software checksum Rongzheng Wang
2026-10-25 14:46     ` netdev-bot+sashiko [this message]
2026-10-24 14:15   ` [PATCH net v2 0/2] xsk: fix " netdev-bot+sinfo

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=179293961591.3134.5478895656850588086@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=hawk@kernel.org \
    --cc=kerneljasonxing@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.fijalkowski@intel.com \
    --cc=magnus.karlsson@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=sdf@fomichev.me \
    --cc=stable@vger.kernel.org \
    --cc=testwrzwrz@gmail.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

all inboxes | Powered by JetHome®