[PATCH] net/mlx5: fix Rx queue count with enhanced CQE compression
Daniil Bobryshev (daniil@peresvet.it)
daniil at peresvet.it
Fri Nov 20 12:12:44 CET 2026
The ai-code-review check on this patch (https://dpdk.org/patch/173059)
says that in the enhanced layout cq_ci should move by one entry per
compressed CQE rather than by MLX5_CQE_NUM_MINIS() + 1, since all
mini-CQEs of an array sit in one 64-byte entry.
I do not think so. In the enhanced layout an array of N mini-CQEs is
written into one entry, but it still takes N entries of the CQ: the
NIC leaves the other N - 1 reserved (02a6195cbeaa: "The invalidation of
reserved CQEs between miniCQEs arrays is not needed"), and the next
CQE is N entries further. The Rx burst advances the consumer index the
same way:
- mlx5_rx_poll_len(): zip->cqe_cnt = MLX5_CQE_NUM_MINIS(op_own) + 1,
zip->cq_ci = rxq->cq_ci + zip->cqe_cnt, and rxq->cq_ci = zip->cq_ci
once the array is consumed.
- rxq_cq_decompress_v(): the next array is looked up at &cq[mcqe_n]
with check_cqe_iteration(cq, rxq->cqe_n, rxq->cq_ci + pkts_n), and
rxq_burst_v() then does rxq->cq_ci += rxq->decompressed.
- The kernel driver does the same in mlx5e_decompress_enhanced_cqe():
wq->cc moves by get_cqe_enhanced_num_mini_cqes() per array.
So in this layout, as in the basic one, the number of packets of a
compressed CQE and the number of CQ entries it takes are the same
value, and rx_queue_count() moves cq_ci by it. Moving by one would
land on a reserved entry the NIC did not write in this pass.
With this patch, on ConnectX-6 Dx with rxq_cqe_comp_en=129 at 100G, the
reported depth stayed within 0..568 of a 32768-entry ring, and the
datapath threads that poll it no longer hang.
The ternary in the loop condition is the same one mlx5_rx_poll_len()
uses; I can move it into a helper in a v2 if you prefer.
Thanks,
Daniil Bobryshev (daniil at peresvet.it)
More information about the dev
mailing list