From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 314D72BB4 for ; Mon, 29 Aug 2016 18:54:54 +0200 (CEST) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP; 29 Aug 2016 09:54:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,597,1470726000"; d="scan'208";a="2376666" Received: from dpdk-test-2.inn.intel.com ([10.125.24.191]) by orsmga004.jf.intel.com with ESMTP; 29 Aug 2016 09:54:52 -0700 From: Yury Kylulin To: helin.zhang@intel.com, konstantin.ananyev@intel.com, jingjing.wu@intel.com Cc: wenzhuo.lu@intel.com, dev@dpdk.org, Yury Kylulin Date: Mon, 29 Aug 2016 19:50:48 +0300 Message-Id: <1472489448-15911-3-git-send-email-yury.kylulin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472489448-15911-1-git-send-email-yury.kylulin@intel.com> References: <1472489448-15911-1-git-send-email-yury.kylulin@intel.com> Subject: [dpdk-dev] [PATCH 2/2] net/i40e: fix mbufs leakage during Rx queue release X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Aug 2016 16:54:55 -0000 For the vector PMD release all mbufs from the Rx queue if no packets received after device start. Fixes: 9ed94e5bb04e ("i40e: add vector Rx") Signed-off-by: Yury Kylulin --- drivers/net/i40e/i40e_rxtx_vec.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/i40e/i40e_rxtx_vec.c b/drivers/net/i40e/i40e_rxtx_vec.c index 51fb282..82571ee 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 */ -- 2.7.4