DPDK patches and discussions
 help / color / mirror / Atom feed
From: bugzilla@dpdk.org
To: dev@dpdk.org
Subject: [DPDK/ethdev Bug 1805] Outdated CQE consumer index in rxq_burst_mprq_v()
Date: Wed, 22 Oct 2025 02:57:47 +0000	[thread overview]
Message-ID: <bug-1805-3@http.bugs.dpdk.org/> (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: dev@dpdk.org
          Reporter: canary.overflow@gmail.com
  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.

-- 
You are receiving this mail because:
You are the assignee for the bug.

                 reply	other threads:[~2025-10-22  2:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-1805-3@http.bugs.dpdk.org/ \
    --to=bugzilla@dpdk.org \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).