Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.6: Backport latest fixes #16934

Merged
merged 34 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
cd24570
drivers: wifi: Option for Qos NULL frame based power save
ajayparida Jul 15, 2024
6676187
drivers: wifi: Change mode to mechanism
ajayparida Jul 29, 2024
806d7d1
drivers: wifi: Implement RPU recovery callbacks
krish2718 May 15, 2024
4f82b1d
drivers: wifi: Implement locking for recovery
krish2718 May 15, 2024
9379fec
drivers: wifi: Add a feature flag for RPU recovery
krish2718 May 15, 2024
d852a65
drivers: wifi: Add configuration option for propagation delay
krish2718 May 15, 2024
f038e13
drivers: wifi: Increase net management events
krish2718 May 15, 2024
4771c8a
drivers: wifi: Add a test command for RPU recovery
krish2718 May 15, 2024
5c15eee
drivers: wifi: Fix RPU recovery not being triggered
krish2718 Jul 8, 2024
7041f36
drivers: wifi: nrf700x: Ignore all failures in iface down
krish2718 Jul 9, 2024
29881b9
drivers: wifi: Add a sanity check for RPU comms
krish2718 Jul 9, 2024
58a3b1f
drivers: wifi: Add support for separate debugs for RPU recovery
krish2718 Jul 9, 2024
fd768b6
drivers: wifi: Increase the propogation delay
krish2718 Jul 11, 2024
50e5c79
drivers: wifi: Remove per-interface extended capabilities
krish2718 May 30, 2024
9a06523
drivers: wifi: Fix memory leak
krish2718 May 30, 2024
8112f34
drivers: wifi: Ignore parallel recovery requests
krish2718 Jul 13, 2024
cb8df06
drivers: wifi: Add quiet period for RPU recovery
krish2718 Jul 13, 2024
ad8d230
drivers: wifi: Fix the NULL check
krish2718 Jul 13, 2024
c156165
drivers: wifi: Add RPU recovery retry mechanism
krish2718 Jul 13, 2024
865f59e
drivers: wifi: Add de-initialization for SPI
krish2718 Feb 25, 2024
7da1e05
drivers: wifi: Assign de-initialization implementation ops
krish2718 Feb 25, 2024
af4a8ed
drivers: wifi: Fix NULL check for FMAC context
krish2718 Mar 25, 2024
66a4781
drivers: wifi: Fix de-init handle extraction
krish2718 May 30, 2024
d9cdfb2
drivers: wifi: Fix RPU recovery disabled build failures
krish2718 Jul 17, 2024
c0ef6ab
drivers: wifi: Fix TX buffers leak
krish2718 Jul 17, 2024
ed65987
net: lib: Add Wi-Fi ready lib
krish2718 Jul 11, 2024
6896ec4
samples: wifi: sta: Use Wi-Fi ready lib
krish2718 Jul 11, 2024
f993249
drivers: wifi: Add PS state debugs
krish2718 Jul 18, 2024
66be9cf
drivers: wifi: Add command and event logging
krish2718 Jul 18, 2024
d77bb28
doc: changelog: Add an entry for RPU recovery
krish2718 Jul 18, 2024
c1eda27
drivers: wifi: Enable management buffers offload
krish2718 Jul 18, 2024
c209f78
drivers: wifi: Increase default PS active timeout interval
krish2718 Aug 6, 2024
45b74a3
drivers: wifi: Add support for keepalive
krish2718 Aug 6, 2024
6e8d788
manifest: nrfxlib: Pull latest fixes
krish2718 Aug 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions doc/nrf/libraries/networking/wifi_ready.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _lib_wifi_ready:

Wi-Fi ready
###########

.. contents::
:local:
:depth: 2

The Wi-Fi ready library manages Wi-Fi® readiness for applications by handling supplicant ready and not ready events.

Overview
********

The Wi-Fi ready library informs applications of Wi-Fi readiness by managing supplicant events, indicating when Wi-Fi is available for use.

Configuration
*************

To use this library, enable the :kconfig:option:`CONFIG_WIFI_READY_LIB` Kconfig option.

API documentation
*****************

| Header file: :file:`include/net/wifi_ready.h`
| Source files: :file:`subsys/net/lib/wifi_ready`

.. doxygengroup:: wifi_ready
:project: nrf
:members:
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ This section provides detailed lists of changes by :ref:`driver <drivers>`.
Wi-Fi drivers
-------------

|no_changes_yet_note|
* Added a new feature to recover nRF70 chip.

Libraries
=========
Expand Down Expand Up @@ -335,7 +335,7 @@ Modem libraries
Libraries for networking
------------------------

|no_changes_yet_note|
* Added the :ref:`lib_wifi_ready` library.

Libraries for NFC
-----------------
Expand Down
127 changes: 127 additions & 0 deletions drivers/wifi/nrf700x/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -620,3 +620,130 @@ config NRF_WIFI_AP_DEAD_DETECT_TIMEOUT
help
The number of seconds after which AP is declared dead if no beacons
are received from the AP. Used to detect AP silently going down e.g., power off.

choice NRF_WIFI_PS_DATA_RETRIEVAL_MECHANISM
prompt "Power save data retrieval mechanism"
default NRF_WIFI_PS_POLL_BASED_RETRIEVAL
help
Select the mechanism to retrieve buffered data from AP.

config NRF_WIFI_PS_POLL_BASED_RETRIEVAL
bool "PS-Poll frame based mechanism to retrieve buffered data from AP"
help
When AP notifies about availability of buffered data, the STA stays in power save
and retrieves the frames one-by-one, this conserved more power but adds latency
to the traffic. Ideal for minimum number of frames.

config NRF_WIFI_QOS_NULL_BASED_RETRIEVAL
bool "QoS null frame based mechanism to retrieve buffered data from AP"
help
When AP notifies about availability of buffered data, the STA comes out of
power save and then AP can deliver all buffered frames without any additional
overhead or latency, but STA enters power save after a delay costing more power
depending on the delay. Ideal for heavy buffered traffic.

endchoice

config NRF_WIFI_MGMT_BUFF_OFFLOAD
bool "Enable management buffer offload"
default y

config NRF_WIFI_RPU_RECOVERY
bool "Enable RPU recovery mechanism"
depends on NRF_WIFI_LOW_POWER
select EXPERIMENTAL
default y
help
Enable RPU recovery mechanism to recover from RPU (nRF70) hang.
This feature performs an interface reset (down and up) which triggers
a RPU coldboot. Application's network connection will be lost during
the recovery process and it is application's responsibility to
re-establish the network connection.

config NRF_WIFI_CMD_EVENT_LOG
bool "Enable command event logging"
help
Enable command event logging to help debug Wi-Fi command events.
if NRF_WIFI_RPU_RECOVERY

config NRF_WIFI_RPU_RECOVERY_PROPAGATION_DELAY_MS
int "RPU recovery propagation delay in milliseconds"
default 2000
help
Propagation delay in milliseconds to wait after RPU is powered down
before powering it up. This delay is required to ensure that the recovery
is propagted to all the applications and stack and have enough time to
clean up the resources.

config NRF_WIFI_RPU_RECOVERY_PS_ACTIVE_TIMEOUT_MS
int "RPU recovery power save active timeout in milliseconds"
default 50000
help
Power save active timeout in milliseconds after which RPU recovery
mechanism will be triggered. This timeout is used to ensure that the
RPU attempts to enter power save mode in case of inactivity.

config NRF_WIFI_RPU_MIN_TIME_TO_ENTER_SLEEP_MS
int "Minimum idle time to enter sleep in milliseconds"
range 100 5000
default 1000
help
Minimum time the host should de-assert WAKEUP_NOW and let RPU enter
sleep mode, assuming there is no activity.

config NRF_WIFI_RPU_RECOVERY_DEBUG
bool "Enable RPU recovery debug logs"
help
Enable RPU recovery debug logs to help debug RPU recovery mechanism.

config NRF_WIFI_RPU_RECOVERY_QUIET_PERIOD_MS
int "RPU recovery quiet period in milliseconds"
default 5000
help
Quiet period in milliseconds after RPU recovery is triggered. During
this period, no new RPU recovery will be triggered.

config NRF_WIFI_RPU_RECOVERY_MAX_RETRIES
int "Maximum number of consecutive RPU recovery retries, 0 to disable"
default 0
help
Maximum number of consecutive RPU recovery retries before giving up
and resetting the system. Set to 0 to keep retrying indefinitely.

config NRF_WIFI_RPU_RECOVERY_RETRY_WINDOW_S
int "RPU recovery retry window in seconds"
default 900
help
Window in seconds during which the number of consecutive RPU recovery
retries are counted. If the number of consecutive RPU recovery retries
exceeds NRF_WIFI_RPU_RECOVERY_MAX_RETRIES within this window, the system
will be reset.

config NRF_WIFI_RPU_RECOVERY_PS_STATE_DEBUG
bool "Enable RPU recovery power save state debug logs"
help
Enable RPU recovery power save state debug logs to help debug RPU recovery mechanism.


config NET_MGMT_EVENT_QUEUE_SIZE
# Doing interface down and up even with delay puts a lot of events in the queue
default 16
endif

config NRF_WIFI_FEAT_KEEPALIVE
bool "Enable Wi-Fi keepalive feature"
depends on NRF700X_STA_MODE
help
Enable Wi-Fi keepalive feature to keep the connection alive by sending
keepalive packets to the AP. Primarily intended to interoperate with APs
that disconnect idle clients without any explicit checks. Slightly increases
power consumption.

if NRF_WIFI_FEAT_KEEPALIVE
config NRF_WIFI_KEEPALIVE_PERIOD_S
int "Keepalive period in seconds"
range 30 3600
default 60
help
Keepalive period in seconds to send keepalive packets to the AP.
endif
19 changes: 14 additions & 5 deletions drivers/wifi/nrf700x/inc/fmac_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,16 @@ struct nrf_wifi_vif_ctx_zep {
struct wifi_ps_config *ps_info;
bool ps_config_info_evnt;
bool authorized;
struct nrf_wifi_ext_capa {
enum nrf_wifi_iftype iftype;
unsigned char *ext_capa, *ext_capa_mask;
unsigned int ext_capa_len;
} iface_ext_capa;
bool cookie_resp_received;
#ifdef CONFIG_NRF700X_DATA_TX
struct k_work nrf_wifi_net_iface_work;
#endif /* CONFIG_NRF700X_DATA_TX */
unsigned long rssi_record_timestamp_us;
signed short rssi;
#endif /* CONFIG_NRF700X_STA_MODE */
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
struct k_work nrf_wifi_rpu_recovery_work;
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
};

struct nrf_wifi_vif_ctx_map {
Expand All @@ -104,6 +102,12 @@ struct nrf_wifi_ctx_zep {
#endif /* CONFIG_NRF700X_RADIO_TEST */
unsigned char *extended_capa, *extended_capa_mask;
unsigned int extended_capa_len;
struct k_mutex rpu_lock;
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
bool rpu_recovery_in_progress;
unsigned long last_rpu_recovery_time_ms;
unsigned int rpu_recovery_retries;
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
};

struct nrf_wifi_drv_priv_zep {
Expand All @@ -123,5 +127,10 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv
enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv_priv_zep);
enum nrf_wifi_status nrf_wifi_fw_load(void *rpu_ctx);
struct nrf_wifi_vif_ctx_zep *nrf_wifi_get_vif_ctx(struct net_if *iface);
#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
void nrf_wifi_rpu_recovery_cb(void *vif_ctx,
void *event_data,
unsigned int event_len);
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */

#endif /* __ZEPHYR_FMAC_MAIN_H__ */
27 changes: 22 additions & 5 deletions drivers/wifi/nrf700x/src/fmac_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ static void nrf_wifi_process_rssi_from_rx(void *vif_ctx,

rpu_ctx_zep = vif_ctx_zep->rpu_ctx_zep;

if (!rpu_ctx_zep) {
LOG_ERR("%s: rpu_ctx_zep is NULL", __func__);
if (!rpu_ctx_zep || !rpu_ctx_zep->rpu_ctx) {
LOG_ERR("%s: rpu_ctx_zep is NULL\n", __func__);
return;
}

Expand Down Expand Up @@ -306,6 +306,7 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
{
enum nrf_wifi_status status = NRF_WIFI_STATUS_FAIL;
struct nrf_wifi_ctx_zep *rpu_ctx_zep = NULL;
struct nrf_wifi_fmac_dev_ctx *fmac_dev_ctx = NULL;
struct nrf_wifi_vif_ctx_zep *vif_ctx_zep = NULL;
struct nrf_wifi_fmac_reg_info reg_domain_info = {0};
struct wifi_reg_chan_info *chan_info = NULL;
Expand Down Expand Up @@ -333,12 +334,18 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
goto err;
}

fmac_dev_ctx = rpu_ctx_zep->rpu_ctx;
if (!fmac_dev_ctx) {
LOG_ERR("%s: fmac_dev_ctx is NULL", __func__);
goto err;
}

if (reg_domain->oper == WIFI_MGMT_SET) {
memcpy(reg_domain_info.alpha2, reg_domain->country_code, WIFI_COUNTRY_CODE_LEN);

reg_domain_info.force = reg_domain->force;

status = nrf_wifi_fmac_set_reg(rpu_ctx_zep->rpu_ctx, &reg_domain_info);
status = nrf_wifi_fmac_set_reg(fmac_dev_ctx, &reg_domain_info);
if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: Failed to set regulatory domain", __func__);
goto err;
Expand All @@ -350,9 +357,9 @@ int nrf_wifi_reg_domain(const struct device *dev, struct wifi_reg_domain *reg_do
goto err;
}

status = nrf_wifi_fmac_get_reg(rpu_ctx_zep->rpu_ctx, &reg_domain_info);
status = nrf_wifi_fmac_get_reg(fmac_dev_ctx, &reg_domain_info);
if (status != NRF_WIFI_STATUS_SUCCESS) {
LOG_ERR("%s: Failed to get regulatory domain", __func__);
LOG_ERR("%s: Failed to get regulatory domain\n", __func__);
goto err;
}

Expand Down Expand Up @@ -625,6 +632,8 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_add_zep(struct nrf_wifi_drv_priv_zep *drv
goto err;
}

k_mutex_init(&rpu_ctx_zep->rpu_lock);

return status;
err:
if (rpu_ctx) {
Expand All @@ -651,6 +660,11 @@ enum nrf_wifi_status nrf_wifi_fmac_dev_rem_zep(struct nrf_wifi_drv_priv_zep *drv
nrf_wifi_fmac_dev_rem(rpu_ctx_zep->rpu_ctx);
#endif /* CONFIG_NRF700X_RADIO_TEST */

free(rpu_ctx_zep->extended_capa);
rpu_ctx_zep->extended_capa = NULL;
free(rpu_ctx_zep->extended_capa_mask);
rpu_ctx_zep->extended_capa_mask = NULL;

rpu_ctx_zep->rpu_ctx = NULL;
LOG_DBG("%s: FMAC device removed", __func__);

Expand Down Expand Up @@ -689,6 +703,9 @@ static int nrf_wifi_drv_main_zep(const struct device *dev)
rx_buf_pools[1].buf_sz = rx2_buf_sz;
rx_buf_pools[2].buf_sz = rx3_buf_sz;

#ifdef CONFIG_NRF_WIFI_RPU_RECOVERY
callbk_fns.rpu_recovery_callbk_fn = nrf_wifi_rpu_recovery_cb;
#endif /* CONFIG_NRF_WIFI_RPU_RECOVERY */
callbk_fns.scan_start_callbk_fn = nrf_wifi_event_proc_scan_start_zep;
callbk_fns.scan_done_callbk_fn = nrf_wifi_event_proc_scan_done_zep;
callbk_fns.reg_change_callbk_fn = reg_change_callbk_fn;
Expand Down
Loading
Loading