net/iavf: fix fail to reset vf when using dcf

Message ID 20240314010049.340381-1-kaiwenx.deng@intel.com (mailing list archive)
State Accepted
Delegated to: Bruce Richardson
Headers
Series net/iavf: fix fail to reset vf when using dcf |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Kaiwen Deng March 14, 2024, 1 a.m. UTC
  On the latest ice kernel driver, renegotiating VIRTCHNL_OP_GET_VF_RESOURCES
will fail without hardware reset when using dcf.

This commit will send VIRTCHNL_OP_RESET_VF to pf before dpdk resets vf.

Fixes: 7a93cd3575eb ("net/iavf: add VF reset check")
Cc: stable@dpdk.org

Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
---
 drivers/net/iavf/iavf_ethdev.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
  

Comments

Li, HongboX March 19, 2024, 9:51 a.m. UTC | #1
> -----Original Message-----
> From: Kaiwen Deng <kaiwenx.deng@intel.com>
> Sent: Thursday, March 14, 2024 9:01 AM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Zhou, YidingX <yidingx.zhou@intel.com>; Deng, KaiwenX
> <kaiwenx.deng@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Zeng,
> ZhichaoX <zhichaox.zeng@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Subject: [PATCH] net/iavf: fix fail to reset vf when using dcf
> 
> On the latest ice kernel driver, renegotiating VIRTCHNL_OP_GET_VF_RESOURCES
> will fail without hardware reset when using dcf.
> 
> This commit will send VIRTCHNL_OP_RESET_VF to pf before dpdk resets vf.
> 
> Fixes: 7a93cd3575eb ("net/iavf: add VF reset check")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>

Tested-by: Li, HongboX <hongbox.li@intel.com>
  
Bruce Richardson April 4, 2024, 10:58 a.m. UTC | #2
On Thu, Mar 14, 2024 at 09:00:49AM +0800, Kaiwen Deng wrote:
> On the latest ice kernel driver, renegotiating VIRTCHNL_OP_GET_VF_RESOURCES
> will fail without hardware reset when using dcf.
> 
> This commit will send VIRTCHNL_OP_RESET_VF to pf before dpdk resets vf.
> 
> Fixes: 7a93cd3575eb ("net/iavf: add VF reset check")

It could be argued that the offending commit could actually be earlier:
Fixes: e74e1bb6280d ("net/iavf: enable port reset")

When applying, I'll add both commits as fixes lines.

> Cc: stable@dpdk.org
> 
> Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
> ---
>  drivers/net/iavf/iavf_ethdev.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
> index 245b3cd854..1c2d23f80f 100644
> --- a/drivers/net/iavf/iavf_ethdev.c
> +++ b/drivers/net/iavf/iavf_ethdev.c
> @@ -3038,6 +3038,16 @@ iavf_dev_reset(struct rte_eth_dev *dev)
>  	struct iavf_adapter *adapter =
>  		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
>  	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
> +	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
> +
> +	if (!vf->in_reset_recovery) {
> +		ret = iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF,
> +						IAVF_SUCCESS, NULL, 0, NULL);
> +		if (ret) {
> +			PMD_DRV_LOG(ERR, "fail to send cmd VIRTCHNL_OP_RESET_VF");
> +			return ret;
> +		}
> +	}
>  
>  	/*
>  	 * Check whether the VF reset has been done and inform application,
> -- 
> 2.34.1
>
  
Bruce Richardson April 4, 2024, 1:42 p.m. UTC | #3
On Tue, Mar 19, 2024 at 09:51:00AM +0000, Li, HongboX wrote:
> > -----Original Message-----
> > From: Kaiwen Deng <kaiwenx.deng@intel.com>
> > Sent: Thursday, March 14, 2024 9:01 AM
> > To: dev@dpdk.org
> > Cc: stable@dpdk.org; Zhou, YidingX <yidingx.zhou@intel.com>; Deng, KaiwenX
> > <kaiwenx.deng@intel.com>; Wu, Jingjing <jingjing.wu@intel.com>; Zeng,
> > ZhichaoX <zhichaox.zeng@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> > Subject: [PATCH] net/iavf: fix fail to reset vf when using dcf
> > 
> > On the latest ice kernel driver, renegotiating VIRTCHNL_OP_GET_VF_RESOURCES
> > will fail without hardware reset when using dcf.
> > 
> > This commit will send VIRTCHNL_OP_RESET_VF to pf before dpdk resets vf.
> > 
> > Fixes: 7a93cd3575eb ("net/iavf: add VF reset check")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Kaiwen Deng <kaiwenx.deng@intel.com>
> 
> Tested-by: Li, HongboX <hongbox.li@intel.com>

Applied to dpdk-next-net-intel.
thanks,
/Bruce
  

Patch

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 245b3cd854..1c2d23f80f 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -3038,6 +3038,16 @@  iavf_dev_reset(struct rte_eth_dev *dev)
 	struct iavf_adapter *adapter =
 		IAVF_DEV_PRIVATE_TO_ADAPTER(dev->data->dev_private);
 	struct iavf_hw *hw = IAVF_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(dev->data->dev_private);
+
+	if (!vf->in_reset_recovery) {
+		ret = iavf_aq_send_msg_to_pf(hw, VIRTCHNL_OP_RESET_VF,
+						IAVF_SUCCESS, NULL, 0, NULL);
+		if (ret) {
+			PMD_DRV_LOG(ERR, "fail to send cmd VIRTCHNL_OP_RESET_VF");
+			return ret;
+		}
+	}
 
 	/*
 	 * Check whether the VF reset has been done and inform application,