diff options
| author | Ravi Joshi <ravij@qca.qualcomm.com> | 2014-05-14 19:54:15 -0700 |
|---|---|---|
| committer | Pitani Venkata Rajesh Kumar <c_vpitan@qti.qualcomm.com> | 2014-05-20 19:38:24 +0530 |
| commit | b19e91ae122a549418347b04d72b2d16de641585 (patch) | |
| tree | 50e34854f6abc4a7df9d99ae7244e8a935368292 | |
| parent | 0b45bc3639639089ba1d3da5161ee1fbc1c029e2 (diff) | |
qcacld-new: Providing fix for global PMKIdCache in HDD (STA + STA)
PMKIdCache and PMKIdCacheIndex are currently global in HDD.
This will create issues while supporting STA + STA concurrency.
Moving the PMKIdCache and PMKIdIndex inside pAdapter.
Change-Id: I9d1c7fa323841a65de76860834eb3e044b034e3d
CRs-Fixed: 663707
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 8 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 94 |
2 files changed, 57 insertions, 45 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index 395c3caf0d00..ad9c539b55c0 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -305,6 +305,9 @@ extern spinlock_t hdd_context_lock; #define WLAN_HDD_TX_FLOW_CONTROL_MAX_24BAND_CH 14 #endif /* QCA_LL_TX_FLOW_CT */ +/* Max PMKSAIDS available in cache */ +#define MAX_PMKSAIDS_IN_CACHE 8 + typedef struct hdd_tx_rx_stats_s { // start_xmit stats @@ -680,6 +683,10 @@ struct hdd_station_ctx /*Save the wep/wpa-none keys*/ tCsrRoamSetKey ibss_enc_key; v_BOOL_t hdd_ReassocScenario; + + /* PMKID Cache */ + tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; + tANI_U32 PMKIDCacheIndex; }; #define BSS_STOP 0 @@ -882,6 +889,7 @@ typedef enum #define WLAN_HDD_ADAPTER_MAGIC 0x574c414e //ASCII "WLAN" + struct hdd_adapter_s { void *pHddCtx; diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index 808a08c5a31b..bd6d7cdc9129 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -8605,17 +8605,12 @@ static int wlan_hdd_cfg80211_add_station(struct wiphy *wiphy, #ifdef FEATURE_WLAN_LFR -#define MAX_PMKSAIDS_IN_CACHE 8 - -static tPmkidCacheInfo PMKIDCache[MAX_PMKSAIDS_IN_CACHE]; // HDD local cache -static tANI_U32 PMKIDCacheIndex; // HDD local Cache index - - static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *dev, struct cfg80211_pmksa *pmksa) { tANI_U32 j=0; hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_station_ctx_t *pHddStaCtx; tHalHandle halHandle; eHalStatus result = eHAL_STATUS_SUCCESS; int status; @@ -8644,17 +8639,18 @@ static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *d // Retrieve halHandle halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); + pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); - for (j = 0; j < PMKIDCacheIndex; j++) + for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) { - if(vos_mem_compare(PMKIDCache[j].BSSID, + if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, pmksa->bssid, VOS_MAC_ADDR_SIZE)) { /* BSSID matched previous entry. Overwrite it. */ BSSIDMatched = 1; - vos_mem_copy(PMKIDCache[j].BSSID, + vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, pmksa->bssid, VOS_MAC_ADDR_SIZE); - vos_mem_copy(PMKIDCache[j].PMKID, + vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Reusing cache entry %d.", @@ -8666,35 +8662,37 @@ static int wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, struct net_device *d } /* Check we compared all entries,if then take the first slot now */ - if(j == MAX_PMKSAIDS_IN_CACHE) PMKIDCacheIndex=0; + if (j == MAX_PMKSAIDS_IN_CACHE) pHddStaCtx->PMKIDCacheIndex=0; if (!BSSIDMatched) { // Now, we DON'T have a BSSID match, so take a new entry in the cache. - vos_mem_copy(PMKIDCache[PMKIDCacheIndex].BSSID, + vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].BSSID, pmksa->bssid, ETHER_ADDR_LEN); - vos_mem_copy(PMKIDCache[PMKIDCacheIndex].PMKID, + vos_mem_copy(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex].PMKID, pmksa->pmkid, CSR_RSN_PMKID_SIZE); - hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Adding a new cache entry %d.", - __func__, PMKIDCacheIndex ); + hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Adding a new cache entry %d.", + __func__, pHddStaCtx->PMKIDCacheIndex ); dump_bssid(pmksa->bssid); dump_pmkid(halHandle, pmksa->pmkid); // Increment the HDD Local Cache index // The "i=0" doesn't work for the call to sme_RoamSetPMKIDCache() - LFR FIXME - if (PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) PMKIDCacheIndex++; else PMKIDCacheIndex = 0; + if (pHddStaCtx->PMKIDCacheIndex <= (MAX_PMKSAIDS_IN_CACHE-1)) + pHddStaCtx->PMKIDCacheIndex++; + else + pHddStaCtx->PMKIDCacheIndex = 0; } // Calling csrRoamSetPMKIDCache to configure the PMKIDs into the cache - //hddLog(LOG1, FL("%s: Calling csrRoamSetPMKIDCache with %d cache entries."), - // __func__, i ); - hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", - __func__, PMKIDCacheIndex ); + hddLog(VOS_TRACE_LEVEL_DEBUG, "%s: Calling csrRoamSetPMKIDCache with %d cache entries.", + __func__, pHddStaCtx->PMKIDCacheIndex ); + // Finally set the PMKSA ID Cache in CSR result = sme_RoamSetPMKIDCache(halHandle,pAdapter->sessionId, - PMKIDCache, - PMKIDCacheIndex); + pHddStaCtx->PMKIDCache, + pHddStaCtx->PMKIDCacheIndex); MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_SET_PMKSA, pAdapter->sessionId, result)); @@ -8708,6 +8706,7 @@ static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *d { tANI_U32 j=0; hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_station_ctx_t *pHddStaCtx; tHalHandle halHandle; tANI_U8 BSSIDMatched = 0; hdd_context_t *pHddCtx; @@ -8735,50 +8734,53 @@ static int wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, struct net_device *d /*Retrieve halHandle*/ halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); + pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); /*in case index is 0,no entry to delete*/ - if (0 == PMKIDCacheIndex) + if (0 == pHddStaCtx->PMKIDCacheIndex) { - hddLog(VOS_TRACE_LEVEL_ERROR, FL("No entries to flush")); - return -EINVAL; + hddLog(VOS_TRACE_LEVEL_INFO, FL("No entries to flush")); + return 0; } /*find the matching PMKSA entry from j=0 to (index-1), * and delete the matched one */ - for (j = 0; j<PMKIDCacheIndex; j++) + for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) { - if (vos_mem_compare(PMKIDCache[j].BSSID, + if (vos_mem_compare(pHddStaCtx->PMKIDCache[j].BSSID, pmksa->bssid, VOS_MAC_ADDR_SIZE)) { /* BSSID matched entry */ BSSIDMatched = 1; - if (j<PMKIDCacheIndex-1) + if (j < pHddStaCtx->PMKIDCacheIndex-1) { /*replace the matching entry with the last entry in HDD local cache*/ - vos_mem_copy(PMKIDCache[j].BSSID, - PMKIDCache[PMKIDCacheIndex-1].BSSID, - VOS_MAC_ADDR_SIZE); - vos_mem_copy(PMKIDCache[j].PMKID, - PMKIDCache[PMKIDCacheIndex-1].PMKID, - CSR_RSN_PMKID_SIZE); + vos_mem_copy(pHddStaCtx->PMKIDCache[j].BSSID, + pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, + VOS_MAC_ADDR_SIZE); + vos_mem_copy(pHddStaCtx->PMKIDCache[j].PMKID, + pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, + CSR_RSN_PMKID_SIZE); } /*clear the last entry in HDD cache ---[index-1]*/ - vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].BSSID, VOS_MAC_ADDR_SIZE); - vos_mem_zero(PMKIDCache[PMKIDCacheIndex-1].PMKID, CSR_RSN_PMKID_SIZE); + vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].BSSID, + VOS_MAC_ADDR_SIZE); + vos_mem_zero(pHddStaCtx->PMKIDCache[pHddStaCtx->PMKIDCacheIndex-1].PMKID, + CSR_RSN_PMKID_SIZE); /*reduce the PMKID array index*/ - PMKIDCacheIndex--; + pHddStaCtx->PMKIDCacheIndex--; /*delete the last PMKID cache in CSR*/ if (eHAL_STATUS_SUCCESS != sme_RoamDelPMKIDfromCache(halHandle, pAdapter->sessionId, pmksa->bssid)) { hddLog(VOS_TRACE_LEVEL_ERROR,"%s: cannot delete PMKSA %d CONTENT.", - __func__,PMKIDCacheIndex); + __func__, pHddStaCtx->PMKIDCacheIndex); status = -EINVAL; } @@ -8808,6 +8810,7 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device { tANI_U32 j=0; hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev); + hdd_station_ctx_t *pHddStaCtx; tHalHandle halHandle; hdd_context_t *pHddCtx; tANI_U8 *pBSSId; @@ -8835,19 +8838,20 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device /*Retrieve halHandle*/ halHandle = WLAN_HDD_GET_HAL_CTX(pAdapter); + pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); /*in case index is 0,no entry to delete*/ - if (0 == PMKIDCacheIndex) + if (0 == pHddStaCtx->PMKIDCacheIndex) { hddLog(VOS_TRACE_LEVEL_INFO, "%s: No entries to flush" , __func__); - return -EINVAL; + return 0; } /*delete all the PMKSA one by one */ - for (j = 0; j<PMKIDCacheIndex; j++) + for (j = 0; j < pHddStaCtx->PMKIDCacheIndex; j++) { - pBSSId =(tANI_U8 *)(PMKIDCache[j].BSSID); + pBSSId =(tANI_U8 *)(pHddStaCtx->PMKIDCache[j].BSSID); /*delete the PMKID in CSR*/ if (eHAL_STATUS_SUCCESS != @@ -8858,11 +8862,11 @@ static int wlan_hdd_cfg80211_flush_pmksa(struct wiphy *wiphy, struct net_device status = -EINVAL; } /*clear the entry in HDD cache 0--index-1 */ - vos_mem_zero(PMKIDCache[j].BSSID, VOS_MAC_ADDR_SIZE); - vos_mem_zero(PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); + vos_mem_zero(pHddStaCtx->PMKIDCache[j].BSSID, VOS_MAC_ADDR_SIZE); + vos_mem_zero(pHddStaCtx->PMKIDCache[j].PMKID, CSR_RSN_PMKID_SIZE); } - PMKIDCacheIndex = 0; + pHddStaCtx->PMKIDCacheIndex = 0; return status; } |
