From: Chaitanya Tata <Chaitanya.mgit@xxxxxxxxx> From: Chaitanya Tata <chaitanya.mgit@xxxxxxxxx> Some drivers take longer than 100ms, and there by the keepalive is sent after the keepalive period and this causes disconnections sometimes, so, adjust for the driver's processing delay (a new driver capability) and send the keepalive early (no harm in sending early). Signed-off-by: Chaitanya Tata <Chaitanya.Tata@xxxxxxxxxxxxx> --- src/drivers/driver.h | 3 +++ wpa_supplicant/events.c | 22 ++++++++++++++++++---- wpa_supplicant/wpa_supplicant.c | 1 + wpa_supplicant/wpa_supplicant_i.h | 1 + 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 0a0532353..b13f8eaa6 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -2541,6 +2541,9 @@ struct wpa_driver_capa { /* Maximum number of bytes of extra IE(s) that can be added to Probe * Request frames */ size_t max_probe_req_ie_len; + + /* Driver TX processing delay in microseconds, used for TX delay compensation */ + unsigned int driver_tx_processing_delay_ms; }; diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index d388f31ff..dae2031f1 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -3001,8 +3001,15 @@ static void wnm_bss_keep_alive(void *eloop_ctx, void *sock_ctx) if (wpa_s->sme.bss_max_idle_period) { unsigned int msec; msec = wpa_s->sme.bss_max_idle_period * 1024; /* times 1000 */ - if (msec > 100) - msec -= 100; + { + unsigned int adj = wpa_s->driver_tx_processing_delay_ms; + + /* Fallback to retain current behaviour */ + if (adj < 100) + adj = 100; + if (msec > adj) + msec -= adj; + } eloop_register_timeout(msec / 1000, msec % 1000 * 1000, wnm_bss_keep_alive, wpa_s, NULL); } @@ -3036,8 +3043,15 @@ static void wnm_process_assoc_resp(struct wpa_supplicant *wpa_s, eloop_cancel_timeout(wnm_bss_keep_alive, wpa_s, NULL); /* msec times 1000 */ msec = wpa_s->sme.bss_max_idle_period * 1024; - if (msec > 100) - msec -= 100; + { + unsigned int adj = wpa_s->driver_tx_processing_delay_ms; + + /* Fallback to retain current behaviour */ + if (adj < 100) + adj = 100; + if (msec > adj) + msec -= adj; + } eloop_register_timeout(msec / 1000, msec % 1000 * 1000, wnm_bss_keep_alive, wpa_s, NULL); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 1114b3b25..c86a6ba38 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -7812,6 +7812,7 @@ static int wpa_supplicant_init_iface(struct wpa_supplicant *wpa_s, wpa_s->extended_capa_len >= 3 && wpa_s->extended_capa[2] & 0x40) wpa_s->multi_bss_support = 1; + wpa_s->driver_tx_processing_delay_ms = capa.driver_tx_processing_delay_ms; } else { wpa_s->drv_max_probe_req_ie_len = 1500; } diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 2f77413d5..9037d75d5 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1631,6 +1631,7 @@ struct wpa_supplicant { unsigned int next_beacon_check; bool scs_reconfigure; + unsigned int driver_tx_processing_delay_ms; }; -- 2.43.0 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap