* [PATCH bpf-next 0/2] selftests/xsk: Enhance traffic validation and batch size support
@ 2024-06-19 13:20 Tushar Vyavahare
2024-06-19 13:20 ` [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver Tushar Vyavahare
2024-06-19 13:20 ` [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations Tushar Vyavahare
0 siblings, 2 replies; 7+ messages in thread
From: Tushar Vyavahare @ 2024-06-19 13:20 UTC (permalink / raw)
To: bpf
Cc: netdev, bjorn, magnus.karlsson, maciej.fijalkowski,
jonathan.lemon, davem, kuba, pabeni, ast, daniel,
tirthendu.sarkar, tushar.vyavahare
This patch series introduces enhancements to xsk selftests, focusing on
dynamic batch size configurations and robust traffic validation.
Patch 1/2: Robust traffic validation post-ring size adjustment
- Fixed the flow in HW_SW_MIN_RING_SIZE and HW_SW_MAX_RING_SIZE test cases
to validate Tx/Rx traffic by checking the return value of
set_ring_size(), preventing premature test termination.
Patch 2/2: Dynamic batch size configuration
- Overcomes the 2K batch size limit by introducing dynamic adjustments for
fill_size, comp_size, tx_size, and rx_size.
- Update HW_SW_MAX_RING_SIZE test case that evaluates the maximum ring
sizes for AF_XDP, ensuring its reliability under maximum ring utilization.
Ensure the xsk selftests patches improve overall reliability and
efficiency, allowing the system to handle larger batch sizes and
effectively validate traffic after configuration changes.
Tushar Vyavahare (2):
selftests/xsk: Ensure traffic validation proceeds after ring size
adjustment in xskxceiver
selftests/xsk: Enhance batch size support with dynamic configurations
tools/testing/selftests/bpf/xskxceiver.c | 40 +++++++++++++++++-------
tools/testing/selftests/bpf/xskxceiver.h | 2 ++
2 files changed, 31 insertions(+), 11 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver
2024-06-19 13:20 [PATCH bpf-next 0/2] selftests/xsk: Enhance traffic validation and batch size support Tushar Vyavahare
@ 2024-06-19 13:20 ` Tushar Vyavahare
2024-06-25 17:22 ` Maciej Fijalkowski
2024-06-19 13:20 ` [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations Tushar Vyavahare
1 sibling, 1 reply; 7+ messages in thread
From: Tushar Vyavahare @ 2024-06-19 13:20 UTC (permalink / raw)
To: bpf
Cc: netdev, bjorn, magnus.karlsson, maciej.fijalkowski,
jonathan.lemon, davem, kuba, pabeni, ast, daniel,
tirthendu.sarkar, tushar.vyavahare
Previously, HW_SW_MIN_RING_SIZE and HW_SW_MAX_RING_SIZE test cases were
not validating Tx/Rx traffic at all due to early return after changing HW
ring size in testapp_validate_traffic().
Fix the flow by checking return value of set_ring_size() and act upon it
rather than terminating the test case there.
Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
---
tools/testing/selftests/bpf/xskxceiver.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 2eac0895b0a1..088df53869e8 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -1899,11 +1899,15 @@ static int testapp_validate_traffic(struct test_spec *test)
}
if (test->set_ring) {
- if (ifobj_tx->hw_ring_size_supp)
- return set_ring_size(ifobj_tx);
-
- ksft_test_result_skip("Changing HW ring size not supported.\n");
- return TEST_SKIP;
+ if (ifobj_tx->hw_ring_size_supp) {
+ if (set_ring_size(ifobj_tx)) {
+ ksft_test_result_skip("Failed to change HW ring size.\n");
+ return TEST_FAILURE;
+ }
+ } else {
+ ksft_test_result_skip("Changing HW ring size not supported.\n");
+ return TEST_SKIP;
+ }
}
xsk_attach_xdp_progs(test, ifobj_rx, ifobj_tx);
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations
2024-06-19 13:20 [PATCH bpf-next 0/2] selftests/xsk: Enhance traffic validation and batch size support Tushar Vyavahare
2024-06-19 13:20 ` [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver Tushar Vyavahare
@ 2024-06-19 13:20 ` Tushar Vyavahare
2024-06-25 17:40 ` Maciej Fijalkowski
1 sibling, 1 reply; 7+ messages in thread
From: Tushar Vyavahare @ 2024-06-19 13:20 UTC (permalink / raw)
To: bpf
Cc: netdev, bjorn, magnus.karlsson, maciej.fijalkowski,
jonathan.lemon, davem, kuba, pabeni, ast, daniel,
tirthendu.sarkar, tushar.vyavahare
Introduce dynamic adjustment capabilities for fill_size, comp_size,
tx_size, and rx_size parameters to support larger batch sizes beyond the
previous 2K limit.
Update HW_SW_MAX_RING_SIZE test cases to evaluate AF_XDP's robustness by
pushing hardware and software ring sizes to their limits. This test
ensures AF_XDP's reliability amidst potential producer/consumer throttling
due to maximum ring utilization.
Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
---
tools/testing/selftests/bpf/xskxceiver.c | 26 ++++++++++++++++++------
tools/testing/selftests/bpf/xskxceiver.h | 2 ++
2 files changed, 22 insertions(+), 6 deletions(-)
diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
index 088df53869e8..5b049f0296e6 100644
--- a/tools/testing/selftests/bpf/xskxceiver.c
+++ b/tools/testing/selftests/bpf/xskxceiver.c
@@ -196,6 +196,12 @@ static int xsk_configure_umem(struct ifobject *ifobj, struct xsk_umem_info *umem
};
int ret;
+ if (umem->fill_size)
+ cfg.fill_size = umem->fill_size;
+
+ if (umem->comp_size)
+ cfg.comp_size = umem->comp_size;
+
if (umem->unaligned_mode)
cfg.flags |= XDP_UMEM_UNALIGNED_CHUNK_FLAG;
@@ -265,6 +271,10 @@ static int __xsk_configure_socket(struct xsk_socket_info *xsk, struct xsk_umem_i
cfg.bind_flags |= XDP_SHARED_UMEM;
if (ifobject->mtu > MAX_ETH_PKT_SIZE)
cfg.bind_flags |= XDP_USE_SG;
+ if (umem->fill_size)
+ cfg.tx_size = umem->fill_size;
+ if (umem->comp_size)
+ cfg.rx_size = umem->comp_size;
txr = ifobject->tx_on ? &xsk->tx : NULL;
rxr = ifobject->rx_on ? &xsk->rx : NULL;
@@ -1616,7 +1626,7 @@ static void xsk_populate_fill_ring(struct xsk_umem_info *umem, struct pkt_stream
if (umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
buffers_to_fill = umem->num_frames;
else
- buffers_to_fill = XSK_RING_PROD__DEFAULT_NUM_DESCS;
+ buffers_to_fill = umem->fill_size;
ret = xsk_ring_prod__reserve(&umem->fq, buffers_to_fill, &idx);
if (ret != buffers_to_fill)
@@ -2445,7 +2455,7 @@ static int testapp_hw_sw_min_ring_size(struct test_spec *test)
static int testapp_hw_sw_max_ring_size(struct test_spec *test)
{
- u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 2;
+ u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
int ret;
test->set_ring = true;
@@ -2453,7 +2463,8 @@ static int testapp_hw_sw_max_ring_size(struct test_spec *test)
test->ifobj_tx->ring.tx_pending = test->ifobj_tx->ring.tx_max_pending;
test->ifobj_tx->ring.rx_pending = test->ifobj_tx->ring.rx_max_pending;
test->ifobj_rx->umem->num_frames = max_descs;
- test->ifobj_rx->xsk->rxqsize = max_descs;
+ test->ifobj_rx->umem->fill_size = max_descs;
+ test->ifobj_rx->umem->comp_size = max_descs;
test->ifobj_tx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
test->ifobj_rx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
@@ -2461,9 +2472,12 @@ static int testapp_hw_sw_max_ring_size(struct test_spec *test)
if (ret)
return ret;
- /* Set batch_size to 4095 */
- test->ifobj_tx->xsk->batch_size = max_descs - 1;
- test->ifobj_rx->xsk->batch_size = max_descs - 1;
+ /* Set batch_size to 8152 for testing, as the ice HW ignores the 3 lowest bits when updating
+ * the Rx HW tail register.
+ */
+ test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
+ test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
+ pkt_stream_replace(test, max_descs, MIN_PKT_SIZE);
return testapp_validate_traffic(test);
}
diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
index 906de5fab7a3..885c948c5d83 100644
--- a/tools/testing/selftests/bpf/xskxceiver.h
+++ b/tools/testing/selftests/bpf/xskxceiver.h
@@ -80,6 +80,8 @@ struct xsk_umem_info {
void *buffer;
u32 frame_size;
u32 base_addr;
+ u32 fill_size;
+ u32 comp_size;
bool unaligned_mode;
};
--
2.34.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver
2024-06-19 13:20 ` [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver Tushar Vyavahare
@ 2024-06-25 17:22 ` Maciej Fijalkowski
0 siblings, 0 replies; 7+ messages in thread
From: Maciej Fijalkowski @ 2024-06-25 17:22 UTC (permalink / raw)
To: Tushar Vyavahare
Cc: bpf, netdev, bjorn, magnus.karlsson, jonathan.lemon, davem, kuba,
pabeni, ast, daniel, tirthendu.sarkar
On Wed, Jun 19, 2024 at 01:20:47PM +0000, Tushar Vyavahare wrote:
> Previously, HW_SW_MIN_RING_SIZE and HW_SW_MAX_RING_SIZE test cases were
> not validating Tx/Rx traffic at all due to early return after changing HW
> ring size in testapp_validate_traffic().
>
> Fix the flow by checking return value of set_ring_size() and act upon it
> rather than terminating the test case there.
>
> Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
Reviewed-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 2eac0895b0a1..088df53869e8 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -1899,11 +1899,15 @@ static int testapp_validate_traffic(struct test_spec *test)
> }
>
> if (test->set_ring) {
> - if (ifobj_tx->hw_ring_size_supp)
> - return set_ring_size(ifobj_tx);
> -
> - ksft_test_result_skip("Changing HW ring size not supported.\n");
> - return TEST_SKIP;
> + if (ifobj_tx->hw_ring_size_supp) {
> + if (set_ring_size(ifobj_tx)) {
> + ksft_test_result_skip("Failed to change HW ring size.\n");
> + return TEST_FAILURE;
> + }
> + } else {
> + ksft_test_result_skip("Changing HW ring size not supported.\n");
> + return TEST_SKIP;
> + }
> }
>
> xsk_attach_xdp_progs(test, ifobj_rx, ifobj_tx);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations
2024-06-19 13:20 ` [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations Tushar Vyavahare
@ 2024-06-25 17:40 ` Maciej Fijalkowski
2024-06-26 8:36 ` Vyavahare, Tushar
0 siblings, 1 reply; 7+ messages in thread
From: Maciej Fijalkowski @ 2024-06-25 17:40 UTC (permalink / raw)
To: Tushar Vyavahare
Cc: bpf, netdev, bjorn, magnus.karlsson, jonathan.lemon, davem, kuba,
pabeni, ast, daniel, tirthendu.sarkar
On Wed, Jun 19, 2024 at 01:20:48PM +0000, Tushar Vyavahare wrote:
> Introduce dynamic adjustment capabilities for fill_size, comp_size,
> tx_size, and rx_size parameters to support larger batch sizes beyond the
you are only introducing fill_size and comp_size to xsk_umem_info. The
latter two seem to be in place.
> previous 2K limit.
>
> Update HW_SW_MAX_RING_SIZE test cases to evaluate AF_XDP's robustness by
> pushing hardware and software ring sizes to their limits. This test
> ensures AF_XDP's reliability amidst potential producer/consumer throttling
> due to maximum ring utilization.
>
> Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
> ---
> tools/testing/selftests/bpf/xskxceiver.c | 26 ++++++++++++++++++------
> tools/testing/selftests/bpf/xskxceiver.h | 2 ++
> 2 files changed, 22 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.c b/tools/testing/selftests/bpf/xskxceiver.c
> index 088df53869e8..5b049f0296e6 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.c
> +++ b/tools/testing/selftests/bpf/xskxceiver.c
> @@ -196,6 +196,12 @@ static int xsk_configure_umem(struct ifobject *ifobj, struct xsk_umem_info *umem
> };
> int ret;
>
> + if (umem->fill_size)
> + cfg.fill_size = umem->fill_size;
> +
> + if (umem->comp_size)
> + cfg.comp_size = umem->comp_size;
> +
> if (umem->unaligned_mode)
> cfg.flags |= XDP_UMEM_UNALIGNED_CHUNK_FLAG;
>
> @@ -265,6 +271,10 @@ static int __xsk_configure_socket(struct xsk_socket_info *xsk, struct xsk_umem_i
> cfg.bind_flags |= XDP_SHARED_UMEM;
> if (ifobject->mtu > MAX_ETH_PKT_SIZE)
> cfg.bind_flags |= XDP_USE_SG;
> + if (umem->fill_size)
> + cfg.tx_size = umem->fill_size;
> + if (umem->comp_size)
> + cfg.rx_size = umem->comp_size;
how is the fq related to txq ? and cq to rxq? shouldn't this be fq-rxq and
cq-txq. What is the intent here? In the end they are the same in your
test.
>
> txr = ifobject->tx_on ? &xsk->tx : NULL;
> rxr = ifobject->rx_on ? &xsk->rx : NULL;
> @@ -1616,7 +1626,7 @@ static void xsk_populate_fill_ring(struct xsk_umem_info *umem, struct pkt_stream
> if (umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
> buffers_to_fill = umem->num_frames;
> else
> - buffers_to_fill = XSK_RING_PROD__DEFAULT_NUM_DESCS;
> + buffers_to_fill = umem->fill_size;
>
> ret = xsk_ring_prod__reserve(&umem->fq, buffers_to_fill, &idx);
> if (ret != buffers_to_fill)
> @@ -2445,7 +2455,7 @@ static int testapp_hw_sw_min_ring_size(struct test_spec *test)
>
> static int testapp_hw_sw_max_ring_size(struct test_spec *test)
> {
> - u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 2;
> + u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
> int ret;
>
> test->set_ring = true;
> @@ -2453,7 +2463,8 @@ static int testapp_hw_sw_max_ring_size(struct test_spec *test)
> test->ifobj_tx->ring.tx_pending = test->ifobj_tx->ring.tx_max_pending;
> test->ifobj_tx->ring.rx_pending = test->ifobj_tx->ring.rx_max_pending;
> test->ifobj_rx->umem->num_frames = max_descs;
> - test->ifobj_rx->xsk->rxqsize = max_descs;
rxqsize is only used for setting xsk_socket_config::rx_size ?
> + test->ifobj_rx->umem->fill_size = max_descs;
> + test->ifobj_rx->umem->comp_size = max_descs;
> test->ifobj_tx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
> test->ifobj_rx->xsk->batch_size = XSK_RING_PROD__DEFAULT_NUM_DESCS;
>
> @@ -2461,9 +2472,12 @@ static int testapp_hw_sw_max_ring_size(struct test_spec *test)
> if (ret)
> return ret;
>
> - /* Set batch_size to 4095 */
> - test->ifobj_tx->xsk->batch_size = max_descs - 1;
> - test->ifobj_rx->xsk->batch_size = max_descs - 1;
> + /* Set batch_size to 8152 for testing, as the ice HW ignores the 3 lowest bits when updating
> + * the Rx HW tail register.
i would wrap the comment to 80 chars but that's personal taste.
> + */
> + test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
> + test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending - 8;
> + pkt_stream_replace(test, max_descs, MIN_PKT_SIZE);
> return testapp_validate_traffic(test);
> }
>
> diff --git a/tools/testing/selftests/bpf/xskxceiver.h b/tools/testing/selftests/bpf/xskxceiver.h
> index 906de5fab7a3..885c948c5d83 100644
> --- a/tools/testing/selftests/bpf/xskxceiver.h
> +++ b/tools/testing/selftests/bpf/xskxceiver.h
> @@ -80,6 +80,8 @@ struct xsk_umem_info {
> void *buffer;
> u32 frame_size;
> u32 base_addr;
> + u32 fill_size;
> + u32 comp_size;
> bool unaligned_mode;
> };
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations
2024-06-25 17:40 ` Maciej Fijalkowski
@ 2024-06-26 8:36 ` Vyavahare, Tushar
2024-06-26 8:51 ` Magnus Karlsson
0 siblings, 1 reply; 7+ messages in thread
From: Vyavahare, Tushar @ 2024-06-26 8:36 UTC (permalink / raw)
To: Fijalkowski, Maciej
Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, bjorn@kernel.org,
Karlsson, Magnus, jonathan.lemon@gmail.com, davem@davemloft.net,
kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
daniel@iogearbox.net, Sarkar, Tirthendu
> -----Original Message-----
> From: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> Sent: Tuesday, June 25, 2024 11:11 PM
> To: Vyavahare, Tushar <tushar.vyavahare@intel.com>
> Cc: bpf@vger.kernel.org; netdev@vger.kernel.org; bjorn@kernel.org;
> Karlsson, Magnus <magnus.karlsson@intel.com>;
> jonathan.lemon@gmail.com; davem@davemloft.net; kuba@kernel.org;
> pabeni@redhat.com; ast@kernel.org; daniel@iogearbox.net; Sarkar,
> Tirthendu <tirthendu.sarkar@intel.com>
> Subject: Re: [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support
> with dynamic configurations
>
> On Wed, Jun 19, 2024 at 01:20:48PM +0000, Tushar Vyavahare wrote:
> > Introduce dynamic adjustment capabilities for fill_size, comp_size,
> > tx_size, and rx_size parameters to support larger batch sizes beyond
> > the
>
> you are only introducing fill_size and comp_size to xsk_umem_info. The latter
> two seem to be in place.
>
I will do it.
> > previous 2K limit.
> >
> > Update HW_SW_MAX_RING_SIZE test cases to evaluate AF_XDP's
> robustness
> > by pushing hardware and software ring sizes to their limits. This test
> > ensures AF_XDP's reliability amidst potential producer/consumer
> > throttling due to maximum ring utilization.
> >
> > Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
> > ---
> > tools/testing/selftests/bpf/xskxceiver.c | 26
> > ++++++++++++++++++------ tools/testing/selftests/bpf/xskxceiver.h |
> > 2 ++
> > 2 files changed, 22 insertions(+), 6 deletions(-)
> >
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.c
> > b/tools/testing/selftests/bpf/xskxceiver.c
> > index 088df53869e8..5b049f0296e6 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.c
> > +++ b/tools/testing/selftests/bpf/xskxceiver.c
> > @@ -196,6 +196,12 @@ static int xsk_configure_umem(struct ifobject
> *ifobj, struct xsk_umem_info *umem
> > };
> > int ret;
> >
> > + if (umem->fill_size)
> > + cfg.fill_size = umem->fill_size;
> > +
> > + if (umem->comp_size)
> > + cfg.comp_size = umem->comp_size;
> > +
> > if (umem->unaligned_mode)
> > cfg.flags |= XDP_UMEM_UNALIGNED_CHUNK_FLAG;
> >
> > @@ -265,6 +271,10 @@ static int __xsk_configure_socket(struct
> xsk_socket_info *xsk, struct xsk_umem_i
> > cfg.bind_flags |= XDP_SHARED_UMEM;
> > if (ifobject->mtu > MAX_ETH_PKT_SIZE)
> > cfg.bind_flags |= XDP_USE_SG;
> > + if (umem->fill_size)
> > + cfg.tx_size = umem->fill_size;
> > + if (umem->comp_size)
> > + cfg.rx_size = umem->comp_size;
>
> how is the fq related to txq ? and cq to rxq? shouldn't this be fq-rxq and cq-
> txq. What is the intent here? In the end they are the same in your test.
>
Yes, you are correct, updating code accordingly.
> >
> > txr = ifobject->tx_on ? &xsk->tx : NULL;
> > rxr = ifobject->rx_on ? &xsk->rx : NULL; @@ -1616,7 +1626,7 @@
> > static void xsk_populate_fill_ring(struct xsk_umem_info *umem, struct
> pkt_stream
> > if (umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
> > buffers_to_fill = umem->num_frames;
> > else
> > - buffers_to_fill = XSK_RING_PROD__DEFAULT_NUM_DESCS;
> > + buffers_to_fill = umem->fill_size;
> >
> > ret = xsk_ring_prod__reserve(&umem->fq, buffers_to_fill, &idx);
> > if (ret != buffers_to_fill)
> > @@ -2445,7 +2455,7 @@ static int testapp_hw_sw_min_ring_size(struct
> > test_spec *test)
> >
> > static int testapp_hw_sw_max_ring_size(struct test_spec *test) {
> > - u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 2;
> > + u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
> > int ret;
> >
> > test->set_ring = true;
> > @@ -2453,7 +2463,8 @@ static int testapp_hw_sw_max_ring_size(struct
> test_spec *test)
> > test->ifobj_tx->ring.tx_pending = test->ifobj_tx-
> >ring.tx_max_pending;
> > test->ifobj_tx->ring.rx_pending = test->ifobj_tx-
> >ring.rx_max_pending;
> > test->ifobj_rx->umem->num_frames = max_descs;
> > - test->ifobj_rx->xsk->rxqsize = max_descs;
>
> rxqsize is only used for setting xsk_socket_config::rx_size ?
>
Initially, we used the rxqsize field from the xsk_socket object, directly
assigning max_descs to it and then using this value to set cfg.rx_size.
However, we are now shifted to a different approach for test, where we are
setting cfg.rx_size based on the comp_size from the umem object, provided
that umem->fill_size is true.
> > + test->ifobj_rx->umem->fill_size = max_descs;
> > + test->ifobj_rx->umem->comp_size = max_descs;
> > test->ifobj_tx->xsk->batch_size =
> XSK_RING_PROD__DEFAULT_NUM_DESCS;
> > test->ifobj_rx->xsk->batch_size =
> XSK_RING_PROD__DEFAULT_NUM_DESCS;
> >
> > @@ -2461,9 +2472,12 @@ static int testapp_hw_sw_max_ring_size(struct
> test_spec *test)
> > if (ret)
> > return ret;
> >
> > - /* Set batch_size to 4095 */
> > - test->ifobj_tx->xsk->batch_size = max_descs - 1;
> > - test->ifobj_rx->xsk->batch_size = max_descs - 1;
> > + /* Set batch_size to 8152 for testing, as the ice HW ignores the 3
> lowest bits when updating
> > + * the Rx HW tail register.
>
> i would wrap the comment to 80 chars but that's personal taste.
>
I will do it.
> > + */
> > + test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending
> - 8;
> > + test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending
> - 8;
> > + pkt_stream_replace(test, max_descs, MIN_PKT_SIZE);
> > return testapp_validate_traffic(test); }
> >
> > diff --git a/tools/testing/selftests/bpf/xskxceiver.h
> > b/tools/testing/selftests/bpf/xskxceiver.h
> > index 906de5fab7a3..885c948c5d83 100644
> > --- a/tools/testing/selftests/bpf/xskxceiver.h
> > +++ b/tools/testing/selftests/bpf/xskxceiver.h
> > @@ -80,6 +80,8 @@ struct xsk_umem_info {
> > void *buffer;
> > u32 frame_size;
> > u32 base_addr;
> > + u32 fill_size;
> > + u32 comp_size;
> > bool unaligned_mode;
> > };
> >
> > --
> > 2.34.1
> >
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations
2024-06-26 8:36 ` Vyavahare, Tushar
@ 2024-06-26 8:51 ` Magnus Karlsson
0 siblings, 0 replies; 7+ messages in thread
From: Magnus Karlsson @ 2024-06-26 8:51 UTC (permalink / raw)
To: Vyavahare, Tushar
Cc: Fijalkowski, Maciej, bpf@vger.kernel.org, netdev@vger.kernel.org,
bjorn@kernel.org, Karlsson, Magnus, jonathan.lemon@gmail.com,
davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
ast@kernel.org, daniel@iogearbox.net, Sarkar, Tirthendu
On Wed, 26 Jun 2024 at 10:36, Vyavahare, Tushar
<tushar.vyavahare@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Fijalkowski, Maciej <maciej.fijalkowski@intel.com>
> > Sent: Tuesday, June 25, 2024 11:11 PM
> > To: Vyavahare, Tushar <tushar.vyavahare@intel.com>
> > Cc: bpf@vger.kernel.org; netdev@vger.kernel.org; bjorn@kernel.org;
> > Karlsson, Magnus <magnus.karlsson@intel.com>;
> > jonathan.lemon@gmail.com; davem@davemloft.net; kuba@kernel.org;
> > pabeni@redhat.com; ast@kernel.org; daniel@iogearbox.net; Sarkar,
> > Tirthendu <tirthendu.sarkar@intel.com>
> > Subject: Re: [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support
> > with dynamic configurations
> >
> > On Wed, Jun 19, 2024 at 01:20:48PM +0000, Tushar Vyavahare wrote:
> > > Introduce dynamic adjustment capabilities for fill_size, comp_size,
> > > tx_size, and rx_size parameters to support larger batch sizes beyond
> > > the
> >
> > you are only introducing fill_size and comp_size to xsk_umem_info. The latter
> > two seem to be in place.
> >
>
> I will do it.
>
> > > previous 2K limit.
> > >
> > > Update HW_SW_MAX_RING_SIZE test cases to evaluate AF_XDP's
> > robustness
> > > by pushing hardware and software ring sizes to their limits. This test
> > > ensures AF_XDP's reliability amidst potential producer/consumer
> > > throttling due to maximum ring utilization.
> > >
> > > Signed-off-by: Tushar Vyavahare <tushar.vyavahare@intel.com>
> > > ---
> > > tools/testing/selftests/bpf/xskxceiver.c | 26
> > > ++++++++++++++++++------ tools/testing/selftests/bpf/xskxceiver.h |
> > > 2 ++
> > > 2 files changed, 22 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/tools/testing/selftests/bpf/xskxceiver.c
> > > b/tools/testing/selftests/bpf/xskxceiver.c
> > > index 088df53869e8..5b049f0296e6 100644
> > > --- a/tools/testing/selftests/bpf/xskxceiver.c
> > > +++ b/tools/testing/selftests/bpf/xskxceiver.c
> > > @@ -196,6 +196,12 @@ static int xsk_configure_umem(struct ifobject
> > *ifobj, struct xsk_umem_info *umem
> > > };
> > > int ret;
> > >
> > > + if (umem->fill_size)
> > > + cfg.fill_size = umem->fill_size;
> > > +
> > > + if (umem->comp_size)
> > > + cfg.comp_size = umem->comp_size;
> > > +
> > > if (umem->unaligned_mode)
> > > cfg.flags |= XDP_UMEM_UNALIGNED_CHUNK_FLAG;
> > >
> > > @@ -265,6 +271,10 @@ static int __xsk_configure_socket(struct
> > xsk_socket_info *xsk, struct xsk_umem_i
> > > cfg.bind_flags |= XDP_SHARED_UMEM;
> > > if (ifobject->mtu > MAX_ETH_PKT_SIZE)
> > > cfg.bind_flags |= XDP_USE_SG;
> > > + if (umem->fill_size)
> > > + cfg.tx_size = umem->fill_size;
> > > + if (umem->comp_size)
> > > + cfg.rx_size = umem->comp_size;
> >
> > how is the fq related to txq ? and cq to rxq? shouldn't this be fq-rxq and cq-
> > txq. What is the intent here? In the end they are the same in your test.
> >
>
> Yes, you are correct, updating code accordingly.
>
> > >
> > > txr = ifobject->tx_on ? &xsk->tx : NULL;
> > > rxr = ifobject->rx_on ? &xsk->rx : NULL; @@ -1616,7 +1626,7 @@
> > > static void xsk_populate_fill_ring(struct xsk_umem_info *umem, struct
> > pkt_stream
> > > if (umem->num_frames < XSK_RING_PROD__DEFAULT_NUM_DESCS)
> > > buffers_to_fill = umem->num_frames;
> > > else
> > > - buffers_to_fill = XSK_RING_PROD__DEFAULT_NUM_DESCS;
> > > + buffers_to_fill = umem->fill_size;
> > >
> > > ret = xsk_ring_prod__reserve(&umem->fq, buffers_to_fill, &idx);
> > > if (ret != buffers_to_fill)
> > > @@ -2445,7 +2455,7 @@ static int testapp_hw_sw_min_ring_size(struct
> > > test_spec *test)
> > >
> > > static int testapp_hw_sw_max_ring_size(struct test_spec *test) {
> > > - u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 2;
> > > + u32 max_descs = XSK_RING_PROD__DEFAULT_NUM_DESCS * 4;
> > > int ret;
> > >
> > > test->set_ring = true;
> > > @@ -2453,7 +2463,8 @@ static int testapp_hw_sw_max_ring_size(struct
> > test_spec *test)
> > > test->ifobj_tx->ring.tx_pending = test->ifobj_tx-
> > >ring.tx_max_pending;
> > > test->ifobj_tx->ring.rx_pending = test->ifobj_tx-
> > >ring.rx_max_pending;
> > > test->ifobj_rx->umem->num_frames = max_descs;
> > > - test->ifobj_rx->xsk->rxqsize = max_descs;
> >
> > rxqsize is only used for setting xsk_socket_config::rx_size ?
> >
>
> Initially, we used the rxqsize field from the xsk_socket object, directly
> assigning max_descs to it and then using this value to set cfg.rx_size.
> However, we are now shifted to a different approach for test, where we are
> setting cfg.rx_size based on the comp_size from the umem object, provided
> that umem->fill_size is true.
>
> > > + test->ifobj_rx->umem->fill_size = max_descs;
> > > + test->ifobj_rx->umem->comp_size = max_descs;
> > > test->ifobj_tx->xsk->batch_size =
> > XSK_RING_PROD__DEFAULT_NUM_DESCS;
> > > test->ifobj_rx->xsk->batch_size =
> > XSK_RING_PROD__DEFAULT_NUM_DESCS;
> > >
> > > @@ -2461,9 +2472,12 @@ static int testapp_hw_sw_max_ring_size(struct
> > test_spec *test)
> > > if (ret)
> > > return ret;
> > >
> > > - /* Set batch_size to 4095 */
> > > - test->ifobj_tx->xsk->batch_size = max_descs - 1;
> > > - test->ifobj_rx->xsk->batch_size = max_descs - 1;
> > > + /* Set batch_size to 8152 for testing, as the ice HW ignores the 3
> > lowest bits when updating
> > > + * the Rx HW tail register.
> >
> > i would wrap the comment to 80 chars but that's personal taste.
> >
>
> I will do it.
You can keep it at 100 chars since that is used in most of the file.
That is allowed these days unless I mistake myself. Though the file
started out at 80 chars.
> > > + */
> > > + test->ifobj_tx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending
> > - 8;
> > > + test->ifobj_rx->xsk->batch_size = test->ifobj_tx->ring.tx_max_pending
> > - 8;
> > > + pkt_stream_replace(test, max_descs, MIN_PKT_SIZE);
> > > return testapp_validate_traffic(test); }
> > >
> > > diff --git a/tools/testing/selftests/bpf/xskxceiver.h
> > > b/tools/testing/selftests/bpf/xskxceiver.h
> > > index 906de5fab7a3..885c948c5d83 100644
> > > --- a/tools/testing/selftests/bpf/xskxceiver.h
> > > +++ b/tools/testing/selftests/bpf/xskxceiver.h
> > > @@ -80,6 +80,8 @@ struct xsk_umem_info {
> > > void *buffer;
> > > u32 frame_size;
> > > u32 base_addr;
> > > + u32 fill_size;
> > > + u32 comp_size;
> > > bool unaligned_mode;
> > > };
> > >
> > > --
> > > 2.34.1
> > >
>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-06-26 8:51 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-19 13:20 [PATCH bpf-next 0/2] selftests/xsk: Enhance traffic validation and batch size support Tushar Vyavahare
2024-06-19 13:20 ` [PATCH bpf-next 1/2] selftests/xsk: Ensure traffic validation proceeds after ring size adjustment in xskxceiver Tushar Vyavahare
2024-06-25 17:22 ` Maciej Fijalkowski
2024-06-19 13:20 ` [PATCH bpf-next 2/2] selftests/xsk: Enhance batch size support with dynamic configurations Tushar Vyavahare
2024-06-25 17:40 ` Maciej Fijalkowski
2024-06-26 8:36 ` Vyavahare, Tushar
2024-06-26 8:51 ` Magnus Karlsson
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).