From: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
To: netdev@vger.kernel.org
Cc: bpf@vger.kernel.org, magnus.karlsson@intel.com,
stfomichev@gmail.com, kuba@kernel.org, pabeni@redhat.com,
horms@kernel.org, larysa.zaremba@intel.com,
aleksander.lobakin@intel.com, bjorn@kernel.org,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Subject: [PATCH v3 net 6/8] selftests: bpf: have a separate variable for drop test
Date: Mon, 23 Mar 2026 20:24:55 +0100 [thread overview]
Message-ID: <20260323192457.504631-7-maciej.fijalkowski@intel.com> (raw)
In-Reply-To: <20260323192457.504631-1-maciej.fijalkowski@intel.com>
Currently two different XDP programs share a static variable for
different purposes (picking where to redirect on shared umem test &
whether to drop a packet). This can be a problem when running full test
suite - idx can be written by shared umem test and this value can cause
a false behavior within XDP drop half test.
Introduce a dedicated variable for drop half test so that these two
don't step on each other toes. There is no real need for using
__sync_fetch_and_add here as XSK tests are executed on single CPU.
Reviewed-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
tools/testing/selftests/bpf/progs/xsk_xdp_progs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
index 683306db8594..023d8befd4ca 100644
--- a/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
+++ b/tools/testing/selftests/bpf/progs/xsk_xdp_progs.c
@@ -26,8 +26,10 @@ SEC("xdp.frags") int xsk_def_prog(struct xdp_md *xdp)
SEC("xdp.frags") int xsk_xdp_drop(struct xdp_md *xdp)
{
+ static unsigned int drop_idx;
+
/* Drop every other packet */
- if (idx++ % 2)
+ if (drop_idx++ % 2)
return XDP_DROP;
return bpf_redirect_map(&xsk, 0, XDP_DROP);
--
2.43.0
next prev parent reply other threads:[~2026-03-23 19:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 19:24 [PATCH v3 net 0/8] xsk: tailroom reservation and MTU validation Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 1/8] xsk: tighten UMEM headroom validation to account for tailroom and min frame Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 2/8] xsk: respect tailroom for ZC setups Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 3/8] xsk: fix XDP_UMEM_SG_FLAG issues Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 4/8] xsk: validate MTU against usable frame size on bind Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 5/8] selftests: bpf: fix pkt grow tests Maciej Fijalkowski
2026-03-23 19:24 ` Maciej Fijalkowski [this message]
2026-03-23 19:24 ` [PATCH v3 net 7/8] selftests: bpf: adjust rx_dropped xskxceiver's test to respect tailroom Maciej Fijalkowski
2026-03-23 19:24 ` [PATCH v3 net 8/8] idpf: remove xsk frame size check against alignment Maciej Fijalkowski
2026-03-27 3:27 ` [PATCH v3 net 0/8] xsk: tailroom reservation and MTU validation Jakub Kicinski
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=20260323192457.504631-7-maciej.fijalkowski@intel.com \
--to=maciej.fijalkowski@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stfomichev@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