* [PATCH bpf-next 1/2] selftests: xsk: Use correct UMEM size in testapp_invalid_desc [not found] <20230403145047.33065-1-kal.conley@dectris.com> @ 2023-04-03 14:50 ` Kal Conley 2023-04-04 6:26 ` Magnus Karlsson 2023-04-03 14:50 ` [PATCH bpf-next 2/2] selftests: xsk: Add test case for packets at end of UMEM Kal Conley 1 sibling, 1 reply; 4+ messages in thread From: Kal Conley @ 2023-04-03 14:50 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 Avoid UMEM_SIZE macro in testapp_invalid_desc which is incorrect when the frame size is not XSK_UMEM__DEFAULT_FRAME_SIZE. Also remove the macro since it's no longer being used. Fixes: 909f0e28207c ("selftests: xsk: Add tests for 2K frame size") Signed-off-by: Kal Conley <kal.conley@dectris.com> --- tools/testing/selftests/bpf/xskxceiver.c | 9 +++++---- tools/testing/selftests/bpf/xskxceiver.h | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index b65e0645b0cd..3956f5db84f3 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1652,6 +1652,7 @@ static void testapp_single_pkt(struct test_spec *test) static void testapp_invalid_desc(struct test_spec *test) { + u64 umem_size = test->ifobj_tx->umem->num_frames * test->ifobj_tx->umem->frame_size; struct pkt pkts[] = { /* Zero packet address allowed */ {0, PKT_SIZE, 0, true}, @@ -1662,9 +1663,9 @@ static void testapp_invalid_desc(struct test_spec *test) /* Packet too large */ {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false}, /* After umem ends */ - {UMEM_SIZE, PKT_SIZE, 0, false}, + {umem_size, PKT_SIZE, 0, false}, /* Straddle the end of umem */ - {UMEM_SIZE - PKT_SIZE / 2, PKT_SIZE, 0, false}, + {umem_size - PKT_SIZE / 2, PKT_SIZE, 0, false}, /* Straddle a page boundrary */ {0x3000 - PKT_SIZE / 2, PKT_SIZE, 0, false}, /* Straddle a 2K boundrary */ @@ -1682,8 +1683,8 @@ static void testapp_invalid_desc(struct test_spec *test) } if (test->ifobj_tx->shared_umem) { - pkts[4].addr += UMEM_SIZE; - pkts[5].addr += UMEM_SIZE; + pkts[4].addr += umem_size; + pkts[5].addr += umem_size; } pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h index bdb4efedf3a9..cc24ab72f3ff 100644 --- a/tools/testing/selftests/bpf/xskxceiver.h +++ b/tools/testing/selftests/bpf/xskxceiver.h @@ -53,7 +53,6 @@ #define THREAD_TMOUT 3 #define DEFAULT_PKT_CNT (4 * 1024) #define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4) -#define UMEM_SIZE (DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE) #define RX_FULL_RXQSIZE 32 #define UMEM_HEADROOM_TEST_SIZE 128 #define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1) -- 2.39.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next 1/2] selftests: xsk: Use correct UMEM size in testapp_invalid_desc 2023-04-03 14:50 ` [PATCH bpf-next 1/2] selftests: xsk: Use correct UMEM size in testapp_invalid_desc Kal Conley @ 2023-04-04 6:26 ` Magnus Karlsson 0 siblings, 0 replies; 4+ messages in thread From: Magnus Karlsson @ 2023-04-04 6:26 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 Mon, 3 Apr 2023 at 16:52, Kal Conley <kal.conley@dectris.com> wrote: > > Avoid UMEM_SIZE macro in testapp_invalid_desc which is incorrect when > the frame size is not XSK_UMEM__DEFAULT_FRAME_SIZE. Also remove the > macro since it's no longer being used. Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> > Fixes: 909f0e28207c ("selftests: xsk: Add tests for 2K frame size") > Signed-off-by: Kal Conley <kal.conley@dectris.com> > --- > tools/testing/selftests/bpf/xskxceiver.c | 9 +++++---- > tools/testing/selftests/bpf/xskxceiver.h | 1 - > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c > index b65e0645b0cd..3956f5db84f3 100644 > --- a/tools/testing/selftests/bpf/xskxceiver.c > +++ b/tools/testing/selftests/bpf/xskxceiver.c > @@ -1652,6 +1652,7 @@ static void testapp_single_pkt(struct test_spec *test) > > static void testapp_invalid_desc(struct test_spec *test) > { > + u64 umem_size = test->ifobj_tx->umem->num_frames * test->ifobj_tx->umem->frame_size; > struct pkt pkts[] = { > /* Zero packet address allowed */ > {0, PKT_SIZE, 0, true}, > @@ -1662,9 +1663,9 @@ static void testapp_invalid_desc(struct test_spec *test) > /* Packet too large */ > {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false}, > /* After umem ends */ > - {UMEM_SIZE, PKT_SIZE, 0, false}, > + {umem_size, PKT_SIZE, 0, false}, > /* Straddle the end of umem */ > - {UMEM_SIZE - PKT_SIZE / 2, PKT_SIZE, 0, false}, > + {umem_size - PKT_SIZE / 2, PKT_SIZE, 0, false}, > /* Straddle a page boundrary */ > {0x3000 - PKT_SIZE / 2, PKT_SIZE, 0, false}, > /* Straddle a 2K boundrary */ > @@ -1682,8 +1683,8 @@ static void testapp_invalid_desc(struct test_spec *test) > } > > if (test->ifobj_tx->shared_umem) { > - pkts[4].addr += UMEM_SIZE; > - pkts[5].addr += UMEM_SIZE; > + pkts[4].addr += umem_size; > + pkts[5].addr += umem_size; > } > > pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); > diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h > index bdb4efedf3a9..cc24ab72f3ff 100644 > --- a/tools/testing/selftests/bpf/xskxceiver.h > +++ b/tools/testing/selftests/bpf/xskxceiver.h > @@ -53,7 +53,6 @@ > #define THREAD_TMOUT 3 > #define DEFAULT_PKT_CNT (4 * 1024) > #define DEFAULT_UMEM_BUFFERS (DEFAULT_PKT_CNT / 4) > -#define UMEM_SIZE (DEFAULT_UMEM_BUFFERS * XSK_UMEM__DEFAULT_FRAME_SIZE) > #define RX_FULL_RXQSIZE 32 > #define UMEM_HEADROOM_TEST_SIZE 128 > #define XSK_UMEM__INVALID_FRAME_SIZE (XSK_UMEM__DEFAULT_FRAME_SIZE + 1) > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH bpf-next 2/2] selftests: xsk: Add test case for packets at end of UMEM [not found] <20230403145047.33065-1-kal.conley@dectris.com> 2023-04-03 14:50 ` [PATCH bpf-next 1/2] selftests: xsk: Use correct UMEM size in testapp_invalid_desc Kal Conley @ 2023-04-03 14:50 ` Kal Conley 2023-04-04 6:27 ` Magnus Karlsson 1 sibling, 1 reply; 4+ messages in thread From: Kal Conley @ 2023-04-03 14:50 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 test case to testapp_invalid_desc for valid packets at the end of the UMEM. Signed-off-by: Kal Conley <kal.conley@dectris.com> --- tools/testing/selftests/bpf/xskxceiver.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c index 3956f5db84f3..34a1f32fe752 100644 --- a/tools/testing/selftests/bpf/xskxceiver.c +++ b/tools/testing/selftests/bpf/xskxceiver.c @@ -1662,6 +1662,8 @@ static void testapp_invalid_desc(struct test_spec *test) {-2, PKT_SIZE, 0, false}, /* Packet too large */ {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false}, + /* Up to end of umem allowed */ + {umem_size - PKT_SIZE, PKT_SIZE, 0, true}, /* After umem ends */ {umem_size, PKT_SIZE, 0, false}, /* Straddle the end of umem */ @@ -1675,16 +1677,17 @@ static void testapp_invalid_desc(struct test_spec *test) if (test->ifobj_tx->umem->unaligned_mode) { /* Crossing a page boundrary allowed */ - pkts[6].valid = true; + pkts[7].valid = true; } if (test->ifobj_tx->umem->frame_size == XSK_UMEM__DEFAULT_FRAME_SIZE / 2) { /* Crossing a 2K frame size boundrary not allowed */ - pkts[7].valid = false; + pkts[8].valid = false; } if (test->ifobj_tx->shared_umem) { pkts[4].addr += umem_size; pkts[5].addr += umem_size; + pkts[6].addr += umem_size; } pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); -- 2.39.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next 2/2] selftests: xsk: Add test case for packets at end of UMEM 2023-04-03 14:50 ` [PATCH bpf-next 2/2] selftests: xsk: Add test case for packets at end of UMEM Kal Conley @ 2023-04-04 6:27 ` Magnus Karlsson 0 siblings, 0 replies; 4+ messages in thread From: Magnus Karlsson @ 2023-04-04 6:27 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 Mon, 3 Apr 2023 at 16:52, Kal Conley <kal.conley@dectris.com> wrote: > > Add test case to testapp_invalid_desc for valid packets at the end of > the UMEM. Thanks. Acked-by: Magnus Karlsson <magnus.karlsson@intel.com> > Signed-off-by: Kal Conley <kal.conley@dectris.com> > --- > tools/testing/selftests/bpf/xskxceiver.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c > index 3956f5db84f3..34a1f32fe752 100644 > --- a/tools/testing/selftests/bpf/xskxceiver.c > +++ b/tools/testing/selftests/bpf/xskxceiver.c > @@ -1662,6 +1662,8 @@ static void testapp_invalid_desc(struct test_spec *test) > {-2, PKT_SIZE, 0, false}, > /* Packet too large */ > {0x2000, XSK_UMEM__INVALID_FRAME_SIZE, 0, false}, > + /* Up to end of umem allowed */ > + {umem_size - PKT_SIZE, PKT_SIZE, 0, true}, > /* After umem ends */ > {umem_size, PKT_SIZE, 0, false}, > /* Straddle the end of umem */ > @@ -1675,16 +1677,17 @@ static void testapp_invalid_desc(struct test_spec *test) > > if (test->ifobj_tx->umem->unaligned_mode) { > /* Crossing a page boundrary allowed */ > - pkts[6].valid = true; > + pkts[7].valid = true; > } > if (test->ifobj_tx->umem->frame_size == XSK_UMEM__DEFAULT_FRAME_SIZE / 2) { > /* Crossing a 2K frame size boundrary not allowed */ > - pkts[7].valid = false; > + pkts[8].valid = false; > } > > if (test->ifobj_tx->shared_umem) { > pkts[4].addr += umem_size; > pkts[5].addr += umem_size; > + pkts[6].addr += umem_size; > } > > pkt_stream_generate_custom(test, pkts, ARRAY_SIZE(pkts)); > -- > 2.39.2 > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-04-04 6:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230403145047.33065-1-kal.conley@dectris.com>
2023-04-03 14:50 ` [PATCH bpf-next 1/2] selftests: xsk: Use correct UMEM size in testapp_invalid_desc Kal Conley
2023-04-04 6:26 ` Magnus Karlsson
2023-04-03 14:50 ` [PATCH bpf-next 2/2] selftests: xsk: Add test case for packets at end of UMEM Kal Conley
2023-04-04 6:27 ` Magnus Karlsson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox