]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: bpf: adjust rx_dropped xskxceiver's test to respect tailroom
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Thu, 2 Apr 2026 15:49:58 +0000 (17:49 +0200)
committerJakub Kicinski <kuba@kernel.org>
Tue, 7 Apr 2026 01:43:52 +0000 (18:43 -0700)
Since we have changed how big user defined headroom in umem can be,
change the logic in testapp_stats_rx_dropped() so we pass updated
headroom validation in xdp_umem_reg() and still drop half of frames.

Test works on non-mbuf setup so __xsk_pool_get_rx_frame_size() that is
called on xsk_rcv_check() will not account skb_shared_info size. Taking
the tailroom size into account in test being fixed is needed as
xdp_umem_reg() defaults to respect it.

Reviewed-by: Björn Töpel <bjorn@kernel.org>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Link: https://patch.msgid.link/20260402154958.562179-9-maciej.fijalkowski@intel.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/bpf/prog_tests/test_xsk.c

index ee60bcc22ee4f3a1014ec15ebde35ebcb813394e..7950c504ed2899883ebfd52c295d41787d929eaa 100644 (file)
@@ -1959,15 +1959,17 @@ int testapp_headroom(struct test_spec *test)
 
 int testapp_stats_rx_dropped(struct test_spec *test)
 {
+       u32 umem_tr = test->ifobj_tx->umem_tailroom;
+
        if (test->mode == TEST_MODE_ZC) {
                ksft_print_msg("Can not run RX_DROPPED test for ZC mode\n");
                return TEST_SKIP;
        }
 
-       if (pkt_stream_replace_half(test, MIN_PKT_SIZE * 4, 0))
+       if (pkt_stream_replace_half(test, (MIN_PKT_SIZE * 3) + umem_tr, 0))
                return TEST_FAILURE;
        test->ifobj_rx->umem->frame_headroom = test->ifobj_rx->umem->frame_size -
-               XDP_PACKET_HEADROOM - MIN_PKT_SIZE * 3;
+               XDP_PACKET_HEADROOM - (MIN_PKT_SIZE * 2) - umem_tr;
        if (pkt_stream_receive_half(test))
                return TEST_FAILURE;
        test->ifobj_rx->validation_func = validate_rx_dropped;