[PATCH 01/15] net/cnxk: resolve sefgault caused during transmit completion

Nithin Dabilpuram ndabilpuram at marvell.com
Fri Mar 3 09:09:59 CET 2023


From: Rakesh Kudurumalla <rkudurumalla at marvell.com>

while sending external buffers from application
if tx_compl_ena is not provided as devargs, cq for
transmit completion is not initialized but the same
is accessed in driver resulting in segfault.
This patch fixes the same by calling callback handler
before the actual packet is transmitted

Signed-off-by: Rakesh Kudurumalla <rkudurumalla at marvell.com>
---

Depends-on: series-27133 ("common/cnxk: add cnf10ka A1 platform")

 drivers/net/cnxk/cn10k_tx.h | 4 ++++
 drivers/net/cnxk/cn9k_tx.h  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h
index 1c1ce9642a..d0f7bc22a4 100644
--- a/drivers/net/cnxk/cn10k_tx.h
+++ b/drivers/net/cnxk/cn10k_tx.h
@@ -650,6 +650,10 @@ cn10k_nix_prefree_seg(struct rte_mbuf *m, struct cn10k_eth_txq *txq,
 	uint32_t sqe_id;
 
 	if (RTE_MBUF_HAS_EXTBUF(m)) {
+		if (unlikely(txq->tx_compl.ena == 0)) {
+			rte_pktmbuf_free_seg(m);
+			return 1;
+		}
 		if (send_hdr->w0.pnc) {
 			txq->tx_compl.ptr[send_hdr->w1.sqe_id]->next = m;
 		} else {
diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h
index b4ef45d65c..52661a624c 100644
--- a/drivers/net/cnxk/cn9k_tx.h
+++ b/drivers/net/cnxk/cn9k_tx.h
@@ -88,6 +88,10 @@ cn9k_nix_prefree_seg(struct rte_mbuf *m, struct cn9k_eth_txq *txq,
 	uint32_t sqe_id;
 
 	if (RTE_MBUF_HAS_EXTBUF(m)) {
+		if (unlikely(txq->tx_compl.ena == 0)) {
+			rte_pktmbuf_free_seg(m);
+			return 1;
+		}
 		if (send_hdr->w0.pnc) {
 			txq->tx_compl.ptr[send_hdr->w1.sqe_id]->next = m;
 		} else {
-- 
2.25.1



More information about the dev mailing list