Skip to contentSkip to conversation

improve i40e parallel VF reset handling

PATCH In review Robert Malz 2 participants 5 messages May 20, 2025 – Jun 9, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover improve i40e parallel VF reset handling

When the i40e driver receives VF reset requests from multiple sources, some requests may not be handled. For example, a VFLR interrupt might be ignored if it occurs while a VF is already resetting as part of an ndo request. In such scenarios, the VFLR is lost and, depending on timing, the VF may be left uninitialized. This can cause the VF driver to become stuck in an initialization loop until another VF reset is triggered.

Currently, in i40e_vc_reset_vf, the driver attempts to reset the VF up to 20 times, logging an error if all attempts fail. This logic assumes that i40e_reset_vf returns false when another reset is already in progress. However, i40e_reset_vf currently always returns true, which causes overlapping resets to be silently ignored.

The first patch updates i40e_reset_vf to return false if a reset is already in progress. This aligns with the retry logic used in i40e_vc_reset_vf.

While the first patch addresses resets triggered via ndo operations, VFLR interrupts can also initiate VF resets. In that case, the driver directly calls i40e_reset_vf, and if the reset is skipped due to another one being in progress, the VF reest is not retried. The second patch addresses this by re-setting the I40E_VFLR_EVENT_PENDING bit, ensuring the VFLR is handled during the next service task execution.

---
Changes in v2:
- Patch 1: modified doc string for i40e_reset_vf function
- Patch 2: removed unnecessary doc string changes from the patch Changes in v3:
- Patch 1: aligned comment block with kdoc requirements

Robert Malz (2):
i40e: return false from i40e_reset_vf if reset is in progress
i40e: retry VFLR handling if there is ongoing VF reset

 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
Signature · 1 line
2.34.1
#1 lore raw

PATCH v3 1/2 i40e: return false from i40e_reset_vf if reset is in progress

The function i40e_vc_reset_vf attempts, up to 20 times, to handle a VF reset request, using the return value of i40e_reset_vf as an indicator of whether the reset was successfully triggered. Currently, i40e_reset_vf always returns true, which causes new reset requests to be ignored if a different VF reset is already in progress.

This patch updates the return value of i40e_reset_vf to reflect when another VF reset is in progress, allowing the caller to properly use the retry mechanism.

Fixes 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +3 -3
index 1120f8e4bb67..22d5b1ec2289 100644
@@ -1546,8 +1546,8 @@ static void i40e_cleanup_reset_vf(struct i40e_vf *vf)
  * @vf: pointer to the VF structure
  * @flr: VFLR was issued or not
  *
- * Returns true if the VF is in reset, resets successfully, or resets
- * are disabled and false otherwise.
+ * Return: True if reset was performed successfully or if resets are disabled.
+ * False if reset is already in progress.
  **/
 bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
 {
@@ -1566,7 +1566,7 @@ bool i40e_reset_vf(struct i40e_vf *vf, bool flr)
 
 	/* If VF is being reset already we don't need to continue. */
 	if (test_and_set_bit(I40E_VF_STATE_RESETTING, &vf->vf_states))
-		return true;
+		return false;
 
 	i40e_trigger_vf_reset(vf, flr);
 
Signature · 1 line
2.34.1
Tested-by on v3 1/2
#2 lore raw

RE: [Intel-wired-lan] [PATCH v3 1/2] i40e: return false from i40e_reset_vf if reset is in progress

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c

Quoted 33 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Robert Malz
Sent: Tuesday, May 20, 2025 10:32 AM
To: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Keller, Jacob E <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 1/2] i40e: return false from i40e_reset_vf if reset is in progress

The function i40e_vc_reset_vf attempts, up to 20 times, to handle a VF reset request, using the return value of i40e_reset_vf as an indicator of whether the reset was successfully triggered. Currently, i40e_reset_vf always returns true, which causes new reset requests to be ignored if a different VF reset is already in progress.

This patch updates the return value of i40e_reset_vf to reflect when another VF reset is in progress, allowing the caller to properly use the retry mechanism.

Fixes 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +0 -0
index 1120f8e4bb67..22d5b1ec2289 100644
#3 lore raw

PATCH v3 2/2 i40e: retry VFLR handling if there is ongoing VF reset

In reply to Robert Malz

When a VFLR interrupt is received during a VF reset initiated from a different source, the VFLR may be not fully handled. This can leave the VF in an undefined state.
To address this, set the I40E_VFLR_EVENT_PENDING bit again during VFLR handling if the reset is not yet complete. This ensures the driver will properly complete the VF reset in such scenarios.

Fixes 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -1
index 22d5b1ec2289..88e6bef69342 100644
@@ -4328,7 +4328,10 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
 		reg = rd32(hw, I40E_GLGEN_VFLRSTAT(reg_idx));
 		if (reg & BIT(bit_idx))
 			/* i40e_reset_vf will clear the bit in GLGEN_VFLRSTAT */
-			i40e_reset_vf(vf, true);
+			if (!i40e_reset_vf(vf, true)) {
+				/* At least one VF did not finish resetting, retry next time */
+				set_bit(__I40E_VFLR_EVENT_PENDING, pf->state);
+			}
 	}
 
 	return 0;
Signature · 1 line
2.34.1
Tested-by on v3 2/2
#4 lore raw

RE: [Intel-wired-lan] [PATCH v3 2/2] i40e: retry VFLR handling if there is ongoing VF reset

Quoted 46 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Robert Malz
Sent: Tuesday, May 20, 2025 10:32 AM
To: [email protected]; [email protected]; Nguyen, Anthony L <[email protected]>; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Keller, Jacob E <[email protected]>
Subject: [Intel-wired-lan] [PATCH v3 2/2] i40e: retry VFLR handling if there is ongoing VF reset

When a VFLR interrupt is received during a VF reset initiated from a different source, the VFLR may be not fully handled. This can leave the VF in an undefined state.
To address this, set the I40E_VFLR_EVENT_PENDING bit again during VFLR handling if the reset is not yet complete. This ensures the driver will properly complete the VF reset in such scenarios.

Fixes 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2 -1
index 22d5b1ec2289..88e6bef69342 100644
@@ -4328,7 +4328,10 @@ int i40e_vc_process_vflr_event(struct i40e_pf *pf)
 		reg = rd32(hw, I40E_GLGEN_VFLRSTAT(reg_idx));
 		if (reg & BIT(bit_idx))
 			/* i40e_reset_vf will clear the bit in GLGEN_VFLRSTAT */
-			i40e_reset_vf(vf, true);
+			if (!i40e_reset_vf(vf, true)) {
+				/* At least one VF did not finish resetting, retry

next time */

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -0
+				set_bit(__I40E_VFLR_EVENT_PENDING, pf-
Quoted 1 line

state);

drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -1
+			}
 	}
 
 	return 0;
--
Quoted 1 line

2.34.1