Skip to content

Commit f9a4c2d

Browse files
tvyavahaKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
selftests/xsk: Implement packet resizing test with bpf_xdp_adjust_tail
Implement a packet resizing test using the bpf_xdp_adjust_tail() function. Add the testapp_adjust_tail function to test packet resizing capabilities. Replace packet streams for both transmit and receive with adjusted lengths. Include logic to skip the test if bpf_xdp_adjust_tail is not supported. Update the test framework to handle various packet resizing scenarios. Signed-off-by: Tushar Vyavahare <[email protected]>
1 parent 573debf commit f9a4c2d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tools/testing/selftests/bpf/xskxceiver.c

+25
Original file line numberDiff line numberDiff line change
@@ -2575,6 +2575,31 @@ static int testapp_xdp_adjust_tail(struct test_spec *test, int count)
25752575
return testapp_validate_traffic(test);
25762576
}
25772577

2578+
static int testapp_adjust_tail(struct test_spec *test, u32 value, u32 pkt_len)
2579+
{
2580+
u32 pkt_cnt = DEFAULT_BATCH_SIZE;
2581+
int ret;
2582+
2583+
test->adjust_tail_support = true;
2584+
test->adjust_tail = true;
2585+
test->total_steps = 1;
2586+
2587+
pkt_stream_replace(test->ifobj_tx, pkt_cnt, pkt_len);
2588+
pkt_stream_replace(test->ifobj_rx, pkt_cnt, pkt_len + value);
2589+
2590+
ret = testapp_xdp_adjust_tail(test, value);
2591+
if (ret)
2592+
return ret;
2593+
2594+
if (!test->adjust_tail_support) {
2595+
ksft_test_result_skip("%s %sResize pkt with bpf_xdp_adjust_tail() not supported\n",
2596+
mode_string(test), busy_poll_string(test));
2597+
return TEST_SKIP;
2598+
}
2599+
2600+
return 0;
2601+
}
2602+
25782603
static void run_pkt_test(struct test_spec *test)
25792604
{
25802605
int ret;

0 commit comments

Comments
 (0)