Subject: Re: [PATCH net-next 4/4] selftests: drv-net: xdp: Add rss_hash metadata tests

From: Jakub Kicinski <[email-masked]>
Date: Fri, 27 Feb 2026 17:14:01 -0800

On Fri, 27 Feb 2026 11:40:20 -0600 Chris J Arges wrote:
> This test loads xdp_metadata.bpf which calls bpf_xdp_metadata_rx_hash() on
> incoming packets. The metadata from that packet is then sent to a BPF
> map for validation. It borrows structure from xdp.py, reusing common
> functions.
> 
> The test checks the device's xdp-rx-metadata-features via netlink
> before running and skips on devices that do not advertise hash support.
> This allows the tests to pass, but one can override the device and test on
> HW or veth devices.
> 
> The test is fairly simple and just verifies that a TCP or UDP packet can be
> identified as an L4 flow. This minimal test also passes if run on a veth
> device.

Thanks for adding the test! The series doesn't seem to apply, I think
you'll need to rebase on latest net-next and repost.

> diff --git a/tools/testing/selftests/drivers/net/Makefile b/tools/testing/selftests/drivers/net/Makefile
> index 8154d6d429d3..6f9708e8d05a 100644
> --- a/tools/testing/selftests/drivers/net/Makefile
> +++ b/tools/testing/selftests/drivers/net/Makefile

the drivers/net tests are expected to run against netdevsim.
You'll need to implement the xmo in netdevsim.. Or does it
already support them given it uses xdp_generic under the hood?
Alternatively you can move the test under hw/ and not bother.

> +# BPF map keys matching the enums in xdp_metadata.bpf.c
> +_SETUP_KEY_PORT = 1
> +
> +_RSS_KEY_HASH = 0
> +_RSS_KEY_TYPE = 1
> +_RSS_KEY_PKT_CNT = 2
> +_RSS_KEY_ERR_CNT = 3

Does pylint complain about those ? We try to keep pylint --disable=R
clean for new tests.

> +    ksft_ge(pkt_cnt, 1, "should have received at least one packet")
> +    ksft_pr(f"  RSS hash error count: {err_cnt}")

Does it randomly report non-zero?
I'm wondering why not ksft_eq(err_cnt, 0, comment='RSS hash error count')

> +    ksft_ne(hash_val, 0,
> +            f"RSS hash should be non-zero for {proto.upper()} traffic")
> +    ksft_pr(f"  RSS hash: {hash_val:#010x}")
> +
> +    ksft_pr(f"  RSS hash type: {hash_type:#06x}")
> +    XDP_RSS_L4 = 0x8  # BIT(3) from enum xdp_rss_hash_type
> +    ksft_ne(hash_type & XDP_RSS_L4, 0,
> +            f"RSS hash type should include L4 for {proto.upper()} traffic")
> +
> +
> +def main():

add:

	""" Ksft boiler plate main """

to silence pylint?