[PATCH bpf-next 5/6] selftests/xsk: Implement packet resizing test with bpf_xdp_adjust_tail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <tushar.vyavahare@xxxxxxxxx>
---
 tools/testing/selftests/bpf/xskxceiver.c | 25 ++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index ccf35b73418b..52ce0217d3d5 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -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;
-- 
2.34.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux