[dpdk-dev] [PATCH 1/2] net/ixgbe: fix mbufs leakage during Rx queue release

2016-08-30 Thread Lu, Wenzhuo
Hi,

> -Original Message-
> From: Kylulin, Yury
> Sent: Tuesday, August 30, 2016 12:51 AM
> To: Zhang, Helin; Ananyev, Konstantin; Wu, Jingjing
> Cc: Lu, Wenzhuo; dev at dpdk.org; Kylulin, Yury
> Subject: [PATCH 1/2] net/ixgbe: fix mbufs leakage during Rx queue release
> 
> For the vector PMD release all mbufs from the Rx queue if no packets received
> after device start.
> 
> Fixes: 11b220c6498d ("ixgbe: fix release queue mbufs")
> 
> Signed-off-by: Yury Kylulin 
Acked-by: Wenzhuo Lu 


[dpdk-dev] [PATCH 1/2] net/ixgbe: fix mbufs leakage during Rx queue release

2016-08-29 Thread Yury Kylulin
For the vector PMD release all mbufs from the Rx queue if no packets
received after device start.

Fixes: 11b220c6498d ("ixgbe: fix release queue mbufs")

Signed-off-by: Yury Kylulin 
---
 drivers/net/ixgbe/ixgbe_rxtx_vec_common.h | 16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h 
b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
index 62b8201..3c3c009 100644
--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
+++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_common.h
@@ -204,8 +204,20 @@ _ixgbe_rx_queue_release_mbufs_vec(struct ixgbe_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 */
-- 
2.7.4