|WARNING| net/mlx5: fix Rx queue count with enhanced CQE compression

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Fri Nov 20 11:59:43 CET 2026


Test-Label: ai-code-review
Test-Status: WARNING
https://dpdk.org/patch/173059

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-11-20

**Error**

drivers/net/mlx5/mlx5_rx.c, rx_queue_count(): in the enhanced layout the CQ index advances by the mini-CQE count, which skips CQE slots.

```c
+			n = rxq->cqe_comp_layout ?
+			    MLX5_CQE_NUM_MINIS(op_own) + 1U :
+			    rte_be_to_cpu_32(cqe->byte_cnt);
 		...
 		cq_ci += n;
```

- The loop uses the same `n` for two things: the number of packets counted, and how far `cq_ci` moves.
- In the basic layout, `byte_cnt` of the title CQE covers the whole compressed session, so advancing `cq_ci` by `n` lands past it.
- In the enhanced layout, all mini-CQEs of a compressed CQE are packed into that single 64-byte CQE entry. Advancing `cq_ci` by `NUM_MINIS + 1` (up to 8) therefore steps over valid CQEs that follow.
- Those skipped entries are never counted. The next `check_cqe_iteration()` is then evaluated on an unrelated slot, and its validity iteration count may not match the expected wrap.
- The result is still a wrong queue count and descriptor status, just a different wrong value.

Keep the packet count and the CQ index advance separate in the enhanced case. For example:

```c
	unsigned int n, step = 1;

	if (MLX5_CQE_FORMAT(op_own) == MLX5_COMPRESSED) {
		if (rxq->cqe_comp_layout) {
			n = MLX5_CQE_NUM_MINIS(op_own) + 1U;
		} else {
			n = rte_be_to_cpu_32(cqe->byte_cnt);
			step = n;
		}
	} else {
		n = 1;
	}
	cq_ci += step;
	used += n;
```

Please confirm this against how the enhanced-layout Rx burst advances `rxq->cq_ci` per compressed CQE, and mirror that exactly.

**Info**

The ternary embedded in the `while` condition is hard to read. Consider selecting the status into a local variable, or adding a small inline helper such as `mlx5_rx_check_cqe(rxq, cqe, cq_ci)` that the burst path could also use.

Review-Result: ERROR


More information about the test-report mailing list