diff options
| author | Rashmi Ramanna <c_ramanr@qti.qualcomm.com> | 2014-01-20 22:55:09 +0200 |
|---|---|---|
| committer | Steve Kondik <shade@chemlab.org> | 2014-06-12 14:07:30 -0700 |
| commit | 641634ce96d43c948d23e913ba110febb9b11413 (patch) | |
| tree | 94870455b1caef419fa3522a9420d64c7bd2dfdf | |
| parent | 4fccad8c8015419c104900ef405424557826d656 (diff) | |
| download | android_external_wpa_supplicant_8-641634ce96d43c948d23e913ba110febb9b11413.tar.gz android_external_wpa_supplicant_8-641634ce96d43c948d23e913ba110febb9b11413.tar.bz2 android_external_wpa_supplicant_8-641634ce96d43c948d23e913ba110febb9b11413.zip | |
P2P: Extend the listen time based on the active concurrent session
A P2P Device while in the Listen state waiting to respond for the
obtained group negotiation request shall give a fair chance for other
concurrent sessions to use the shared radio by inducing an idle time
between the successive listen states. However, if there are no
concurrent operations, this idle time can be reduced.
CRs-Fixed: 606348
Git-commit: a2d63657603b8f0714274f34bea45cb5d0c0a7b9
Git-repo : git://w1.fi/srv/git/hostap.git
Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Change-Id: Ifbc6b7687889055764ef462abb710ef9a6c580a8
| -rw-r--r-- | src/p2p/p2p.c | 12 | ||||
| -rw-r--r-- | src/p2p/p2p.h | 9 | ||||
| -rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 16 |
3 files changed, 31 insertions, 6 deletions
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c index e31c4e9a..ca3b7c5b 100644 --- a/src/p2p/p2p.c +++ b/src/p2p/p2p.c @@ -3241,13 +3241,13 @@ static void p2p_timeout_connect_listen(struct p2p_data *p2p) static void p2p_timeout_wait_peer_connect(struct p2p_data *p2p) { - /* - * TODO: could remain constantly in Listen state for some time if there - * are no other concurrent uses for the radio. For now, go to listen - * state once per second to give other uses a chance to use the radio. - */ p2p_set_state(p2p, P2P_WAIT_PEER_IDLE); - p2p_set_timeout(p2p, 0, 500000); + + if (p2p->cfg->is_concurrent_session_active && + p2p->cfg->is_concurrent_session_active(p2p->cfg->cb_ctx)) + p2p_set_timeout(p2p, 0, 500000); + else + p2p_set_timeout(p2p, 0, 200000); } diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index c6e5c94e..8e077177 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -762,6 +762,15 @@ struct p2p_config { * or 0 if not. */ int (*go_connected)(void *ctx, const u8 *dev_addr); + + /** + * is_concurrent_session_active - Check whether concurrent session is + * active on other virtual interfaces + * @ctx: Callback context from cb_ctx + * Returns: 1 if concurrent session is active on other virtual interface + * or 0 if not. + */ + int (*is_concurrent_session_active)(void *ctx); }; diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index a066e6c8..3db16d7f 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -3239,6 +3239,21 @@ static int wpas_go_connected(void *ctx, const u8 *dev_addr) } +static int wpas_is_concurrent_session_active(void *ctx) +{ + struct wpa_supplicant *wpa_s = ctx; + struct wpa_supplicant *ifs; + + for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) { + if (ifs == wpa_s) + continue; + if (ifs->wpa_state > WPA_ASSOCIATED) + return 1; + } + return 0; +} + + static void wpas_p2p_debug_print(void *ctx, int level, const char *msg) { struct wpa_supplicant *wpa_s = ctx; @@ -3349,6 +3364,7 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s) p2p.invitation_result = wpas_invitation_result; p2p.get_noa = wpas_get_noa; p2p.go_connected = wpas_go_connected; + p2p.is_concurrent_session_active = wpas_is_concurrent_session_active; os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN); os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN); |
