All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Qi Z" <qi.z.zhang@intel.com>
To: "Yu, DapengX" <dapengx.yu@intel.com>,
	"Yang, Qiming" <qiming.yang@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v4] net/ice: simplify the use of DCF device reset
Date: Tue, 26 Oct 2021 08:55:09 +0000	[thread overview]
Message-ID: <14a12a2966ec48b99dc79a8ec2ec8de5@intel.com> (raw)
In-Reply-To: <20211026084401.1681489-1-dapengx.yu@intel.com>



> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Tuesday, October 26, 2021 4:44 PM
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Yu, DapengX <dapengx.yu@intel.com>; stable@dpdk.org
> Subject: [PATCH v4] net/ice: simplify the use of DCF device reset
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> After DCF is reset by PF, the DCF device un-initialization cannot function
> normally since the resource is already invalidated. So reset DCF twice is
> necessary, the first simplified reset re-initializes the AdminQ of DCF, only then
> second reset can clean the filters successfully.
> 
> This patch detects the reset flag, which is set by PF on DCF reset, if the flag is
> true, do DCF reset twice automatically.
> 
> Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
> V2:
> * Ignore the returned error of dev_uninit when DCF is reset by PF
> V3:
> * Add a reset function to re-initialize AdminQ resource
> * Add a function to check the reset flag
> V4:
> * Remove redundant reset flag setting
> ---
>  drivers/net/ice/ice_dcf.c        |  2 ++
>  drivers/net/ice/ice_dcf_ethdev.c | 33 +++++++++++++++++++++++++++++++-
>  2 files changed, 34 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c index
> 084f7a53db..366ff0a907 100644
> --- a/drivers/net/ice/ice_dcf.c
> +++ b/drivers/net/ice/ice_dcf.c
> @@ -593,6 +593,8 @@ ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct
> ice_dcf_hw *hw)
>  	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
>  	int ret, size;
> 
> +	hw->resetting = false;
> +
>  	hw->avf.hw_addr = pci_dev->mem_resource[0].addr;
>  	hw->avf.back = hw;
> 
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
> index 7c71a48010..171b58a748 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -1025,11 +1025,43 @@ ice_dcf_tm_ops_get(struct rte_eth_dev *dev
> __rte_unused,
>  	return 0;
>  }
> 
> +static inline void
> +ice_dcf_simple_reset(struct rte_eth_dev *eth_dev, struct ice_dcf_hw	

Better to rename the function to ice_dcf_reset_hw 

> +*hw) {
> +	ice_dcf_uninit_hw(eth_dev, hw);
> +	ice_dcf_init_hw(eth_dev, hw);
> +}
> +
> +/* Check if reset has been triggered by PF */ static inline bool
> +dcf_is_reset(struct rte_eth_dev *dev) {
> +	struct ice_dcf_adapter *ad = dev->data->dev_private;
> +	struct iavf_hw *hw = &ad->real_hw.avf;
> +
> +	return !(IAVF_READ_REG(hw, IAVF_VF_ARQLEN1) &
> +		 IAVF_VF_ARQLEN1_ARQENABLE_MASK);
> +}
> +
>  static int
>  ice_dcf_dev_reset(struct rte_eth_dev *dev)  {
> +	struct ice_dcf_adapter *ad = dev->data->dev_private;
> +	struct ice_dcf_hw *hw = &ad->real_hw;
>  	int ret;
> 
> +	if (dcf_is_reset(dev)) {
> +		if (!ad->real_hw.resetting)
> +			ad->real_hw.resetting = true;
> +		PMD_DRV_LOG(ERR, "The DCF has been reset by PF");
> +
> +		/*
> +		 * Do the simplified reset to make DCF get AdminQ resource.
> +		 * Then the next uninit/init can clean filters successfully.
> +		 */		

Can reword as below:

Simply reset hw to trigger an additional DCF enable/disable cycle which help to workaround
the issue that kernel driver may not clean up resource during previous reset.

> +		ice_dcf_simple_reset(dev, hw);
> +	}
> +
>  	ret = ice_dcf_dev_uninit(dev);
>  	if (ret)
>  		return ret;
> @@ -1072,7 +1104,6 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev)  {
>  	struct ice_dcf_adapter *adapter = eth_dev->data->dev_private;
> 
> -	adapter->real_hw.resetting = false;
>  	eth_dev->dev_ops = &ice_dcf_eth_dev_ops;
>  	eth_dev->rx_pkt_burst = ice_dcf_recv_pkts;
>  	eth_dev->tx_pkt_burst = ice_dcf_xmit_pkts;
> --
> 2.27.0


  reply	other threads:[~2021-10-26  8:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-25  6:41 [dpdk-dev] [PATCH] net/ice: simplify the use of DCF device reset dapengx.yu
2021-10-25  7:12 ` [dpdk-dev] [PATCH v2] " dapengx.yu
2021-10-26  8:18   ` [dpdk-dev] [PATCH v3] " dapengx.yu
2021-10-26  8:44     ` [dpdk-dev] [PATCH v4] " dapengx.yu
2021-10-26  8:55       ` Zhang, Qi Z [this message]
2021-10-26  9:53       ` [dpdk-dev] [PATCH v5] " dapengx.yu
2021-10-27  3:24         ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=14a12a2966ec48b99dc79a8ec2ec8de5@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dapengx.yu@intel.com \
    --cc=dev@dpdk.org \
    --cc=qiming.yang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.