[1/7] net/bnxt: avoid seg fault in Tx queue release

Message ID 20240208171330.31139-2-ajit.khaparde@broadcom.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series bnxt bug fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Ajit Khaparde Feb. 8, 2024, 5:13 p.m. UTC
  From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>

The tx queue mutex should be freed before the tx queue structure and
similarly the completion ring stats should be reset before ring free.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_txq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index f99ad211db..7d91e88c9d 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -104,12 +104,12 @@  void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx)
 
 		/* Free TX completion ring hardware descriptors */
 		if (txq->cp_ring) {
+			bnxt_free_txq_stats(txq);
 			bnxt_free_ring(txq->cp_ring->cp_ring_struct);
 			rte_free(txq->cp_ring->cp_ring_struct);
 			rte_free(txq->cp_ring);
 		}
 
-		bnxt_free_txq_stats(txq);
 		rte_memzone_free(txq->mz);
 		txq->mz = NULL;