Skip to contentSkip to conversation

Outdated CQE consumer index in rxq_burst_mprq_v()

DPDK/ethdev Bug 1805 [email protected] 1 participant 1 message Oct 22, 2025

lore
Share & tools
lore
#0 lore raw

http://bugs.dpdk.org/show_bug.cgi?id=1805

            Bug ID: 1805
           Summary: Outdated CQE consumer index in rxq_burst_mprq_v()
           Product: DPDK
           Version: 22.11
          Hardware: x86
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: ethdev
          Assignee: [email protected]
          Reporter: [email protected]

Target Milestone: ---

In function rxq_burst_mprq_v() [drivers/net/mlx5/mlx5_rxtx_vec.c line 470]:

unsigned int cq_idx = rxq->cq_ci & q_mask;
...
cq = &(*rxq->cqes)[cq_idx];
rte_prefetch0(cq);
rte_prefetch0(cq + 1);
rte_prefetch0(cq + 2);
rte_prefetch0(cq + 3);
...

if (rcvd_pkt > 0) {
    rcvd_pkt = RTE_MIN(rcvd_pkt, pkts_n);
    cp_pkt = rxq_copy_mprq_mbuf_v(rxq, pkts, rcvd_pkt); // rxq->cq_ci
incremented here
    rxq->decompressed -= rcvd_pkt;
    pkts += cp_pkt;
}

...
/* Not to overflow pkts array. */
pkts_n = RTE_ALIGN_FLOOR(pkts_n - cp_pkt, MLX5_VPMD_DESCS_PER_LOOP); /* Not to cross queue end. */
pkts_n = RTE_MIN(pkts_n, elts_n - elts_idx);
pkts_n = RTE_MIN(pkts_n, q_n - cq_idx); // (1)
...
/* At this point, there shouldn't be any remaining packets. */ MLX5_ASSERT(rxq->decompressed == 0);
/* Process all the CQEs */
nocmp_n = rxq_cq_process_v(rxq, cq, elts, pkts, pkts_n, err, &comp_idx); (2)

The cq pointer may be using an outdated rxq->cq_ci value if rcvd_pkt > 0 and rxq->cq_ci gets incremented in rxq_copy_mprq_mbuf_v(). This may have the following issues:
- pkts_n computed in (1) may be more than what it should be
- the cq pointer retrieved using the outdated cq_idx is being passed into rxq_cq_process_v() again (2).

For the fix, I think the value of cq_idx needs to be updated again after the processing the decompressed packets and cq pointer be retrieved after.

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.