From 0c4489f1adb6bb193d3cd68c4330d8c7323417e2 Mon Sep 17 00:00:00 2001 From: Pragaspathi Thilagaraj Date: Mon, 5 Aug 2019 20:50:23 +0530 Subject: [PATCH] qcacld-3.0: WPA3 roam make preauth start command as wakable In WPA3 roam hybrid model, the SAE exchange/4-way handshake is offloaded to the wpa_supplicant. After roam candidate selection, firmware will send WMI_ROAM_PREAUTH_START_EVENTID to send SAE authentication frame with the selected candidate. If the host is in suspended state, then SAE preauthentication could fail. So wakeup the host when WMI_ROAM_PREAUTH_START_EVENTID event is received to carry out the SAE authentication with the provided candidate Change-Id: I7a89234e90e7fccef58ec3822dc0cda3740bad20 CRs-Fixed: 2512871 --- components/pmo/core/src/wlan_pmo_wow.c | 7 +++++++ core/wma/inc/wma.h | 3 +++ core/wma/src/wma_features.c | 8 ++++++++ core/wma/src/wma_main.c | 4 ++++ core/wma/src/wma_scan_roam.c | 6 ++++++ 5 files changed, 28 insertions(+) diff --git a/components/pmo/core/src/wlan_pmo_wow.c b/components/pmo/core/src/wlan_pmo_wow.c index 9564b064094f..51cfffef4bff 100644 --- a/components/pmo/core/src/wlan_pmo_wow.c +++ b/components/pmo/core/src/wlan_pmo_wow.c @@ -425,6 +425,13 @@ void pmo_set_sta_wow_bitmask(uint32_t *bitmask, uint32_t wow_bitmap_size) pmo_set_wow_event_bitmap(WOW_NLO_SCAN_COMPLETE_EVENT, wow_bitmap_size, bitmask); + /* + * WPA3 roaming offloads SAE authentication to wpa_supplicant + * Firmware will send WMI_ROAM_PREAUTH_STATUS_CMDID + */ + pmo_set_wow_event_bitmap(WOW_ROAM_PREAUTH_START_EVENT, + wow_bitmap_size, + bitmask); } void pmo_set_sap_wow_bitmask(uint32_t *bitmask, uint32_t wow_bitmap_size) diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index a58422f50d94..07f0d4fbf5fb 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -225,6 +225,8 @@ #define WMA_DEAUTH_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED #define WMA_DISASSOC_RECV_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED #define WMA_ROAM_HO_WAKE_LOCK_DURATION (500) /* in msec */ +#define WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION (2 * 1000) + #ifdef FEATURE_WLAN_AUTO_SHUTDOWN #define WMA_AUTO_SHUTDOWN_WAKE_LOCK_DURATION WAKELOCK_DURATION_RECOMMENDED #endif @@ -1060,6 +1062,7 @@ typedef struct { qdf_wake_lock_t wow_ap_assoc_lost_wl; qdf_wake_lock_t wow_auto_shutdown_wl; qdf_wake_lock_t roam_ho_wl; + qdf_wake_lock_t roam_preauth_wl; int wow_nack; qdf_atomic_t is_wow_bus_suspended; bool suitable_ap_hb_failure; diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index 53203ddac6e2..a20a15b29438 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -1395,6 +1395,8 @@ static const uint8_t *wma_wow_wake_reason_str(A_INT32 wake_reason) return "IOAC_TIMER_EVENT"; case WOW_REASON_ROAM_HO: return "ROAM_HO"; + case WOW_REASON_ROAM_PREAUTH_START: + return "ROAM_PREAUTH_START_EVENT"; case WOW_REASON_DFS_PHYERR_RADADR_EVENT: return "DFS_PHYERR_RADADR_EVENT"; case WOW_REASON_BEACON_RECV: @@ -1668,6 +1670,9 @@ static int wow_get_wmi_eventid(int32_t reason, uint32_t tag) case WOW_REASON_11D_SCAN: event_id = WMI_11D_NEW_COUNTRY_EVENTID; break; + case WOW_ROAM_PREAUTH_START_EVENT: + event_id = WMI_ROAM_PREAUTH_STATUS_CMDID; + break; default: WMA_LOGD(FL("No Event Id for WOW reason %s(%d)"), wma_wow_wake_reason_str(reason), reason); @@ -2244,6 +2249,9 @@ static void wma_acquire_wow_wakelock(t_wma_handle *wma, int wake_reason) wl = &wma->roam_ho_wl; ms = WMA_ROAM_HO_WAKE_LOCK_DURATION; break; + case WOW_REASON_ROAM_PREAUTH_START: + wl = &wma->roam_preauth_wl; + ms = WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION; default: return; } diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index ecbd62237dac..79dc9c335e41 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -3176,6 +3176,8 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, "wlan_auto_shutdown_wl"); qdf_wake_lock_create(&wma_handle->roam_ho_wl, "wlan_roam_ho_wl"); + qdf_wake_lock_create(&wma_handle->roam_preauth_wl, + "wlan_roam_preauth_wl"); } qdf_status = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_LEGACY_WMA_ID); @@ -3679,6 +3681,7 @@ err_get_psoc_ref: qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); + qdf_wake_lock_destroy(&wma_handle->roam_preauth_wl); } err_free_wma_handle: cds_free_context(QDF_MODULE_ID_WMA, wma_handle); @@ -4703,6 +4706,7 @@ QDF_STATUS wma_close(void) qdf_wake_lock_destroy(&wma_handle->wow_ap_assoc_lost_wl); qdf_wake_lock_destroy(&wma_handle->wow_auto_shutdown_wl); qdf_wake_lock_destroy(&wma_handle->roam_ho_wl); + qdf_wake_lock_destroy(&wma_handle->roam_preauth_wl); } /* unregister Firmware debug log */ diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 4bb7ea60a03c..700f43f78ef4 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -3242,6 +3242,12 @@ int wma_roam_auth_offload_event_handler(WMA_HANDLE handle, uint8_t *event, return -EINVAL; } + cds_host_diag_log_work(&wma->roam_preauth_wl, + WMA_ROAM_PREAUTH_WAKE_LOCK_DURATION, + WIFI_POWER_EVENT_WAKELOCK_WOW); + qdf_wake_lock_timeout_acquire(&wma->roam_ho_wl, + WMA_ROAM_HO_WAKE_LOCK_DURATION); + WMI_MAC_ADDR_TO_CHAR_ARRAY(&rso_auth_start_ev->candidate_ap_bssid, ap_bssid.bytes); if (qdf_is_macaddr_zero(&ap_bssid) ||