2023-03-19 19:58:42

by Kal Cutter Conley

[permalink] [raw]
Subject: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes

Add tests:
- RUN_TO_COMPLETION_8K_FRAME_SIZE: frame_size=8192 (aligned)
- RUN_TO_COMPLETION_9K_FRAME_SIZE: frame_size=9000 (unaligned)

Signed-off-by: Kal Conley <[email protected]>
---
tools/testing/selftests/bpf/xskxceiver.c | 24 ++++++++++++++++++++++++
tools/testing/selftests/bpf/xskxceiver.h | 2 ++
2 files changed, 26 insertions(+)

diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 7a47ef28fbce..f10ff8c5e9c5 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1789,6 +1789,30 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
testapp_validate_traffic(test);
break;
+ case TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME:
+ if (!hugepages_present(test->ifobj_tx)) {
+ ksft_test_result_skip("No 2M huge pages present.\n");
+ return;
+ }
+ test_spec_set_name(test, "RUN_TO_COMPLETION_8K_FRAME_SIZE");
+ test->ifobj_tx->umem->frame_size = 8192;
+ test->ifobj_rx->umem->frame_size = 8192;
+ pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
+ testapp_validate_traffic(test);
+ break;
+ case TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME:
+ if (!hugepages_present(test->ifobj_tx)) {
+ ksft_test_result_skip("No 2M huge pages present.\n");
+ return;
+ }
+ test_spec_set_name(test, "RUN_TO_COMPLETION_9K_FRAME_SIZE");
+ test->ifobj_tx->umem->frame_size = 9000;
+ test->ifobj_rx->umem->frame_size = 9000;
+ test->ifobj_tx->umem->unaligned_mode = true;
+ test->ifobj_rx->umem->unaligned_mode = true;
+ pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
+ testapp_validate_traffic(test);
+ break;
case TEST_TYPE_RX_POLL:
test->ifobj_rx->use_poll = true;
test_spec_set_name(test, "POLL_RX");
diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
index 3e8ec7d8ec32..ff723b6d7852 100644
--- a/tools/testing/selftests/bpf/xskxceiver.h
+++ b/tools/testing/selftests/bpf/xskxceiver.h
@@ -70,6 +70,8 @@ enum test_mode {
enum test_type {
TEST_TYPE_RUN_TO_COMPLETION,
TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME,
+ TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME,
+ TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME,
TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT,
TEST_TYPE_RX_POLL,
TEST_TYPE_TX_POLL,
--
2.39.2



2023-03-21 08:47:09

by Magnus Karlsson

[permalink] [raw]
Subject: Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes

On Sun, 19 Mar 2023 at 21:07, Kal Conley <[email protected]> wrote:
>
> Add tests:
> - RUN_TO_COMPLETION_8K_FRAME_SIZE: frame_size=8192 (aligned)
> - RUN_TO_COMPLETION_9K_FRAME_SIZE: frame_size=9000 (unaligned)
>
> Signed-off-by: Kal Conley <[email protected]>
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 24 ++++++++++++++++++++++++
> tools/testing/selftests/bpf/xskxceiver.h | 2 ++
> 2 files changed, 26 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 7a47ef28fbce..f10ff8c5e9c5 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -1789,6 +1789,30 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
> pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> testapp_validate_traffic(test);
> break;
> + case TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME:
> + if (!hugepages_present(test->ifobj_tx)) {
> + ksft_test_result_skip("No 2M huge pages present.\n");
> + return;
> + }
> + test_spec_set_name(test, "RUN_TO_COMPLETION_8K_FRAME_SIZE");
> + test->ifobj_tx->umem->frame_size = 8192;
> + test->ifobj_rx->umem->frame_size = 8192;
> + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> + testapp_validate_traffic(test);
> + break;
> + case TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME:

TEST_TYPE_UNALIGNED_9K_FRAME

> + if (!hugepages_present(test->ifobj_tx)) {
> + ksft_test_result_skip("No 2M huge pages present.\n");
> + return;
> + }
> + test_spec_set_name(test, "RUN_TO_COMPLETION_9K_FRAME_SIZE");

UNALIGNED_MODE_9K

> + test->ifobj_tx->umem->frame_size = 9000;
> + test->ifobj_rx->umem->frame_size = 9000;
> + test->ifobj_tx->umem->unaligned_mode = true;
> + test->ifobj_rx->umem->unaligned_mode = true;
> + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> + testapp_validate_traffic(test);
> + break;
> case TEST_TYPE_RX_POLL:
> test->ifobj_rx->use_poll = true;
> test_spec_set_name(test, "POLL_RX");
> diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
> index 3e8ec7d8ec32..ff723b6d7852 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.h
> +++ b/tools/testing/selftests/bpf/xskxceiver.h
> @@ -70,6 +70,8 @@ enum test_mode {
> enum test_type {
> TEST_TYPE_RUN_TO_COMPLETION,
> TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME,
> + TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME,
> + TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME,
> TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT,
> TEST_TYPE_RX_POLL,
> TEST_TYPE_TX_POLL,
> --
> 2.39.2
>

2023-03-21 08:49:03

by Magnus Karlsson

[permalink] [raw]
Subject: Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes

On Tue, 21 Mar 2023 at 09:45, Magnus Karlsson <[email protected]> wrote:
>
> On Sun, 19 Mar 2023 at 21:07, Kal Conley <[email protected]> wrote:
> >
> > Add tests:
> > - RUN_TO_COMPLETION_8K_FRAME_SIZE: frame_size=8192 (aligned)
> > - RUN_TO_COMPLETION_9K_FRAME_SIZE: frame_size=9000 (unaligned)
> >
> > Signed-off-by: Kal Conley <[email protected]>
> > ---
> > tools/testing/selftests/bpf/xskxceiver.c | 24 ++++++++++++++++++++++++
> > tools/testing/selftests/bpf/xskxceiver.h | 2 ++
> > 2 files changed, 26 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> > index 7a47ef28fbce..f10ff8c5e9c5 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.c
> > +++ b/tools/testing/selftests/bpf/xskxceiver.c
> > @@ -1789,6 +1789,30 @@ static void run_pkt_test(struct test_spec *test, enum test_mode mode, enum test_
> > pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> > testapp_validate_traffic(test);
> > break;
> > + case TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME:
> > + if (!hugepages_present(test->ifobj_tx)) {
> > + ksft_test_result_skip("No 2M huge pages present.\n");
> > + return;
> > + }
> > + test_spec_set_name(test, "RUN_TO_COMPLETION_8K_FRAME_SIZE");
> > + test->ifobj_tx->umem->frame_size = 8192;
> > + test->ifobj_rx->umem->frame_size = 8192;
> > + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> > + testapp_validate_traffic(test);
> > + break;
> > + case TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME:
>
> TEST_TYPE_UNALIGNED_9K_FRAME
>
> > + if (!hugepages_present(test->ifobj_tx)) {
> > + ksft_test_result_skip("No 2M huge pages present.\n");
> > + return;
> > + }
> > + test_spec_set_name(test, "RUN_TO_COMPLETION_9K_FRAME_SIZE");
>
> UNALIGNED_MODE_9K

_9K_FRAME_SIZE it should have been. Hit send too early.

> > + test->ifobj_tx->umem->frame_size = 9000;
> > + test->ifobj_rx->umem->frame_size = 9000;
> > + test->ifobj_tx->umem->unaligned_mode = true;
> > + test->ifobj_rx->umem->unaligned_mode = true;
> > + pkt_stream_replace(test, DEFAULT_PKT_CNT, PKT_SIZE);
> > + testapp_validate_traffic(test);
> > + break;
> > case TEST_TYPE_RX_POLL:
> > test->ifobj_rx->use_poll = true;
> > test_spec_set_name(test, "POLL_RX");
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
> > index 3e8ec7d8ec32..ff723b6d7852 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.h
> > +++ b/tools/testing/selftests/bpf/xskxceiver.h
> > @@ -70,6 +70,8 @@ enum test_mode {
> > enum test_type {
> > TEST_TYPE_RUN_TO_COMPLETION,
> > TEST_TYPE_RUN_TO_COMPLETION_2K_FRAME,
> > + TEST_TYPE_RUN_TO_COMPLETION_8K_FRAME,
> > + TEST_TYPE_RUN_TO_COMPLETION_9K_FRAME,
> > TEST_TYPE_RUN_TO_COMPLETION_SINGLE_PKT,
> > TEST_TYPE_RX_POLL,
> > TEST_TYPE_TX_POLL,
> > --
> > 2.39.2
> >

2023-03-29 10:23:08

by Kal Cutter Conley

[permalink] [raw]
Subject: Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes

> > TEST_TYPE_UNALIGNED_9K_FRAME
> >
> > > + if (!hugepages_present(test->ifobj_tx)) {
> > > + ksft_test_result_skip("No 2M huge pages present.\n");
> > > + return;
> > > + }
> > > + test_spec_set_name(test, "RUN_TO_COMPLETION_9K_FRAME_SIZE");
> >
> > UNALIGNED_MODE_9K
>
> _9K_FRAME_SIZE it should have been. Hit send too early.
>

Fixed in the v2 patchset (coming soon).

Kal