improve i40e parallel VF reset handling
Subsystems (3)
v2 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
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
PATCH v2 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.
--- 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
@@ -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. +* Returns 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
Re: [PATCH v2 1/2] i40e: return false from i40e_reset_vf if reset is in progress
Quoted 7 lines · Robert Malz
The function
i40e_vc_reset_vfattempts, up to 20 times, to handle a VF reset request, using the return value ofi40e_reset_vfas an indicator of whether the reset was successfully triggered. Currently,i40e_reset_vfalways returns true, which causes new reset requests to be ignored if a different VF reset is already in progress.
Quoted 6 lines
This patch updates the return value of
i40e_reset_vfto 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")Signed-off-by Robert Malz <[email protected]>
Quoted 32 lines
--- 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
-4@@ -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. +* Returns 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); --2.34.1
Tony Nguyen
maintainerRe: [PATCH v2 1/2] i40e: return false from i40e_reset_vf if reset is in progress
In reply to Robert MalzQuoted 21 lines · Robert Malz
The function
i40e_vc_reset_vfattempts, up to 20 times, to handle a VF reset request, using the return value ofi40e_reset_vfas an indicator of whether the reset was successfully triggered. Currently,i40e_reset_vfalways 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_vfto 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")Signed-off-by Robert Malz <[email protected]>--- 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
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c static void i40e_cleanup_reset_vf(struct i40e_vf *vf) · line 1550
Quoted 7 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2
-2@@ -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. +* Returns true if reset was performed successfully or if resets are +* disabled. False if reset is already in progress.
nit but if we are editing this, let's make kdoc happy. Please start with Return: or Returns:
Thanks,
Tony
Quoted 12 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1
-1**/ 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);
Re: [PATCH v2 1/2] i40e: return false from i40e_reset_vf if reset is in progress
Quoted 36 lines · Tony Nguyen
Quoted 21 lines · Robert Malz
The function
i40e_vc_reset_vfattempts, up to 20 times, to handle a VF reset request, using the return value ofi40e_reset_vfas an indicator of whether the reset was successfully triggered. Currently,i40e_reset_vfalways 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_vfto 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")Signed-off-by Robert Malz <[email protected]>--- 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
-0drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c static void i40e_cleanup_reset_vf(struct i40e_vf *vf) · line 1550
Quoted 7 lines
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +2
-2@@ -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. +* Returns true if reset was performed successfully or if resets are +* disabled. False if reset is already in progress. nit but if we are editing this, let's make kdoc happy. Please start with
Return: or Returns:
Quoted 3 lines
Thanks,
Tony
Hey Tony, thanks for the review. Fixed in v3.
Regards,
Robert
PATCH v2 2/2 i40e: retry VFLR handling if there is ongoing VF reset
In reply to Robert MalzWhen 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.
--- 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
@@ -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
Re: [PATCH v2 2/2] i40e: retry VFLR handling if there is ongoing VF reset
Quoted 10 lines · Robert Malz
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
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 theI40E_VFLR_EVENT_PENDINGbit again during VFLR handling if the reset is not yet complete. This ensures the driver will properly complete the VF reset in such scenarios.
Quoted 2 lines
Fixes 52424f974bc5 ("i40e: Fix VF hang when reset is triggered on another VF")Signed-off-by Robert Malz <[email protected]>
Quoted 24 lines
--- 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
-2@@ -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 ; --2.34.1