[dpdk-dev] [PATCH v1] net/i40e: fix PF port close

Zhirun Yan zhirun.yan at intel.com
Wed Nov 28 17:52:31 CET 2018


Before this patch, the function i40e_dev_close wants to call
i40e_dev_stop() to release res, but it will never call it.

Fixes: 4861cde4611601ccc9 ("i40e: new poll mode driver")

Signed-off-by: Zhirun Yan <zhirun.yan at intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 7030eb1fa..bc5e45095 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -2391,15 +2391,11 @@ static void
 i40e_dev_stop(struct rte_eth_dev *dev)
 {
 	struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
-	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
 	struct i40e_vsi *main_vsi = pf->main_vsi;
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
 	struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 	int i;
 
-	if (hw->adapter_stopped == 1)
-		return;
-
 	if (dev->data->dev_conf.intr_conf.rxq == 0) {
 		rte_eal_alarm_cancel(i40e_dev_alarm_handler, dev);
 		rte_intr_enable(intr_handle);
@@ -2442,8 +2438,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
 
 	/* reset hierarchy commit */
 	pf->tm_conf.committed = false;
-
-	hw->adapter_stopped = 1;
 }
 
 static void
@@ -2460,7 +2454,10 @@ i40e_dev_close(struct rte_eth_dev *dev)
 
 	PMD_INIT_FUNC_TRACE();
 
-	i40e_dev_stop(dev);
+	if (dev->data->dev_started != 0) {
+		dev->data->dev_started = 0;
+		i40e_dev_stop(dev);
+	}
 
 	/* Remove all mirror rules */
 	while ((p_mirror = TAILQ_FIRST(&pf->mirror_list))) {
@@ -2523,6 +2520,8 @@ i40e_dev_close(struct rte_eth_dev *dev)
 	I40E_WRITE_REG(hw, I40E_PFGEN_CTRL,
 			(reg | I40E_PFGEN_CTRL_PFSWR_MASK));
 	I40E_WRITE_FLUSH(hw);
+
+	hw->adapter_stopped = 1;
 }
 
 /*
@@ -2539,8 +2538,6 @@ i40e_dev_reset(struct rte_eth_dev *dev)
 	 * To avoid unexpected behavior in VF, currently reset of PF with
 	 * SR-IOV activation is not supported. It might be supported later.
 	 */
-	if (dev->data->sriov.active)
-		return -ENOTSUP;
 
 	ret = eth_i40e_dev_uninit(dev);
 	if (ret)
-- 
2.17.1



More information about the dev mailing list