Skip to contentSkip to conversation

net/ice: retry getting VF VSI map after it fails

PATCH Superseded [email protected] 3 participants 5 messages Sep 14, 2021 – Sep 28, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/ice: retry getting VF VSI map after it fails

From: Dapeng Yu <[email protected]>

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")
---
 drivers/net/ice/ice_dcf.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ice/ice_dcf.c +13 -2
index 38e9a84698..043bd48192 100644
@@ -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);
Signature · 1 line
2.27.0
#1 lore raw
Quoted 42 lines

-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Tuesday, September 14, 2021 11:09
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Wang, Haiyue <[email protected]>; Yu, DapengX <[email protected]>; [email protected]
Subject: [PATCH] net/ice: retry getting VF VSI map after it fails

From: Dapeng Yu <[email protected]>

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")
---
 drivers/net/ice/ice_dcf.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/net/ice/ice_dcf.c +4 -2
index 38e9a84698..043bd48192 100644
@@ -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) {

drivers/net/ice/ice_dcf.c ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw) · line 557

Quoted 10 lines
drivers/net/ice/ice_dcf.c +9 -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);
	}
Quoted 4 lines
drivers/net/ice/ice_dcf.c +0 -1
 	rte_intr_enable(&pci_dev->intr_handle);
 	ice_dcf_enable_irq0(hw);
--

2.27.0

#2 lore raw

PATCH v2 1/1 net/ice: retry getting VF VSI map after it fails

In reply to [email protected]

From: Dapeng Yu <[email protected]>

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")

---
V2:
* Remove goto

---
 drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
drivers/net/ice/ice_dcf.c +14 -3
index 38e9a84698..c9c01a14e3 100644
@@ -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);
Signature · 1 line
2.27.0
Acked-by on v2 1/1
#3 lore raw
Quoted 16 lines

-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Friday, September 24, 2021 16:08
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Wang, Haiyue <[email protected]>; Yu, DapengX <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: retry getting VF VSI map after it fails

From: Dapeng Yu <[email protected]>

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")
Quoted 8 lines

---
V2:
* Remove goto

---
 drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Quoted 2 lines

--
2.27.0

Applied
#4 lore raw
Quoted 36 lines

-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Friday, September 24, 2021 4:24 PM
To: Yu, DapengX <[email protected]>; Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; [email protected]
Subject: RE: [PATCH v2] net/ice: retry getting VF VSI map after it fails

Quoted 17 lines

-----Original Message-----
From: Yu, DapengX <[email protected]>
Sent: Friday, September 24, 2021 16:08
To: Yang, Qiming <[email protected]>; Zhang, Qi Z <[email protected]>
Cc: [email protected]; Wang, Haiyue <[email protected]>; Yu, DapengX <[email protected]>; [email protected]
Subject: [PATCH v2] net/ice: retry getting VF VSI map after it fails

From: Dapeng Yu <[email protected]>

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")
Quoted 8 lines

---
V2:
* Remove goto

---
 drivers/net/ice/ice_dcf.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Quoted 1 line

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 4 lines
Quoted 3 lines

--
2.27.0