DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yunjian Wang <wangyunjian@huawei.com>
To: <dev@dpdk.org>
Cc: <haiyue.wang@intel.com>, <beilei.xing@intel.com>,
	<qiming.yang@intel.com>,  <qi.z.zhang@intel.com>,
	<dingxiaoxiong@huawei.com>, Yunjian Wang <wangyunjian@huawei.com>
Subject: [dpdk-dev] [PATCH 3/4] net/i40e: delete HW rings when releasing queues
Date: Fri, 17 Sep 2021 19:24:54 +0800	[thread overview]
Message-ID: <429eef38654b1b565c232b3939320c02ce7f231e.1631877273.git.wangyunjian@huawei.com> (raw)
In-Reply-To: <cover.1631877273.git.wangyunjian@huawei.com>

Normally when closing the device the queue memzone should be
freed. But the memzone will be not freed, when device setup
ops like:
 - rte_eth_bond_slave_remove
 - rte_eth_dev_internal_reset
 - eth_dev_rx_queue_config
 - dev_rx_queue_release
 - dev_close
 - dev_free_queues

In order to free the memzone, we can release the memzone
when releasing queues.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/i40e/i40e_fdir.c | 3 ---
 drivers/net/i40e/i40e_rxtx.c | 8 ++++++--
 drivers/net/i40e/i40e_rxtx.h | 2 ++
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index af075fda2a..e910346e4d 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -284,7 +284,6 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 {
 	struct i40e_hw *hw = I40E_PF_TO_HW(pf);
 	struct i40e_vsi *vsi;
-	struct rte_eth_dev *dev = &rte_eth_devices[pf->dev_data->port_id];
 
 	vsi = pf->fdir.fdir_vsi;
 	if (!vsi)
@@ -301,10 +300,8 @@ i40e_fdir_teardown(struct i40e_pf *pf)
 	if (err)
 		PMD_DRV_LOG(DEBUG, "Failed to do FDIR RX switch off");
 
-	rte_eth_dma_zone_free(dev, "fdir_rx_ring", pf->fdir.rxq->queue_id);
 	i40e_dev_rx_queue_release(pf->fdir.rxq);
 	pf->fdir.rxq = NULL;
-	rte_eth_dma_zone_free(dev, "fdir_tx_ring", pf->fdir.txq->queue_id);
 	i40e_dev_tx_queue_release(pf->fdir.txq);
 	pf->fdir.txq = NULL;
 	i40e_vsi_release(vsi);
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 8329cbdd4e..b67eb1ee94 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2034,6 +2034,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	rxq->mz = rz;
 	/* Zero all the descriptors in the ring. */
 	memset(rz->addr, 0, ring_size);
 
@@ -2113,6 +2114,7 @@ i40e_dev_rx_queue_release(void *rxq)
 
 	i40e_rx_queue_release_mbufs(q);
 	rte_free(q->sw_ring);
+	rte_memzone_free(q->mz);
 	rte_free(q);
 }
 
@@ -2433,6 +2435,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_rs_thresh = tx_rs_thresh;
 	txq->tx_free_thresh = tx_free_thresh;
@@ -2506,6 +2509,7 @@ i40e_dev_tx_queue_release(void *txq)
 
 	i40e_tx_queue_release_mbufs(q);
 	rte_free(q->sw_ring);
+	rte_memzone_free(q->mz);
 	rte_free(q);
 }
 
@@ -3058,7 +3062,6 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
 			continue;
 		i40e_dev_rx_queue_release(dev->data->rx_queues[i]);
 		dev->data->rx_queues[i] = NULL;
-		rte_eth_dma_zone_free(dev, "rx_ring", i);
 	}
 
 	for (i = 0; i < dev->data->nb_tx_queues; i++) {
@@ -3066,7 +3069,6 @@ i40e_dev_free_queues(struct rte_eth_dev *dev)
 			continue;
 		i40e_dev_tx_queue_release(dev->data->tx_queues[i]);
 		dev->data->tx_queues[i] = NULL;
-		rte_eth_dma_zone_free(dev, "tx_ring", i);
 	}
 }
 
@@ -3109,6 +3111,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf)
 		return I40E_ERR_NO_MEMORY;
 	}
 
+	txq->mz = tz;
 	txq->nb_tx_desc = I40E_FDIR_NUM_TX_DESC;
 	txq->queue_id = I40E_FDIR_QUEUE_ID;
 	txq->reg_idx = pf->fdir.fdir_vsi->base_queue;
@@ -3167,6 +3170,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf)
 		return I40E_ERR_NO_MEMORY;
 	}
 
+	rxq->mz = rz;
 	rxq->nb_rx_desc = I40E_FDIR_NUM_RX_DESC;
 	rxq->queue_id = I40E_FDIR_QUEUE_ID;
 	rxq->reg_idx = pf->fdir.fdir_vsi->base_queue;
diff --git a/drivers/net/i40e/i40e_rxtx.h b/drivers/net/i40e/i40e_rxtx.h
index 5ccf5773e8..3c1a2fab89 100644
--- a/drivers/net/i40e/i40e_rxtx.h
+++ b/drivers/net/i40e/i40e_rxtx.h
@@ -121,6 +121,7 @@ struct i40e_rx_queue {
 	uint16_t rx_using_sse; /**<flag indicate the usage of vPMD for rx */
 	uint8_t dcb_tc;         /**< Traffic class of rx queue */
 	uint64_t offloads; /**< Rx offload flags of DEV_RX_OFFLOAD_* */
+	const struct rte_memzone *mz;
 };
 
 struct i40e_tx_entry {
@@ -166,6 +167,7 @@ struct i40e_tx_queue {
 	bool tx_deferred_start; /**< don't start this queue in dev start */
 	uint8_t dcb_tc;         /**< Traffic class of tx queue */
 	uint64_t offloads; /**< Tx offload flags of DEV_RX_OFFLOAD_* */
+	const struct rte_memzone *mz;
 };
 
 /** Offload features */
-- 
2.23.0


  parent reply	other threads:[~2021-09-17 11:25 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 11:24 [dpdk-dev] [PATCH 0/4] " Yunjian Wang
2021-09-17 11:24 ` [dpdk-dev] [PATCH 1/4] net/e1000: " Yunjian Wang
2021-09-17 11:24 ` [dpdk-dev] [PATCH 2/4] net/ice: " Yunjian Wang
2021-09-17 11:24 ` Yunjian Wang [this message]
2021-09-17 11:25 ` [dpdk-dev] [PATCH 4/4] net/ixgbe: " Yunjian Wang
2021-09-17 15:46   ` Wang, Haiyue
2021-09-18  3:10     ` wangyunjian
2021-09-18  3:19       ` Wang, Haiyue
2021-09-18  8:33 ` [dpdk-dev] [PATCH v2 0/4] delete HW rings when releasing queues for some drivers Yunjian Wang
2021-09-18  8:33   ` [dpdk-dev] [PATCH v2 1/4] net/e1000: delete HW rings when releasing queues Yunjian Wang
2021-09-18  8:41   ` [dpdk-dev] [PATCH v2 2/4] net/ice: " Yunjian Wang
2021-09-18  8:41   ` [dpdk-dev] [PATCH v2 3/4] net/i40e: " Yunjian Wang
2021-09-18  8:41   ` [dpdk-dev] [PATCH v2 4/4] net/ixgbe: " Yunjian Wang
2021-09-22  6:22     ` Wang, Haiyue
2021-09-22  6:58       ` wangyunjian
2021-09-22  7:04         ` Wang, Haiyue
2021-09-22 11:13           ` wangyunjian
2021-09-22 11:43             ` Wang, Haiyue
2021-09-20  7:25   ` [dpdk-dev] [PATCH v2 0/4] delete HW rings when releasing queues for some drivers David Marchand
2021-09-21  9:21     ` Wang, Haiyue
2021-09-22 13:27 ` [dpdk-dev] [PATCH v3 0/4] fixes for intel drivers Yunjian Wang
2021-09-22 13:28   ` [dpdk-dev] [PATCH v3 1/4] net/e1000: fix memzone leak when re-configure the RX/TX queues Yunjian Wang
2021-09-22 13:51     ` Wang, Haiyue
2021-09-22 13:28   ` [dpdk-dev] [PATCH v3 2/4] net/ice: " Yunjian Wang
2021-09-22 13:51     ` Wang, Haiyue
2021-09-22 13:29   ` [dpdk-dev] [PATCH v3 3/4] net/i40e: " Yunjian Wang
2021-09-22 13:51     ` Wang, Haiyue
2021-09-22 13:30   ` [dpdk-dev] [PATCH v3 4/4] net/ixgbe: " Yunjian Wang
2021-09-22 13:51     ` Wang, Haiyue
2021-10-07 11:39   ` [dpdk-dev] [PATCH v3 0/4] fixes for intel drivers Ferruh Yigit

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=429eef38654b1b565c232b3939320c02ce7f231e.1631877273.git.wangyunjian@huawei.com \
    --to=wangyunjian@huawei.com \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=dingxiaoxiong@huawei.com \
    --cc=haiyue.wang@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@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).