patch 'bus/dpaa: fix hang on FQ shutdown' has been queued to stable release 25.11.5

Kevin Traynor ktraynor at redhat.com
Thu Dec 3 14:03:52 CET 2026


Hi,

FYI, your patch has been queued to stable release 25.11.5

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/08/26. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/e33408e33017b8c1194b82f9440f6001ef4d2316

Thanks.

Kevin

---
>From e33408e33017b8c1194b82f9440f6001ef4d2316 Mon Sep 17 00:00:00 2001
From: Jun Yang <jun.yang at nxp.com>
Date: Fri, 16 Oct 2026 16:49:39 +0530
Subject: [PATCH] bus/dpaa: fix hang on FQ shutdown

[ upstream commit dd82d0e9c46db5ae372893008d0785422d25b0d0 ]

qman_shutdown_fq() took only an fqid and always drained the FQ through
get_affine_portal(), the portal of the calling thread. A frame queue
that belongs to a different portal cannot be drained that way. Take
the FQ descriptor instead and use fq->qp when the caller has one,
falling back to the affine portal otherwise, so a caller that owns the
queue can drain it on the portal the queue is bound to. Add a
qman_shutdown_fq_by_fqid() wrapper for the one caller that only has an
fqid: net/dpaa cleans up a frame queue left behind by a previous run
before the queue is initialized, so no descriptor exists yet.

qman_shutdown_fq() also waits for the FQRN in an unbounded
do { } while (!found_fqrn) loop and picks the SDQCR drain source from
the channel the FQ sits on.

QM_SDQCR_CHANNELS_DEDICATED only dequeues the calling portal's own
channel, so an FQ on another portal's dedicated channel never delivers
the notification and the loop spins forever. Push-mode Rx queues are
such FQs. A channel in the DCP portal range cannot be drained from
software at all.

Reject both with -EBUSY instead of draining, bound the wait by
QMAN_FQRN_WAIT_MAX, and restore the portal SDQCR on every path.

Fixes: c47ff048b99a ("bus/dpaa: add QMAN driver core routines")

Signed-off-by: Jun Yang <jun.yang at nxp.com>
Signed-off-by: Gagandeep Singh <g.singh at nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal at nxp.com>
---
 drivers/bus/dpaa/base/qbman/qman.c  | 76 +++++++++++++++++------------
 drivers/bus/dpaa/include/fsl_qman.h | 16 +++++-
 drivers/net/dpaa/dpaa_ethdev.c      |  2 +-
 3 files changed, 60 insertions(+), 34 deletions(-)

diff --git a/drivers/bus/dpaa/base/qbman/qman.c b/drivers/bus/dpaa/base/qbman/qman.c
index 6b7f2adcf6..ff771dd754 100644
--- a/drivers/bus/dpaa/base/qbman/qman.c
+++ b/drivers/bus/dpaa/base/qbman/qman.c
@@ -2785,16 +2785,18 @@ qm_mc_result_timeout(struct qm_portal *portal,
 RTE_EXPORT_INTERNAL_SYMBOL(qman_shutdown_fq)
 int
-qman_shutdown_fq(u32 fqid)
+qman_shutdown_fq(struct qman_fq *fq)
 {
-	struct qman_portal *p;
+	struct qman_portal *p = fq->qp;
 	struct qm_mc_command *mcc;
 	struct qm_mc_result *mcr;
 	int orl_empty, drain = 0, ret = 0;
-	u32 res;
+	u32 res, fqid = fq->fqid;
+	u32 loop;
 	u8 state;
-	u32 channel, wq;
+	u32 channel;
 
 	DPAA_BUS_DEBUG("In shutdown for queue = %x", fqid);
-	p = get_affine_portal();
+	if (!p)
+		p = get_affine_portal();
 	/* Determine the state of the FQID */
 	mcc = qm_mc_start(&p->p);
@@ -2824,5 +2826,4 @@ qman_shutdown_fq(u32 fqid)
 	/* Need to store these since the MCR gets reused */
 	channel = qm_fqd_get_chan(&mcr->queryfq.fqd);
-	wq = qm_fqd_get_wq(&mcr->queryfq.fqd);
 
 	switch (state) {
@@ -2858,40 +2859,51 @@ qman_shutdown_fq(u32 fqid)
 			drain = 1;
 
-			__maybe_unused u16 dequeue_wq = 0;
 			if (channel >= qm_channel_pool1 &&
 				channel < (u16)(qm_channel_pool1 + 15)) {
-				/* Pool channel, enable the bit in the portal */
-				dequeue_wq = (channel -
-						qm_channel_pool1 + 1) << 4 | wq;
+				/* Any portal may subscribe to a pool channel. */
+				qm_dqrr_sdqcr_set(&p->p,
+						  QM_SDQCR_TYPE_ACTIVE |
+						  QM_SDQCR_CHANNELS_POOL_CONV(channel));
 			} else if (channel < qm_channel_pool1) {
-				/* Dedicated channel */
-				dequeue_wq = wq;
-			} else {
-				DPAA_BUS_ERR("Can't recover FQ 0x%x, ch: 0x%x",
-					fqid, channel);
-				ret = -EBUSY;
-				goto out;
-			}
-			/* Set the sdqcr to drain this channel */
-			if (channel < qm_channel_pool1)
+				/* DEDICATED only dequeues our own channel, so
+				 * another portal's FQ would never retire here.
+				 */
+				if (channel != p->config->channel) {
+					DPAA_BUS_ERR("FQ 0x%x on portal channel 0x%x, not ours(0x%x)",
+						fqid, channel,
+						p->config->channel);
+					ret = -EBUSY;
+					goto out;
+				}
 				qm_dqrr_sdqcr_set(&p->p,
 						  QM_SDQCR_TYPE_ACTIVE |
 						  QM_SDQCR_CHANNELS_DEDICATED);
-			else
-				qm_dqrr_sdqcr_set(&p->p,
-						  QM_SDQCR_TYPE_ACTIVE |
-						  QM_SDQCR_CHANNELS_POOL_CONV
-						  (channel));
-			do {
+			} else {
+				/* DCP portal channel, not drainable from software. */
+				DPAA_BUS_ERR("DCP portal channel 0x%x for FQ 0x%x",
+					channel, fqid);
+				ret = -EBUSY;
+				goto out;
+			}
+
+			for (loop = 0; loop < QMAN_FQRN_WAIT_MAX; loop++) {
 				/* Keep draining DQRR while checking the MR*/
 				qm_dqrr_drain_nomatch(&p->p);
 				/* Process message ring too */
-				found_fqrn = qm_mr_drain(&p->p,
-							FQRN);
+				found_fqrn = qm_mr_drain(&p->p, FQRN);
+				if (found_fqrn)
+					break;
 				cpu_relax();
-			} while (!found_fqrn);
-			/* Restore SDQCR */
-			qm_dqrr_sdqcr_set(&p->p,
-					p->sdqcr);
+			}
+
+			/* Restore portal SDQCR. */
+			qm_dqrr_sdqcr_set(&p->p, p->sdqcr);
+
+			if (!found_fqrn) {
+				DPAA_BUS_ERR("FQ 0x%x retire did not complete",
+					fqid);
+				ret = -EBUSY;
+				goto out;
+			}
 		}
 		if (res != QM_MCR_RESULT_OK &&
diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h
index 0494ad709d..c0bb648efb 100644
--- a/drivers/bus/dpaa/include/fsl_qman.h
+++ b/drivers/bus/dpaa/include/fsl_qman.h
@@ -1277,4 +1277,9 @@ struct qman_cgr {
 };
 
+/* Polling bound while waiting for an FQ retirement notification. A retire
+ * that has not been reported by then is not going to complete on this portal.
+ */
+#define QMAN_FQRN_WAIT_MAX		10000000u
+
 /* Flags to qman_create_fq() */
 #define QMAN_FQ_FLAG_NO_ENQUEUE      0x00000001 /* can't enqueue */
@@ -1897,5 +1902,14 @@ void qman_seed_fqid_range(u32 fqid, unsigned int count);
 
 __rte_internal
-int qman_shutdown_fq(u32 fqid);
+int qman_shutdown_fq(struct qman_fq *fq);
+
+static inline int qman_shutdown_fq_by_fqid(u32 fqid)
+{
+	struct qman_fq fq;
+
+	memset(&fq, 0, sizeof(struct qman_fq));
+	fq.fqid = fqid;
+	return qman_shutdown_fq(&fq);
+}
 
 /**
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 3e8d553270..afe54fcd09 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -2365,5 +2365,5 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 		 * before it is initialized.
 		 */
-		qman_shutdown_fq(fqid);
+		qman_shutdown_fq_by_fqid(fqid);
 
 		if (dpaa_intf->cgr_rx)
-- 
2.56.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2026-12-03 12:52:47.879627711 +0000
+++ 0306-bus-dpaa-fix-hang-on-FQ-shutdown.patch	2026-12-03 12:52:39.241938743 +0000
@@ -1 +1 @@
-From dd82d0e9c46db5ae372893008d0785422d25b0d0 Mon Sep 17 00:00:00 2001
+From e33408e33017b8c1194b82f9440f6001ef4d2316 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit dd82d0e9c46db5ae372893008d0785422d25b0d0 ]
+
@@ -30 +31,0 @@
-Cc: stable at dpdk.org
@@ -42 +43 @@
-index 25989f969f..5d7bf393c0 100644
+index 6b7f2adcf6..ff771dd754 100644
@@ -45 +46 @@
-@@ -2788,16 +2788,18 @@ qm_mc_result_timeout(struct qm_portal *portal,
+@@ -2785,16 +2785,18 @@ qm_mc_result_timeout(struct qm_portal *portal,
@@ -69 +70 @@
-@@ -2827,5 +2829,4 @@ qman_shutdown_fq(u32 fqid)
+@@ -2824,5 +2826,4 @@ qman_shutdown_fq(u32 fqid)
@@ -75 +76 @@
-@@ -2861,40 +2862,51 @@ qman_shutdown_fq(u32 fqid)
+@@ -2858,40 +2859,51 @@ qman_shutdown_fq(u32 fqid)
@@ -154 +155 @@
-index 82269cdf99..d67b571dcc 100644
+index 0494ad709d..c0bb648efb 100644
@@ -184 +185 @@
-index 1688acfb30..f6170f557d 100644
+index 3e8d553270..afe54fcd09 100644
@@ -187 +188 @@
-@@ -2360,5 +2360,5 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
+@@ -2365,5 +2365,5 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)



More information about the stable mailing list