[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250220084147.94494-6-tushar.vyavahare@intel.com>
Date: Thu, 20 Feb 2025 08:41:46 +0000
From: Tushar Vyavahare <tushar.vyavahare@...el.com>
To: bpf@...r.kernel.org
Cc: netdev@...r.kernel.org,
bjorn@...nel.org,
magnus.karlsson@...el.com,
maciej.fijalkowski@...el.com,
jonathan.lemon@...il.com,
davem@...emloft.net,
kuba@...nel.org,
pabeni@...hat.com,
ast@...nel.org,
daniel@...earbox.net,
tushar.vyavahare@...el.com
Subject: [PATCH bpf-next 5/6] 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 <tushar.vyavahare@...el.com>
---
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
Powered by blists - more mailing lists