The xsk tests take the size of the shared info off the UMEM headroom of RX_DROPPED and off the growth of XDP_ADJUST_TAIL_GROW_MULTI_BUFF, as zero-copy multi-buffer pools kept it at the end of each chunk. The previous patch moves the shared info into the buffer pool, so the UMEM headroom limit and the frame size no longer leave room for it. Drop it from both tests. Signed-off-by: Björn Töpel --- tools/testing/selftests/bpf/prog_tests/test_xsk.c | 10 ++++------ tools/testing/selftests/bpf/prog_tests/test_xsk.h | 2 -- tools/testing/selftests/bpf/prog_tests/xsk.c | 13 +------------ tools/testing/selftests/bpf/xskxceiver.c | 15 +-------------- 4 files changed, 6 insertions(+), 34 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.c b/tools/testing/selftests/bpf/prog_tests/test_xsk.c index 4549358cc8c2..7145a36e6ea2 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.c +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.c @@ -1984,17 +1984,16 @@ int testapp_headroom(struct test_spec *test) int testapp_stats_rx_dropped(struct test_spec *test) { struct xsk_umem_info *umem = test->ifobj_rx->xsk->umem; - 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 * 3) + umem_tr, 0)) + if (pkt_stream_replace_half(test, MIN_PKT_SIZE * 4, 0)) return TEST_FAILURE; umem->frame_headroom = umem->frame_size - - XDP_PACKET_HEADROOM - (MIN_PKT_SIZE * 2) - umem_tr; + XDP_PACKET_HEADROOM - MIN_PKT_SIZE * 3; if (pkt_stream_receive_half(test)) return TEST_FAILURE; test->ifobj_rx->validation_func = validate_rx_dropped; @@ -2592,12 +2591,11 @@ int testapp_adjust_tail_grow_mb(struct test_spec *test) * pkt_len, expect that it will be broken down to 2 descs each * with 3k payload; * - * 4k is truesize, 3k payload, 256 HR, 320 TR; + * 4k is truesize, 3k payload, 256 HR; */ grow_size = XSK_UMEM__MAX_FRAME_SIZE - XSK_UMEM__LARGE_FRAME_SIZE - - XDP_PACKET_HEADROOM - - test->ifobj_tx->umem_tailroom; + XDP_PACKET_HEADROOM; test->mtu = MAX_ETH_JUMBO_SIZE; return testapp_adjust_tail(test, grow_size, XSK_UMEM__LARGE_FRAME_SIZE * 2); diff --git a/tools/testing/selftests/bpf/prog_tests/test_xsk.h b/tools/testing/selftests/bpf/prog_tests/test_xsk.h index 03753ddc5dcd..1b816226597b 100644 --- a/tools/testing/selftests/bpf/prog_tests/test_xsk.h +++ b/tools/testing/selftests/bpf/prog_tests/test_xsk.h @@ -32,7 +32,6 @@ #define USLEEP_MAX 10000 #define MAX_SKB_FRAGS_PATH "/proc/sys/net/core/max_skb_frags" -#define SMP_CACHE_BYTES_PATH "/sys/devices/system/cpu/cpu0/cache/index0/coherency_line_size" extern bool opt_verbose; #define print_verbose(x...) do { if (opt_verbose) ksft_print_msg(x); } while (0) @@ -137,7 +136,6 @@ struct ifobject { int mtu; u32 bind_flags; u32 xdp_zc_max_segs; - u32 umem_tailroom; u32 max_skb_frags; bool tx_on; bool rx_on; diff --git a/tools/testing/selftests/bpf/prog_tests/xsk.c b/tools/testing/selftests/bpf/prog_tests/xsk.c index 772f3dd7ce64..b3758b9bf2ec 100644 --- a/tools/testing/selftests/bpf/prog_tests/xsk.c +++ b/tools/testing/selftests/bpf/prog_tests/xsk.c @@ -62,7 +62,7 @@ int configure_ifobj(struct ifobject *tx, struct ifobject *rx) static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode) { - u32 max_frags, umem_tailroom, cache_line_size; + u32 max_frags; struct ifobject *ifobj_tx, *ifobj_rx; struct test_spec test; int ret; @@ -85,10 +85,6 @@ static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode) ifobj_tx->set_ring.default_rx = ifobj_tx->ring.rx_pending; } - cache_line_size = read_procfs_val(SMP_CACHE_BYTES_PATH); - if (!cache_line_size) - cache_line_size = 64; - max_frags = read_procfs_val(MAX_SKB_FRAGS_PATH); if (!max_frags) max_frags = 17; @@ -96,13 +92,6 @@ static void test_xsk(const struct test_spec *test_to_run, enum test_mode mode) ifobj_tx->max_skb_frags = max_frags; ifobj_rx->max_skb_frags = max_frags; - /* 48 bytes is a part of skb_shared_info w/o frags array; - * 16 bytes is sizeof(skb_frag_t) - */ - umem_tailroom = ALIGN(48 + (max_frags * 16), cache_line_size); - ifobj_tx->umem_tailroom = umem_tailroom; - ifobj_rx->umem_tailroom = umem_tailroom; - if (!ASSERT_OK(init_iface(ifobj_rx, worker_testapp_validate_rx), "init RX")) goto delete_rx; if (!ASSERT_OK(init_iface(ifobj_tx, worker_testapp_validate_tx), "init TX")) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 7dad8556a722..a385464cfaf8 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -334,7 +334,7 @@ static void print_tests(void) int main(int argc, char **argv) { const size_t total_tests = ARRAY_SIZE(tests) + ARRAY_SIZE(ci_skip_tests); - u32 cache_line_size, max_frags, umem_tailroom; + u32 max_frags; struct pkt_stream *rx_pkt_stream_default; struct pkt_stream *tx_pkt_stream_default; struct ifobject *ifobj_tx, *ifobj_rx; @@ -356,12 +356,6 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); - cache_line_size = read_procfs_val(SMP_CACHE_BYTES_PATH); - if (!cache_line_size) { - ksft_print_msg("Can't get SMP_CACHE_BYTES from system, using default (64)\n"); - cache_line_size = 64; - } - max_frags = read_procfs_val(MAX_SKB_FRAGS_PATH); if (!max_frags) { ksft_print_msg("Can't get MAX_SKB_FRAGS from system, using default (17)\n"); @@ -370,13 +364,6 @@ int main(int argc, char **argv) ifobj_tx->max_skb_frags = max_frags; ifobj_rx->max_skb_frags = max_frags; - /* 48 bytes is a part of skb_shared_info w/o frags array; - * 16 bytes is sizeof(skb_frag_t) - */ - umem_tailroom = ALIGN(48 + (max_frags * 16), cache_line_size); - ifobj_tx->umem_tailroom = umem_tailroom; - ifobj_rx->umem_tailroom = umem_tailroom; - parse_command_line(ifobj_tx, ifobj_rx, argc, argv); if (opt_print_tests) { -- 2.56.1