DPDK patches and discussions
 help / color / mirror / Atom feed
From: Guoyang Zhou <zhouguoyang@huawei.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <bluca@debian.org>,
	<cloud.wangxiaoyun@huawei.com>, <luoxianjun@huawei.com>,
	<yin.yinshi@huawei.com>, <luojiachen@huawei.com>,
	<zhouguoyang@huawei.com>, <chenlizhong@huawei.com>,
	<zhaohui8@huawei.com>, <chenchanghu@huawei.com>,
	<stable@dpdk.org>
Subject: [dpdk-dev] [PATCH v1 1/1] net/hinic: fix the problem of hugepage memory leaks
Date: Fri, 20 Nov 2020 11:40:40 +0800	[thread overview]
Message-ID: <de81246d43808a9acfdc0c90c77c854364dae26a.1605842700.git.zhouguoyang@huawei.com> (raw)
In-Reply-To: <cover.1605842700.git.zhouguoyang@huawei.com>

The nic_io memory sets to NULL before free it, this is wrong, and
the freeing of some private port resources should be moved from the
".remove(device)" function to the ".dev_close(port)" function.

Fixes: f30e69b41f94 ("ethdev: add device flag to bypass auto-filled queue xstats")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
---
 drivers/net/hinic/base/hinic_pmd_nicio.c |  1 -
 drivers/net/hinic/hinic_pmd_ethdev.c     | 17 ++++++++---------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/hinic/base/hinic_pmd_nicio.c b/drivers/net/hinic/base/hinic_pmd_nicio.c
index 576fe59..2736305 100644
--- a/drivers/net/hinic/base/hinic_pmd_nicio.c
+++ b/drivers/net/hinic/base/hinic_pmd_nicio.c
@@ -664,7 +664,6 @@ static int hinic_init_nic_hwdev(struct hinic_hwdev *hwdev)
 static void hinic_free_nic_hwdev(struct hinic_hwdev *hwdev)
 {
 	hinic_vf_func_free(hwdev);
-	hwdev->nic_io = NULL;
 }
 
 int hinic_rx_tx_flush(struct hinic_hwdev *hwdev)
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index b694fd8..97c7f22 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -1268,6 +1268,8 @@ static void hinic_disable_interrupt(struct rte_eth_dev *dev)
 	if (retries == HINIC_INTR_CB_UNREG_MAX_RETRIES)
 		PMD_DRV_LOG(ERR, "Unregister intr callback failed after %d retries",
 			    retries);
+
+	rte_bit_relaxed_clear32(HINIC_DEV_INIT, &nic_dev->dev_status);
 }
 
 static int hinic_set_dev_promiscuous(struct hinic_nic_dev *nic_dev, bool enable)
@@ -1540,6 +1542,9 @@ static void hinic_deinit_mac_addr(struct rte_eth_dev *eth_dev)
 
 	/* delete multicast mac addrs */
 	hinic_delete_mc_addr_list(nic_dev);
+
+	rte_free(nic_dev->mc_list);
+
 }
 
 static int hinic_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
@@ -3006,6 +3011,9 @@ static int hinic_dev_close(struct rte_eth_dev *dev)
 	/* disable hardware and uio interrupt */
 	hinic_disable_interrupt(dev);
 
+	/* desctroy rx mode mutex */
+	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);
+
 	/* deinit nic hardware device */
 	hinic_nic_dev_destroy(dev);
 
@@ -3246,20 +3254,11 @@ static int hinic_dev_init(struct rte_eth_dev *eth_dev)
 
 static int hinic_dev_uninit(struct rte_eth_dev *dev)
 {
-	struct hinic_nic_dev *nic_dev;
-
-	nic_dev = HINIC_ETH_DEV_TO_PRIVATE_NIC_DEV(dev);
-	rte_bit_relaxed_clear32(HINIC_DEV_INIT, &nic_dev->dev_status);
-
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	hinic_mutex_destroy(&nic_dev->rx_mode_mutex);
-
 	hinic_dev_close(dev);
 
-	rte_free(nic_dev->mc_list);
-
 	return HINIC_OK;
 }
 
-- 
1.8.3.1


      reply	other threads:[~2020-11-20  3:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-20  3:40 [dpdk-dev] [PATCH v1 0/1] " Guoyang Zhou
2020-11-20  3:40 ` Guoyang Zhou [this message]

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=de81246d43808a9acfdc0c90c77c854364dae26a.1605842700.git.zhouguoyang@huawei.com \
    --to=zhouguoyang@huawei.com \
    --cc=bluca@debian.org \
    --cc=chenchanghu@huawei.com \
    --cc=chenlizhong@huawei.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=luojiachen@huawei.com \
    --cc=luoxianjun@huawei.com \
    --cc=stable@dpdk.org \
    --cc=yin.yinshi@huawei.com \
    --cc=zhaohui8@huawei.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).