> -----Original Message-----
> From: Xu, Ting <ting...@intel.com>
> Sent: Tuesday, June 16, 2020 20:41
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zh...@intel.com>; Yang, Qiming
> <qiming.y...@intel.com>; Wu, Jingjing <jingjing...@intel.com>; Xing, Beilei
> <beilei.x...@intel.com>; Kovacevic, Marko <marko.kovace...@intel.com>;
> Mcnamara, John <john.mcnam...@intel.com>; Ye, Xiaolong
> <xiaolong...@intel.com>
> Subject: [PATCH v3 05/12] net/ice: add stop flag for device start / stop
> 
> From: Qi Zhang <qi.z.zh...@intel.com>
> 
> Add stop flag for DCF device start and stop.
> 
> Signed-off-by: Qi Zhang <qi.z.zh...@intel.com>
> Signed-off-by: Ting Xu <ting...@intel.com>
> ---
>  drivers/net/ice/ice_dcf_ethdev.c | 12 ++++++++++++
> drivers/net/ice/ice_dcf_parent.c |  1 +
>  2 files changed, 13 insertions(+)
> 
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c
> b/drivers/net/ice/ice_dcf_ethdev.c
> index 0c3013228..ff2cab054 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -45,6 +45,11 @@ ice_dcf_xmit_pkts(__rte_unused void *tx_queue,
> static int  ice_dcf_dev_start(struct rte_eth_dev *dev)  {
> +     struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
> +     struct ice_adapter *ad = &dcf_ad->parent;
> +
> +     ad->pf.adapter_stopped = 0;
> +
>       dev->data->dev_link.link_status = ETH_LINK_UP;
> 
>       return 0;
> @@ -53,7 +58,14 @@ ice_dcf_dev_start(struct rte_eth_dev *dev)  static
> void  ice_dcf_dev_stop(struct rte_eth_dev *dev)  {
> +     struct ice_dcf_adapter *dcf_ad = dev->data->dev_private;
> +     struct ice_adapter *ad = &dcf_ad->parent;
> +
> +     if (ad->pf.adapter_stopped == 1)

We can add logs like 'port already stopped'

> +             return;
> +
>       dev->data->dev_link.link_status = ETH_LINK_DOWN;
> +     ad->pf.adapter_stopped = 1;
>  }
> 
>  static int
> diff --git a/drivers/net/ice/ice_dcf_parent.c
> b/drivers/net/ice/ice_dcf_parent.c
> index 322a5273f..c5dfdd36e 100644
> --- a/drivers/net/ice/ice_dcf_parent.c
> +++ b/drivers/net/ice/ice_dcf_parent.c
> @@ -341,6 +341,7 @@ ice_dcf_init_parent_adapter(struct rte_eth_dev
> *eth_dev)
>       if (!parent_adapter->pf.main_vsi)
>               return -ENOMEM;
>       parent_adapter->pf.main_vsi->adapter = parent_adapter;
> +     parent_adapter->pf.adapter_stopped = 1;
> 
>       parent_hw->back = parent_adapter;
>       parent_hw->mac_type = ICE_MAC_GENERIC;
> --
> 2.17.1

Reply via email to