From: Di ChenxuX <chenxux.di@intel.com>
To: dev@dpdk.org
Cc: Wenzhuo Lu <wenzhuo.lu@intel.com>,
Beilei Xing <beilei.xing@intel.com>,
Qi Zhang <qi.z.zhang@intel.com>,
Yang Qiming <qiming.yang@intel.com>,
Di ChenxuX <chenxux.di@intel.com>
Subject: [dpdk-dev] [PATCH 4/5] net/ice: release port upon close
Date: Mon, 2 Sep 2019 10:27:44 +0000 [thread overview]
Message-ID: <20190902102745.66695-5-chenxux.di@intel.com> (raw)
In-Reply-To: <20190902102745.66695-1-chenxux.di@intel.com>
Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close().
Signed-off-by: Di ChenxuX <chenxux.di@intel.com>
---
drivers/net/ice/ice_ethdev.c | 33 ++++++++++++++++++++++-----------
drivers/net/ice/ice_ethdev.h | 1 +
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 44a14cb8a..d2e2085fa 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -1488,6 +1488,11 @@ ice_dev_init(struct rte_eth_dev *dev)
goto err_init_mac;
}
+ /* Pass the information to the rte_eth_dev_close() that it should also
+ * release the private port resources.
+ */
+ dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
ret = ice_res_pool_init(&pf->msix_pool, 1,
hw->func_caps.common_cap.num_msix_vectors - 1);
if (ret) {
@@ -1536,6 +1541,9 @@ ice_dev_init(struct rte_eth_dev *dev)
TAILQ_INIT(&pf->flow_list);
+ pf->adapter_stopped = 0;
+ pf->adapter_closed = 0;
+
return 0;
err_pf_setup:
@@ -1653,6 +1661,9 @@ ice_dev_close(struct rte_eth_dev *dev)
{
struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
struct ice_hw *hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+ struct rte_flow *p_flow;
/* Since stop will make link down, then the link event will be
* triggered, disable the irq firstly to avoid the port_infoe etc
@@ -1672,17 +1683,6 @@ ice_dev_close(struct rte_eth_dev *dev)
rte_free(hw->port_info);
hw->port_info = NULL;
ice_shutdown_all_ctrlq(hw);
-}
-
-static int
-ice_dev_uninit(struct rte_eth_dev *dev)
-{
- struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
- struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
- struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
- struct rte_flow *p_flow;
-
- ice_dev_close(dev);
dev->dev_ops = NULL;
dev->rx_pkt_burst = NULL;
@@ -1705,6 +1705,17 @@ ice_dev_uninit(struct rte_eth_dev *dev)
rte_free(p_flow);
}
+ pf->adapter_closed = 1;
+}
+
+static int
+ice_dev_uninit(struct rte_eth_dev *dev)
+{
+ struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
+
+ if (pf->adapter_closed == 0)
+ ice_dev_close(dev);
+
return 0;
}
diff --git a/drivers/net/ice/ice_ethdev.h b/drivers/net/ice/ice_ethdev.h
index f569da833..2d4a2b4bb 100644
--- a/drivers/net/ice/ice_ethdev.h
+++ b/drivers/net/ice/ice_ethdev.h
@@ -270,6 +270,7 @@ struct ice_pf {
struct ice_eth_stats internal_stats;
bool offset_loaded;
bool adapter_stopped;
+ bool adapter_closed;
struct ice_flow_list flow_list;
};
--
2.17.1
next prev parent reply other threads:[~2019-09-02 11:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: " Di ChenxuX
2019-09-02 10:27 ` [dpdk-dev] [PATCH 1/5] net/e1000: " Di ChenxuX
2019-09-02 15:59 ` Ye Xiaolong
2019-09-02 10:27 ` [dpdk-dev] [PATCH 2/5] net/fm10k: " Di ChenxuX
2019-09-02 10:27 ` [dpdk-dev] [PATCH 3/5] net/i40e: " Di ChenxuX
2019-09-02 10:27 ` Di ChenxuX [this message]
2019-09-02 15:51 ` [dpdk-dev] [PATCH 4/5] net/ice: " Ye Xiaolong
2019-09-02 10:27 ` [dpdk-dev] [PATCH 5/5] net/ixgbe: " Di ChenxuX
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=20190902102745.66695-5-chenxux.di@intel.com \
--to=chenxux.di@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=qi.z.zhang@intel.com \
--cc=qiming.yang@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).