DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close
@ 2019-09-02 10:27 Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 1/5] net/e1000: " Di ChenxuX
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
 for the port can be freed by rte_eth_dev_close().
This patch cover all the intel drivers.

Di ChenxuX (5):
  net/e1000: release port upon close
  net/fm10k: release port upon close
  net/i40e: release port upon close
  net/ice: release port upon close
  net/ixgbe: release port upon close

 drivers/net/e1000/e1000_ethdev.h  |   1 +
 drivers/net/e1000/igb_ethdev.c    | 142 +++++++++++++-----------
 drivers/net/fm10k/fm10k.h         |   3 +
 drivers/net/fm10k/fm10k_ethdev.c  | 122 ++++++++++++---------
 drivers/net/i40e/i40e_ethdev.c    | 131 +++++++++++-----------
 drivers/net/i40e/i40e_ethdev_vf.c |  25 +++--
 drivers/net/ice/ice_ethdev.c      |  33 ++++--
 drivers/net/ice/ice_ethdev.h      |   1 +
 drivers/net/ixgbe/ixgbe_ethdev.c  | 176 +++++++++++++++++-------------
 drivers/net/ixgbe/ixgbe_ethdev.h  |   2 +
 10 files changed, 362 insertions(+), 274 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 1/5] net/e1000: release port upon close
  2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close Di ChenxuX
@ 2019-09-02 10:27 ` Di ChenxuX
  2019-09-02 15:59   ` Ye Xiaolong
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 2/5] net/fm10k: " Di ChenxuX
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

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/e1000/e1000_ethdev.h |   1 +
 drivers/net/e1000/igb_ethdev.c   | 142 +++++++++++++++++--------------
 2 files changed, 81 insertions(+), 62 deletions(-)

diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
index 01ff9433b..67785fb67 100644
--- a/drivers/net/e1000/e1000_ethdev.h
+++ b/drivers/net/e1000/e1000_ethdev.h
@@ -282,6 +282,7 @@ struct e1000_adapter {
 	struct e1000_vf_info    *vfdata;
 	struct e1000_filter_info filter;
 	bool stopped;
+	bool closed;
 	struct rte_timecounter  systime_tc;
 	struct rte_timecounter  rx_tstamp_tc;
 	struct rte_timecounter  tx_tstamp_tc;
diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
index fec2b4289..022c61c7c 100644
--- a/drivers/net/e1000/igb_ethdev.c
+++ b/drivers/net/e1000/igb_ethdev.c
@@ -843,6 +843,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
 			&eth_dev->data->mac_addrs[0]);
 
+	/* Pass the information to the rte_eth_dev_close() that it should also
+	 * release the private port resources.
+	 */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	/* initialize the vfta */
 	memset(shadow_vfta, 0, sizeof(*shadow_vfta));
 
@@ -856,6 +861,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 	}
 	hw->mac.get_link_status = 1;
 	adapter->stopped = 0;
+	adapter->closed = 0;
 
 	/* Indicate SOL/IDER usage */
 	if (e1000_check_reset_block(hw) < 0) {
@@ -912,62 +918,17 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
 static int
 eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	struct rte_pci_device *pci_dev;
-	struct rte_intr_handle *intr_handle;
-	struct e1000_hw *hw;
 	struct e1000_adapter *adapter =
 		E1000_DEV_PRIVATE(eth_dev->data->dev_private);
-	struct e1000_filter_info *filter_info =
-		E1000_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
-	hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
-	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	intr_handle = &pci_dev->intr_handle;
-
-	if (adapter->stopped == 0)
+	if (adapter->closed == 0)
 		eth_igb_close(eth_dev);
 
-	eth_dev->dev_ops = NULL;
-	eth_dev->rx_pkt_burst = NULL;
-	eth_dev->tx_pkt_burst = NULL;
-
-	/* Reset any pending lock */
-	igb_reset_swfw_lock(hw);
-
-	/* uninitialize PF if max_vfs not zero */
-	igb_pf_host_uninit(eth_dev);
-
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
-	rte_intr_callback_unregister(intr_handle,
-				     eth_igb_interrupt_handler, eth_dev);
-
-	/* clear the SYN filter info */
-	filter_info->syn_info = 0;
-
-	/* clear the ethertype filters info */
-	filter_info->ethertype_mask = 0;
-	memset(filter_info->ethertype_filters, 0,
-		E1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));
-
-	/* clear the rss filter info */
-	memset(&filter_info->rss_info, 0,
-		sizeof(struct igb_rte_flow_rss_conf));
-
-	/* remove all ntuple filters of the device */
-	igb_ntuple_filter_uninit(eth_dev);
-
-	/* remove all flex filters of the device */
-	igb_flex_filter_uninit(eth_dev);
-
-	/* clear all the filters list */
-	igb_filterlist_flush(eth_dev);
-
 	return 0;
 }
 
@@ -1010,6 +971,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->vendor_id = pci_dev->id.vendor_id;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
 	adapter->stopped = 0;
+	adapter->closed = 0;
 
 	/* Initialize the shared code (base driver) */
 	diag = e1000_setup_init_funcs(hw, TRUE);
@@ -1038,6 +1000,11 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
 		return -ENOMEM;
 	}
 
+	/* Pass the information to the rte_eth_dev_close() that it should also
+	 * release the private port resources.
+	 */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	/* Generate a random MAC address, if none was assigned by PF. */
 	if (rte_is_zero_ether_addr(perm_addr)) {
 		rte_eth_random_addr(perm_addr->addr_bytes);
@@ -1079,26 +1046,15 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
 	struct e1000_adapter *adapter =
 		E1000_DEV_PRIVATE(eth_dev->data->dev_private);
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
-	if (adapter->stopped == 0)
+	if (adapter->closed == 0)
 		igbvf_dev_close(eth_dev);
 
-	eth_dev->dev_ops = NULL;
-	eth_dev->rx_pkt_burst = NULL;
-	eth_dev->tx_pkt_burst = NULL;
-
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(&pci_dev->intr_handle);
-	rte_intr_callback_unregister(&pci_dev->intr_handle,
-				     eth_igbvf_interrupt_handler,
-				     (void *)eth_dev);
-
 	return 0;
 }
 
@@ -1506,6 +1462,11 @@ eth_igb_stop(struct rte_eth_dev *dev)
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_eth_link link;
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct e1000_adapter *adapter =
+		E1000_DEV_PRIVATE(dev->data->dev_private);
+
+	if (adapter->stopped)
+		return;
 
 	eth_igb_rxtx_control(dev, false);
 
@@ -1547,6 +1508,8 @@ eth_igb_stop(struct rte_eth_dev *dev)
 		rte_free(intr_handle->intr_vec);
 		intr_handle->intr_vec = NULL;
 	}
+
+	adapter->stopped = 1;
 }
 
 static int
@@ -1579,14 +1542,15 @@ static void
 eth_igb_close(struct rte_eth_dev *dev)
 {
 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	struct e1000_adapter *adapter =
-		E1000_DEV_PRIVATE(dev->data->dev_private);
 	struct rte_eth_link link;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct e1000_filter_info *filter_info =
+		E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
+	struct e1000_adapter *adapter =
+		E1000_DEV_PRIVATE(dev->data->dev_private);
 
 	eth_igb_stop(dev);
-	adapter->stopped = 1;
 
 	e1000_phy_hw_reset(hw);
 	igb_release_manageability(hw);
@@ -1610,6 +1574,42 @@ eth_igb_close(struct rte_eth_dev *dev)
 
 	memset(&link, 0, sizeof(link));
 	rte_eth_linkstatus_set(dev, &link);
+
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	/* Reset any pending lock */
+	igb_reset_swfw_lock(hw);
+
+	/* uninitialize PF if max_vfs not zero */
+	igb_pf_host_uninit(dev);
+
+	rte_intr_callback_unregister(intr_handle,
+				     eth_igb_interrupt_handler, dev);
+
+	/* clear the SYN filter info */
+	filter_info->syn_info = 0;
+
+	/* clear the ethertype filters info */
+	filter_info->ethertype_mask = 0;
+	memset(filter_info->ethertype_filters, 0,
+		E1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));
+
+	/* clear the rss filter info */
+	memset(&filter_info->rss_info, 0,
+		sizeof(struct igb_rte_flow_rss_conf));
+
+	/* remove all ntuple filters of the device */
+	igb_ntuple_filter_uninit(dev);
+
+	/* remove all flex filters of the device */
+	igb_flex_filter_uninit(dev);
+
+	/* clear all the filters list */
+	igb_filterlist_flush(dev);
+
+	adapter->closed = 1;
 }
 
 /*
@@ -3331,6 +3331,11 @@ igbvf_dev_stop(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 e1000_adapter *adapter =
+		E1000_DEV_PRIVATE(dev->data->dev_private);
+
+	if (adapter->stopped == 1)
+		return;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -3353,6 +3358,8 @@ igbvf_dev_stop(struct rte_eth_dev *dev)
 		rte_free(intr_handle->intr_vec);
 		intr_handle->intr_vec = NULL;
 	}
+
+	adapter->stopped = 1;
 }
 
 static void
@@ -3362,13 +3369,14 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 	struct e1000_adapter *adapter =
 		E1000_DEV_PRIVATE(dev->data->dev_private);
 	struct rte_ether_addr addr;
+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 
 	PMD_INIT_FUNC_TRACE();
 
 	e1000_reset_hw(hw);
 
 	igbvf_dev_stop(dev);
-	adapter->stopped = 1;
+
 	igb_dev_free_queues(dev);
 
 	/**
@@ -3379,6 +3387,16 @@ igbvf_dev_close(struct rte_eth_dev *dev)
 
 	memset(&addr, 0, sizeof(addr));
 	igbvf_default_mac_addr_set(dev, &addr);
+
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	rte_intr_callback_unregister(&pci_dev->intr_handle,
+				     eth_igbvf_interrupt_handler,
+				     (void *)dev);
+
+	adapter->closed = 1;
 }
 
 static void
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 2/5] net/fm10k: release port upon close
  2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 1/5] net/e1000: " Di ChenxuX
@ 2019-09-02 10:27 ` Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 3/5] net/i40e: " Di ChenxuX
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

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/fm10k/fm10k.h        |   3 +
 drivers/net/fm10k/fm10k_ethdev.c | 122 ++++++++++++++++++-------------
 2 files changed, 75 insertions(+), 50 deletions(-)

diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h
index 916b856ac..40ded015c 100644
--- a/drivers/net/fm10k/fm10k.h
+++ b/drivers/net/fm10k/fm10k.h
@@ -133,6 +133,9 @@ struct fm10k_adapter {
 	struct fm10k_hw             hw;
 	struct fm10k_hw_stats       stats;
 	struct fm10k_dev_info       info;
+
+	bool stopped;
+	bool closed;
 };
 
 #define FM10K_DEV_PRIVATE_TO_HW(adapter) \
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index db4d72129..d21448776 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -1054,10 +1054,13 @@ static int
 fm10k_dev_start(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct fm10k_adapter *adapter = dev->data->dev_private;
 	int i, diag;
 
 	PMD_INIT_FUNC_TRACE();
 
+	adapter->stopped = 0;
+
 	/* stop, init, then start the hw */
 	diag = fm10k_stop_hw(hw);
 	if (diag != FM10K_SUCCESS) {
@@ -1140,10 +1143,14 @@ static void
 fm10k_dev_stop(struct rte_eth_dev *dev)
 {
 	struct fm10k_hw *hw = FM10K_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct fm10k_adapter *adapter = dev->data->dev_private;
 	struct rte_pci_device *pdev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pdev->intr_handle;
 	int i;
 
+	if (adapter->stopped == 1)
+		return;
+
 	PMD_INIT_FUNC_TRACE();
 
 	if (dev->data->tx_queues)
@@ -1171,6 +1178,8 @@ fm10k_dev_stop(struct rte_eth_dev *dev)
 	rte_intr_efd_disable(intr_handle);
 	rte_free(intr_handle->intr_vec);
 	intr_handle->intr_vec = NULL;
+
+	adapter->stopped = 1;
 }
 
 static void
@@ -1194,28 +1203,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)
@@ -2799,6 +2786,56 @@ 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;
+	struct fm10k_adapter *adapter = 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);
+
+	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);
+	}
+
+	adapter->closed = 1;
+}
+
 static const struct eth_dev_ops fm10k_eth_dev_ops = {
 	.dev_configure		= fm10k_dev_configure,
 	.dev_start		= fm10k_dev_start,
@@ -3022,6 +3059,7 @@ eth_fm10k_dev_init(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;
+	struct fm10k_adapter *adapter = dev->data->dev_private;
 	int diag, i;
 	struct fm10k_macvlan_filter_info *macvlan;
 
@@ -3103,6 +3141,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);
 
@@ -3199,46 +3242,25 @@ eth_fm10k_dev_init(struct rte_eth_dev *dev)
 	fm10k_MAC_filter_set(dev, hw->mac.addr, true,
 		MAIN_VSI_POOL_NUMBER);
 
+	adapter->closed = 0;
+	adapter->stopped = 0;
+
 	return 0;
 }
 
 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;
+	struct fm10k_adapter *adapter = dev->data->dev_private;
+
 	PMD_INIT_FUNC_TRACE();
 
 	/* only uninitialize in the primary process */
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	/* 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);
-	}
+	if (adapter->closed == 0)
+		fm10k_dev_close(dev);
 
 	return 0;
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 3/5] net/i40e: release port upon close
  2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 1/5] net/e1000: " Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 2/5] net/fm10k: " Di ChenxuX
@ 2019-09-02 10:27 ` Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 4/5] net/ice: " Di ChenxuX
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 5/5] net/ixgbe: " Di ChenxuX
  4 siblings, 0 replies; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

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/i40e/i40e_ethdev.c    | 131 +++++++++++++++---------------
 drivers/net/i40e/i40e_ethdev_vf.c |  25 ++++--
 2 files changed, 83 insertions(+), 73 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4e40b7ab5..401578694 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -1520,6 +1520,11 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr,
 					&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;
+
 	/* Init dcb to sw mode by default */
 	ret = i40e_dcb_init_configure(dev, TRUE);
 	if (ret != I40E_SUCCESS) {
@@ -1690,14 +1695,8 @@ static int
 eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf;
-	struct rte_pci_device *pci_dev;
-	struct rte_intr_handle *intr_handle;
 	struct i40e_hw *hw;
-	struct i40e_filter_control_settings settings;
-	struct rte_flow *p_flow;
 	int ret;
-	uint8_t aq_fail = 0;
-	int retries = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1706,68 +1705,16 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
 
 	pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
-	pci_dev = RTE_ETH_DEV_TO_PCI(dev);
-	intr_handle = &pci_dev->intr_handle;
-
-	ret = rte_eth_switch_domain_free(pf->switch_domain_id);
-	if (ret)
-		PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
 
-	if (hw->adapter_closed == 0)
+	if (hw->adapter_closed != 0) {
+		ret = rte_eth_switch_domain_free(pf->switch_domain_id);
+		if (ret)
+			PMD_INIT_LOG(WARNING,
+				"failed to free switch domain: %d", ret);
+	} else {
 		i40e_dev_close(dev);
-
-	dev->dev_ops = NULL;
-	dev->rx_pkt_burst = NULL;
-	dev->tx_pkt_burst = NULL;
-
-	/* Clear PXE mode */
-	i40e_clear_pxe_mode(hw);
-
-	/* Unconfigure filter control */
-	memset(&settings, 0, sizeof(settings));
-	ret = i40e_set_filter_control(hw, &settings);
-	if (ret)
-		PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
-					ret);
-
-	/* Disable flow control */
-	hw->fc.requested_mode = I40E_FC_NONE;
-	i40e_set_fc(hw, &aq_fail, TRUE);
-
-	/* uninitialize pf host driver */
-	i40e_pf_host_uninit(dev);
-
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
-
-	/* unregister callback func to eal lib */
-	do {
-		ret = rte_intr_callback_unregister(intr_handle,
-				i40e_dev_interrupt_handler, dev);
-		if (ret >= 0) {
-			break;
-		} else if (ret != -EAGAIN) {
-			PMD_INIT_LOG(ERR,
-				 "intr callback unregister failed: %d",
-				 ret);
-			return ret;
-		}
-		i40e_msec_delay(500);
-	} while (retries++ < 5);
-
-	i40e_rm_ethtype_filter_list(pf);
-	i40e_rm_tunnel_filter_list(pf);
-	i40e_rm_fdir_filter_list(pf);
-
-	/* Remove all flows */
-	while ((p_flow = TAILQ_FIRST(&pf->flow_list))) {
-		TAILQ_REMOVE(&pf->flow_list, p_flow, node);
-		rte_free(p_flow);
 	}
 
-	/* Remove all Traffic Manager configuration */
-	i40e_tm_conf_uninit(dev);
-
 	return 0;
 }
 
@@ -2465,12 +2412,21 @@ i40e_dev_close(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 i40e_mirror_rule *p_mirror;
+	struct i40e_filter_control_settings settings;
+	struct rte_flow *p_flow;
 	uint32_t reg;
 	int i;
 	int ret;
+	uint8_t aq_fail = 0;
+	int retries = 0;
 
 	PMD_INIT_FUNC_TRACE();
 
+	ret = rte_eth_switch_domain_free(pf->switch_domain_id);
+	if (ret)
+		PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
+
+
 	i40e_dev_stop(dev);
 
 	/* Remove all mirror rules */
@@ -2535,6 +2491,53 @@ i40e_dev_close(struct rte_eth_dev *dev)
 			(reg | I40E_PFGEN_CTRL_PFSWR_MASK));
 	I40E_WRITE_FLUSH(hw);
 
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	/* Clear PXE mode */
+	i40e_clear_pxe_mode(hw);
+
+	/* Unconfigure filter control */
+	memset(&settings, 0, sizeof(settings));
+	ret = i40e_set_filter_control(hw, &settings);
+	if (ret)
+		PMD_INIT_LOG(WARNING, "setup_pf_filter_control failed: %d",
+					ret);
+
+	/* Disable flow control */
+	hw->fc.requested_mode = I40E_FC_NONE;
+	i40e_set_fc(hw, &aq_fail, TRUE);
+
+	/* uninitialize pf host driver */
+	i40e_pf_host_uninit(dev);
+
+	do {
+		ret = rte_intr_callback_unregister(intr_handle,
+				i40e_dev_interrupt_handler, dev);
+		if (ret >= 0) {
+			break;
+		} else if (ret != -EAGAIN) {
+			PMD_INIT_LOG(ERR,
+				 "intr callback unregister failed: %d",
+				 ret);
+		}
+		i40e_msec_delay(500);
+	} while (retries++ < 5);
+
+	i40e_rm_ethtype_filter_list(pf);
+	i40e_rm_tunnel_filter_list(pf);
+	i40e_rm_fdir_filter_list(pf);
+
+	/* Remove all flows */
+	while ((p_flow = TAILQ_FIRST(&pf->flow_list))) {
+		TAILQ_REMOVE(&pf->flow_list, p_flow, node);
+		rte_free(p_flow);
+	}
+
+	/* Remove all Traffic Manager configuration */
+	i40e_tm_conf_uninit(dev);
+
 	hw->adapter_closed = 1;
 }
 
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 308fb9835..0916e01a6 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1310,17 +1310,12 @@ i40evf_init_vf(struct rte_eth_dev *dev)
 static int
 i40evf_uninit_vf(struct rte_eth_dev *dev)
 {
-	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (hw->adapter_closed == 0)
 		i40evf_dev_close(dev);
-	rte_free(vf->vf_res);
-	vf->vf_res = NULL;
-	rte_free(vf->aq_resp);
-	vf->aq_resp = NULL;
 
 	return 0;
 }
@@ -1498,6 +1493,11 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->adapter_stopped = 0;
 	hw->adapter_closed = 0;
 
+	/* Pass the information to the rte_eth_dev_close() that it should also
+	 * release the private port resources.
+	 */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	if(i40evf_init_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "Init vf failed");
 		return -1;
@@ -1534,10 +1534,6 @@ i40evf_dev_uninit(struct rte_eth_dev *eth_dev)
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return -EPERM;
 
-	eth_dev->dev_ops = NULL;
-	eth_dev->rx_pkt_burst = NULL;
-	eth_dev->tx_pkt_burst = NULL;
-
 	if (i40evf_uninit_vf(eth_dev) != 0) {
 		PMD_INIT_LOG(ERR, "i40evf_uninit_vf failed");
 		return -1;
@@ -2324,6 +2320,7 @@ static void
 i40evf_dev_close(struct rte_eth_dev *dev)
 {
 	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_vf *vf = I40EVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
 
 	i40evf_dev_stop(dev);
 	i40e_dev_free_queues(dev);
@@ -2339,6 +2336,16 @@ i40evf_dev_close(struct rte_eth_dev *dev)
 	i40evf_reset_vf(dev);
 	i40e_shutdown_adminq(hw);
 	i40evf_disable_irq0(hw);
+
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	rte_free(vf->vf_res);
+	vf->vf_res = NULL;
+	rte_free(vf->aq_resp);
+	vf->aq_resp = NULL;
+
 	hw->adapter_closed = 1;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 4/5] net/ice: release port upon close
  2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close Di ChenxuX
                   ` (2 preceding siblings ...)
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 3/5] net/i40e: " Di ChenxuX
@ 2019-09-02 10:27 ` Di ChenxuX
  2019-09-02 15:51   ` Ye Xiaolong
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 5/5] net/ixgbe: " Di ChenxuX
  4 siblings, 1 reply; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [dpdk-dev] [PATCH 5/5] net/ixgbe: release port upon close
  2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close Di ChenxuX
                   ` (3 preceding siblings ...)
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 4/5] net/ice: " Di ChenxuX
@ 2019-09-02 10:27 ` Di ChenxuX
  4 siblings, 0 replies; 8+ messages in thread
From: Di ChenxuX @ 2019-09-02 10:27 UTC (permalink / raw)
  To: dev; +Cc: Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming, Di ChenxuX

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/ixgbe/ixgbe_ethdev.c | 176 +++++++++++++++++--------------
 drivers/net/ixgbe/ixgbe_ethdev.h |   2 +
 2 files changed, 100 insertions(+), 78 deletions(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 03fc1f717..61fdc7aea 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1067,6 +1067,7 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
+	struct ixgbe_adapter *adapter = eth_dev->data->dev_private;
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
 	struct ixgbe_vfta *shadow_vfta =
@@ -1167,6 +1168,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 	}
 	hw->fc.send_xon = 1;
 
+	adapter->closed = 0;
+
 	/* Make sure we have a good EEPROM before we read from it */
 	diag = ixgbe_validate_eeprom_checksum(hw, &csum);
 	if (diag != IXGBE_SUCCESS) {
@@ -1245,6 +1248,11 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 		return -ENOMEM;
 	}
 
+	/* Pass the information to the rte_eth_dev_close() that it should also
+	 * release the private port resources.
+	 */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	/* initialize the vfta */
 	memset(shadow_vfta, 0, sizeof(*shadow_vfta));
 
@@ -1311,74 +1319,16 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused)
 static int
 eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-	struct ixgbe_hw *hw;
-	int retries = 0;
-	int ret;
+	struct ixgbe_adapter *adapter = eth_dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
-
-	if (hw->adapter_stopped == 0)
+	if (adapter->closed == 0)
 		ixgbe_dev_close(eth_dev);
 
-	eth_dev->dev_ops = NULL;
-	eth_dev->rx_pkt_burst = NULL;
-	eth_dev->tx_pkt_burst = NULL;
-
-	/* Unlock any pending hardware semaphore */
-	ixgbe_swfw_lock_reset(hw);
-
-	/* disable uio intr before callback unregister */
-	rte_intr_disable(intr_handle);
-
-	do {
-		ret = rte_intr_callback_unregister(intr_handle,
-				ixgbe_dev_interrupt_handler, eth_dev);
-		if (ret >= 0) {
-			break;
-		} else if (ret != -EAGAIN) {
-			PMD_INIT_LOG(ERR,
-				"intr callback unregister failed: %d",
-				ret);
-			return ret;
-		}
-		rte_delay_ms(100);
-	} while (retries++ < (10 + IXGBE_LINK_UP_TIME));
-
-	/* cancel the delay handler before remove dev */
-	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, eth_dev);
-
-	/* cancel the link handler before remove dev */
-	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, eth_dev);
-
-	/* uninitialize PF if max_vfs not zero */
-	ixgbe_pf_host_uninit(eth_dev);
-
-	/* remove all the fdir filters & hash */
-	ixgbe_fdir_filter_uninit(eth_dev);
-
-	/* remove all the L2 tunnel filters & hash */
-	ixgbe_l2_tn_filter_uninit(eth_dev);
-
-	/* Remove all ntuple filters of the device */
-	ixgbe_ntuple_filter_uninit(eth_dev);
-
-	/* clear all the filters list */
-	ixgbe_filterlist_flush();
-
-	/* Remove all Traffic Manager configuration */
-	ixgbe_tm_conf_uninit(eth_dev);
-
-#ifdef RTE_LIBRTE_SECURITY
-	rte_free(eth_dev->security_ctx);
-#endif
-
 	return 0;
 }
 
@@ -1615,6 +1565,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		IXGBE_DEV_PRIVATE_TO_HWSTRIP_BITMAP(eth_dev->data->dev_private);
 	struct rte_ether_addr *perm_addr =
 		(struct rte_ether_addr *)hw->mac.perm_addr;
+	struct ixgbe_adapter *adapter = eth_dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -1653,6 +1604,7 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 	hw->device_id = pci_dev->id.device_id;
 	hw->vendor_id = pci_dev->id.vendor_id;
 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
+	adapter->closed = 0;
 
 	/* initialize the vfta */
 	memset(shadow_vfta, 0, sizeof(*shadow_vfta));
@@ -1711,6 +1663,11 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 		return -ENOMEM;
 	}
 
+	/* Pass the information to the rte_eth_dev_close() that it should also
+	 * release the private port resources.
+	 */
+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
+
 	/* Generate a random MAC address, if none was assigned by PF. */
 	if (rte_is_zero_ether_addr(perm_addr)) {
 		generate_random_mac_addr(perm_addr);
@@ -1762,31 +1719,16 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev)
 static int
 eth_ixgbevf_dev_uninit(struct rte_eth_dev *eth_dev)
 {
-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
-	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
-	struct ixgbe_hw *hw;
+	struct ixgbe_adapter *adapter = eth_dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
 		return 0;
 
-	hw = IXGBE_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
-
-	if (hw->adapter_stopped == 0)
+	if (adapter->closed == 0)
 		ixgbevf_dev_close(eth_dev);
 
-	eth_dev->dev_ops = NULL;
-	eth_dev->rx_pkt_burst = NULL;
-	eth_dev->tx_pkt_burst = NULL;
-
-	/* Disable the interrupts for VF */
-	ixgbevf_intr_disable(eth_dev);
-
-	rte_intr_disable(intr_handle);
-	rte_intr_callback_unregister(intr_handle,
-				     ixgbevf_dev_interrupt_handler, eth_dev);
-
 	return 0;
 }
 
@@ -2876,6 +2818,9 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 	struct ixgbe_tm_conf *tm_conf =
 		IXGBE_DEV_PRIVATE_TO_TM_CONF(dev->data->dev_private);
 
+	if (hw->adapter_stopped == 1)
+		return;
+
 	PMD_INIT_FUNC_TRACE();
 
 	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
@@ -2928,6 +2873,8 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
 	tm_conf->committed = false;
 
 	adapter->rss_reta_updated = 0;
+
+	hw->adapter_stopped = 1;
 }
 
 /*
@@ -2998,13 +2945,18 @@ ixgbe_dev_close(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw =
 		IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct ixgbe_adapter *adapter = 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;
+	int retries = 0;
+	int ret;
 
 	PMD_INIT_FUNC_TRACE();
 
 	ixgbe_pf_reset_hw(hw);
 
 	ixgbe_dev_stop(dev);
-	hw->adapter_stopped = 1;
 
 	ixgbe_dev_free_queues(dev);
 
@@ -3012,6 +2964,56 @@ ixgbe_dev_close(struct rte_eth_dev *dev)
 
 	/* reprogram the RAR[0] in case user changed it. */
 	ixgbe_set_rar(hw, 0, hw->mac.addr, 0, IXGBE_RAH_AV);
+
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	/* Unlock any pending hardware semaphore */
+	ixgbe_swfw_lock_reset(hw);
+
+	/* disable uio intr before callback unregister */
+	rte_intr_disable(intr_handle);
+
+	do {
+		ret = rte_intr_callback_unregister(intr_handle,
+				ixgbe_dev_interrupt_handler, dev);
+		if (ret >= 0) {
+			break;
+		} else if (ret != -EAGAIN) {
+			PMD_INIT_LOG(ERR,
+				"intr callback unregister failed: %d",
+				ret);
+		}
+		rte_delay_ms(100);
+	} while (retries++ < (10 + IXGBE_LINK_UP_TIME));
+
+	/* cancel the delay handler before remove dev */
+	rte_eal_alarm_cancel(ixgbe_dev_interrupt_delayed_handler, dev);
+
+	/* uninitialize PF if max_vfs not zero */
+	ixgbe_pf_host_uninit(dev);
+
+	/* remove all the fdir filters & hash */
+	ixgbe_fdir_filter_uninit(dev);
+
+	/* remove all the L2 tunnel filters & hash */
+	ixgbe_l2_tn_filter_uninit(dev);
+
+	/* Remove all ntuple filters of the device */
+	ixgbe_ntuple_filter_uninit(dev);
+
+	/* clear all the filters list */
+	ixgbe_filterlist_flush();
+
+	/* Remove all Traffic Manager configuration */
+	ixgbe_tm_conf_uninit(dev);
+
+#ifdef RTE_LIBRTE_SECURITY
+	rte_free(dev->security_ctx);
+#endif
+
+	adapter->closed = 1;
 }
 
 /*
@@ -5233,6 +5235,8 @@ ixgbevf_dev_start(struct rte_eth_dev *dev)
 	 */
 	ixgbevf_dev_link_update(dev, 0);
 
+	hw->adapter_stopped = 0;
+
 	return 0;
 }
 
@@ -5244,6 +5248,9 @@ ixgbevf_dev_stop(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;
 
+	if (hw->adapter_stopped == 1)
+		return;
+
 	PMD_INIT_FUNC_TRACE();
 
 	rte_eal_alarm_cancel(ixgbe_dev_setup_link_alarm_handler, dev);
@@ -5278,6 +5285,9 @@ static void
 ixgbevf_dev_close(struct rte_eth_dev *dev)
 {
 	struct ixgbe_hw *hw = IXGBE_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 ixgbe_adapter *adapter = dev->data->dev_private;
 
 	PMD_INIT_FUNC_TRACE();
 
@@ -5293,6 +5303,16 @@ ixgbevf_dev_close(struct rte_eth_dev *dev)
 	 * after stop, close and detach of the VF
 	 **/
 	ixgbevf_remove_mac_addr(dev, 0);
+
+	dev->dev_ops = NULL;
+	dev->rx_pkt_burst = NULL;
+	dev->tx_pkt_burst = NULL;
+
+	rte_intr_disable(intr_handle);
+	rte_intr_callback_unregister(intr_handle,
+				     ixgbevf_dev_interrupt_handler, dev);
+
+	adapter->closed = 1;
 }
 
 /*
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h
index 6e9ed2e10..8bf6bfd3c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.h
+++ b/drivers/net/ixgbe/ixgbe_ethdev.h
@@ -503,6 +503,8 @@ struct ixgbe_adapter {
 	 * mailbox status) link status.
 	 */
 	uint8_t pflink_fullchk;
+
+	bool closed;
 };
 
 struct ixgbe_vf_representor {
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH 4/5] net/ice: release port upon close
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 4/5] net/ice: " Di ChenxuX
@ 2019-09-02 15:51   ` Ye Xiaolong
  0 siblings, 0 replies; 8+ messages in thread
From: Ye Xiaolong @ 2019-09-02 15:51 UTC (permalink / raw)
  To: Di ChenxuX; +Cc: dev, Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming

Hi, Chenxu

On 09/02, Di ChenxuX wrote:
>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;

I think the adapter_closed is useless here, unlike the adapter_stopped which
can be set to false when the port restart, after closing a port with dev_close,
it cannot be reopened.

Thanks,
Xiaolong
> 	struct ice_flow_list flow_list;
> };
> 
>-- 
>2.17.1
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [dpdk-dev] [PATCH 1/5] net/e1000: release port upon close
  2019-09-02 10:27 ` [dpdk-dev] [PATCH 1/5] net/e1000: " Di ChenxuX
@ 2019-09-02 15:59   ` Ye Xiaolong
  0 siblings, 0 replies; 8+ messages in thread
From: Ye Xiaolong @ 2019-09-02 15:59 UTC (permalink / raw)
  To: Di ChenxuX; +Cc: dev, Wenzhuo Lu, Beilei Xing, Qi Zhang, Yang Qiming

On 09/02, Di ChenxuX wrote:
>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/e1000/e1000_ethdev.h |   1 +
> drivers/net/e1000/igb_ethdev.c   | 142 +++++++++++++++++--------------

You also need to do the migration for the em_ethdev.c.

> 2 files changed, 81 insertions(+), 62 deletions(-)
>
>diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h
>index 01ff9433b..67785fb67 100644
>--- a/drivers/net/e1000/e1000_ethdev.h
>+++ b/drivers/net/e1000/e1000_ethdev.h
>@@ -282,6 +282,7 @@ struct e1000_adapter {
> 	struct e1000_vf_info    *vfdata;
> 	struct e1000_filter_info filter;
> 	bool stopped;
>+	bool closed;

closed is not needed.

Thanks,
Xiaolong

> 	struct rte_timecounter  systime_tc;
> 	struct rte_timecounter  rx_tstamp_tc;
> 	struct rte_timecounter  tx_tstamp_tc;
>diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c
>index fec2b4289..022c61c7c 100644
>--- a/drivers/net/e1000/igb_ethdev.c
>+++ b/drivers/net/e1000/igb_ethdev.c
>@@ -843,6 +843,11 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
> 	rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.addr,
> 			&eth_dev->data->mac_addrs[0]);
> 
>+	/* Pass the information to the rte_eth_dev_close() that it should also
>+	 * release the private port resources.
>+	 */
>+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
>+
> 	/* initialize the vfta */
> 	memset(shadow_vfta, 0, sizeof(*shadow_vfta));
> 
>@@ -856,6 +861,7 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
> 	}
> 	hw->mac.get_link_status = 1;
> 	adapter->stopped = 0;
>+	adapter->closed = 0;
> 
> 	/* Indicate SOL/IDER usage */
> 	if (e1000_check_reset_block(hw) < 0) {
>@@ -912,62 +918,17 @@ eth_igb_dev_init(struct rte_eth_dev *eth_dev)
> static int
> eth_igb_dev_uninit(struct rte_eth_dev *eth_dev)
> {
>-	struct rte_pci_device *pci_dev;
>-	struct rte_intr_handle *intr_handle;
>-	struct e1000_hw *hw;
> 	struct e1000_adapter *adapter =
> 		E1000_DEV_PRIVATE(eth_dev->data->dev_private);
>-	struct e1000_filter_info *filter_info =
>-		E1000_DEV_PRIVATE_TO_FILTER_INFO(eth_dev->data->dev_private);
> 
> 	PMD_INIT_FUNC_TRACE();
> 
> 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> 		return -EPERM;
> 
>-	hw = E1000_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
>-	pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>-	intr_handle = &pci_dev->intr_handle;
>-
>-	if (adapter->stopped == 0)
>+	if (adapter->closed == 0)
> 		eth_igb_close(eth_dev);
> 
>-	eth_dev->dev_ops = NULL;
>-	eth_dev->rx_pkt_burst = NULL;
>-	eth_dev->tx_pkt_burst = NULL;
>-
>-	/* Reset any pending lock */
>-	igb_reset_swfw_lock(hw);
>-
>-	/* uninitialize PF if max_vfs not zero */
>-	igb_pf_host_uninit(eth_dev);
>-
>-	/* disable uio intr before callback unregister */
>-	rte_intr_disable(intr_handle);
>-	rte_intr_callback_unregister(intr_handle,
>-				     eth_igb_interrupt_handler, eth_dev);
>-
>-	/* clear the SYN filter info */
>-	filter_info->syn_info = 0;
>-
>-	/* clear the ethertype filters info */
>-	filter_info->ethertype_mask = 0;
>-	memset(filter_info->ethertype_filters, 0,
>-		E1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));
>-
>-	/* clear the rss filter info */
>-	memset(&filter_info->rss_info, 0,
>-		sizeof(struct igb_rte_flow_rss_conf));
>-
>-	/* remove all ntuple filters of the device */
>-	igb_ntuple_filter_uninit(eth_dev);
>-
>-	/* remove all flex filters of the device */
>-	igb_flex_filter_uninit(eth_dev);
>-
>-	/* clear all the filters list */
>-	igb_filterlist_flush(eth_dev);
>-
> 	return 0;
> }
> 
>@@ -1010,6 +971,7 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
> 	hw->vendor_id = pci_dev->id.vendor_id;
> 	hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
> 	adapter->stopped = 0;
>+	adapter->closed = 0;
> 
> 	/* Initialize the shared code (base driver) */
> 	diag = e1000_setup_init_funcs(hw, TRUE);
>@@ -1038,6 +1000,11 @@ eth_igbvf_dev_init(struct rte_eth_dev *eth_dev)
> 		return -ENOMEM;
> 	}
> 
>+	/* Pass the information to the rte_eth_dev_close() that it should also
>+	 * release the private port resources.
>+	 */
>+	eth_dev->data->dev_flags |= RTE_ETH_DEV_CLOSE_REMOVE;
>+
> 	/* Generate a random MAC address, if none was assigned by PF. */
> 	if (rte_is_zero_ether_addr(perm_addr)) {
> 		rte_eth_random_addr(perm_addr->addr_bytes);
>@@ -1079,26 +1046,15 @@ eth_igbvf_dev_uninit(struct rte_eth_dev *eth_dev)
> {
> 	struct e1000_adapter *adapter =
> 		E1000_DEV_PRIVATE(eth_dev->data->dev_private);
>-	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
> 
> 	PMD_INIT_FUNC_TRACE();
> 
> 	if (rte_eal_process_type() != RTE_PROC_PRIMARY)
> 		return -EPERM;
> 
>-	if (adapter->stopped == 0)
>+	if (adapter->closed == 0)
> 		igbvf_dev_close(eth_dev);
> 
>-	eth_dev->dev_ops = NULL;
>-	eth_dev->rx_pkt_burst = NULL;
>-	eth_dev->tx_pkt_burst = NULL;
>-
>-	/* disable uio intr before callback unregister */
>-	rte_intr_disable(&pci_dev->intr_handle);
>-	rte_intr_callback_unregister(&pci_dev->intr_handle,
>-				     eth_igbvf_interrupt_handler,
>-				     (void *)eth_dev);
>-
> 	return 0;
> }
> 
>@@ -1506,6 +1462,11 @@ eth_igb_stop(struct rte_eth_dev *dev)
> 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> 	struct rte_eth_link link;
> 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
>+	struct e1000_adapter *adapter =
>+		E1000_DEV_PRIVATE(dev->data->dev_private);
>+
>+	if (adapter->stopped)
>+		return;
> 
> 	eth_igb_rxtx_control(dev, false);
> 
>@@ -1547,6 +1508,8 @@ eth_igb_stop(struct rte_eth_dev *dev)
> 		rte_free(intr_handle->intr_vec);
> 		intr_handle->intr_vec = NULL;
> 	}
>+
>+	adapter->stopped = 1;
> }
> 
> static int
>@@ -1579,14 +1542,15 @@ static void
> eth_igb_close(struct rte_eth_dev *dev)
> {
> 	struct e1000_hw *hw = E1000_DEV_PRIVATE_TO_HW(dev->data->dev_private);
>-	struct e1000_adapter *adapter =
>-		E1000_DEV_PRIVATE(dev->data->dev_private);
> 	struct rte_eth_link link;
> 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
>+	struct e1000_filter_info *filter_info =
>+		E1000_DEV_PRIVATE_TO_FILTER_INFO(dev->data->dev_private);
>+	struct e1000_adapter *adapter =
>+		E1000_DEV_PRIVATE(dev->data->dev_private);
> 
> 	eth_igb_stop(dev);
>-	adapter->stopped = 1;
> 
> 	e1000_phy_hw_reset(hw);
> 	igb_release_manageability(hw);
>@@ -1610,6 +1574,42 @@ eth_igb_close(struct rte_eth_dev *dev)
> 
> 	memset(&link, 0, sizeof(link));
> 	rte_eth_linkstatus_set(dev, &link);
>+
>+	dev->dev_ops = NULL;
>+	dev->rx_pkt_burst = NULL;
>+	dev->tx_pkt_burst = NULL;
>+
>+	/* Reset any pending lock */
>+	igb_reset_swfw_lock(hw);
>+
>+	/* uninitialize PF if max_vfs not zero */
>+	igb_pf_host_uninit(dev);
>+
>+	rte_intr_callback_unregister(intr_handle,
>+				     eth_igb_interrupt_handler, dev);
>+
>+	/* clear the SYN filter info */
>+	filter_info->syn_info = 0;
>+
>+	/* clear the ethertype filters info */
>+	filter_info->ethertype_mask = 0;
>+	memset(filter_info->ethertype_filters, 0,
>+		E1000_MAX_ETQF_FILTERS * sizeof(struct igb_ethertype_filter));
>+
>+	/* clear the rss filter info */
>+	memset(&filter_info->rss_info, 0,
>+		sizeof(struct igb_rte_flow_rss_conf));
>+
>+	/* remove all ntuple filters of the device */
>+	igb_ntuple_filter_uninit(dev);
>+
>+	/* remove all flex filters of the device */
>+	igb_flex_filter_uninit(dev);
>+
>+	/* clear all the filters list */
>+	igb_filterlist_flush(dev);
>+
>+	adapter->closed = 1;
> }
> 
> /*
>@@ -3331,6 +3331,11 @@ igbvf_dev_stop(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 e1000_adapter *adapter =
>+		E1000_DEV_PRIVATE(dev->data->dev_private);
>+
>+	if (adapter->stopped == 1)
>+		return;
> 
> 	PMD_INIT_FUNC_TRACE();
> 
>@@ -3353,6 +3358,8 @@ igbvf_dev_stop(struct rte_eth_dev *dev)
> 		rte_free(intr_handle->intr_vec);
> 		intr_handle->intr_vec = NULL;
> 	}
>+
>+	adapter->stopped = 1;
> }
> 
> static void
>@@ -3362,13 +3369,14 @@ igbvf_dev_close(struct rte_eth_dev *dev)
> 	struct e1000_adapter *adapter =
> 		E1000_DEV_PRIVATE(dev->data->dev_private);
> 	struct rte_ether_addr addr;
>+	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
> 
> 	PMD_INIT_FUNC_TRACE();
> 
> 	e1000_reset_hw(hw);
> 
> 	igbvf_dev_stop(dev);
>-	adapter->stopped = 1;
>+
> 	igb_dev_free_queues(dev);
> 
> 	/**
>@@ -3379,6 +3387,16 @@ igbvf_dev_close(struct rte_eth_dev *dev)
> 
> 	memset(&addr, 0, sizeof(addr));
> 	igbvf_default_mac_addr_set(dev, &addr);
>+
>+	dev->dev_ops = NULL;
>+	dev->rx_pkt_burst = NULL;
>+	dev->tx_pkt_burst = NULL;
>+
>+	rte_intr_callback_unregister(&pci_dev->intr_handle,
>+				     eth_igbvf_interrupt_handler,
>+				     (void *)dev);
>+
>+	adapter->closed = 1;
> }
> 
> static void
>-- 
>2.17.1
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-09-02 16:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-02 10:27 [dpdk-dev] [PATCH 0/5] drivers/net: release port upon close 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 ` [dpdk-dev] [PATCH 4/5] net/ice: " Di ChenxuX
2019-09-02 15:51   ` Ye Xiaolong
2019-09-02 10:27 ` [dpdk-dev] [PATCH 5/5] net/ixgbe: " Di ChenxuX

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).