From: Weqaar Janjua <weqaar.janjua@gmail.com>
To: bpf@vger.kernel.org, netdev@vger.kernel.org,
daniel@iogearbox.net, ast@kernel.org, yhs@fb.com,
magnus.karlsson@gmail.com, bjorn.topel@intel.com
Cc: Weqaar Janjua <weqaar.a.janjua@intel.com>,
shuah@kernel.org, skhan@linuxfoundation.org,
linux-kselftest@vger.kernel.org, anders.roxell@linaro.org,
jonathan.lemon@gmail.com
Subject: [PATCH bpf-next v3 3/5] selftests/bpf: xsk selftests - DRV POLL, NOPOLL
Date: Wed, 25 Nov 2020 18:37:47 +0000 [thread overview]
Message-ID: <20201125183749.13797-4-weqaar.a.janjua@intel.com> (raw)
In-Reply-To: <20201125183749.13797-1-weqaar.a.janjua@intel.com>
Adds following tests:
2. AF_XDP DRV/Native mode
Works on any netdevice with XDP_REDIRECT support, driver dependent.
Processes packets before SKB allocation. Provides better performance
than SKB. Driver hook available just after DMA of buffer descriptor.
a. nopoll
b. poll
* Only copy mode is supported because veth does not currently support
zero-copy mode
Signed-off-by: Weqaar Janjua <weqaar.a.janjua@intel.com>
---
tools/testing/selftests/bpf/test_xsk.sh | 24 ++++++++++++++++++++++++
tools/testing/selftests/bpf/xdpxceiver.c | 22 +++++++++++++++++++---
tools/testing/selftests/bpf/xdpxceiver.h | 1 +
3 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 9c3812bd353f..375f9590db90 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -152,6 +152,30 @@ retval=$?
test_status $retval "${TEST_NAME}"
statusList+=($retval)
+### TEST 3
+TEST_NAME="DRV NOPOLL"
+
+vethXDPnative ${VETH0} ${VETH1} ${NS1}
+
+params=("-N")
+execxdpxceiver params
+
+retval=$?
+test_status $retval "${TEST_NAME}"
+statusList+=($retval)
+
+### TEST 4
+TEST_NAME="DRV POLL"
+
+vethXDPnative ${VETH0} ${VETH1} ${NS1}
+
+params=("-N" "-p")
+execxdpxceiver params
+
+retval=$?
+test_status $retval "${TEST_NAME}"
+statusList+=($retval)
+
## END TESTS
cleanup_exit ${VETH0} ${VETH1} ${NS1}
diff --git a/tools/testing/selftests/bpf/xdpxceiver.c b/tools/testing/selftests/bpf/xdpxceiver.c
index e6c448668cd9..3027247bbb4e 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -27,7 +27,16 @@
* a. nopoll - soft-irq processing
* b. poll - using poll() syscall
*
- * Total tests: 2
+ * 2. AF_XDP DRV/Native mode
+ * Works on any netdevice with XDP_REDIRECT support, driver dependent. Processes
+ * packets before SKB allocation. Provides better performance than SKB. Driver
+ * hook available just after DMA of buffer descriptor.
+ * a. nopoll
+ * b. poll
+ * - Only copy mode is supported because veth does not currently support
+ * zero-copy mode
+ *
+ * Total tests: 4
*
* Flow:
* -----
@@ -87,7 +96,7 @@ static void __exit_with_error(int error, const char *file, const char *func, int
#define exit_with_error(error) __exit_with_error(error, __FILE__, __func__, __LINE__)
#define print_ksft_result(void)\
- (ksft_test_result_pass("PASS: %s %s\n", uut ? "" : "SKB", opt_poll ? "POLL" : "NOPOLL"))
+ (ksft_test_result_pass("PASS: %s %s\n", uut ? "DRV" : "SKB", opt_poll ? "POLL" : "NOPOLL"))
static void pthread_init_mutex(void)
{
@@ -310,6 +319,7 @@ static struct option long_options[] = {
{"queue", optional_argument, 0, 'q'},
{"poll", no_argument, 0, 'p'},
{"xdp-skb", no_argument, 0, 'S'},
+ {"xdp-native", no_argument, 0, 'N'},
{"copy", no_argument, 0, 'c'},
{"debug", optional_argument, 0, 'D'},
{"tx-pkt-count", optional_argument, 0, 'C'},
@@ -325,6 +335,7 @@ static void usage(const char *prog)
" -q, --queue=n Use queue n (default 0)\n"
" -p, --poll Use poll syscall\n"
" -S, --xdp-skb=n Use XDP SKB mode\n"
+ " -N, --xdp-native=n Enforce XDP DRV (native) mode\n"
" -c, --copy Force copy mode\n"
" -D, --debug Debug mode - dump packets L2 - L5\n"
" -C, --tx-pkt-count=n Number of packets to send\n";
@@ -416,7 +427,7 @@ static void parse_command_line(int argc, char **argv)
opterr = 0;
for (;;) {
- c = getopt_long(argc, argv, "i:q:pScDC:", long_options, &option_index);
+ c = getopt_long(argc, argv, "i:q:pSNcDC:", long_options, &option_index);
if (c == -1)
break;
@@ -446,6 +457,11 @@ static void parse_command_line(int argc, char **argv)
opt_xdp_bind_flags |= XDP_COPY;
uut = ORDER_CONTENT_VALIDATE_XDP_SKB;
break;
+ case 'N':
+ opt_xdp_flags |= XDP_FLAGS_DRV_MODE;
+ opt_xdp_bind_flags |= XDP_COPY;
+ uut = ORDER_CONTENT_VALIDATE_XDP_DRV;
+ break;
case 'c':
opt_xdp_bind_flags |= XDP_COPY;
break;
diff --git a/tools/testing/selftests/bpf/xdpxceiver.h b/tools/testing/selftests/bpf/xdpxceiver.h
index 32ee33311141..dba47e818466 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.h
+++ b/tools/testing/selftests/bpf/xdpxceiver.h
@@ -44,6 +44,7 @@ typedef __u8 u8;
enum TESTS {
ORDER_CONTENT_VALIDATE_XDP_SKB = 0,
+ ORDER_CONTENT_VALIDATE_XDP_DRV = 1,
};
u8 uut;
--
2.20.1
next prev parent reply other threads:[~2020-11-25 18:38 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-25 18:37 [PATCH bpf-next v3 0/5] selftests/bpf: xsk selftests Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 1/5] selftests/bpf: xsk selftests framework Weqaar Janjua
2020-11-26 6:44 ` Yonghong Song
2020-11-26 9:01 ` Björn Töpel
2020-11-26 21:22 ` Weqaar Janjua
2020-11-27 4:19 ` Yonghong Song
2020-11-27 17:54 ` Weqaar Janjua
2020-11-28 3:13 ` Yonghong Song
2020-12-07 21:55 ` Weqaar Janjua
2020-12-08 3:48 ` Yonghong Song
2020-11-25 18:37 ` [PATCH bpf-next v3 2/5] selftests/bpf: xsk selftests - SKB POLL, NOPOLL Weqaar Janjua
2020-11-27 4:31 ` Yonghong Song
2020-11-27 9:01 ` Weqaar Janjua
2020-11-25 18:37 ` Weqaar Janjua [this message]
2020-11-25 18:37 ` [PATCH bpf-next v3 4/5] selftests/bpf: xsk selftests - Socket Teardown - SKB, DRV Weqaar Janjua
2020-11-25 18:37 ` [PATCH bpf-next v3 5/5] selftests/bpf: xsk selftests - Bi-directional Sockets " Weqaar Janjua
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201125183749.13797-4-weqaar.a.janjua@intel.com \
--to=weqaar.janjua@gmail.com \
--cc=anders.roxell@linaro.org \
--cc=ast@kernel.org \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=jonathan.lemon@gmail.com \
--cc=linux-kselftest@vger.kernel.org \
--cc=magnus.karlsson@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=weqaar.a.janjua@intel.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.