diff options
author | Sunil Ravi <sunilravi@google.com> | 2021-06-21 19:51:28 -0700 |
---|---|---|
committer | Sunil Ravi <sunilravi@google.com> | 2021-06-21 21:43:07 -0700 |
commit | e18d262a894eb424bf484ede479f5d887d0404ee (patch) | |
tree | d201164694ebc50aac2c5688947cac5e52ed10ee | |
parent | 6a16d8c74cd60e030728f2ea53fb1e2358a9407c (diff) | |
download | wpa_supplicant_8-e18d262a894eb424bf484ede479f5d887d0404ee.tar.gz |
Use a shorter wait time for p2p connect with operating frequency
If supplicant is receiving the connect request with GO operating frequency,
then application(caller) must be already knowing and sure that GO is
operating on that frequency. So if the GO is not seen in the first
scan attempt, it is not worth waiting for 1 second to trigger the next scan.
It's better to finish scans quickly and report the Join failure to application.
This will help applications to trigger another Join attempt with a band information
or without band or frequency information.
To speed up the scan, reduced the scan interval for single channel scan
from 1 sec to 200 milli seconds.
Bug: 191718156
Test: Manual - Triggered P2P join request with channel, band, no
channel/band and verified the scan times.
Change-Id: I44e22f8e3a4d7460466b3e102f2d0c92038914d1
-rw-r--r-- | wpa_supplicant/hidl/1.4/p2p_iface.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/wpa_supplicant/hidl/1.4/p2p_iface.cpp b/wpa_supplicant/hidl/1.4/p2p_iface.cpp index db8f3a4d..cabcccb6 100644 --- a/wpa_supplicant/hidl/1.4/p2p_iface.cpp +++ b/wpa_supplicant/hidl/1.4/p2p_iface.cpp @@ -26,7 +26,12 @@ extern "C" } #define P2P_MAX_JOIN_SCAN_ATTEMPTS 3 -#define P2P_JOIN_SCAN_INTERVAL_USECS 1000000 +// Wait time before triggering the single channel scan to discover Auto GO. +// Use a shorter wait time when the given frequency is GO operating frequency. +// The idea is to quickly finish scans and return the status to application. +#define P2P_JOIN_SINGLE_CHANNEL_SCAN_INTERVAL_USECS 200000 +// Wait time before triggering the multiple channel scan to discover Auto GO. +#define P2P_JOIN_MULTIPLE_CHANNEL_SCAN_INTERVAL_USECS 1000000 namespace { const char kConfigMethodStrPbc[] = "pbc"; @@ -180,6 +185,19 @@ static int setP2pCliOptimizedScanFreqsList(struct wpa_supplicant *wpa_s, return 0; } +/** + * getP2pJoinScanInterval - Get the delay in triggering the scan to discover + * Auto GO. + */ +static int getP2pJoinScanIntervalUsecs(int freq) +{ + if (freq == 5 || freq == 2 || freq == 0) { + return P2P_JOIN_MULTIPLE_CHANNEL_SCAN_INTERVAL_USECS; + } else { + return P2P_JOIN_SINGLE_CHANNEL_SCAN_INTERVAL_USECS; + } +} + /* * isAnyEtherAddr - match any ether address * @@ -1795,7 +1813,7 @@ SupplicantStatus P2pIface::addGroup_1_2Internal( } }; - pending_scan_res_join_callback = [wpa_s, ssid, passphrase, peer_address, this]() { + pending_scan_res_join_callback = [wpa_s, ssid, passphrase, peer_address, freq, this]() { if (wpa_s->global->p2p == NULL || wpa_s->global->p2p_disabled) { return; } @@ -1820,7 +1838,7 @@ SupplicantStatus P2pIface::addGroup_1_2Internal( eloop_cancel_timeout(joinScanWrapper, wpa_s, NULL); if (wpa_s->p2p_join_scan_count < P2P_MAX_JOIN_SCAN_ATTEMPTS) { wpa_printf(MSG_DEBUG, "P2P: Try join again later."); - eloop_register_timeout(0, P2P_JOIN_SCAN_INTERVAL_USECS, + eloop_register_timeout(0, getP2pJoinScanIntervalUsecs(freq), joinScanWrapper, wpa_s, this); return; } |