nss-packages-breeze303/qca-nss-drv/patches-11.4/0023-add-boot-delay.patch
Sean Khan 0cf4f442e2 nss-drv: add boot wait
Ensures NSS cores are fully booted to hopefully workaround issues with
wifi stats (rx/tx rates) and inactive time.

Patch-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
Signed-off-by: Sean Khan <datapronix@protonmail.com>
2024-08-09 01:40:40 -04:00

61 lines
1.6 KiB
Diff

--- a/nss_core.c
+++ b/nss_core.c
@@ -87,6 +87,8 @@ MODULE_PARM_DESC(pn_qlimits, "Queue limi
static atomic_t jumbo_mru;
static atomic_t paged_mode;
+static int nss_bootstate = 0;
+
/*
* nss_core_update_max_ipv4_conn()
* Update the maximum number of configured IPv4 connections
@@ -2187,6 +2189,19 @@ static inline void nss_core_handle_tx_un
nss_hal_disable_interrupt(nss_ctx, nss_ctx->int_ctx[0].shift_factor, NSS_N2H_INTR_TX_UNBLOCKED);
}
+void nss_bootwait(void)
+{
+ int dead = 10 * 10;
+#if (NSS_MAX_CORES > 1)
+ while (nss_bootstate < 2 && dead-- > 0)
+#else
+ while (!nss_bootstate && dead-- > 0)
+#endif
+ {
+ msleep(100);
+ }
+}
+
/*
* nss_core_handle_cause_nonqueue()
* Handle non-queue interrupt causes (e.g. empty buffer SOS, Tx unblocked)
@@ -2255,6 +2270,9 @@ static void nss_core_handle_cause_nonque
#endif
#endif
}
+ if (unlikely(nss_ctx->state == NSS_CORE_STATE_INITIALIZED)) {
+ nss_bootstate++;
+ }
/*
* TODO: find better mechanism to handle empty buffers
--- a/nss_hal/nss_hal.c
+++ b/nss_hal/nss_hal.c
@@ -827,6 +827,7 @@ int nss_hal_probe(struct platform_device
}
nss_info("%px: All resources initialized and nss core%d has been brought out of reset", nss_ctx, nss_dev->id);
+ nss_bootwait();
goto out;
err_register_irq:
--- a/nss_core.h
+++ b/nss_core.h
@@ -1035,4 +1035,6 @@ extern void nss_ppe_free(void);
extern nss_tx_status_t nss_n2h_cfg_empty_pool_size(struct nss_ctx_instance *nss_ctx, uint32_t pool_sz);
extern nss_tx_status_t nss_n2h_paged_buf_pool_init(struct nss_ctx_instance *nss_ctx);
+void nss_bootwait(void);
+
#endif /* __NSS_CORE_H */