* [dpdk-dev] [PATCH] net/mlx5: fix threshold for mbuf replenishment in MPRQ
@ 2021-07-12 14:29 Alexander Kozyrev
2021-07-13 15:21 ` [dpdk-dev] [PATCH v2] " Alexander Kozyrev
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kozyrev @ 2021-07-12 14:29 UTC (permalink / raw)
To: dev; +Cc: stable, rasland, viacheslavo, matan, orika
The replenishment scheme for the vectorized MPRQ Rx burst aims
to improve the cache locality by allocating new mbufs only when
there are almost no mbufs left: one burst gap between allocated
and consumed indexes.
This gap is not big enough to accommodate a corner case when we
have a very aggressive CQE compression with up to 4 regular CQEs
and 64 zipped CQEs at the end.
Need to keep in mind this case and extend the replenishment
threshold by MLX5_VPMD_DESCS_PER_LOOP (4) to avoid mbuf overflow.
Fixes: 5fc2e5c27d6 ("net/mlx5: fix mbuf overflow in vectorized MPRQ")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
drivers/net/mlx5/mlx5_rxtx_vec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index d5af2d91ff..e22ab665df 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -152,7 +152,8 @@ mlx5_rx_mprq_replenish_bulk_mbuf(struct mlx5_rxq_data *rxq)
unsigned int i;
if (n >= rxq->rq_repl_thresh &&
- rxq->elts_ci - rxq->rq_pi <= rxq->rq_repl_thresh) {
+ rxq->elts_ci - rxq->rq_pi <=
+ (uint32_t)rxq->rq_repl_thresh + MLX5_VPMD_DESCS_PER_LOOP) {
MLX5_ASSERT(n >= MLX5_VPMD_RXQ_RPLNSH_THRESH(elts_n));
MLX5_ASSERT(MLX5_VPMD_RXQ_RPLNSH_THRESH(elts_n) >
MLX5_VPMD_DESCS_PER_LOOP);
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* [dpdk-dev] [PATCH v2] net/mlx5: fix threshold for mbuf replenishment in MPRQ
2021-07-12 14:29 [dpdk-dev] [PATCH] net/mlx5: fix threshold for mbuf replenishment in MPRQ Alexander Kozyrev
@ 2021-07-13 15:21 ` Alexander Kozyrev
2021-07-14 11:57 ` Raslan Darawsheh
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Kozyrev @ 2021-07-13 15:21 UTC (permalink / raw)
To: dev; +Cc: rasland, matan, viacheslavo, stable
The replenishment scheme for the vectorized MPRQ Rx burst aims
to improve the cache locality by allocating new mbufs only when
there are almost no mbufs left: one burst gap between allocated
and consumed indexes.
This gap is not big enough to accommodate a corner case when we
have a very aggressive CQE compression with multiple regular CQEs
at the beginning and 64 zipped CQEs at the end.
Need to keep in mind this case and extend the replenishment
threshold by MLX5_VPMD_RX_MAX_BURST (64) to avoid mbuf overflow.
Fixes: 5fc2e5c27d6 ("net/mlx5: fix mbuf overflow in vectorized MPRQ")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
v2: increased the replenishment gap to MLX5_VPMD_RX_MAX_BURST
v1: https://patchwork.dpdk.org/project/dpdk/patch/20210712142910.314572-1-akozyrev@nvidia.com/
drivers/net/mlx5/mlx5_rxtx_vec.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c
index e64ef70181..e1b6d5422a 100644
--- a/drivers/net/mlx5/mlx5_rxtx_vec.c
+++ b/drivers/net/mlx5/mlx5_rxtx_vec.c
@@ -157,7 +157,8 @@ mlx5_rx_mprq_replenish_bulk_mbuf(struct mlx5_rxq_data *rxq)
unsigned int i;
if (n >= rxq->rq_repl_thresh &&
- rxq->elts_ci - rxq->rq_pi <= rxq->rq_repl_thresh) {
+ rxq->elts_ci - rxq->rq_pi <=
+ rxq->rq_repl_thresh + MLX5_VPMD_RX_MAX_BURST) {
MLX5_ASSERT(n >= MLX5_VPMD_RXQ_RPLNSH_THRESH(elts_n));
MLX5_ASSERT(MLX5_VPMD_RXQ_RPLNSH_THRESH(elts_n) >
MLX5_VPMD_DESCS_PER_LOOP);
--
2.18.2
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/mlx5: fix threshold for mbuf replenishment in MPRQ
2021-07-13 15:21 ` [dpdk-dev] [PATCH v2] " Alexander Kozyrev
@ 2021-07-14 11:57 ` Raslan Darawsheh
0 siblings, 0 replies; 3+ messages in thread
From: Raslan Darawsheh @ 2021-07-14 11:57 UTC (permalink / raw)
To: Alexander Kozyrev, dev; +Cc: Matan Azrad, Slava Ovsiienko, stable
Hi,
> -----Original Message-----
> From: Alexander Kozyrev <akozyrev@nvidia.com>
> Sent: Tuesday, July 13, 2021 6:21 PM
> To: dev@dpdk.org
> Cc: Raslan Darawsheh <rasland@nvidia.com>; Matan Azrad
> <matan@nvidia.com>; Slava Ovsiienko <viacheslavo@nvidia.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/mlx5: fix threshold for mbuf replenishment in MPRQ
>
> The replenishment scheme for the vectorized MPRQ Rx burst aims
> to improve the cache locality by allocating new mbufs only when
> there are almost no mbufs left: one burst gap between allocated
> and consumed indexes.
>
> This gap is not big enough to accommodate a corner case when we
> have a very aggressive CQE compression with multiple regular CQEs
> at the beginning and 64 zipped CQEs at the end.
>
> Need to keep in mind this case and extend the replenishment
> threshold by MLX5_VPMD_RX_MAX_BURST (64) to avoid mbuf overflow.
>
> Fixes: 5fc2e5c27d6 ("net/mlx5: fix mbuf overflow in vectorized MPRQ")
> Cc: stable@dpdk.org
>
> Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> ---
>
> v2: increased the replenishment gap to MLX5_VPMD_RX_MAX_BURST
> v1:
> https://patchwork.dpdk.org/project/dpdk/patch/20210712142910.314572-1-
> akozyrev@nvidia.com/
>
> drivers/net/mlx5/mlx5_rxtx_vec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-14 11:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-12 14:29 [dpdk-dev] [PATCH] net/mlx5: fix threshold for mbuf replenishment in MPRQ Alexander Kozyrev
2021-07-13 15:21 ` [dpdk-dev] [PATCH v2] " Alexander Kozyrev
2021-07-14 11:57 ` Raslan Darawsheh
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).