diff mbox series

[iwl-net,08/10] ice: detect a PF reset that does not complete

Message ID 20261002130752.2597259-9-poros@redhat.com
State Under Review
Delegated to: Anthony Nguyen
Headers show
Series ice: port missing i40e fixes | expand

Commit Message

Petr Oros Oct. 2, 2026, 1:07 p.m. UTC
ice_pf_reset() polls PFGEN_CTRL.PFSWR for up to
ICE_GLOBAL_CFG_LOCK_TIMEOUT + ICE_PF_RESET_WAIT_COUNT iterations, but
the timeout check after the loop still compares the counter with
ICE_PF_RESET_WAIT_COUNT alone. When the reset never completes the loop
ends with cnt == 5300, the check does not match and the function
returns success with PFSWR still set. A reset that completes just when
the counter reaches ICE_PF_RESET_WAIT_COUNT is reported as a failure
instead.

Check the PFSWR bit read last instead of the loop counter, the same
way i40e_pf_reset() does after its poll loop.

Fixes: c9a12d6d2091 ("ice: Increase timeout after PFR")
Assisted-by: LLM
Signed-off-by: Petr Oros <poros@redhat.com>
---
 drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ivan Vecera Oct. 3, 2026, 9:55 a.m. UTC | #1
On October 2, 2026 3:07:50 PM GMT+02:00, Petr Oros <poros@redhat.com> wrote:
>ice_pf_reset() polls PFGEN_CTRL.PFSWR for up to
>ICE_GLOBAL_CFG_LOCK_TIMEOUT + ICE_PF_RESET_WAIT_COUNT iterations, but
>the timeout check after the loop still compares the counter with
>ICE_PF_RESET_WAIT_COUNT alone. When the reset never completes the loop
>ends with cnt == 5300, the check does not match and the function
>returns success with PFSWR still set. A reset that completes just when
>the counter reaches ICE_PF_RESET_WAIT_COUNT is reported as a failure
>instead.
>
>Check the PFSWR bit read last instead of the loop counter, the same
>way i40e_pf_reset() does after its poll loop.
>
>Fixes: c9a12d6d2091 ("ice: Increase timeout after PFR")
>Assisted-by: LLM
>Signed-off-by: Petr Oros <poros@redhat.com>
>---
> drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
>index 04633103e3e610..0ffd6b5b81239e 100644
>--- a/drivers/net/ethernet/intel/ice/ice_common.c
>+++ b/drivers/net/ethernet/intel/ice/ice_common.c
>@@ -1291,7 +1291,7 @@ static int ice_pf_reset(struct ice_hw *hw)
> 		mdelay(1);
> 	}
> 
>-	if (cnt == ICE_PF_RESET_WAIT_COUNT) {
>+	if (reg & PFGEN_CTRL_PFSWR_M) {
> 		ice_debug(hw, ICE_DBG_INIT, "PF reset polling failed to complete.\n");
> 		return -EIO;
> 	}

Reviewed-by: Ivan Vecera <ivecera@redhat.com>
Loktionov, Aleksandr Oct. 5, 2026, 10:27 a.m. UTC | #2
> -----Original Message-----
> From: Petr Oros <poros@redhat.com>
> Sent: Friday, October 2, 2026 3:08 PM
> To: netdev@vger.kernel.org
> Cc: Oros, Petr <poros@redhat.com>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@intel.com>; Andrew Lunn <andrew+netdev@lunn.ch>;
> David S. Miller <davem@davemloft.net>; Eric Dumazet
> <edumazet@kernel.org>; Jakub Kicinski <kuba@kernel.org>; Paolo Abeni
> <pabeni@redhat.com>; Lobakin, Aleksander
> <aleksander.lobakin@intel.com>; Alexei Starovoitov <ast@kernel.org>;
> Daniel Borkmann <daniel@iogearbox.net>; Jesper Dangaard Brouer
> <hawk@kernel.org>; John Fastabend <john.fastabend@gmail.com>;
> Stanislav Fomichev <sdf@fomichev.me>; Henry Tieman
> <henry.w.tieman@intel.com>; Anirudh Venkataramanan
> <anirudh.venkataramanan@intel.com>; Michal Swiatkowski
> <michal.swiatkowski@linux.intel.com>; Jesse Brandeburg
> <jbrandeb@kernel.org>; Preethi Banala <preethi.banala@intel.com>;
> Kiran Patil <kiran.patil@intel.com>; Dan Nowlin
> <dan.nowlin@intel.com>; Stephen Hemminger
> <stephen@networkplumber.org>; intel-wired-lan@lists.osuosl.org; linux-
> kernel@vger.kernel.org; bpf@vger.kernel.org
> Subject: [PATCH iwl-net 08/10] ice: detect a PF reset that does not
> complete
> 
> ice_pf_reset() polls PFGEN_CTRL.PFSWR for up to
> ICE_GLOBAL_CFG_LOCK_TIMEOUT + ICE_PF_RESET_WAIT_COUNT iterations, but
> the timeout check after the loop still compares the counter with
> ICE_PF_RESET_WAIT_COUNT alone. When the reset never completes the loop
> ends with cnt == 5300, the check does not match and the function
> returns success with PFSWR still set. A reset that completes just when
> the counter reaches ICE_PF_RESET_WAIT_COUNT is reported as a failure
> instead.
> 
> Check the PFSWR bit read last instead of the loop counter, the same
> way i40e_pf_reset() does after its poll loop.
> 
> Fixes: c9a12d6d2091 ("ice: Increase timeout after PFR")
> Assisted-by: LLM
> Signed-off-by: Petr Oros <poros@redhat.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_common.c
> b/drivers/net/ethernet/intel/ice/ice_common.c
> index 04633103e3e610..0ffd6b5b81239e 100644
> --- a/drivers/net/ethernet/intel/ice/ice_common.c
> +++ b/drivers/net/ethernet/intel/ice/ice_common.c
> @@ -1291,7 +1291,7 @@ static int ice_pf_reset(struct ice_hw *hw)
>  		mdelay(1);
>  	}
> 
> -	if (cnt == ICE_PF_RESET_WAIT_COUNT) {
> +	if (reg & PFGEN_CTRL_PFSWR_M) {
>  		ice_debug(hw, ICE_DBG_INIT, "PF reset polling failed to
> complete.\n");
>  		return -EIO;
>  	}
> --
> 2.55.0

Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethernet/intel/ice/ice_common.c
index 04633103e3e610..0ffd6b5b81239e 100644
--- a/drivers/net/ethernet/intel/ice/ice_common.c
+++ b/drivers/net/ethernet/intel/ice/ice_common.c
@@ -1291,7 +1291,7 @@  static int ice_pf_reset(struct ice_hw *hw)
 		mdelay(1);
 	}
 
-	if (cnt == ICE_PF_RESET_WAIT_COUNT) {
+	if (reg & PFGEN_CTRL_PFSWR_M) {
 		ice_debug(hw, ICE_DBG_INIT, "PF reset polling failed to complete.\n");
 		return -EIO;
 	}