patch 'net/octeon_ep: fix device start' has been queued to stable release 24.11.4

Kevin Traynor ktraynor at redhat.com
Fri Oct 31 15:33:00 CET 2025


Hi,

FYI, your patch has been queued to stable release 24.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/05/25. 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/c4c0edd1947bbc4095981dc0d96738ef22db524e

Thanks.

Kevin

---
>From c4c0edd1947bbc4095981dc0d96738ef22db524e Mon Sep 17 00:00:00 2001
From: Vamsi Attunuru <vattunuru at marvell.com>
Date: Mon, 14 Jul 2025 11:28:49 +0530
Subject: [PATCH] net/octeon_ep: fix device start

[ upstream commit c892964faa605c7884b454b435c4fb663dff0c9e ]

Currently the device start routine clears the TX doorbell and
updates RX doorbell, which causes the device start operation
to fail after a device stop.

Patch corrects the handling of RX & TX doorbell and ensures
that any pending packets in the RX queue are drained and gets
refilled before starting the device.

Fixes: 2c82554c98bd ("net/octeontx_ep: add device start and stop")

Signed-off-by: Vamsi Attunuru <vattunuru at marvell.com>
---
 drivers/net/octeon_ep/cnxk_ep_rx.c    | 40 +++++++++++++++++++++++++++
 drivers/net/octeon_ep/cnxk_ep_vf.c    | 32 ++++++++++-----------
 drivers/net/octeon_ep/otx2_ep_vf.c    | 30 +++++++++-----------
 drivers/net/octeon_ep/otx_ep_common.h |  1 +
 drivers/net/octeon_ep/otx_ep_ethdev.c |  6 ++++
 drivers/net/octeon_ep/otx_ep_rxtx.h   |  3 ++
 6 files changed, 77 insertions(+), 35 deletions(-)

diff --git a/drivers/net/octeon_ep/cnxk_ep_rx.c b/drivers/net/octeon_ep/cnxk_ep_rx.c
index a10e9c536e..9678cec90b 100644
--- a/drivers/net/octeon_ep/cnxk_ep_rx.c
+++ b/drivers/net/octeon_ep/cnxk_ep_rx.c
@@ -152,2 +152,42 @@ cn9k_ep_recv_pkts_mseg(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pk
 	return new_pkts;
 }
+
+void
+cnxk_ep_drain_rx_pkts(void *rx_queue)
+{
+	struct otx_ep_droq *droq = (struct otx_ep_droq *)rx_queue;
+	struct rte_mbuf *rx_pkt, *next_seg, *seg;
+	uint16_t i, j, nb_pkts;
+
+	if (droq->read_idx == 0 && droq->pkts_pending == 0 && droq->refill_count)
+		return;
+
+	/* Check for pending packets */
+	nb_pkts = cnxk_ep_rx_pkts_to_process(droq, droq->nb_desc);
+
+	/* Drain the pending packets */
+	for (i = 0; i < nb_pkts; i++) {
+		rx_pkt = NULL;
+		cnxk_ep_process_pkts_scalar_mseg(&rx_pkt, droq, 1);
+		if (rx_pkt) {
+			seg = rx_pkt->next;
+			for (j = 1; j < rx_pkt->nb_segs; j++) {
+				next_seg = seg->next;
+				rte_mempool_put(droq->mpool, seg);
+				seg = next_seg;
+			}
+			rx_pkt->nb_segs = 1;
+			rte_mempool_put(droq->mpool, rx_pkt);
+		}
+	}
+
+	cnxk_ep_rx_refill(droq);
+
+	/* Reset the indexes */
+	droq->read_idx  = 0;
+	droq->write_idx = 0;
+	droq->refill_idx = 0;
+	droq->refill_count = 0;
+	droq->last_pkt_count = 0;
+	droq->pkts_pending = 0;
+}
diff --git a/drivers/net/octeon_ep/cnxk_ep_vf.c b/drivers/net/octeon_ep/cnxk_ep_vf.c
index ca84cac962..a1d9f65f38 100644
--- a/drivers/net/octeon_ep/cnxk_ep_vf.c
+++ b/drivers/net/octeon_ep/cnxk_ep_vf.c
@@ -139,4 +139,16 @@ cnxk_ep_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
 	}
 
+	/* Clear the IQ doorbell  */
+	loop = OTX_EP_BUSY_LOOP_COUNT;
+	while ((rte_read64(iq->doorbell_reg) != 0ull) && loop--) {
+		rte_write32(OTX_EP_CLEAR_INSTR_DBELL, iq->doorbell_reg);
+		rte_delay_ms(1);
+	}
+
+	if (loop < 0) {
+		otx_ep_err("INSTR DBELL is not zero");
+		return -EIO;
+	}
+
 	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
 	 * to raise
@@ -238,6 +250,6 @@ cnxk_ep_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		(uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr
 			     + CNXK_EP_OQ_ISM_OFFSET(oq_no));
-	otx_ep_err("SDP_R[%d] OQ ISM virt: %p dma: 0x%" PRIX64,
-		    oq_no, (void *)(uintptr_t)droq->pkts_sent_ism, ism_addr);
+	otx_ep_dbg("SDP_R[%d] OQ ISM virt: %p dma: 0x%" PRIX64, oq_no,
+		   (void *)(uintptr_t)droq->pkts_sent_ism, ism_addr);
 	*droq->pkts_sent_ism = 0;
 	droq->pkts_sent_prev = 0;
@@ -267,22 +279,6 @@ static int
 cnxk_ep_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
 {
-	int loop = OTX_EP_BUSY_LOOP_COUNT;
 	uint64_t reg_val = 0ull;
 
-	/* Resetting doorbells during IQ enabling also to handle abrupt
-	 * guest reboot. IQ reset does not clear the doorbells.
-	 */
-	oct_ep_write64(0xFFFFFFFF, otx_ep->hw_addr + CNXK_EP_R_IN_INSTR_DBELL(q_no));
-
-	while (((oct_ep_read64(otx_ep->hw_addr +
-		 CNXK_EP_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
-		rte_delay_ms(1);
-	}
-
-	if (loop < 0) {
-		otx_ep_err("INSTR DBELL not coming back to 0");
-		return -EIO;
-	}
-
 	reg_val = oct_ep_read64(otx_ep->hw_addr + CNXK_EP_R_IN_ENABLE(q_no));
 	reg_val |= 0x1ull;
diff --git a/drivers/net/octeon_ep/otx2_ep_vf.c b/drivers/net/octeon_ep/otx2_ep_vf.c
index a482f4266e..00f723a5a8 100644
--- a/drivers/net/octeon_ep/otx2_ep_vf.c
+++ b/drivers/net/octeon_ep/otx2_ep_vf.c
@@ -288,4 +288,16 @@ otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no)
 	}
 
+	/* Clear the IQ doorbell  */
+	loop = OTX_EP_BUSY_LOOP_COUNT;
+	while ((rte_read64(iq->doorbell_reg) != 0ull) && loop--) {
+		rte_write32(OTX_EP_CLEAR_INSTR_DBELL, iq->doorbell_reg);
+		rte_delay_ms(1);
+	}
+
+	if (loop < 0) {
+		otx_ep_err("INSTR DBELL is not zero");
+		return -EIO;
+	}
+
 	/* IN INTR_THRESHOLD is set to max(FFFFFFFF) which disable the IN INTR
 	 * to raise
@@ -389,5 +401,5 @@ otx2_vf_setup_oq_regs(struct otx_ep_device *otx_ep, uint32_t oq_no)
 		(uint32_t __rte_atomic *)((uint8_t *)otx_ep->ism_buffer_mz->addr
 			     + OTX2_EP_OQ_ISM_OFFSET(oq_no));
-	otx_ep_err("SDP_R[%d] OQ ISM virt: %p, dma: 0x%x", oq_no,
+	otx_ep_dbg("SDP_R[%d] OQ ISM virt: %p, dma: 0x%x", oq_no,
 		   (void *)(uintptr_t)droq->pkts_sent_ism,
 		   (unsigned int)ism_addr);
@@ -412,22 +424,6 @@ static int
 otx2_vf_enable_iq(struct otx_ep_device *otx_ep, uint32_t q_no)
 {
-	int loop = SDP_VF_BUSY_LOOP_COUNT;
 	uint64_t reg_val = 0ull;
 
-	/* Resetting doorbells during IQ enabling also to handle abrupt
-	 * guest reboot. IQ reset does not clear the doorbells.
-	 */
-	oct_ep_write64(0xFFFFFFFF, otx_ep->hw_addr + SDP_VF_R_IN_INSTR_DBELL(q_no));
-
-	while (((oct_ep_read64(otx_ep->hw_addr +
-		 SDP_VF_R_IN_INSTR_DBELL(q_no))) != 0ull) && loop--) {
-		rte_delay_ms(1);
-	}
-
-	if (loop < 0) {
-		otx_ep_err("INSTR DBELL not coming back to 0");
-		return -EIO;
-	}
-
 	reg_val = oct_ep_read64(otx_ep->hw_addr + SDP_VF_R_IN_ENABLE(q_no));
 	reg_val |= 0x1ull;
diff --git a/drivers/net/octeon_ep/otx_ep_common.h b/drivers/net/octeon_ep/otx_ep_common.h
index 122926cd40..53de8b18d6 100644
--- a/drivers/net/octeon_ep/otx_ep_common.h
+++ b/drivers/net/octeon_ep/otx_ep_common.h
@@ -590,4 +590,5 @@ int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
 #define OTX_EP_CLEAR_OUT_INT_LVLS 0x3FFFFFFFFFFFFFULL
 #define OTX_EP_CLEAR_IN_INT_LVLS 0xFFFFFFFF
+#define OTX_EP_CLEAR_INSTR_DBELL 0xFFFFFFFF
 #define OTX_EP_CLEAR_SDP_IN_INT_LVLS 0x3FFFFFFFFFFFFFUL
 #define OTX_EP_DROQ_BUFSZ_MASK 0xFFFF
diff --git a/drivers/net/octeon_ep/otx_ep_ethdev.c b/drivers/net/octeon_ep/otx_ep_ethdev.c
index b4f8baf3b3..57a53e5d30 100644
--- a/drivers/net/octeon_ep/otx_ep_ethdev.c
+++ b/drivers/net/octeon_ep/otx_ep_ethdev.c
@@ -237,4 +237,10 @@ otx_ep_dev_start(struct rte_eth_dev *eth_dev)
 
 	otx_epvf = (struct otx_ep_device *)OTX_EP_DEV(eth_dev);
+
+	for (q = 0; q < otx_epvf->nb_rx_queues; q++) {
+		cnxk_ep_drain_rx_pkts(otx_epvf->droq[q]);
+		otx_epvf->fn_list.setup_oq_regs(otx_epvf, q);
+	}
+
 	/* Enable IQ/OQ for this device */
 	ret = otx_epvf->fn_list.enable_io_queues(otx_epvf);
diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.h b/drivers/net/octeon_ep/otx_ep_rxtx.h
index 6b3abe21b1..384e4fb412 100644
--- a/drivers/net/octeon_ep/otx_ep_rxtx.h
+++ b/drivers/net/octeon_ep/otx_ep_rxtx.h
@@ -33,4 +33,7 @@ otx_ep_incr_index(uint32_t index, uint32_t count, uint32_t max)
 }
 
+void
+cnxk_ep_drain_rx_pkts(void *rx_queue);
+
 uint16_t
 otx_ep_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts);
-- 
2.51.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2025-10-31 13:53:54.056136421 +0000
+++ 0058-net-octeon_ep-fix-device-start.patch	2025-10-31 13:53:52.167523777 +0000
@@ -1 +1 @@
-From c892964faa605c7884b454b435c4fb663dff0c9e Mon Sep 17 00:00:00 2001
+From c4c0edd1947bbc4095981dc0d96738ef22db524e Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit c892964faa605c7884b454b435c4fb663dff0c9e ]
+
@@ -15 +16,0 @@
-Cc: stable at dpdk.org
@@ -189 +190 @@
-index 10f2f8a2e0..cd8e4bad3b 100644
+index b4f8baf3b3..57a53e5d30 100644
@@ -192 +193 @@
-@@ -233,4 +233,10 @@ otx_ep_dev_start(struct rte_eth_dev *eth_dev)
+@@ -237,4 +237,10 @@ otx_ep_dev_start(struct rte_eth_dev *eth_dev)



More information about the stable mailing list