net/bnxt: fix mbuf free when clearing Tx queue

Message ID 20191023142735.17571-1-lance.richardson@broadcom.com (mailing list archive)
State Accepted, archived
Headers
Series net/bnxt: fix mbuf free when clearing Tx queue |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-compilation success Compile Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed

Commit Message

Lance Richardson Oct. 23, 2019, 2:27 p.m. UTC
  When freeing pending transmit mbufs, use rte_pktmbuf_free_seg()
instead of rte_pktmbuf_free(), otherwise linked mbufs may be freed
more than once.

Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
---
 drivers/net/bnxt/bnxt_txq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ajit Khaparde Oct. 23, 2019, 3:40 p.m. UTC | #1
On Wed, Oct 23, 2019 at 10:27 AM Lance Richardson <
lance.richardson@broadcom.com> wrote:

> When freeing pending transmit mbufs, use rte_pktmbuf_free_seg()
> instead of rte_pktmbuf_free(), otherwise linked mbufs may be freed
> more than once.
>
> Fixes: 6eb3cc2294fd ("net/bnxt: add initial Tx code")
> Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
> Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
>
Patch applied to dpdk-next-net-brcm
  

Patch

diff --git a/drivers/net/bnxt/bnxt_txq.c b/drivers/net/bnxt/bnxt_txq.c
index ebb9199d2..6b866d445 100644
--- a/drivers/net/bnxt/bnxt_txq.c
+++ b/drivers/net/bnxt/bnxt_txq.c
@@ -34,7 +34,7 @@  static void bnxt_tx_queue_release_mbufs(struct bnxt_tx_queue *txq)
 	if (sw_ring) {
 		for (i = 0; i < txq->tx_ring->tx_ring_struct->ring_size; i++) {
 			if (sw_ring[i].mbuf) {
-				rte_pktmbuf_free(sw_ring[i].mbuf);
+				rte_pktmbuf_free_seg(sw_ring[i].mbuf);
 				sw_ring[i].mbuf = NULL;
 			}
 		}