patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Yuanhan Liu <yliu@fridaylinux.org>
To: Xiaoxin Peng <xiaoxin.peng@broadcom.com>
Cc: Jay Ding <jay.ding@broadcom.com>,
	Scott Branden <scott.branden@broadcom.com>,
	Ray Jui <ray.jui@broadcom.com>,
	Randy Schacher <stuart.schacher@broadcom.com>,
	Ajit Khaparde <ajit.khaparde@broadcom.com>,
	dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/bnxt: fix Rx mbuf and agg ring leak in dev stop' has been queued to LTS release 17.11.3
Date: Sun, 20 May 2018 21:02:35 +0800	[thread overview]
Message-ID: <20180520130246.16287-19-yliu@fridaylinux.org> (raw)
In-Reply-To: <20180520130246.16287-1-yliu@fridaylinux.org>

Hi,

FYI, your patch has been queued to LTS release 17.11.3

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 05/27/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 9607f65550b1310b2d162435f82466fab2a9226b Mon Sep 17 00:00:00 2001
From: Xiaoxin Peng <xiaoxin.peng@broadcom.com>
Date: Mon, 30 Apr 2018 18:06:14 -0700
Subject: [PATCH] net/bnxt: fix Rx mbuf and agg ring leak in dev stop

[ upstream commit 3f07f2da6ca91febb67816ce8818cbdec4976413 ]

In the start/stop_op operation, mbufs allocated for rings were not freed

1) add bnxt_free_tx_mbuf/bnxt_free_rx_mbuf in bnxt_dev_stop_op to free MBUF
   before freeing the rings.
2) MBUF allocation and free routines were not in sync. Allocation uses the
   ring->ring_size including any rounded up and multiple factors while the
   free routine uses the requested queue size.

Fixes: c09f57b49c13 ("net/bnxt: add start/stop/link update operations")

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Xiaoxin Peng <xiaoxin.peng@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 4 ++--
 drivers/net/bnxt/bnxt_rxq.c    | 6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index b011f437f..52c511ee0 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -628,6 +628,8 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
 	}
 	bnxt_set_hwrm_link_config(bp, false);
 	bnxt_hwrm_port_clr_stats(bp);
+	bnxt_free_tx_mbufs(bp);
+	bnxt_free_rx_mbufs(bp);
 	bnxt_shutdown_nic(bp);
 	bp->dev_stopped = 1;
 }
@@ -639,8 +641,6 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
 	if (bp->dev_stopped == 0)
 		bnxt_dev_stop_op(eth_dev);
 
-	bnxt_free_tx_mbufs(bp);
-	bnxt_free_rx_mbufs(bp);
 	bnxt_free_mem(bp);
 	if (eth_dev->data->mac_addrs != NULL) {
 		rte_free(eth_dev->data->mac_addrs);
diff --git a/drivers/net/bnxt/bnxt_rxq.c b/drivers/net/bnxt/bnxt_rxq.c
index b4e9f38dd..5088e9dfd 100644
--- a/drivers/net/bnxt/bnxt_rxq.c
+++ b/drivers/net/bnxt/bnxt_rxq.c
@@ -237,7 +237,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 	if (rxq) {
 		sw_ring = rxq->rx_ring->rx_buf_ring;
 		if (sw_ring) {
-			for (i = 0; i < rxq->nb_rx_desc; i++) {
+			for (i = 0;
+			     i < rxq->rx_ring->rx_ring_struct->ring_size; i++) {
 				if (sw_ring[i].mbuf) {
 					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
 					sw_ring[i].mbuf = NULL;
@@ -247,7 +248,8 @@ static void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq)
 		/* Free up mbufs in Agg ring */
 		sw_ring = rxq->rx_ring->ag_buf_ring;
 		if (sw_ring) {
-			for (i = 0; i < rxq->nb_rx_desc; i++) {
+			for (i = 0;
+			     i < rxq->rx_ring->ag_ring_struct->ring_size; i++) {
 				if (sw_ring[i].mbuf) {
 					rte_pktmbuf_free_seg(sw_ring[i].mbuf);
 					sw_ring[i].mbuf = NULL;
-- 
2.11.0

  parent reply	other threads:[~2018-05-20 13:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-20 13:02 [dpdk-stable] patch 'event/dpaa2: remove link from info structure' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'crypto/scheduler: set null pointer after freeing' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'crypto/scheduler: fix memory leak' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/crypto-perf: check minimum lcore number' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/reorder: fix freeing mbuf twice' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/distributor: fix return type of thread function' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/pipeline: fix return type of stub miss' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'examples/quota_watermark: fix return type of threads' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix slave port detection' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix valid ports prints' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix forward ports update' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix forward ports Rx flush' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix synchronic port hotplug' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix removed device link status asking' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'examples/performance-thread: fix return type of threads' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'test/pipeline: fix type of table entry parameter' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'vhost: fix dead lock on closing in server mode' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/vhost: initialise device as inactive' " Yuanhan Liu
2018-05-20 13:02 ` Yuanhan Liu [this message]
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnxt: fix usage of vnic id' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'app/testpmd: fix empty list of RSS queues for flow' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/failsafe: fix probe cleanup' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/i40e: fix link status update' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bonding: fix slave activation simultaneously' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'mempool: fix virtual address population' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: do not cast function pointers as a policy' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: fix KR2 device check' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/bnx2x: fix memzone name overrun' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/i40e: fix failing to disable FDIR Tx queue' " Yuanhan Liu
2018-05-20 13:02 ` [dpdk-stable] patch 'net/ixgbe: fix too many interrupts' " 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=20180520130246.16287-19-yliu@fridaylinux.org \
    --to=yliu@fridaylinux.org \
    --cc=ajit.khaparde@broadcom.com \
    --cc=jay.ding@broadcom.com \
    --cc=ray.jui@broadcom.com \
    --cc=scott.branden@broadcom.com \
    --cc=stable@dpdk.org \
    --cc=stuart.schacher@broadcom.com \
    --cc=xiaoxin.peng@broadcom.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).