DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] net/i40e: fix PF port close
@ 2018-11-28 16:52 Zhirun Yan
  0 siblings, 0 replies; only message in thread
From: Zhirun Yan @ 2018-11-28 16:52 UTC (permalink / raw)
  To: dev, qi.z.zhang; +Cc: haiyue.wang, Zhirun Yan

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@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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-28  9:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28 16:52 [dpdk-dev] [PATCH v1] net/i40e: fix PF port close Zhirun Yan

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