> -----Original Message----- > From: Intel-wired-lan <[email protected]> On Behalf > Of Lorenzo Bianconi > Sent: Tuesday, February 10, 2026 6:22 PM > To: Donald Hunter <[email protected]>; Jakub Kicinski > <[email protected]>; David S. Miller <[email protected]>; Eric Dumazet > <[email protected]>; Paolo Abeni <[email protected]>; Simon Horman > <[email protected]>; Alexei Starovoitov <[email protected]>; Daniel > Borkmann <[email protected]>; Jesper Dangaard Brouer > <[email protected]>; John Fastabend <[email protected]>; > Stanislav Fomichev <[email protected]>; Andrew Lunn > <[email protected]>; Nguyen, Anthony L > <[email protected]>; Kitszel, Przemyslaw > <[email protected]>; Lobakin, Aleksander > <[email protected]>; Andrii Nakryiko <[email protected]>; > Martin KaFai Lau <[email protected]>; Eduard Zingerman > <[email protected]>; Song Liu <[email protected]>; Yonghong Song > <[email protected]>; KP Singh <[email protected]>; Hao Luo > <[email protected]>; Jiri Olsa <[email protected]>; Shuah Khan > <[email protected]>; Fijalkowski, Maciej <[email protected]> > Cc: Jakub Sitnicki <[email protected]>; [email protected]; > [email protected]; [email protected]; linux- > [email protected]; Lorenzo Bianconi <[email protected]> > Subject: [Intel-wired-lan] [PATCH bpf-next 4/5] selftests/bpf: Add > selftest support for bpf_xdp_metadata_rx_checksum > > Introduce support to xdp_metadata selftest for > bpf_xdp_metadata_rx_checksum kfunc. > > Signed-off-by: Lorenzo Bianconi <[email protected]> > --- > tools/testing/selftests/bpf/prog_tests/xdp_metadata.c | 7 +++++++ > tools/testing/selftests/bpf/progs/xdp_metadata.c | 1 + > tools/testing/selftests/bpf/xdp_metadata.h | 9 +++++++++ > 3 files changed, 17 insertions(+) > > diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > index > 19f92affc2daa23fdd869554e7a0475b86350a4f..707c98e664745763b01b638a537a > 797211ded4e1 100644 > --- a/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > +++ b/tools/testing/selftests/bpf/prog_tests/xdp_metadata.c > @@ -258,6 +258,7 @@ static void refill_rx(struct xsk *xsk, __u64 addr) > > static int verify_xsk_metadata(struct xsk *xsk, bool > sent_from_af_xdp) { > + __u8 ip_summed = sent_from_af_xdp ? XDP_CHECKSUM_NONE : > +XDP_CHECKSUM_PARTIAL; > const struct xdp_desc *rx_desc; > struct pollfd fds = {}; > struct xdp_meta *meta; > @@ -310,6 +311,12 @@ static int verify_xsk_metadata(struct xsk *xsk, > bool sent_from_af_xdp) > if (!ASSERT_NEQ(meta->rx_hash, 0, "rx_hash")) > return -1; > > + if (!ASSERT_EQ(meta->ip_summed, ip_summed, "rx_ip_summed")) > + return -1; > + > + if (!ASSERT_EQ(meta->cksum_meta, 0, "rx_cksum_meta")) > + return -1; > + > if (!sent_from_af_xdp) { > if (!ASSERT_NEQ(meta->rx_hash_type & XDP_RSS_TYPE_L4, 0, > "rx_hash_type")) > return -1; > diff --git a/tools/testing/selftests/bpf/progs/xdp_metadata.c > b/tools/testing/selftests/bpf/progs/xdp_metadata.c > index > 09bb8a038d528cf26c5b314cc927915ac2796bf0..ef6a5584a1876a3c47440f21dca9 > 27ec783469dc 100644 > --- a/tools/testing/selftests/bpf/progs/xdp_metadata.c > +++ b/tools/testing/selftests/bpf/progs/xdp_metadata.c > @@ -98,6 +98,7 @@ int rx(struct xdp_md *ctx) > bpf_xdp_metadata_rx_hash(ctx, &meta->rx_hash, &meta- > >rx_hash_type); > bpf_xdp_metadata_rx_vlan_tag(ctx, &meta->rx_vlan_proto, > &meta->rx_vlan_tci); > + bpf_xdp_metadata_rx_checksum(ctx, &meta->ip_summed, > +&meta->cksum_meta); > > return bpf_redirect_map(&xsk, ctx->rx_queue_index, XDP_PASS); > } diff --git a/tools/testing/selftests/bpf/xdp_metadata.h > b/tools/testing/selftests/bpf/xdp_metadata.h > index > 87318ad1117a1d677af121f11778178532e2a562..a16f71488a34e6df23fec6dd7dde > 7b7989774618 100644 > --- a/tools/testing/selftests/bpf/xdp_metadata.h > +++ b/tools/testing/selftests/bpf/xdp_metadata.h > @@ -30,6 +30,11 @@ enum xdp_meta_field { > XDP_META_FIELD_VLAN_TAG = BIT(2), > }; > > +#define XDP_CHECKSUM_NONE 0 > +#define XDP_CHECKSUM_UNNECESSARY 1 > +#define XDP_CHECKSUM_COMPLETE 2 > +#define XDP_CHECKSUM_PARTIAL 3 > + > struct xdp_meta { > union { > __u64 rx_timestamp; > @@ -48,5 +53,9 @@ struct xdp_meta { > }; > __s32 rx_vlan_tag_err; > }; > + struct { > + __u8 ip_summed; > + __u32 cksum_meta; > + }; > enum xdp_meta_field hint_valid; > }; > > -- > 2.53.0
Reviewed-by: Aleksandr Loktionov <[email protected]>
