[dpdk-dev] [PATCH 7/7] net/iavf: fix port close

Wu, Jingjing jingjing.wu at intel.com
Wed Aug 12 04:57:44 CEST 2020


If RTE_ETH_DEV_CLOSE_REMOVE is set, port would be released when dev_close is called.
So it is not necessary to mark it as closed.

Another concern in my mind is the REST virtchnl message is missed to send to PF in iavf_dev_reset.

Thanks
Jingjing

> -----Original Message-----
> From: Yang, SteveX <stevex.yang at intel.com>
> Sent: Tuesday, August 11, 2020 3:59 PM
> To: Wu, Jingjing <jingjing.wu at intel.com>; Xing, Beilei
> <beilei.xing at intel.com>; dev at dpdk.org
> Cc: Yang, Qiming <qiming.yang at intel.com>; Yang, SteveX
> <stevex.yang at intel.com>
> Subject: [PATCH 7/7] net/iavf: fix port close
> 
> Port reset will call iavf_dev_uninit() to release resources. It wants to call
> iavf_dev_close() to release resources. So there will be a call conflict if calling
> iavf_dev_reset() and iavf_dev_close() at the same time.
> 
> This patch added adapter->closed flag in iavf_dev_close() to control the
> status of close.
> 
> Fixes: 83fe5e80692a ("net/iavf: move device state flag")
> 
> Signed-off-by: SteveX Yang <stevex.yang at intel.com>
> ---
>  drivers/net/iavf/iavf.h        | 1 +
>  drivers/net/iavf/iavf_ethdev.c | 6 ++++++
>  2 files changed, 7 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index
> 9be8a2381..06cbe6089 100644
> --- a/drivers/net/iavf/iavf.h
> +++ b/drivers/net/iavf/iavf.h
> @@ -161,6 +161,7 @@ struct iavf_adapter {
>  	bool tx_vec_allowed;
>  	const uint32_t *ptype_tbl;
>  	bool stopped;
> +	bool closed;
>  	uint16_t fdir_ref_cnt;
>  };
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index f16aff531..b58e57b07 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -1367,6 +1367,7 @@ iavf_dev_init(struct rte_eth_dev *eth_dev)
>  	hw->back = IAVF_DEV_PRIVATE_TO_ADAPTER(eth_dev->data-
> >dev_private);
>  	adapter->eth_dev = eth_dev;
>  	adapter->stopped = 1;
> +	adapter->closed = 0;
> 
>  	if (iavf_init_vf(eth_dev) != 0) {
>  		PMD_INIT_LOG(ERR, "Init vf failed");
> @@ -1423,6 +1424,9 @@ iavf_dev_close(struct rte_eth_dev *dev)
>  	struct iavf_adapter *adapter =
>  		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
> 
> +	if (adapter->closed == 1)
> +		return;
> +
>  	iavf_dev_stop(dev);
>  	iavf_flow_flush(dev, NULL);
>  	iavf_flow_uninit(adapter);
> @@ -1434,6 +1438,8 @@ iavf_dev_close(struct rte_eth_dev *dev)
>  	rte_intr_callback_unregister(intr_handle,
>  				     iavf_dev_interrupt_handler, dev);
>  	iavf_disable_irq0(hw);
> +
> +	adapter->closed = 1;
>  }
> 
>  static int
> --
> 2.17.1



More information about the dev mailing list