Skip to content

Commit

Permalink
selftests/xsk: Implement packet resizing test with bpf_xdp_adjust_tail
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tvyavaha authored and Kernel Patches Daemon committed Feb 21, 2025
1 parent 6dac82b commit 68ad143
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tools/testing/selftests/bpf/xskxceiver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2575,6 +2575,31 @@ static int testapp_xdp_adjust_tail(struct test_spec *test, int count)
return testapp_validate_traffic(test);
}

static int testapp_adjust_tail(struct test_spec *test, u32 value, u32 pkt_len)
{
u32 pkt_cnt = DEFAULT_BATCH_SIZE;
int ret;

test->adjust_tail_support = true;
test->adjust_tail = true;
test->total_steps = 1;

pkt_stream_replace(test->ifobj_tx, pkt_cnt, pkt_len);
pkt_stream_replace(test->ifobj_rx, pkt_cnt, pkt_len + value);

ret = testapp_xdp_adjust_tail(test, value);
if (ret)
return ret;

if (!test->adjust_tail_support) {
ksft_test_result_skip("%s %sResize pkt with bpf_xdp_adjust_tail() not supported\n",
mode_string(test), busy_poll_string(test));
return TEST_SKIP;
}

return 0;
}

static void run_pkt_test(struct test_spec *test)
{
int ret;
Expand Down

0 comments on commit 68ad143

Please sign in to comment.