Skip to content

Commit

Permalink
[nrf fromtree] net: wifi: Fix power save timeout data type
Browse files Browse the repository at this point in the history
This should be an unsigned integer. Also, add a comment to explain this
feature.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
(cherry picked from commit a71bff7)
  • Loading branch information
krish2718 authored and rlubos committed Jun 28, 2023
1 parent e405279 commit 8f601c9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 7 additions & 1 deletion include/zephyr/net/wifi_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@ struct wifi_ps_params {
unsigned short listen_interval;
enum wifi_ps_wakeup_mode wakeup_mode;
enum wifi_ps_mode mode;
int timeout_ms;
/* This is the time out to wait after sending a TX packet
* before going back to power save (in ms) to receive any replies
* from the AP. Zero means this feature is disabled.
*
* It's a tradeoff between power consumption and latency.
*/
unsigned int timeout_ms;
enum ps_param_type type;
enum wifi_config_ps_param_fail_reason fail_reason;
};
Expand Down
16 changes: 12 additions & 4 deletions subsys/net/l2/wifi/wifi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,13 @@ static int cmd_wifi_ps(const struct shell *sh, size_t argc, char *argv[])
shell_fprintf(sh, SHELL_NORMAL, "PS wake up mode: %s\n",
config.ps_params.wakeup_mode ? "Listen interval" : "DTIM");

shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n",
config.ps_params.timeout_ms);
if (config.ps_params.timeout_ms) {
shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n",
config.ps_params.timeout_ms);
} else {
shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n");
}


if (config.num_twt_flows == 0) {
shell_fprintf(sh, SHELL_NORMAL, "No TWT flows\n");
Expand Down Expand Up @@ -695,8 +700,11 @@ static int cmd_wifi_ps_timeout(const struct shell *sh, size_t argc, char *argv[]
return -ENOEXEC;
}

shell_fprintf(sh, SHELL_NORMAL,
"PS timeout %d ms\n", params.timeout_ms);
if (params.timeout_ms) {
shell_fprintf(sh, SHELL_NORMAL, "PS timeout: %d ms\n", params.timeout_ms);
} else {
shell_fprintf(sh, SHELL_NORMAL, "PS timeout: disabled\n");
}

return 0;
}
Expand Down

0 comments on commit 8f601c9

Please sign in to comment.