Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: iwlwifi: add retry loop for firmware reload on resume
@ 2026-05-05 13:59 Ashwin Gundarapu
  0 siblings, 0 replies; only message in thread
From: Ashwin Gundarapu @ 2026-05-05 13:59 UTC (permalink / raw)
  To: miriam.rachel.korenblit, johannes.berg; +Cc: linux-wireless, linux-kernel

 From 48670d4341d2a9187e8368a2a929d155c4ffd003 Mon Sep 17 00:00:00 2001
From: Ashwin Gundarapu <linuxuser509@zohomail.in>
Date: Tue, 5 May 2026 19:12:48 +0530
Subject: [PATCH] wifi: iwlwifi: add retry loop for firmware reload on resume

After suspend, the PCIe link may not be fully ready when the driver
attempts to reload firmware. This causes iwlwifi to fail silently,
leaving users with no WiFi until reboot.

Add a retry loop that attempts firmware reload up to 3 times with
a 100ms delay between attempts, replacing the previous single attempt
that the code itself described as 'hope for the best here.'
---
  drivers/net/wireless/intel/iwlwifi/pcie/drv.c | 16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c 
b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
index dc99e7ac4726..2208b06d7e63 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/drv.c
@@ -1257,14 +1257,20 @@ static int _iwl_pci_resume(struct device 
*device, bool restore)

         if (restore || device_was_powered_off) {
                 trans->state = IWL_TRANS_NO_FW;
-               /* Hope for the best here ... If one of those steps fails we
-                * won't really know how to recover.
+               /* Retry firmware reload up to 3 times.
+                * The PCIe link may not be fully ready on the first attempt
+                * after resume, causing iwlwifi to fail silently.
                  */
-               iwl_pcie_prepare_card_hw(trans);
-               iwl_trans_activate_nic(trans);
+               int retry;
+               for (retry = 0; retry < 3; retry++) {
+                       iwl_pcie_prepare_card_hw(trans);
+                       iwl_trans_activate_nic(trans);
+                       if (trans->state != IWL_TRANS_NO_FW)
+                               break;
+                       msleep(100);
+               }
                 iwl_op_mode_device_powered_off(trans->op_mode);
         }
-
         /* In WOWLAN, let iwl_trans_pcie_d3_resume do the rest of the 
work */
         if (test_bit(STATUS_DEVICE_ENABLED, &trans->status))
                 return 0;

base-commit: 26fd6bff2c050196005312d1d306889220952a99
prerequisite-patch-id: 039ce4200f5ab50b86e8ef1fea9d93294ae43517
-- 
2.43.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-05 14:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-05 13:59 [PATCH] wifi: iwlwifi: add retry loop for firmware reload on resume Ashwin Gundarapu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox