net/i40e: fix port close
Port reset will call i40evf_uninit_vf() to release resource. It wants to call i40evf_dev_close() to release resources. Before this patch, hw->adapter_stopped was used to mark the status about start/stop and close. So it will never call i40evf_dev_close() after stopping the port. This patch added hw->adapter_closed flag in i40evf_dev_close() and i40e_dev_close() to control the status of close. Fixes: 4861cde46116 ("i40e: new poll mode driver") Cc: stable@dpdk.org Signed-off-by: Zhirun Yan <zhirun.yan@intel.com> Signed-off-by: Haiyue Wang <haiyue.wang@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
8832837c6e
commit
38827a0481
drivers/net/i40e
@ -670,6 +670,7 @@ struct i40e_hw {
|
||||
u8 revision_id;
|
||||
u8 port;
|
||||
bool adapter_stopped;
|
||||
bool adapter_closed;
|
||||
|
||||
/* capabilities for entire device and PCI func */
|
||||
struct i40e_hw_capabilities dev_caps;
|
||||
|
@ -1316,6 +1316,7 @@ eth_i40e_dev_init(struct rte_eth_dev *dev, void *init_params __rte_unused)
|
||||
hw->bus.device = pci_dev->addr.devid;
|
||||
hw->bus.func = pci_dev->addr.function;
|
||||
hw->adapter_stopped = 0;
|
||||
hw->adapter_closed = 0;
|
||||
|
||||
/*
|
||||
* Switch Tag value should not be identical to either the First Tag
|
||||
@ -1713,7 +1714,7 @@ eth_i40e_dev_uninit(struct rte_eth_dev *dev)
|
||||
if (ret)
|
||||
PMD_INIT_LOG(WARNING, "failed to free switch domain: %d", ret);
|
||||
|
||||
if (hw->adapter_stopped == 0)
|
||||
if (hw->adapter_closed == 0)
|
||||
i40e_dev_close(dev);
|
||||
|
||||
dev->dev_ops = NULL;
|
||||
@ -2534,6 +2535,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_closed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1256,7 +1256,7 @@ i40evf_uninit_vf(struct rte_eth_dev *dev)
|
||||
|
||||
PMD_INIT_FUNC_TRACE();
|
||||
|
||||
if (hw->adapter_stopped == 0)
|
||||
if (hw->adapter_closed == 0)
|
||||
i40evf_dev_close(dev);
|
||||
rte_free(vf->vf_res);
|
||||
vf->vf_res = NULL;
|
||||
@ -1438,6 +1438,7 @@ i40evf_dev_init(struct rte_eth_dev *eth_dev)
|
||||
hw->bus.func = pci_dev->addr.function;
|
||||
hw->hw_addr = (void *)pci_dev->mem_resource[0].addr;
|
||||
hw->adapter_stopped = 0;
|
||||
hw->adapter_closed = 0;
|
||||
|
||||
if(i40evf_init_vf(eth_dev) != 0) {
|
||||
PMD_INIT_LOG(ERR, "Init vf failed");
|
||||
@ -2260,6 +2261,7 @@ i40evf_dev_close(struct rte_eth_dev *dev)
|
||||
i40e_shutdown_adminq(hw);
|
||||
i40evf_disable_irq0(hw);
|
||||
rte_eal_alarm_cancel(i40evf_dev_alarm_handler, dev);
|
||||
hw->adapter_closed = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user