Skip to content

Commit b5ac16a

Browse files
committed
drivers: wifi: nrf71: Add IPC host TX send retry timeout
Replace the infinite BUSYQ_NOTREADY loop with bounded retries so a stuck IPC peer returns -ETIMEDOUT instead of hanging forever. Assisted-by: Cursor:Auto Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
1 parent a1c5517 commit b5ac16a

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

drivers/wifi/nrf71/bus/ipc_if.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
* via tail write.
1515
*/
1616

17+
#include <errno.h>
18+
1719
#include <zephyr/kernel.h>
1820
#include <zephyr/logging/log.h>
1921

@@ -194,12 +196,28 @@ int ipc_send(ipc_ctx_t ctx, const void *data, int len)
194196
}
195197

196198
/* TX path: send (addr, size, ack_addr) on IPC0 */
197-
do {
198-
status = wifi_ipc_host_tx_send(&wifi_host_tx,
199-
data,
200-
(size_t)len,
201-
ack_addr);
202-
} while (status == WIFI_IPC_STATUS_BUSYQ_NOTREADY);
199+
{
200+
int64_t deadline = k_uptime_get() + CONFIG_NRF71_IPC_SEND_TIMEOUT_MS;
201+
202+
do {
203+
status = wifi_ipc_host_tx_send(&wifi_host_tx,
204+
data,
205+
(size_t)len,
206+
ack_addr);
207+
if (status != WIFI_IPC_STATUS_BUSYQ_NOTREADY) {
208+
break;
209+
}
210+
211+
if (k_uptime_get() >= deadline) {
212+
LOG_ERR("IPC host TX timed out after %d ms",
213+
CONFIG_NRF71_IPC_SEND_TIMEOUT_MS);
214+
host_tx_ack_slot_free(ack_addr);
215+
return -ETIMEDOUT;
216+
}
217+
218+
k_usleep(CONFIG_NRF71_IPC_SEND_RETRY_INTERVAL_US);
219+
} while (true);
220+
}
203221

204222
if (status != WIFI_IPC_STATUS_OK) {
205223
host_tx_ack_slot_free(ack_addr);

0 commit comments

Comments
 (0)