From: Magnus Karlsson <magnus.karlsson@gmail.com>
To: magnus.karlsson@intel.com, bjorn@kernel.org, ast@kernel.org,
daniel@iogearbox.net, netdev@vger.kernel.org,
maciej.fijalkowski@intel.com, bpf@vger.kernel.org, yhs@fb.com,
andrii@kernel.org, martin.lau@linux.dev, song@kernel.org,
john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com,
haoluo@google.com, jolsa@kernel.org, tirthendu.sarkar@intel.com
Cc: jonathan.lemon@gmail.com
Subject: [PATCH bpf-next v3 14/15] selftests/xsk: automatically restore packet stream
Date: Wed, 11 Jan 2023 10:35:25 +0100 [thread overview]
Message-ID: <20230111093526.11682-15-magnus.karlsson@gmail.com> (raw)
In-Reply-To: <20230111093526.11682-1-magnus.karlsson@gmail.com>
From: Magnus Karlsson <magnus.karlsson@intel.com>
Automatically restore the default packet stream if needed at the end
of each test. This so that test writers do not forget to do this.
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
---
tools/testing/selftests/bpf/xskxceiver.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 11e4f29d40f7..66863504c76a 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1501,8 +1501,6 @@ static void testapp_stats_tx_invalid_descs(struct test_spec *test)
pkt_stream_replace_half(test, XSK_UMEM__INVALID_FRAME_SIZE, 0);
test->ifobj_tx->validation_func = validate_tx_invalid_descs;
testapp_validate_traffic(test);
-
- pkt_stream_restore_default(test);
}
static void testapp_stats_rx_full(struct test_spec *test)
@@ -1518,8 +1516,6 @@ static void testapp_stats_rx_full(struct test_spec *test)
test->ifobj_rx->release_rx = false;
test->ifobj_rx->validation_func = validate_rx_full;
testapp_validate_traffic(test);
-
- pkt_stream_restore_default(test);
}
static void testapp_stats_fill_empty(struct test_spec *test)
@@ -1534,8 +1530,6 @@ static void testapp_stats_fill_empty(struct test_spec *test)
test->ifobj_rx->use_fill_ring = false;
test->ifobj_rx->validation_func = validate_fill_empty;
testapp_validate_traffic(test);
-
- pkt_stream_restore_default(test);
}
/* Simple test */
@@ -1568,7 +1562,6 @@ static bool testapp_unaligned(struct test_spec *test)
test->ifobj_rx->pkt_stream->use_addr_for_fill = true;
testapp_validate_traffic(test);
- pkt_stream_restore_default(test);
return true;
}
@@ -1578,7 +1571,6 @@ static void testapp_single_pkt(struct test_spec *test)
pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts));
testapp_validate_traffic(test);
- pkt_stream_restore_default(test);
}
static void testapp_invalid_desc(struct test_spec *test)
@@ -1619,7 +1611,6 @@ static void testapp_invalid_desc(struct test_spec *test)
pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts));
testapp_validate_traffic(test);
- pkt_stream_restore_default(test);
}
static void testapp_xdp_drop(struct test_spec *test)
@@ -1640,7 +1631,6 @@ static void testapp_xdp_drop(struct test_spec *test)
pkt_stream_receive_half(test);
testapp_validate_traffic(test);
- pkt_stream_restore_default(test);
xsk_detach_xdp_program(ifobj->ifindex, ifobj->xdp_flags);
err = xsk_attach_xdp_program(ifobj->xdp_progs->progs.xsk_def_prog, ifobj->ifindex,
ifobj->xdp_flags);
@@ -1659,8 +1649,6 @@ static void testapp_poll_txq_tmout(struct test_spec *test)
test->ifobj_tx->umem->frame_size = 2048;
pkt_stream_replace(test, 2 * DEFAULT_PKT_CNT, 2048);
testapp_validate_traffic_single_thread(test, test->ifobj_tx);
-
- pkt_stream_restore_default(test);
}
static void testapp_poll_rxq_tmout(struct test_spec *test)
@@ -1766,8 +1754,6 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
test->ifobj_rx->umem->frame_size = 2048;
pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
testapp_validate_traffic(test);
-
- pkt_stream_restore_default(test);
break;
case TEST_TYPE_RX_POLL:
test->ifobj_rx->use_poll = true;
@@ -1822,6 +1808,7 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
if (!test->fail)
ksft_test_result_pass("PASS: %s %s%s\n", mode_string(test), busy_poll_string(test),
test->name);
+ pkt_stream_restore_default(test);
}
static struct ifobject *ifobject_create(void)
--
2.34.1
next prev parent reply other threads:[~2023-01-11 9:39 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-11 9:35 [PATCH bpf-next v3 00/15] selftests/xsk: speed-ups, fixes, and new XDP programs Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 01/15] selftests/xsk: print correct payload for packet dump Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 02/15] selftests/xsk: do not close unused file descriptors Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 03/15] selftests/xsk: submit correct number of frames in populate_fill_ring Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 04/15] selftests/xsk: print correct error codes when exiting Magnus Karlsson
2023-01-12 2:23 ` Alexei Starovoitov
2023-01-12 9:29 ` Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 05/15] selftests/xsk: remove unused variable outstanding_tx Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 06/15] selftests/xsk: add debug option for creating netdevs Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 07/15] selftests/xsk: replace asm acquire/release implementations Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 08/15] selftests/xsk: remove namespaces Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 09/15] selftests/xsk: load and attach XDP program only once per mode Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 10/15] selftests/xsk: remove unnecessary code in control path Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 11/15] selftests/xsk: get rid of built-in XDP program Magnus Karlsson
2023-01-12 2:16 ` Alexei Starovoitov
2023-01-11 9:35 ` [PATCH bpf-next v3 12/15] selftests/xsk: add test when some packets are XDP_DROPed Magnus Karlsson
2023-01-11 9:35 ` [PATCH bpf-next v3 13/15] selftests/xsk: merge dual and single thread dispatchers Magnus Karlsson
2023-01-11 9:35 ` Magnus Karlsson [this message]
2023-01-11 9:35 ` [PATCH bpf-next v3 15/15] selftests/xsk: automatically switch XDP programs Magnus Karlsson
2023-01-12 2:30 ` [PATCH bpf-next v3 00/15] selftests/xsk: speed-ups, fixes, and new " patchwork-bot+netdevbpf
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=20230111093526.11682-15-magnus.karlsson@gmail.com \
--to=magnus.karlsson@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bjorn@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=kpsingh@kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=magnus.karlsson@intel.com \
--cc=martin.lau@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=tirthendu.sarkar@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox