@@ -73,7 +73,6 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
7373 nrf_wifi_rpu_recovery_work );
7474 struct nrf_wifi_ctx_zep * rpu_ctx_zep = NULL ;
7575 int ret ;
76- bool recovery_fail = false;
7776
7877 if (!vif_ctx_zep ) {
7978 LOG_ERR ("%s: vif_ctx_zep is NULL" , __func__ );
@@ -144,11 +143,27 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
144143 ret = net_if_down (vif_ctx_zep -> zep_net_if_ctx );
145144 if (ret ) {
146145 rpu_ctx_zep -> rpu_recovery_failure ++ ;
147- recovery_fail = true;
148146 LOG_ERR ("%s: net_if_down failed: %d" , __func__ , ret );
149147 /* Continue with the recovery */
148+ } else {
149+ rpu_ctx_zep -> rpu_recovery_success ++ ;
150150 }
151- k_msleep (CONFIG_NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS );
151+ /* Continue recovery process after delay without blocking system workqueue.
152+ * Mutex is released in the next phase.
153+ */
154+ k_work_reschedule (& vif_ctx_zep -> nrf_wifi_rpu_recovery_bringup_work ,
155+ K_MSEC (CONFIG_NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS ));
156+ }
157+
158+ static void nrf_wifi_rpu_recovery_bringup_work_handler (struct k_work * work )
159+ {
160+ struct k_work_delayable * dwork = k_work_delayable_from_work (work );
161+ struct nrf_wifi_vif_ctx_zep * vif_ctx_zep = CONTAINER_OF (dwork ,
162+ struct nrf_wifi_vif_ctx_zep ,
163+ nrf_wifi_rpu_recovery_bringup_work );
164+ struct nrf_wifi_ctx_zep * rpu_ctx_zep = vif_ctx_zep -> rpu_ctx_zep ;
165+ int ret ;
166+
152167#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG
153168 LOG_ERR ("%s: Bringing the interface up" , __func__ );
154169#else
@@ -160,9 +175,6 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
160175 }
161176 rpu_ctx_zep -> rpu_recovery_in_progress = false;
162177 rpu_ctx_zep -> last_rpu_recovery_time_ms = k_uptime_get ();
163- if (!recovery_fail ) {
164- rpu_ctx_zep -> rpu_recovery_success ++ ;
165- }
166178 k_mutex_unlock (& rpu_ctx_zep -> rpu_lock );
167179#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG
168180 LOG_ERR ("%s: RPU recovery done" , __func__ );
@@ -669,6 +681,8 @@ void nrf_wifi_if_init_zep(struct net_if *iface)
669681#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
670682 k_work_init (& vif_ctx_zep -> nrf_wifi_rpu_recovery_work ,
671683 nrf_wifi_rpu_recovery_work_handler );
684+ k_work_init_delayable (& vif_ctx_zep -> nrf_wifi_rpu_recovery_bringup_work ,
685+ nrf_wifi_rpu_recovery_bringup_work_handler );
672686#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
673687
674688#if !defined(CONFIG_NRF_WIFI_IF_AUTO_START )
0 commit comments