Skip to content

Commit

Permalink
net: wifi: shell: add parameters for twt setup
Browse files Browse the repository at this point in the history
Add two parameters for twt setup.

Signed-off-by: Rex Chen <[email protected]>
  • Loading branch information
Rex-Chen-NXP committed Dec 10, 2024
1 parent 5bbe743 commit 6091204
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions drivers/wifi/nxp/nxp_wifi_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1356,10 +1356,12 @@ static int nxp_wifi_set_twt(const struct device *dev, struct wifi_twt_params *pa
twt_setup_conf.implicit = params->setup.implicit;
twt_setup_conf.announced = params->setup.announce;
twt_setup_conf.trigger_enabled = params->setup.trigger;
twt_setup_conf.twt_info_disabled = params->setup.twt_info_disable;
twt_setup_conf.negotiation_type = params->negotiation_type;
twt_setup_conf.twt_wakeup_duration = params->setup.twt_wake_interval;
twt_setup_conf.flow_identifier = params->flow_id;
twt_setup_conf.hard_constraint = 1;
twt_setup_conf.twt_exponent = params->setup.exponent;
twt_setup_conf.twt_mantissa = params->setup.twt_interval;
twt_setup_conf.twt_request = params->setup.responder;
ret = wlan_set_twt_setup_cfg(&twt_setup_conf);
Expand Down
4 changes: 4 additions & 0 deletions include/zephyr/net/wifi_mgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,10 @@ struct wifi_twt_params {
* prepare the data before TWT SP starts.
*/
uint32_t twt_wake_ahead_duration;
/** TWT info enabled or disable */
bool twt_info_disable;
/** TWT exponent */
uint8_t exponent;
} setup;
/** Setup specific parameters */
struct {
Expand Down
21 changes: 20 additions & 1 deletion subsys/net/l2/wifi/wifi_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,8 @@ static int twt_args_to_params(const struct shell *sh, size_t argc, char *argv[],
{"wake-interval", required_argument, 0, 'w'},
{"interval", required_argument, 0, 'i'},
{"wake-ahead-duration", required_argument, 0, 'D'},
{"info-disable", required_argument, 0, 'd'},
{"exponent", required_argument, 0, 'e'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}};

Expand Down Expand Up @@ -1703,6 +1705,21 @@ static int twt_args_to_params(const struct shell *sh, size_t argc, char *argv[],
params->setup.twt_wake_ahead_duration = (uint32_t)value;
break;

case 'd':
if (!parse_number(sh, &value, state->optarg, NULL, 0, 1)) {
return -EINVAL;
}
params->setup.twt_info_disable = (bool)value;
break;

case 'e':
if (!parse_number(sh, &value, state->optarg, NULL, 0,
WIFI_MAX_TWT_EXPONENT)) {
return -EINVAL;
}
params->setup.exponent = (uint8_t)value;
break;

case 'h':
return -ENOEXEC;
}
Expand Down Expand Up @@ -3318,9 +3335,11 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops,
"<-w --wake-interval>: 1-262144us\n"
"<-i --interval>: 1us-2^31us\n"
"<-D --wake-ahead-duration>: 0us-2^31us\n"
"<-d --info-disable>: 0/1\n"
"<-e --exponent>: 0-63\n"
"[-h, --help]: Print out command usage.\n",
cmd_wifi_twt_setup,
23, 1),
27, 1),
SHELL_CMD_ARG(
btwt_setup, NULL,
" Start a BTWT flow:\n"
Expand Down

0 comments on commit 6091204

Please sign in to comment.