DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yury Kylulin <yury.kylulin@intel.com>
To: helin.zhang@intel.com, konstantin.ananyev@intel.com,
	jingjing.wu@intel.com
Cc: wenzhuo.lu@intel.com, dev@dpdk.org,
	Yury Kylulin <yury.kylulin@intel.com>
Subject: [dpdk-dev] [PATCH 2/2] net/i40e: fix mbufs leakage during Rx queue release
Date: Mon, 29 Aug 2016 19:50:48 +0300	[thread overview]
Message-ID: <1472489448-15911-3-git-send-email-yury.kylulin@intel.com> (raw)
In-Reply-To: <1472489448-15911-1-git-send-email-yury.kylulin@intel.com>

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 <yury.kylulin@intel.com>
---
 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

  parent reply	other threads:[~2016-08-29 16:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-29 16:50 [dpdk-dev] [PATCH 0/2] fix mbufs leakage during Rx queue release on ixgbe/i40e Yury Kylulin
2016-08-29 16:50 ` [dpdk-dev] [PATCH 1/2] net/ixgbe: fix mbufs leakage during Rx queue release Yury Kylulin
2016-08-30  2:00   ` Lu, Wenzhuo
2016-08-29 16:50 ` Yury Kylulin [this message]
2016-09-01  2:38   ` [dpdk-dev] [PATCH 2/2] net/i40e: " Xing, Beilei
2016-09-19 13:29 ` [dpdk-dev] [PATCH 0/2] fix mbufs leakage during Rx queue release on ixgbe/i40e Bruce Richardson
2016-09-19 13:52   ` Christian Ehrhardt
2016-09-19 14:47     ` [dpdk-dev] [dpdk-stable] " Yuanhan Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1472489448-15911-3-git-send-email-yury.kylulin@intel.com \
    --to=yury.kylulin@intel.com \
    --cc=dev@dpdk.org \
    --cc=helin.zhang@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).