Use a single cleanup timer per wpa_supplicant process
Previously, one timeout per process (by default every 30 seconds) was used P2P peer expiration and another per-interface timeout (every 10 seconds) was used to expire BSS entries. Merge these to a single per-process timeout that triggers every 10 seconds to minimize number of process wakeups due to periodic operations. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
7b7e8a2ee7
commit
8c0d0ff22e
4 changed files with 38 additions and 33 deletions
|
@ -48,9 +48,8 @@ static void p2p_scan_timeout(void *eloop_ctx, void *timeout_ctx);
|
|||
#define P2P_PEER_EXPIRATION_AGE 60
|
||||
#endif /* P2P_PEER_EXPIRATION_AGE */
|
||||
|
||||
#define P2P_PEER_EXPIRATION_INTERVAL (P2P_PEER_EXPIRATION_AGE / 2)
|
||||
|
||||
static void p2p_expire_peers(struct p2p_data *p2p)
|
||||
void p2p_expire_peers(struct p2p_data *p2p)
|
||||
{
|
||||
struct p2p_device *dev, *n;
|
||||
struct os_reltime now;
|
||||
|
@ -103,15 +102,6 @@ static void p2p_expire_peers(struct p2p_data *p2p)
|
|||
}
|
||||
|
||||
|
||||
static void p2p_expiration_timeout(void *eloop_ctx, void *timeout_ctx)
|
||||
{
|
||||
struct p2p_data *p2p = eloop_ctx;
|
||||
p2p_expire_peers(p2p);
|
||||
eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0,
|
||||
p2p_expiration_timeout, p2p, NULL);
|
||||
}
|
||||
|
||||
|
||||
static const char * p2p_state_txt(int state)
|
||||
{
|
||||
switch (state) {
|
||||
|
@ -2919,9 +2909,6 @@ struct p2p_data * p2p_init(const struct p2p_config *cfg)
|
|||
|
||||
dl_list_init(&p2p->devices);
|
||||
|
||||
eloop_register_timeout(P2P_PEER_EXPIRATION_INTERVAL, 0,
|
||||
p2p_expiration_timeout, p2p, NULL);
|
||||
|
||||
p2p->go_timeout = 100;
|
||||
p2p->client_timeout = 20;
|
||||
p2p->num_p2p_sd_queries = 0;
|
||||
|
@ -2950,7 +2937,6 @@ void p2p_deinit(struct p2p_data *p2p)
|
|||
wpabuf_free(p2p->wfd_coupled_sink_info);
|
||||
#endif /* CONFIG_WIFI_DISPLAY */
|
||||
|
||||
eloop_cancel_timeout(p2p_expiration_timeout, p2p, NULL);
|
||||
eloop_cancel_timeout(p2p_ext_listen_timeout, p2p, NULL);
|
||||
eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
|
||||
eloop_cancel_timeout(p2p_go_neg_start, p2p, NULL);
|
||||
|
|
|
@ -2256,4 +2256,13 @@ int p2p_service_del_asp(struct p2p_data *p2p, u32 adv_id);
|
|||
void p2p_service_flush_asp(struct p2p_data *p2p);
|
||||
struct p2ps_advertisement * p2p_get_p2ps_adv_list(struct p2p_data *p2p);
|
||||
|
||||
/**
|
||||
* p2p_expire_peers - Periodic cleanup function to expire peers
|
||||
* @p2p: P2P module context from p2p_init()
|
||||
*
|
||||
* This is a cleanup function that the entity calling p2p_init() is
|
||||
* expected to call periodically to clean up expired peer entries.
|
||||
*/
|
||||
void p2p_expire_peers(struct p2p_data *p2p);
|
||||
|
||||
#endif /* P2P_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue