[01/15] net/cnxk: resolve sefgault caused during transmit completion
Checks
Commit Message
From: Rakesh Kudurumalla <rkudurumalla@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@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(+)
@@ -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 {
@@ -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 {