DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/ice: retry getting VF VSI map after it fails
@ 2021-09-14  3:08 dapengx.yu
  2021-09-24  5:43 ` Wang, Haiyue
  2021-09-24  8:08 ` [dpdk-dev] [PATCH v2] " dapengx.yu
  0 siblings, 2 replies; 5+ messages in thread
From: dapengx.yu @ 2021-09-14  3:08 UTC (permalink / raw)
  To: Qiming Yang, Qi Zhang; +Cc: dev, haiyue.wang, Dapeng Yu, stable

From: Dapeng Yu <dapengx.yu@intel.com>

The request of getting VF VSI map request may fail when DCF is busy,
this patch adds retry mechanism to make it able to succeed.

Fixes: b09d34ac8584 ("net/ice: fix flow redirector")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
 drivers/net/ice/ice_dcf.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 38e9a84698..043bd48192 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -534,6 +534,7 @@ int
 ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(hw->eth_dev);
+	int i = 0;
 	int err = 0;
 
 	rte_spinlock_lock(&hw->vc_cmd_send_lock);
@@ -541,8 +542,18 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 	rte_intr_disable(&pci_dev->intr_handle);
 	ice_dcf_disable_irq0(hw);
 
-	if (ice_dcf_get_vf_resource(hw) || ice_dcf_get_vf_vsi_map(hw) < 0)
-		err = -1;
+	do {
+		if (ice_dcf_get_vf_resource(hw) ||
+		    ice_dcf_get_vf_vsi_map(hw) < 0) {
+			err = -1;
+			goto again;
+		} else {
+			err = 0;
+			break;
+		}
+again:
+		rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
+	} while (i++ < ICE_DCF_ARQ_MAX_RETRIES);
 
 	rte_intr_enable(&pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH] net/ice: retry getting VF VSI map after it fails
  2021-09-14  3:08 [dpdk-dev] [PATCH] net/ice: retry getting VF VSI map after it fails dapengx.yu
@ 2021-09-24  5:43 ` Wang, Haiyue
  2021-09-24  8:08 ` [dpdk-dev] [PATCH v2] " dapengx.yu
  1 sibling, 0 replies; 5+ messages in thread
From: Wang, Haiyue @ 2021-09-24  5:43 UTC (permalink / raw)
  To: Yu, DapengX, Yang, Qiming, Zhang, Qi Z; +Cc: dev, stable

> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Tuesday, September 14, 2021 11:09
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX <dapengx.yu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH] net/ice: retry getting VF VSI map after it fails
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> The request of getting VF VSI map request may fail when DCF is busy,
> this patch adds retry mechanism to make it able to succeed.
> 
> Fixes: b09d34ac8584 ("net/ice: fix flow redirector")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
>  drivers/net/ice/ice_dcf.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
> index 38e9a84698..043bd48192 100644
> --- a/drivers/net/ice/ice_dcf.c
> +++ b/drivers/net/ice/ice_dcf.c
> @@ -534,6 +534,7 @@ int
>  ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
>  {
>  	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(hw->eth_dev);
> +	int i = 0;
>  	int err = 0;
> 
>  	rte_spinlock_lock(&hw->vc_cmd_send_lock);
> @@ -541,8 +542,18 @@ ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
>  	rte_intr_disable(&pci_dev->intr_handle);
>  	ice_dcf_disable_irq0(hw);
> 
> -	if (ice_dcf_get_vf_resource(hw) || ice_dcf_get_vf_vsi_map(hw) < 0)
> -		err = -1;
> +	do {
> +		if (ice_dcf_get_vf_resource(hw) ||
> +		    ice_dcf_get_vf_vsi_map(hw) < 0) {
> +			err = -1;
> +			goto again;
> +		} else {
> +			err = 0;
> +			break;
> +		}
> +again:
> +		rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
> +	} while (i++ < ICE_DCF_ARQ_MAX_RETRIES);
> 

I think we can remove the 'goto', and sleep if we can (like < MAX_RERRIES),
like:

	int err = -1;
	int i = 0;

	for (;;) {
		if (ice_dcf_get_vf_resource(hw) == 0 &&
		    ice_dcf_get_vf_vsi_map(hw) >= 0) {
			err = 0;
			break;
		}

		if (++i < ICE_DCF_ARQ_MAX_RETRIES)
			break;

		rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
	}

>  	rte_intr_enable(&pci_dev->intr_handle);
>  	ice_dcf_enable_irq0(hw);
> --
> 2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [dpdk-dev] [PATCH v2] net/ice: retry getting VF VSI map after it fails
  2021-09-14  3:08 [dpdk-dev] [PATCH] net/ice: retry getting VF VSI map after it fails dapengx.yu
  2021-09-24  5:43 ` Wang, Haiyue
@ 2021-09-24  8:08 ` dapengx.yu
  2021-09-24  8:23   ` Wang, Haiyue
  1 sibling, 1 reply; 5+ messages in thread
From: dapengx.yu @ 2021-09-24  8:08 UTC (permalink / raw)
  To: Qiming Yang, Qi Zhang; +Cc: dev, haiyue.wang, Dapeng Yu, stable

From: Dapeng Yu <dapengx.yu@intel.com>

The request of getting VF VSI map request may fail when DCF is busy,
this patch adds retry mechanism to make it able to succeed.

Fixes: b09d34ac8584 ("net/ice: fix flow redirector")
Cc: stable@dpdk.org

Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
---
V2:
* Remove goto 
---
 drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c
index 38e9a84698..c9c01a14e3 100644
--- a/drivers/net/ice/ice_dcf.c
+++ b/drivers/net/ice/ice_dcf.c
@@ -534,15 +534,26 @@ int
 ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw)
 {
 	struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(hw->eth_dev);
-	int err = 0;
+	int i = 0;
+	int err = -1;
 
 	rte_spinlock_lock(&hw->vc_cmd_send_lock);
 
 	rte_intr_disable(&pci_dev->intr_handle);
 	ice_dcf_disable_irq0(hw);
 
-	if (ice_dcf_get_vf_resource(hw) || ice_dcf_get_vf_vsi_map(hw) < 0)
-		err = -1;
+	for (;;) {
+		if (ice_dcf_get_vf_resource(hw) == 0 &&
+		    ice_dcf_get_vf_vsi_map(hw) >= 0) {
+			err = 0;
+			break;
+		}
+
+		if (++i >= ICE_DCF_ARQ_MAX_RETRIES)
+			break;
+
+		rte_delay_ms(ICE_DCF_ARQ_CHECK_TIME);
+	}
 
 	rte_intr_enable(&pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
-- 
2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ice: retry getting VF VSI map after it fails
  2021-09-24  8:08 ` [dpdk-dev] [PATCH v2] " dapengx.yu
@ 2021-09-24  8:23   ` Wang, Haiyue
  2021-09-28  4:58     ` Zhang, Qi Z
  0 siblings, 1 reply; 5+ messages in thread
From: Wang, Haiyue @ 2021-09-24  8:23 UTC (permalink / raw)
  To: Yu, DapengX, Yang, Qiming, Zhang, Qi Z; +Cc: dev, stable

> -----Original Message-----
> From: Yu, DapengX <dapengx.yu@intel.com>
> Sent: Friday, September 24, 2021 16:08
> To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX <dapengx.yu@intel.com>;
> stable@dpdk.org
> Subject: [PATCH v2] net/ice: retry getting VF VSI map after it fails
> 
> From: Dapeng Yu <dapengx.yu@intel.com>
> 
> The request of getting VF VSI map request may fail when DCF is busy,
> this patch adds retry mechanism to make it able to succeed.
> 
> Fixes: b09d34ac8584 ("net/ice: fix flow redirector")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> ---
> V2:
> * Remove goto
> ---
>  drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 

Acked-by: Haiyue Wang <haiyue.wang@intel.com>

> --
> 2.27.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [dpdk-dev] [PATCH v2] net/ice: retry getting VF VSI map after it fails
  2021-09-24  8:23   ` Wang, Haiyue
@ 2021-09-28  4:58     ` Zhang, Qi Z
  0 siblings, 0 replies; 5+ messages in thread
From: Zhang, Qi Z @ 2021-09-28  4:58 UTC (permalink / raw)
  To: Wang, Haiyue, Yu, DapengX, Yang, Qiming; +Cc: dev, stable



> -----Original Message-----
> From: Wang, Haiyue <haiyue.wang@intel.com>
> Sent: Friday, September 24, 2021 4:24 PM
> To: Yu, DapengX <dapengx.yu@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: RE: [PATCH v2] net/ice: retry getting VF VSI map after it fails
> 
> > -----Original Message-----
> > From: Yu, DapengX <dapengx.yu@intel.com>
> > Sent: Friday, September 24, 2021 16:08
> > To: Yang, Qiming <qiming.yang@intel.com>; Zhang, Qi Z
> > <qi.z.zhang@intel.com>
> > Cc: dev@dpdk.org; Wang, Haiyue <haiyue.wang@intel.com>; Yu, DapengX
> > <dapengx.yu@intel.com>; stable@dpdk.org
> > Subject: [PATCH v2] net/ice: retry getting VF VSI map after it fails
> >
> > From: Dapeng Yu <dapengx.yu@intel.com>
> >
> > The request of getting VF VSI map request may fail when DCF is busy,
> > this patch adds retry mechanism to make it able to succeed.
> >
> > Fixes: b09d34ac8584 ("net/ice: fix flow redirector")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
> > ---
> > V2:
> > * Remove goto
> > ---
> >  drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
> >  1 file changed, 14 insertions(+), 3 deletions(-)
> >
> 
> Acked-by: Haiyue Wang <haiyue.wang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
> 
> > --
> > 2.27.0
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-28  4:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-14  3:08 [dpdk-dev] [PATCH] net/ice: retry getting VF VSI map after it fails dapengx.yu
2021-09-24  5:43 ` Wang, Haiyue
2021-09-24  8:08 ` [dpdk-dev] [PATCH v2] " dapengx.yu
2021-09-24  8:23   ` Wang, Haiyue
2021-09-28  4:58     ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).