From de74489276683f85adba7e464a0828131411daf4 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 20 Jul 2015 13:42:35 +0300 Subject: [PATCH] Move ap_list_timer() to use common AP periodic cleanup mechanism This reduces number of periodic eloop timeouts when AP mode operations are in progress. Signed-off-by: Jouni Malinen --- src/ap/ap_list.c | 7 +------ src/ap/ap_list.h | 5 +++++ src/ap/hostapd.c | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/ap/ap_list.c b/src/ap/ap_list.c index 78a1f7c37..8bf6ddec8 100644 --- a/src/ap/ap_list.c +++ b/src/ap/ap_list.c @@ -248,15 +248,12 @@ void ap_list_process_beacon(struct hostapd_iface *iface, } -static void ap_list_timer(void *eloop_ctx, void *timeout_ctx) +void ap_list_timer(struct hostapd_iface *iface) { - struct hostapd_iface *iface = eloop_ctx; struct os_reltime now; struct ap_info *ap; int set_beacon = 0; - eloop_register_timeout(10, 0, ap_list_timer, iface, NULL); - if (!iface->ap_list) return; @@ -305,13 +302,11 @@ static void ap_list_timer(void *eloop_ctx, void *timeout_ctx) int ap_list_init(struct hostapd_iface *iface) { - eloop_register_timeout(10, 0, ap_list_timer, iface, NULL); return 0; } void ap_list_deinit(struct hostapd_iface *iface) { - eloop_cancel_timeout(ap_list_timer, iface, NULL); hostapd_free_aps(iface); } diff --git a/src/ap/ap_list.h b/src/ap/ap_list.h index 93dc0eda8..9e0353cfe 100644 --- a/src/ap/ap_list.h +++ b/src/ap/ap_list.h @@ -39,6 +39,7 @@ void ap_list_process_beacon(struct hostapd_iface *iface, #ifdef NEED_AP_MLME int ap_list_init(struct hostapd_iface *iface); void ap_list_deinit(struct hostapd_iface *iface); +void ap_list_timer(struct hostapd_iface *iface); #else /* NEED_AP_MLME */ static inline int ap_list_init(struct hostapd_iface *iface) { @@ -48,6 +49,10 @@ static inline int ap_list_init(struct hostapd_iface *iface) static inline void ap_list_deinit(struct hostapd_iface *iface) { } + +static inline void ap_list_timer(struct hostapd_iface *iface) +{ +} #endif /* NEED_AP_MLME */ #endif /* AP_LIST_H */ diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index 0ae8f4a68..c509ebf42 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -2928,6 +2928,8 @@ void hostapd_periodic_iface(struct hostapd_iface *iface) { size_t i; + ap_list_timer(iface); + for (i = 0; i < iface->num_bss; i++) { struct hostapd_data *hapd = iface->bss[i];