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 <jouni@qca.qualcomm.com>
This commit is contained in:
Jouni Malinen 2015-07-20 13:42:35 +03:00 committed by Jouni Malinen
parent 22fd2822f9
commit de74489276
3 changed files with 8 additions and 6 deletions

View file

@ -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 os_reltime now;
struct ap_info *ap; struct ap_info *ap;
int set_beacon = 0; int set_beacon = 0;
eloop_register_timeout(10, 0, ap_list_timer, iface, NULL);
if (!iface->ap_list) if (!iface->ap_list)
return; return;
@ -305,13 +302,11 @@ static void ap_list_timer(void *eloop_ctx, void *timeout_ctx)
int ap_list_init(struct hostapd_iface *iface) int ap_list_init(struct hostapd_iface *iface)
{ {
eloop_register_timeout(10, 0, ap_list_timer, iface, NULL);
return 0; return 0;
} }
void ap_list_deinit(struct hostapd_iface *iface) void ap_list_deinit(struct hostapd_iface *iface)
{ {
eloop_cancel_timeout(ap_list_timer, iface, NULL);
hostapd_free_aps(iface); hostapd_free_aps(iface);
} }

View file

@ -39,6 +39,7 @@ void ap_list_process_beacon(struct hostapd_iface *iface,
#ifdef NEED_AP_MLME #ifdef NEED_AP_MLME
int ap_list_init(struct hostapd_iface *iface); int ap_list_init(struct hostapd_iface *iface);
void ap_list_deinit(struct hostapd_iface *iface); void ap_list_deinit(struct hostapd_iface *iface);
void ap_list_timer(struct hostapd_iface *iface);
#else /* NEED_AP_MLME */ #else /* NEED_AP_MLME */
static inline int ap_list_init(struct hostapd_iface *iface) 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_deinit(struct hostapd_iface *iface)
{ {
} }
static inline void ap_list_timer(struct hostapd_iface *iface)
{
}
#endif /* NEED_AP_MLME */ #endif /* NEED_AP_MLME */
#endif /* AP_LIST_H */ #endif /* AP_LIST_H */

View file

@ -2928,6 +2928,8 @@ void hostapd_periodic_iface(struct hostapd_iface *iface)
{ {
size_t i; size_t i;
ap_list_timer(iface);
for (i = 0; i < iface->num_bss; i++) { for (i = 0; i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i]; struct hostapd_data *hapd = iface->bss[i];