> -----Original Message-----
> From: Vladimir Vdovin <[email protected]>
> Sent: Wednesday, July 8, 2026 10:34 PM
> To: Lorenzo Bianconi <[email protected]>; 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]>; Loktionov, Aleksandr
> <[email protected]>; [email protected];
> [email protected]; [email protected]; linux-
> [email protected]; Vladimir Vdovin <[email protected]>
> Subject: [PATCH bpf-next v4 6/6] selftests: drv-net: add XDP RX
> checksum metadata tests
>
> Extend the xdp_metadata.py driver test with coverage for
> bpf_xdp_metadata_rx_checksum().
>
> Add an xdp_rx_csum program to xdp_metadata.bpf.o that reads the RX
> checksum verdict and stores the ip_summed bitmask, the hw checksum
> value and the checksum level into a map. The L4 port/protocol filter
> is the same as in the existing xdp_rss_hash program, so move it into a
> common helper.
>
> The new cases only run on devices whose driver implements the
> xmo_rx_checksum callback, detected through the "checksum" bit of the
> xdp-rx-metadata-features netlink attribute; on other devices they
> report SKIP:
>
> - xdp_rx_csum_valid (tcp/udp variants): traffic with a correct
> checksum sent from the remote endpoint must be reported with a
> usable verdict, i.e. CHECKSUM_UNNECESSARY and/or CHECKSUM_COMPLETE.
> CHECKSUM_NONE is a legitimate verdict for a device that does not
> verify the packets (e.g. veth reports it for locally generated
> CHECKSUM_PARTIAL traffic), so it results in SKIP rather than in a
> failure;
>
> - xdp_rx_csum_invalid: UDP packets with a corrupted L4 checksum
> (sent with the net/lib csum tool) must not be reported as
> CHECKSUM_UNNECESSARY.
>
> Signed-off-by: Vladimir Vdovin <[email protected]>
> ---
> .../selftests/drivers/net/hw/xdp_metadata.py | 110 +++++++++++++++++
> .../selftests/net/lib/xdp_metadata.bpf.c | 112 ++++++++++++++++-
> -
> 2 files changed, 209 insertions(+), 13 deletions(-)
>
> diff --git a/tools/testing/selftests/drivers/net/hw/xdp_metadata.py
> b/tools/testing/selftests/drivers/net/hw/xdp_metadata.py
> index 33a1985356d9..1a623771477b 100644
> --- a/tools/testing/selftests/drivers/net/hw/xdp_metadata.py
> +++ b/tools/testing/selftests/drivers/net/hw/xdp_metadata.py
> @@ -8,6 +8,8 @@ These tests load device-bound XDP programs from
> xdp_metadata.bpf.o that call metadata kfuncs, send traffic, and
> verify the extracted metadata via BPF maps.
> """
> +import time
> +
> from lib.py import ksft_run, ksft_eq, ksft_exit, ksft_ge, ksft_ne,
> ksft_pr from lib.py import KsftNamedVariant, ksft_variants from
> lib.py import CmdExitFailure, KsftSkipEx, NetDrvEpEnv @@ -81,8 +83,22
> @@ _RSS_KEY_TYPE = 1 _RSS_KEY_PKT_CNT = 2 _RSS_KEY_ERR_CNT = 3
>
> +_CSUM_KEY_IP_SUMMED = 0
> +_CSUM_KEY_CKSUM = 1
> +_CSUM_KEY_LEVEL = 2
> +_CSUM_KEY_PKT_CNT = 3
> +_CSUM_KEY_ERR_CNT = 4
> +
> XDP_RSS_L4 = 0x8 # BIT(3) from enum xdp_rss_hash_type
>
> +# Mirror of enum xdp_checksum from include/net/xdp.h
> XDP_CHECKSUM_NONE
> += 0x1 XDP_CHECKSUM_UNNECESSARY = 0x2 XDP_CHECKSUM_COMPLETE = 0x4
> +
> +# Fixed destination port of the net/lib csum tool _CSUM_TOOL_PORT =
> +34000
> +
>
> @ksft_variants([
> KsftNamedVariant("tcp", "tcp"),
> @@ -130,6 +146,98 @@ def test_xdp_rss_hash(cfg, proto):
> f"RSS hash type should include L4 for {proto.upper()}
> traffic")
>
>
...
> char _license[] SEC("license") = "GPL";
> --
> 2.47.0
Reviewed-by: Aleksandr Loktionov <[email protected]>