Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
[nrf noup] zephyr: Set Max idle period
Browse files Browse the repository at this point in the history
Dynamically set Max idle period.

Signed-off-by: Ajay Parida <ajay.parida@nordicsemi.no>
  • Loading branch information
ajayparida committed Jun 21, 2024
1 parent 6311fde commit 2d5bd58
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/drivers/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,9 @@ struct wpa_driver_associate_params {
*/
int sae_pwe;

/**
* bss_max_idle_period - Maximum idle period which STA currently supports.
*/
unsigned short bss_max_idle_period;
};

Expand Down
3 changes: 2 additions & 1 deletion wpa_supplicant/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -4430,7 +4430,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
if (driver_param)
config->driver_param = os_strdup(driver_param);
config->gas_rand_addr_lifetime = DEFAULT_RAND_ADDR_LIFETIME;

config->bss_max_idle_period = DEFAULT_BSS_MAX_IDLE_PERIOD;
return config;
}

Expand Down Expand Up @@ -5265,6 +5265,7 @@ static const struct global_parse_data global_fields[] = {
{ INT_RANGE(pasn_corrupt_mic, 0, 1), 0 },
#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN */
{ INT(bss_max_idle_period), 0 },
};

#undef FUNC
Expand Down
6 changes: 6 additions & 0 deletions wpa_supplicant/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#define DEFAULT_OCE_SUPPORT OCE_STA
#define DEFAULT_EXTENDED_KEY_ID 0
#define DEFAULT_SCAN_RES_VALID_FOR_CONNECT 5
#define DEFAULT_BSS_MAX_IDLE_PERIOD 300

#include "config_ssid.h"
#include "wps/wps.h"
Expand Down Expand Up @@ -1699,6 +1700,11 @@ struct wpa_config {

#endif /* CONFIG_TESTING_OPTIONS */
#endif /* CONFIG_PASN*/
/*
* bss_max_idle_period - Maximum idle period after
* which STA will send keep-alive
*/
unsigned int bss_max_idle_period;
};


Expand Down
3 changes: 3 additions & 0 deletions wpa_supplicant/config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
if (config->wowlan_disconnect_on_deinit)
fprintf(f, "wowlan_disconnect_on_deinit=%d\n",
config->wowlan_disconnect_on_deinit);
if (config->bss_max_idle_period != DEFAULT_BSS_MAX_IDLE_PERIOD)
fprintf(f, "bss_max_idle_period=%u\n",
config->bss_max_idle_period);
}

#endif /* CONFIG_NO_CONFIG_WRITE */
Expand Down
4 changes: 4 additions & 0 deletions wpa_supplicant/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -2517,6 +2517,10 @@ static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s,
unsigned int msec;
wpa_s->sme.bss_max_idle_period =
WPA_GET_LE16(elems.bss_max_idle_period);
printf("User config max idle period = %u "
"(*1000 TU)", wpa_s->conf->bss_max_idle_period);

Check failure on line 2521 in wpa_supplicant/events.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

CODE_INDENT

wpa_supplicant/events.c:2521 code indent should use tabs where possible

Check warning on line 2521 in wpa_supplicant/events.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

LEADING_SPACE

wpa_supplicant/events.c:2521 please, no spaces at the start of a line
printf("AP config max idle period = %u "
"(*1000 TU)", wpa_s->sme.bss_max_idle_period);
wpa_printf(MSG_DEBUG, "WNM: BSS Max Idle Period: %u (* 1000 "
"TU)%s", wpa_s->sme.bss_max_idle_period,
(elems.bss_max_idle_period[2] & 0x01) ?
Expand Down
2 changes: 1 addition & 1 deletion wpa_supplicant/sme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
else
params.uapsd = -1;

params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
params.bss_max_idle_period = wpa_s->conf->bss_max_idle_period;
if (wpa_drv_associate(wpa_s, &params) < 0) {
wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
"driver failed");
Expand Down
2 changes: 1 addition & 1 deletion wpa_supplicant/wpa_supplicant.c
Original file line number Diff line number Diff line change
Expand Up @@ -4020,7 +4020,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
params.sae_pwe = wpa_s->conf->sae_pwe;
#endif /* CONFIG_SAE */

params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
params.bss_max_idle_period = wpa_s->conf->bss_max_idle_period;
ret = wpa_drv_associate(wpa_s, &params);
os_free(wpa_ie);
if (ret < 0) {
Expand Down

0 comments on commit 2d5bd58

Please sign in to comment.