linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next 2/3] selftests: xsk: Use hugepages when umem->frame_size > PAGE_SIZE
       [not found] <20230319195656.326701-1-kal.conley@dectris.com>
@ 2023-03-19 19:56 ` Kal Conley
  2023-03-19 19:56 ` [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes Kal Conley
  1 sibling, 0 replies; 5+ messages in thread
From: Kal Conley @ 2023-03-19 19:56 UTC (permalink / raw)
  To: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko, Shuah Khan
  Cc: Kal Conley, netdev, bpf, linux-kselftest, linux-kernel

HugeTLB UMEMs now support chunk_size > PAGE_SIZE. Set MAP_HUGETLB when
frame_size > PAGE_SIZE for future tests.

Signed-off-by: Kal Conley <kal.conley@dectris.com>
---
 tools/testing/selftests/bpf/xskxceiver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index a17655107a94..7a47ef28fbce 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1265,7 +1265,7 @@ static void thread_common_ops(struct test_spec *test, struct ifobject *ifobject)
 	void *bufs;
 	int ret;
 
-	if (ifobject->umem->unaligned_mode)
+	if (ifobject->umem->frame_size > sysconf(_SC_PAGESIZE) || ifobject->umem->unaligned_mode)
 		mmap_flags |= MAP_HUGETLB;
 
 	if (ifobject->shared_umem)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes
       [not found] <20230319195656.326701-1-kal.conley@dectris.com>
  2023-03-19 19:56 ` [PATCH bpf-next 2/3] selftests: xsk: Use hugepages when umem->frame_size > PAGE_SIZE Kal Conley
@ 2023-03-19 19:56 ` Kal Conley
  2023-03-21  8:45   ` Magnus Karlsson
  1 sibling, 1 reply; 5+ messages in thread
From: Kal Conley @ 2023-03-19 19:56 UTC (permalink / raw)
  To: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko, Shuah Khan
  Cc: Kal Conley, netdev, bpf, linux-kselftest, linux-kernel

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 <kal.conley@dectris.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes
  2023-03-19 19:56 ` [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes Kal Conley
@ 2023-03-21  8:45   ` Magnus Karlsson
  2023-03-21  8:47     ` Magnus Karlsson
  0 siblings, 1 reply; 5+ messages in thread
From: Magnus Karlsson @ 2023-03-21  8:45 UTC (permalink / raw)
  To: Kal Conley
  Cc: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko, Shuah Khan, netdev, bpf, linux-kselftest,
	linux-kernel

On Sun, 19 Mar 2023 at 21:07, Kal Conley <kal.conley@dectris.com> 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 <kal.conley@dectris.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes
  2023-03-21  8:45   ` Magnus Karlsson
@ 2023-03-21  8:47     ` Magnus Karlsson
  2023-03-29 10:22       ` Kal Cutter Conley
  0 siblings, 1 reply; 5+ messages in thread
From: Magnus Karlsson @ 2023-03-21  8:47 UTC (permalink / raw)
  To: Kal Conley
  Cc: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko, Shuah Khan, netdev, bpf, linux-kselftest,
	linux-kernel

On Tue, 21 Mar 2023 at 09:45, Magnus Karlsson <magnus.karlsson@gmail.com> wrote:
>
> On Sun, 19 Mar 2023 at 21:07, Kal Conley <kal.conley@dectris.com> 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 <kal.conley@dectris.com>
> > ---
> >  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
> >

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes
  2023-03-21  8:47     ` Magnus Karlsson
@ 2023-03-29 10:22       ` Kal Cutter Conley
  0 siblings, 0 replies; 5+ messages in thread
From: Kal Cutter Conley @ 2023-03-29 10:22 UTC (permalink / raw)
  To: Magnus Karlsson
  Cc: Björn Töpel, Magnus Karlsson, Maciej Fijalkowski,
	Jonathan Lemon, Alexei Starovoitov, Daniel Borkmann,
	Andrii Nakryiko, Martin KaFai Lau, Song Liu, Yonghong Song,
	John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
	Mykola Lysenko, Shuah Khan, netdev, bpf, linux-kselftest,
	linux-kernel

> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-29 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230319195656.326701-1-kal.conley@dectris.com>
2023-03-19 19:56 ` [PATCH bpf-next 2/3] selftests: xsk: Use hugepages when umem->frame_size > PAGE_SIZE Kal Conley
2023-03-19 19:56 ` [PATCH bpf-next 3/3] selftests: xsk: Add tests for 8K and 9K frame sizes Kal Conley
2023-03-21  8:45   ` Magnus Karlsson
2023-03-21  8:47     ` Magnus Karlsson
2023-03-29 10:22       ` Kal Cutter Conley

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).