From: Yury Kylulin Date: Mon, 29 Aug 2016 16:50:48 +0000 (+0300) Subject: net/i40e: fix mbuf leak during Rx queue release X-Git-Tag: spdx-start~5894 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=158efcdc5eed048f989c911ab372e78ceb1431bb;p=dpdk.git net/i40e: fix mbuf leak during Rx queue release For the vector PMD, release all mbufs from the Rx queue if no packets are received after device start. Fixes: 9ed94e5bb04e ("i40e: add vector Rx") Signed-off-by: Yury Kylulin Acked-by: Beilei Xing --- diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c index a9ca5153fe..2ce0d7d699 100644 --- a/drivers/net/i40e/i40e_rxtx_vec.c +++ b/drivers/net/i40e/i40e_rxtx_vec.c @@ -692,8 +692,20 @@ i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue *rxq) return; /* free all mbufs that are valid in the ring */ - for (i = rxq->rx_tail; i != rxq->rxrearm_start; i = (i + 1) & mask) - rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); + if (rxq->rxrearm_nb == 0) { + for (i = 0; i < rxq->nb_rx_desc; i++) { + if (rxq->sw_ring[i].mbuf != NULL) + rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); + } + } else { + for (i = rxq->rx_tail; + i != rxq->rxrearm_start; + i = (i + 1) & mask) { + if (rxq->sw_ring[i].mbuf != NULL) + rte_pktmbuf_free_seg(rxq->sw_ring[i].mbuf); + } + } + rxq->rxrearm_nb = rxq->nb_rx_desc; /* set all entries to NULL */