diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index f65ce0cd1017..b90c8466a308 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -20848,13 +20848,15 @@ static inline bool wlan_hdd_is_pmksa_valid(struct cfg80211_pmksa *pmksa) /* * hdd_fill_pmksa_info: API to update tPmkidCacheInfo from cfg80211_pmksa - * @pmk_cache: pmksa from supplicant - * @pmk_cache: pmk needs to be updated - * + * @adapter: Pointer to hdd adapter + * @pmk_cache: pmk that needs to be udated + * @pmksa: pmk from supplicant + * @is_delete: Bool to decide set or delete PMK * Return: None */ -static void hdd_fill_pmksa_info(tPmkidCacheInfo *pmk_cache, - struct cfg80211_pmksa *pmksa, bool is_delete) +static void hdd_fill_pmksa_info(struct hdd_adapter *adapter, + tPmkidCacheInfo *pmk_cache, + struct cfg80211_pmksa *pmksa, bool is_delete) { if (pmksa->bssid) { hdd_debug("%s PMKSA for " MAC_ADDRESS_STR, @@ -20902,14 +20904,18 @@ static inline bool wlan_hdd_is_pmksa_valid(struct cfg80211_pmksa *pmksa) /* * hdd_fill_pmksa_info: API to update tPmkidCacheInfo from cfg80211_pmksa - * @pmk_cache: pmksa from supplicant - * @pmk_cache: pmk needs to be updated + * @adapter: Pointer to hdd adapter + * @pmk_cache: pmk which needs to be updated + * @pmksa: pmk from supplicant + * @is_delete: Bool to decide whether to set or delete PMK * * Return: None */ -static void hdd_fill_pmksa_info(tPmkidCacheInfo *pmk_cache, - struct cfg80211_pmksa *pmksa, bool is_delete) +static void hdd_fill_pmksa_info(struct hdd_adapter *adapter, + tPmkidCacheInfo *pmk_cache, + struct cfg80211_pmksa *pmksa, bool is_delete) { + tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter); hdd_debug("%s PMKSA for " MAC_ADDRESS_STR, is_delete ? "Delete" : "Set", MAC_ADDR_ARRAY(pmksa->bssid)); qdf_mem_copy(pmk_cache->BSSID.bytes, @@ -20917,7 +20923,7 @@ static void hdd_fill_pmksa_info(tPmkidCacheInfo *pmk_cache, if (is_delete) return; - + sme_get_pmk_info(hal, adapter->session_id, pmk_cache); qdf_mem_copy(pmk_cache->PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); } #endif @@ -20976,7 +20982,7 @@ static int __wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, qdf_mem_zero(&pmk_cache, sizeof(pmk_cache)); - hdd_fill_pmksa_info(&pmk_cache, pmksa, false); + hdd_fill_pmksa_info(adapter, &pmk_cache, pmksa, false); /* * Add to the PMKSA Cache in CSR @@ -21071,7 +21077,7 @@ static int __wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, qdf_mem_zero(&pmk_cache, sizeof(pmk_cache)); - hdd_fill_pmksa_info(&pmk_cache, pmksa, true); + hdd_fill_pmksa_info(adapter, &pmk_cache, pmksa, true); /* Delete the PMKID CSR cache */ if (QDF_STATUS_SUCCESS != diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index b0e307296f1a..9b1a49721bbf 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -401,6 +401,18 @@ QDF_STATUS sme_roam_set_pmkid_cache(tHalHandle hHal, uint8_t sessionId, tPmkidCacheInfo *pPMKIDCache, uint32_t numItems, bool update_entire_cache); + +/** + * sme_get_pmk_info(): A wrapper function to request CSR to save PMK + * @hal: Global structure + * @session_id: SME session_id + * @pmk_cache: pointer to a structure of pmk + * + * Return: none + */ +void sme_get_pmk_info(tHalHandle hal, uint8_t session_id, + tPmkidCacheInfo *pmk_cache); + #ifdef WLAN_FEATURE_ROAM_OFFLOAD QDF_STATUS sme_roam_set_psk_pmk(tHalHandle hHal, uint8_t sessionId, uint8_t *pPSK_PMK, size_t pmk_len); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index c62efa342476..f617e79ea481 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -3605,6 +3605,18 @@ QDF_STATUS sme_roam_del_pmkid_from_cache(tHalHandle hHal, uint8_t sessionId, return status; } +void sme_get_pmk_info(tHalHandle hal, uint8_t session_id, + tPmkidCacheInfo *pmk_cache) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + QDF_STATUS status = sme_acquire_global_lock(&mac_ctx->sme); + + if (QDF_IS_STATUS_SUCCESS(status)) { + if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) + csr_get_pmk_info(mac_ctx, session_id, pmk_cache); + sme_release_global_lock(&mac_ctx->sme); + } +} #ifdef WLAN_FEATURE_ROAM_OFFLOAD /* * \fn sme_roam_set_psk_pmk diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index 1000941e8d39..d69aa247715e 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -14468,6 +14468,24 @@ static void csr_roam_update_connected_profile_from_new_bss(tpAniSirGlobal pMac, } } +void csr_get_pmk_info(tpAniSirGlobal mac_ctx, uint8_t session_id, + tPmkidCacheInfo *pmk_cache) +{ + struct csr_roam_session *session = NULL; + + if (!mac_ctx) { + sme_err("Mac_ctx is NULL"); + return; + } + session = CSR_GET_SESSION(mac_ctx, session_id); + if (!session) { + sme_err("session %d not found", session_id); + return; + } + qdf_mem_copy(pmk_cache->pmk, session->psk_pmk, + sizeof(session->psk_pmk)); + pmk_cache->pmk_len = session->pmk_len; +} #ifdef WLAN_FEATURE_ROAM_OFFLOAD QDF_STATUS csr_roam_set_psk_pmk(tpAniSirGlobal pMac, uint32_t sessionId, uint8_t *pPSK_PMK, size_t pmk_len) diff --git a/core/sme/src/csr/csr_inside_api.h b/core/sme/src/csr/csr_inside_api.h index ba54fa0ce346..34ed4c392352 100644 --- a/core/sme/src/csr/csr_inside_api.h +++ b/core/sme/src/csr/csr_inside_api.h @@ -741,6 +741,20 @@ QDF_STATUS csr_roam_set_pmkid_cache(tpAniSirGlobal pMac, uint32_t sessionId, tPmkidCacheInfo *pPMKIDCache, uint32_t numItems, bool update_entire_cache); +/* + * csr_get_pmk_info(): store PMK in pmk_cache + * @mac_ctx: pointer to global structure for MAC + * @session_id: Sme session id + * @pmk_cache: pointer to a structure of Pmk + * + * This API gets the PMK from the session and + * stores it in the pmk_cache + * + * Return: none + */ +void csr_get_pmk_info(tpAniSirGlobal mac_ctx, uint8_t session_id, + tPmkidCacheInfo *pmk_cache); + #ifdef WLAN_FEATURE_ROAM_OFFLOAD /* * csr_roam_set_psk_pmk() -