Skip to content

Commit 1614913

Browse files
committed
[nrf fromlist] drivers: nrf_wifi: Fix rpu recovery debug info
Rpu recovey debug stats are stored in hal_dev_ctx which is not persistent in case of interface is brought down/up. Need to add in nrf_wifi_ctx_zep and update before interface goes down. Upstream PR #: 92995 Signed-off-by: Kapil Bhatt <[email protected]>
1 parent 2adb057 commit 1614913

File tree

3 files changed

+33
-8
lines changed

3 files changed

+33
-8
lines changed

drivers/wifi/nrf_wifi/inc/fmac_main.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ struct nrf_wifi_ctx_zep {
120120
unsigned int rpu_recovery_retries;
121121
int rpu_recovery_success;
122122
int rpu_recovery_failure;
123+
int wdt_irq_received;
124+
int wdt_irq_ignored;
123125
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
124126
};
125127

drivers/wifi/nrf_wifi/src/net_if.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
7272
struct nrf_wifi_vif_ctx_zep,
7373
nrf_wifi_rpu_recovery_work);
7474
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
75+
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
76+
struct nrf_wifi_hal_dev_ctx *hal_dev_ctx = NULL;
7577
int ret;
7678

7779
if (!vif_ctx_zep) {
@@ -90,6 +92,18 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
9092
return;
9193
}
9294

95+
fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
96+
if (!fmac_dev_ctx) {
97+
LOG_ERR("%s: fmac_dev_ctx is NULL", __func__);
98+
return;
99+
}
100+
101+
hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx;
102+
if (!hal_dev_ctx) {
103+
LOG_ERR("%s: hal_dev_ctx is NULL", __func__);
104+
return;
105+
}
106+
93107
if (rpu_ctx_zep->rpu_recovery_in_progress) {
94108
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG
95109
LOG_ERR("%s: RPU recovery already in progress", __func__);
@@ -134,6 +148,8 @@ static void nrf_wifi_rpu_recovery_work_handler(struct k_work *work)
134148
}
135149
#endif
136150
rpu_ctx_zep->rpu_recovery_in_progress = true;
151+
rpu_ctx_zep->wdt_irq_received += hal_dev_ctx->wdt_irq_received;
152+
rpu_ctx_zep->wdt_irq_ignored += hal_dev_ctx->wdt_irq_ignored;
137153
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY_DEBUG
138154
LOG_ERR("%s: Bringing the interface down", __func__);
139155
#else

drivers/wifi/nrf_wifi/src/wifi_util.c

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -938,10 +938,20 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh,
938938
}
939939

940940
fmac_dev_ctx = ctx->rpu_ctx;
941+
if (!fmac_dev_ctx) {
942+
shell_fprintf(sh, SHELL_ERROR, "FMAC context not initialized\n");
943+
ret = -ENOEXEC;
944+
goto unlock;
945+
}
946+
941947
hal_dev_ctx = fmac_dev_ctx->hal_dev_ctx;
948+
if (!hal_dev_ctx) {
949+
shell_fprintf(sh, SHELL_ERROR, "HAL context not initialized\n");
950+
ret = -ENOEXEC;
951+
goto unlock;
952+
}
942953

943-
shell_fprintf(sh,
944-
SHELL_INFO,
954+
shell_fprintf(sh, SHELL_INFO,
945955
"wdt_irq_received: %d\n"
946956
"wdt_irq_ignored: %d\n"
947957
"last_wakeup_now_asserted_time_ms: %lu milliseconds\n"
@@ -950,14 +960,11 @@ static int nrf_wifi_util_rpu_recovery_info(const struct shell *sh,
950960
"current time: %lu milliseconds\n"
951961
"rpu_recovery_success: %d\n"
952962
"rpu_recovery_failure: %d\n\n",
953-
hal_dev_ctx->wdt_irq_received,
954-
hal_dev_ctx->wdt_irq_ignored,
963+
ctx->wdt_irq_received, ctx->wdt_irq_ignored,
955964
hal_dev_ctx->last_wakeup_now_asserted_time_ms,
956965
hal_dev_ctx->last_wakeup_now_deasserted_time_ms,
957-
hal_dev_ctx->last_rpu_sleep_opp_time_ms,
958-
current_time_ms,
959-
ctx->rpu_recovery_success,
960-
ctx->rpu_recovery_failure);
966+
hal_dev_ctx->last_rpu_sleep_opp_time_ms, current_time_ms,
967+
ctx->rpu_recovery_success, ctx->rpu_recovery_failure);
961968

962969
ret = 0;
963970
unlock:

0 commit comments

Comments
 (0)