[PATCH] net/mlx5: fix Rx queue count with enhanced CQE compression
Daniil Bobryshev
daniil at peresvet.it
Thu Nov 19 21:34:48 CET 2026
With the enhanced CQE compression layout (bit 7 of the rxq_cqe_comp_en
devarg) the Rx burst checks CQE ownership with the validity iteration
count and takes the number of packets of a compressed session from
op_own (MLX5_CQE_NUM_MINIS() + 1). rx_queue_count() was not updated:
it still checks the owner bit and reads the session size from byte_cnt
of the title CQE, as in the basic layout.
In the enhanced layout byte_cnt of a compressed CQE holds mini-CQE data
(a packet length), so the walk moves the consumer index by an arbitrary
amount, and since consumed CQEs are not invalidated in this layout the
owner bit check keeps accepting stale entries. rte_eth_rx_queue_count()
and rte_eth_rx_descriptor_status() return wrong values, and datapath
threads that poll the queue depth were observed stuck inside
rx_queue_count() on ConnectX-6 Dx.
When the enhanced layout is enabled, check the CQE with
check_cqe_iteration() and count MLX5_CQE_NUM_MINIS() + 1 packets per
compressed CQE, the same way the Rx burst does.
Fixes: 02a6195cbeaa ("net/mlx5: support enhanced CQE compression in Rx burst")
Cc: stable at dpdk.org
Signed-off-by: Daniil Bobryshev <daniil at peresvet.it>
---
.mailmap | 1 +
drivers/net/mlx5/mlx5_rx.c | 8 ++++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/.mailmap b/.mailmap
index a0096fb97..f7d683ee6 100644
--- a/.mailmap
+++ b/.mailmap
@@ -348,6 +348,7 @@ Daniel Shelepov <dashel at microsoft.com>
Daniel Verkamp <daniel.verkamp at intel.com>
Daniele Di Proietto <ddiproietto at vmware.com>
Daniil Agalakov <ade at amicon.ru>
+Daniil Bobryshev <daniil at peresvet.it>
Daniil Iskhakov <dish at amicon.ru>
Daniil Ushkov <daniil.ushkov at yandex.ru>
Danny Patel <dannyp at marvell.com>
diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c
index c0ad8d670..f55b96aeb 100644
--- a/drivers/net/mlx5/mlx5_rx.c
+++ b/drivers/net/mlx5/mlx5_rx.c
@@ -94,13 +94,17 @@ rx_queue_count(struct mlx5_rxq_data *rxq)
cq_ci = rxq->cq_ci;
}
cqe = &(*rxq->cqes)[cq_ci & cqe_cnt];
- while (check_cqe(cqe, cqe_n, cq_ci) != MLX5_CQE_STATUS_HW_OWN) {
+ while ((rxq->cqe_comp_layout ?
+ check_cqe_iteration(cqe, rxq->cqe_n, cq_ci) :
+ check_cqe(cqe, cqe_n, cq_ci)) != MLX5_CQE_STATUS_HW_OWN) {
int8_t op_own;
unsigned int n;
op_own = cqe->op_own;
if (MLX5_CQE_FORMAT(op_own) == MLX5_COMPRESSED)
- n = rte_be_to_cpu_32(cqe->byte_cnt);
+ n = rxq->cqe_comp_layout ?
+ MLX5_CQE_NUM_MINIS(op_own) + 1U :
+ rte_be_to_cpu_32(cqe->byte_cnt);
else
n = 1;
cq_ci += n;
--
2.56.0
More information about the dev
mailing list