From: Ciara Loftus <ciara.loftus@intel.com>
To: netdev@vger.kernel.org, bpf@vger.kernel.org,
magnus.karlsson@intel.com, bjorn@kernel.org,
weqaar.a.janjua@intel.com
Cc: Ciara Loftus <ciara.loftus@intel.com>
Subject: [PATCH bpf-next v2 6/6] selftests/bpf: XSK_TRACE_DROP_FQ_EMPTY test
Date: Tue, 26 Jan 2021 07:52:39 +0000 [thread overview]
Message-ID: <20210126075239.25378-7-ciara.loftus@intel.com> (raw)
In-Reply-To: <20210126075239.25378-1-ciara.loftus@intel.com>
This test skips the populating of the fill queue which
causes packet drops and traces reporting the drop. The
test validates that these traces were successfully
generated.
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
tools/testing/selftests/bpf/test_xsk.sh | 24 ++++++++++++++++++++++++
tools/testing/selftests/bpf/xdpxceiver.c | 13 +++++++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/bpf/test_xsk.sh b/tools/testing/selftests/bpf/test_xsk.sh
index 95ceee151de1..997ba0aa79db 100755
--- a/tools/testing/selftests/bpf/test_xsk.sh
+++ b/tools/testing/selftests/bpf/test_xsk.sh
@@ -295,6 +295,30 @@ retval=$?
test_status $retval "${TEST_NAME}"
statusList+=($retval)
+### TEST 14
+TEST_NAME="SKB TRACE DROP FQ_EMPTY"
+
+vethXDPgeneric ${VETH0} ${VETH1} ${NS1}
+
+params=("-S" "-t" "2" "-C" "${TRACEPKTS}")
+execxdpxceiver params
+
+retval=$?
+test_status $retval "${TEST_NAME}"
+statusList+=($retval)
+
+### TEST 15
+TEST_NAME="DRV TRACE DROP FQ_EMPTY"
+
+vethXDPnative ${VETH0} ${VETH1} ${NS1}
+
+params=("-N" "-t" "2" "-C" "${TRACEPKTS}")
+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 bee10bb686fc..49c2d42b5882 100644
--- a/tools/testing/selftests/bpf/xdpxceiver.c
+++ b/tools/testing/selftests/bpf/xdpxceiver.c
@@ -37,6 +37,8 @@
* Reduce the RXQ size and do not read from it. Validate traces.
* f. Tracing - XSK_TRACE_DROP_PKT_TOO_BIG
* Increase the headroom size and send packets. Validate traces.
+ * g. Tracing - XSK_TRACE_DROP_FQ_EMPTY
+ * Do not populate the fill queue and send packets. Validate traces.
*
* 2. AF_XDP DRV/Native mode
* Works on any netdevice with XDP_REDIRECT support, driver dependent. Processes
@@ -50,8 +52,9 @@
* zero-copy mode
* e. Tracing - XSK_TRACE_DROP_RXQ_FULL
* f. Tracing - XSK_TRACE_DROP_PKT_TOO_BIG
+ * g. Tracing - XSK_TRACE_DROP_FQ_EMPTY
*
- * Total tests: 12
+ * Total tests: 14
*
* Flow:
* -----
@@ -981,7 +984,9 @@ static void *worker_testapp_validate(void *arg)
thread_common_ops(ifobject, bufs, &sync_mutex_tx, &spinning_rx);
ksft_print_msg("Interface [%s] vector [Rx]\n", ifobject->ifname);
- xsk_populate_fill_ring(ifobject->umem);
+ if (opt_trace_code != XSK_TRACE_DROP_FQ_EMPTY)
+ xsk_populate_fill_ring(ifobject->umem);
+
TAILQ_INIT(&head);
if (debug_pkt_dump) {
@@ -1188,6 +1193,10 @@ int main(int argc, char **argv)
expected_traces = opt_pkt_count;
reason_str = "packet too big";
break;
+ case XSK_TRACE_DROP_FQ_EMPTY:
+ expected_traces = opt_pkt_count;
+ reason_str = "fq empty";
+ break;
default:
ksft_test_result_fail("ERROR: unsupported trace %i\n",
opt_trace_code);
--
2.17.1
next prev parent reply other threads:[~2021-01-26 18:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-26 7:52 [PATCH bpf-next v2 0/6] AF_XDP Packet Drop Tracing Ciara Loftus
2021-01-26 7:52 ` [PATCH bpf-next v2 1/6] xsk: add tracepoints for packet drops Ciara Loftus
2021-01-26 22:51 ` Daniel Borkmann
2021-01-27 14:10 ` Loftus, Ciara
2021-01-27 23:15 ` Daniel Borkmann
2021-01-26 7:52 ` [PATCH bpf-next v2 2/6] selftests/bpf: restructure setting the packet count Ciara Loftus
2021-01-26 7:52 ` [PATCH bpf-next v2 3/6] selftests/bpf: add framework for xsk selftests Ciara Loftus
2021-01-26 7:52 ` [PATCH bpf-next v2 4/6] selftests/bpf: XSK_TRACE_DROP_RXQ_FULL test Ciara Loftus
2021-01-26 7:52 ` [PATCH bpf-next v2 5/6] selftests/bpf: XSK_TRACE_DROP_PKT_TOO_BIG test Ciara Loftus
2021-01-26 7:52 ` Ciara Loftus [this message]
2021-01-26 8:45 ` [PATCH bpf-next v2 0/6] AF_XDP Packet Drop Tracing Toke Høiland-Jørgensen
2021-01-27 10:17 ` Loftus, Ciara
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=20210126075239.25378-7-ciara.loftus@intel.com \
--to=ciara.loftus@intel.com \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=magnus.karlsson@intel.com \
--cc=netdev@vger.kernel.org \
--cc=weqaar.a.janjua@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).