Skip to content

Commit

Permalink
drivers: wifi: Add PS exit strategy runtime configuration
Browse files Browse the repository at this point in the history
Dynamically set power save exit strategy runtime configuration that
allows to switch b/w stratgies depending on conserving power and
low-latency traffic download.

Signed-off-by: Ajay Parida <[email protected]>
  • Loading branch information
ajayparida authored and carlescufi committed Oct 17, 2024
1 parent d0d659b commit fe920fc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/wifi/nrfwifi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -338,4 +338,5 @@ zephyr_compile_definitions(
-DNRF70_ANT_GAIN_5G_BAND1=${CONFIG_NRF70_ANT_GAIN_5G_BAND1}
-DNRF70_ANT_GAIN_5G_BAND2=${CONFIG_NRF70_ANT_GAIN_5G_BAND2}
-DNRF70_ANT_GAIN_5G_BAND3=${CONFIG_NRF70_ANT_GAIN_5G_BAND3}
-DNRF_WIFI_PS_INT_PS=${CONFIG_NRF_WIFI_PS_INT_PS}
)
20 changes: 20 additions & 0 deletions drivers/wifi/nrfwifi/Kconfig.nrfwifi
Original file line number Diff line number Diff line change
Expand Up @@ -795,4 +795,24 @@ config NRF_WIFI_KEEPALIVE_PERIOD_S
Keepalive period in seconds to send keepalive packets to the AP.
endif

choice NRF_WIFI_PS_EXIT_STRATEGY
prompt "Power save exit strategy"
default NRF_WIFI_PS_INT_PS
help
Select the power save exit strategy to retrieve buffered data from AP.

config NRF_WIFI_PS_EXIT_EVERY_TIM
bool "Exit power save every time to retrieve buffered data from AP"
help
Exit power save every time to retrieve buffered data from AP. Entering back to
power save mode might take some time and power.

config NRF_WIFI_PS_INT_PS
bool "Exit power save based on an intelligent algorithm"
help
Exit power save based on an intelligent algorithm to retrieve buffered data from AP.
The algorithm tracks the buffered data at the AP and then dynamically decides
whether to stay in PS (for lower amount of buffered data) or exit PS (for higher
amount of buffered data).
endchoice
endif # WIFI_NRF70
23 changes: 23 additions & 0 deletions drivers/wifi/nrfwifi/src/wifi_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,24 @@ int nrf_wifi_set_power_save(const struct device *dev,
vif_ctx_zep->vif_idx,
params->wakeup_mode);
break;
case WIFI_PS_PARAM_EXIT_STRATEGY:
unsigned int exit_strategy;

if (params->exit_strategy == WIFI_PS_EXIT_EVERY_TIM) {
exit_strategy = EVERY_TIM;
} else if (params->exit_strategy == WIFI_PS_EXIT_CUSTOM_ALGO) {
exit_strategy = INT_PS;
} else {
params->fail_reason =
WIFI_PS_PARAM_FAIL_INVALID_EXIT_STRATEGY;
return -EINVAL;
}

status = nrf_wifi_fmac_set_ps_exit_strategy(
rpu_ctx_zep->rpu_ctx,
vif_ctx_zep->vif_idx,
exit_strategy);
break;
default:
params->fail_reason =
WIFI_PS_PARAM_FAIL_CMD_EXEC_FAIL;
Expand Down Expand Up @@ -379,6 +397,11 @@ void nrf_wifi_event_proc_get_power_save_info(void *vif_ctx,
vif_ctx_zep->ps_info->ps_params.timeout_ms = ps_info->ps_timeout;
vif_ctx_zep->ps_info->ps_params.listen_interval = ps_info->listen_interval;
vif_ctx_zep->ps_info->ps_params.wakeup_mode = ps_info->extended_ps;
if (ps_info->ps_exit_strategy == EVERY_TIM) {
vif_ctx_zep->ps_info->ps_params.exit_strategy = WIFI_PS_EXIT_EVERY_TIM;
} else if (ps_info->ps_exit_strategy == INT_PS) {
vif_ctx_zep->ps_info->ps_params.exit_strategy = WIFI_PS_EXIT_CUSTOM_ALGO;
}

for (int i = 0; i < ps_info->num_twt_flows; i++) {
struct twt_interval_float twt_interval_fp;
Expand Down

0 comments on commit fe920fc

Please sign in to comment.