From: Di ChenxuX <chenxux.di@intel.com>
To: dev@dpdk.org
Cc: qiming.yang@intel.com, Di ChenxuX <chenxux.di@intel.com>
Subject: [dpdk-dev] [PATCH v6 2/5] net/fm10k: release port upon close
Date: Thu, 26 Sep 2019 10:00:12 +0000 [thread overview]
Message-ID: <20190926100015.53088-3-chenxux.di@intel.com> (raw)
In-Reply-To: <20190926100015.53088-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>
---
doc/guides/rel_notes/release_19_11.rst | 4 +
drivers/net/fm10k/fm10k_ethdev.c | 100 +++++++++++++------------
2 files changed, 56 insertions(+), 48 deletions(-)
diff --git a/doc/guides/rel_notes/release_19_11.rst b/doc/guides/rel_notes/release_19_11.rst
index 99de7b0a3..177cd9b4a 100644
--- a/doc/guides/rel_notes/release_19_11.rst
+++ b/doc/guides/rel_notes/release_19_11.rst
@@ -68,6 +68,10 @@ New Features
Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.
+* **Updated the Intel fm10k driver.**
+
+ Added support for the ``RTE_ETH_DEV_CLOSE_REMOVE`` flag.
+
Removed Items
-------------
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index f0f629008..f3048b6a6 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1202,28 +1202,6 @@ fm10k_dev_queue_release(struct rte_eth_dev *dev)
}
}
-static void
-fm10k_dev_close(struct rte_eth_dev *dev)
-{
- struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-
- PMD_INIT_FUNC_TRACE();
-
- fm10k_mbx_lock(hw);
- hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map,
- MAX_LPORT_NUM, false);
- fm10k_mbx_unlock(hw);
-
- /* allow 100ms for device to quiesce */
- rte_delay_us(FM10K_SWITCH_QUIESCE_US);
-
- /* Stop mailbox service first */
- fm10k_close_mbx_service(hw);
- fm10k_dev_stop(dev);
- fm10k_dev_queue_release(dev);
- fm10k_stop_hw(hw);
-}
-
static int
fm10k_link_update(struct rte_eth_dev *dev,
__rte_unused int wait_to_complete)
@@ -2809,6 +2787,53 @@ fm10k_close_mbx_service(struct fm10k_hw *hw)
hw->mbx.ops.disconnect(hw, &hw->mbx);
}
+static void
+fm10k_dev_close(struct rte_eth_dev *dev)
+{
+ struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+ struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
+ struct rte_intr_handle *intr_handle = &pdev->intr_handle;
+
+ PMD_INIT_FUNC_TRACE();
+
+ fm10k_mbx_lock(hw);
+ hw->mac.ops.update_lport_state(hw, hw->mac.dglort_map,
+ MAX_LPORT_NUM, false);
+ fm10k_mbx_unlock(hw);
+
+ /* allow 100ms for device to quiesce */
+ rte_delay_us(FM10K_SWITCH_QUIESCE_US);
+
+ /* Stop mailbox service first */
+ fm10k_close_mbx_service(hw);
+ fm10k_dev_stop(dev);
+ fm10k_dev_queue_release(dev);
+ fm10k_stop_hw(hw);
+
+ dev->dev_ops = NULL;
+ dev->rx_pkt_burst = NULL;
+ dev->tx_pkt_burst = NULL;
+
+ /* disable uio/vfio intr */
+ rte_intr_disable(intr_handle);
+
+ /*PF/VF has different interrupt handling mechanism */
+ if (hw->mac.type == fm10k_mac_pf) {
+ /* disable interrupt */
+ fm10k_dev_disable_intr_pf(dev);
+
+ /* unregister callback func to eal lib */
+ rte_intr_callback_unregister(intr_handle,
+ fm10k_dev_interrupt_handler_pf, (void *)dev);
+ } else {
+ /* disable interrupt */
+ fm10k_dev_disable_intr_vf(dev);
+
+ rte_intr_callback_unregister(intr_handle,
+ fm10k_dev_interrupt_handler_vf, (void *)dev);
+ }
+}
+
static const struct eth_dev_ops fm10k_eth_dev_ops = {
.dev_configure = fm10k_dev_configure,
.dev_start = fm10k_dev_start,
@@ -3113,6 +3138,11 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
&dev->data->mac_addrs[0]);
}
+ /* 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;
+
/* Reset the hw statistics */
fm10k_stats_reset(dev);
@@ -3215,9 +3245,6 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
static int
eth_fm10k_dev_uninit(struct rte_eth_dev *dev)
{
- struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
- struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
- struct rte_intr_handle *intr_handle = &pdev->intr_handle;
PMD_INIT_FUNC_TRACE();
/* only uninitialize in the primary process */
@@ -3227,29 +3254,6 @@ eth_fm10k_dev_uninit(struct rte_eth_dev *dev)
/* safe to close dev here */
fm10k_dev_close(dev);
- dev->dev_ops = NULL;
- dev->rx_pkt_burst = NULL;
- dev->tx_pkt_burst = NULL;
-
- /* disable uio/vfio intr */
- rte_intr_disable(intr_handle);
-
- /*PF/VF has different interrupt handling mechanism */
- if (hw->mac.type == fm10k_mac_pf) {
- /* disable interrupt */
- fm10k_dev_disable_intr_pf(dev);
-
- /* unregister callback func to eal lib */
- rte_intr_callback_unregister(intr_handle,
- fm10k_dev_interrupt_handler_pf, (void *)dev);
- } else {
- /* disable interrupt */
- fm10k_dev_disable_intr_vf(dev);
-
- rte_intr_callback_unregister(intr_handle,
- fm10k_dev_interrupt_handler_vf, (void *)dev);
- }
-
return 0;
}
--
2.17.1
next prev parent reply other threads:[~2019-09-26 10:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-27 5:01 [dpdk-dev] [PATCH] drivers/net: " chenxux.di
2019-08-27 6:23 ` Ye Xiaolong
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 0/5] " Di ChenxuX
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 1/5] net/e1000: " Di ChenxuX
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 2/5] net/fm10k: " Di ChenxuX
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 3/5] net/i40e: " Di ChenxuX
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 4/5] net/ice: " Di ChenxuX
2019-09-05 11:03 ` [dpdk-dev] [PATCH v3 5/5] net/ixgbe: " Di ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 0/5] drivers/net: " Di ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 1/5] net/e1000: " Di ChenxuX
2019-09-25 15:41 ` Ye Xiaolong
2019-09-26 3:21 ` Di, ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 2/5] net/fm10k: " Di ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 3/5] net/i40e: " Di ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 4/5] net/ice: " Di ChenxuX
2019-09-19 2:47 ` [dpdk-dev] [PATCH v4 5/5] net/ixgbe: " Di ChenxuX
2019-09-23 2:27 ` [dpdk-dev] [PATCH v4 0/5] drivers/net: " Yang, Qiming
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 " Di ChenxuX
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 1/5] net/e1000: " Di ChenxuX
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 2/5] net/fm10k: " Di ChenxuX
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 3/5] net/i40e: " Di ChenxuX
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 4/5] net/ice: " Di ChenxuX
2019-09-26 7:30 ` [dpdk-dev] [PATCH v5 5/5] net/ixgbe: " Di ChenxuX
2019-09-26 10:42 ` [dpdk-dev] [PATCH v5 0/5] drivers/net: " Ye Xiaolong
2019-09-26 10:00 ` [dpdk-dev] [PATCH v6 " Di ChenxuX
2019-09-26 10:00 ` [dpdk-dev] [PATCH v6 1/5] net/e1000: " Di ChenxuX
2019-09-26 10:00 ` Di ChenxuX [this message]
2019-09-26 10:00 ` [dpdk-dev] [PATCH v6 3/5] net/i40e: " Di ChenxuX
2019-09-26 10:00 ` [dpdk-dev] [PATCH v6 4/5] net/ice: " Di ChenxuX
2019-09-26 10:00 ` [dpdk-dev] [PATCH v6 5/5] net/ixgbe: " Di ChenxuX
2019-09-27 2:46 ` [dpdk-dev] [PATCH v6 0/5] drivers/net: " Yang, Qiming
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 " Di ChenxuX
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 1/5] net/e1000: " Di ChenxuX
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 2/5] net/fm10k: " Di ChenxuX
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 3/5] net/i40e: " Di ChenxuX
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 4/5] net/ice: " Di ChenxuX
2019-09-27 9:09 ` [dpdk-dev] [PATCH v7 5/5] net/ixgbe: " Di ChenxuX
2019-09-27 10:50 ` [dpdk-dev] [PATCH v7 0/5] drivers/net: " Ye Xiaolong
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=20190926100015.53088-3-chenxux.di@intel.com \
--to=chenxux.di@intel.com \
--cc=dev@dpdk.org \
--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).