Skip to content

Commit 2cea7a5

Browse files
committed
[nrf noup] zephyr: Set Max idle period
Dynamically set Max idle period. Signed-off-by: Ajay Parida <[email protected]>
1 parent dda5457 commit 2cea7a5

File tree

7 files changed

+20
-3
lines changed

7 files changed

+20
-3
lines changed

src/drivers/driver.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,9 @@ struct wpa_driver_associate_params {
12041204
*/
12051205
int sae_pwe;
12061206

1207+
/**
1208+
* bss_max_idle_period - Maximum idle period which STA currently supports.
1209+
*/
12071210
unsigned short bss_max_idle_period;
12081211
};
12091212

wpa_supplicant/config.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4430,7 +4430,7 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
44304430
if (driver_param)
44314431
config->driver_param = os_strdup(driver_param);
44324432
config->gas_rand_addr_lifetime = DEFAULT_RAND_ADDR_LIFETIME;
4433-
4433+
config->bss_max_idle_period = DEFAULT_BSS_MAX_IDLE_PERIOD;
44344434
return config;
44354435
}
44364436

@@ -5265,6 +5265,7 @@ static const struct global_parse_data global_fields[] = {
52655265
{ INT_RANGE(pasn_corrupt_mic, 0, 1), 0 },
52665266
#endif /* CONFIG_TESTING_OPTIONS */
52675267
#endif /* CONFIG_PASN */
5268+
{ INT(bss_max_idle_period), 0 },
52685269
};
52695270

52705271
#undef FUNC

wpa_supplicant/config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#define DEFAULT_OCE_SUPPORT OCE_STA
4848
#define DEFAULT_EXTENDED_KEY_ID 0
4949
#define DEFAULT_SCAN_RES_VALID_FOR_CONNECT 5
50+
#define DEFAULT_BSS_MAX_IDLE_PERIOD 300
5051

5152
#include "config_ssid.h"
5253
#include "wps/wps.h"
@@ -1699,6 +1700,11 @@ struct wpa_config {
16991700

17001701
#endif /* CONFIG_TESTING_OPTIONS */
17011702
#endif /* CONFIG_PASN*/
1703+
/*
1704+
* bss_max_idle_period - Maximum idle period after
1705+
* which STA will send keep-alive
1706+
*/
1707+
unsigned int bss_max_idle_period;
17021708
};
17031709

17041710

wpa_supplicant/config_file.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
15591559
if (config->wowlan_disconnect_on_deinit)
15601560
fprintf(f, "wowlan_disconnect_on_deinit=%d\n",
15611561
config->wowlan_disconnect_on_deinit);
1562+
if (config->bss_max_idle_period != DEFAULT_BSS_MAX_IDLE_PERIOD)
1563+
fprintf(f, "bss_max_idle_period=%u\n",
1564+
config->bss_max_idle_period);
15621565
}
15631566

15641567
#endif /* CONFIG_NO_CONFIG_WRITE */

wpa_supplicant/events.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2517,6 +2517,10 @@ static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s,
25172517
unsigned int msec;
25182518
wpa_s->sme.bss_max_idle_period =
25192519
WPA_GET_LE16(elems.bss_max_idle_period);
2520+
wpa_printf(MSG_ERROR, "User config max idle period = %u "
2521+
"(*1000 TU)", wpa_s->conf->bss_max_idle_period);
2522+
wpa_printf(MSG_ERROR, "AP config max idle period = %u "
2523+
"(*1000 TU)", wpa_s->sme.bss_max_idle_period);
25202524
wpa_printf(MSG_DEBUG, "WNM: BSS Max Idle Period: %u (* 1000 "
25212525
"TU)%s", wpa_s->sme.bss_max_idle_period,
25222526
(elems.bss_max_idle_period[2] & 0x01) ?

wpa_supplicant/sme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
21192119
else
21202120
params.uapsd = -1;
21212121

2122-
params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
2122+
params.bss_max_idle_period = wpa_s->conf->bss_max_idle_period;
21232123
if (wpa_drv_associate(wpa_s, &params) < 0) {
21242124
wpa_msg(wpa_s, MSG_INFO, "SME: Association request to the "
21252125
"driver failed");

wpa_supplicant/wpa_supplicant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4020,7 +4020,7 @@ static void wpas_start_assoc_cb(struct wpa_radio_work *work, int deinit)
40204020
params.sae_pwe = wpa_s->conf->sae_pwe;
40214021
#endif /* CONFIG_SAE */
40224022

4023-
params.bss_max_idle_period = CONFIG_BSS_MAX_IDLE_TIME;
4023+
params.bss_max_idle_period = wpa_s->conf->bss_max_idle_period;
40244024
ret = wpa_drv_associate(wpa_s, &params);
40254025
os_free(wpa_ie);
40264026
if (ret < 0) {

0 commit comments

Comments
 (0)