diff options
| author | Ryan Hsu <ryanhsu@qca.qualcomm.com> | 2015-01-30 17:36:12 -0800 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2015-02-05 17:08:51 +0530 |
| commit | a9817e018b4e8865f8a39220d38081975142a0bf (patch) | |
| tree | 76149e73de0f2365fa3d35d25077f6be485f6422 | |
| parent | 74c0b152de8a5679a8632ed1805e78d4875091ee (diff) | |
qcacld: hdd: update the apies before restart the sap
When wlan_hdd_restart_sap() happens, the vdev and pSession will
be flushed, so that some AP (WPS/OBSS) IES will be flushed.
So applied all the AP IES before restarting the SAP.
Change-Id: I7380278b449be43869b4fe72497c829e313e2fbb
CRs-fixed: 789486
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_cfg80211.h | 2 | ||||
| -rw-r--r-- | CORE/HDD/inc/wlan_hdd_main.h | 11 | ||||
| -rw-r--r-- | CORE/HDD/src/wlan_hdd_cfg80211.c | 106 | ||||
| -rwxr-xr-x | CORE/HDD/src/wlan_hdd_main.c | 26 |
4 files changed, 93 insertions, 52 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h index 184a1d80d310..db3cb2a41872 100644 --- a/CORE/HDD/inc/wlan_hdd_cfg80211.h +++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h @@ -1129,4 +1129,6 @@ static inline int wlan_hdd_send_roam_auth_event(hdd_context_t *hdd_ctx_ptr, int wlan_hdd_disable_dfs_chan_scan(hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter, u32 no_dfs_flag); + +int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter); #endif diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h index a3b03a816729..e66924487825 100644 --- a/CORE/HDD/inc/wlan_hdd_main.h +++ b/CORE/HDD/inc/wlan_hdd_main.h @@ -513,8 +513,14 @@ typedef struct hdd_wapi_info_s hdd_wapi_info_t; #endif /* FEATURE_WLAN_WAPI */ typedef struct beacon_data_s { - u8 *head, *tail; - int head_len, tail_len; + u8 *head; + u8 *tail; + u8 *proberesp_ies; + u8 *assocresp_ies; + int head_len; + int tail_len; + int proberesp_ies_len; + int assocresp_ies_len; int dtim_period; } beacon_data_t; @@ -1762,4 +1768,5 @@ int hdd_wlan_set_mcc_p2p_quota(hdd_adapter_t *hostapd_adapter, uint32_t set_value); int hdd_set_mas(hdd_adapter_t *hostapd_adapter, uint8_t filter_type); uint8_t hdd_is_mcc_in_24G(hdd_context_t *hdd_ctx); + #endif // end #if !defined( WLAN_HDD_MAIN_H ) diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c index df29d8d9e204..a2e1f4f6410a 100644 --- a/CORE/HDD/src/wlan_hdd_cfg80211.c +++ b/CORE/HDD/src/wlan_hdd_cfg80211.c @@ -5878,7 +5878,8 @@ int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, int size; beacon_data_t *beacon = NULL; beacon_data_t *old = NULL; - int head_len,tail_len; + int head_len, tail_len, proberesp_ies_len, assocresp_ies_len; + const u8 *head, *tail, *proberesp_ies, *assocresp_ies; ENTER(); if (params->head && !params->head_len) @@ -5898,59 +5899,79 @@ int wlan_hdd_cfg80211_alloc_new_beacon(hdd_adapter_t *pAdapter, return -EINVAL; } - if(params->head) + if (params->head) { head_len = params->head_len; - else + head = params->head; + } else { head_len = old->head_len; + head = old->head; + } - if(params->tail || !old) + if (params->tail || !old) { tail_len = params->tail_len; - else + tail = params->tail; + } else { tail_len = old->tail_len; + tail = old->tail; + } + + if (params->proberesp_ies || !old) { + proberesp_ies_len = params->proberesp_ies_len; + proberesp_ies = params->proberesp_ies; + } else { + proberesp_ies_len = old->proberesp_ies_len; + proberesp_ies = old->proberesp_ies; + } - size = sizeof(beacon_data_t) + head_len + tail_len; + if (params->assocresp_ies || !old) { + assocresp_ies_len = params->assocresp_ies_len; + assocresp_ies = params->assocresp_ies; + } else { + assocresp_ies_len = old->assocresp_ies_len; + assocresp_ies = old->assocresp_ies; + } + + size = sizeof(beacon_data_t) + head_len + tail_len + + proberesp_ies_len + assocresp_ies_len; beacon = kzalloc(size, GFP_KERNEL); - if( beacon == NULL ) - { + if (beacon == NULL) { VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("Mem allocation for beacon failed")); return -ENOMEM; } #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(WITH_BACKPORTS) - if(params->dtim_period || !old ) + if (params->dtim_period) beacon->dtim_period = params->dtim_period; else beacon->dtim_period = old->dtim_period; #else - if(dtim_period || !old ) + if (dtim_period) beacon->dtim_period = dtim_period; else beacon->dtim_period = old->dtim_period; #endif - beacon->head = ((u8 *) beacon) + sizeof(beacon_data_t); + /* ----------------------------------------------- + * | head | tail | proberesp_ies | assocresp_ies | + * ----------------------------------------------- + */ + beacon->head = ((u8 *)beacon) + sizeof(beacon_data_t); beacon->tail = beacon->head + head_len; + beacon->proberesp_ies = beacon->tail + tail_len; + beacon->assocresp_ies = beacon->proberesp_ies + proberesp_ies_len; + beacon->head_len = head_len; beacon->tail_len = tail_len; + beacon->proberesp_ies_len = proberesp_ies_len; + beacon->assocresp_ies_len= assocresp_ies_len; - if(params->head) { - memcpy (beacon->head,params->head,beacon->head_len); - } - else { - if(old) - memcpy (beacon->head,old->head,beacon->head_len); - } - - if(params->tail) { - memcpy (beacon->tail,params->tail,beacon->tail_len); - } - else { - if(old) - memcpy (beacon->tail,old->tail,beacon->tail_len); - } + memcpy(beacon->head, head, head_len); + memcpy(beacon->tail, tail, tail_len); + memcpy(beacon->proberesp_ies, proberesp_ies, proberesp_ies_len); + memcpy(beacon->assocresp_ies, assocresp_ies, assocresp_ies_len); *ppBeacon = beacon; @@ -6215,21 +6236,17 @@ static void wlan_hdd_add_extra_ie(hdd_adapter_t* pHostapdAdapter, return; } -#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0)) && !defined(WITH_BACKPORTS) -static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, - struct beacon_parameters *params) -#else -static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, - struct cfg80211_beacon_data *params) -#endif +int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter) { v_U8_t *genie; v_U8_t total_ielen = 0; int ret = 0; tsap_Config_t *pConfig; tSirUpdateIE updateIE; + beacon_data_t *pBeacon = NULL; pConfig = &pHostapdAdapter->sessionCtx.ap.sapConfig; + pBeacon = pHostapdAdapter->sessionCtx.ap.beacon; genie = vos_mem_malloc(MAX_GENIE_LEN); @@ -6314,8 +6331,8 @@ static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, /* Added for Probe Response IE */ if (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) { - updateIE.ieBufferlength = params->proberesp_ies_len; - updateIE.pAdditionIEBuffer = (tANI_U8*)params->proberesp_ies; + updateIE.ieBufferlength = pBeacon->proberesp_ies_len; + updateIE.pAdditionIEBuffer = (tANI_U8*)pBeacon->proberesp_ies; updateIE.append = VOS_FALSE; updateIE.notify = VOS_FALSE; if (sme_UpdateAddIE(WLAN_HDD_GET_HAL_CTX(pHostapdAdapter), @@ -6327,15 +6344,15 @@ static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, WLANSAP_ResetSapConfigAddIE(pConfig, eUPDATE_IE_PROBE_RESP); } else { WLANSAP_UpdateSapConfigAddIE(pConfig, - params->proberesp_ies, - params->proberesp_ies_len, + pBeacon->proberesp_ies, + pBeacon->proberesp_ies_len, eUPDATE_IE_PROBE_RESP); } /* Assoc resp Add ie Data */ if (test_bit(SOFTAP_BSS_STARTED, &pHostapdAdapter->event_flags)) { - updateIE.ieBufferlength = params->assocresp_ies_len; - updateIE.pAdditionIEBuffer = (tANI_U8*)params->assocresp_ies; + updateIE.ieBufferlength = pBeacon->assocresp_ies_len; + updateIE.pAdditionIEBuffer = (tANI_U8*)pBeacon->assocresp_ies; updateIE.append = VOS_FALSE; updateIE.notify = VOS_FALSE; if (sme_UpdateAddIE(WLAN_HDD_GET_HAL_CTX(pHostapdAdapter), @@ -6347,8 +6364,8 @@ static int wlan_hdd_cfg80211_update_apies(hdd_adapter_t* pHostapdAdapter, WLANSAP_ResetSapConfigAddIE(pConfig, eUPDATE_IE_ASSOC_RESP); } else { WLANSAP_UpdateSapConfigAddIE(pConfig, - params->assocresp_ies, - params->assocresp_ies_len, + pBeacon->assocresp_ies, + pBeacon->assocresp_ies_len, eUPDATE_IE_ASSOC_RESP); } @@ -7269,7 +7286,7 @@ static int wlan_hdd_cfg80211_start_bss(hdd_adapter_t *pHostapdAdapter, // ht_capab is not what the name conveys,this is used for protection bitmap pConfig->ht_capab = iniConfig->apProtection; - if ( 0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter, params) ) + if (0 != wlan_hdd_cfg80211_update_apies(pHostapdAdapter)) { hddLog(LOGE, FL("SAP Not able to set AP IEs")); WLANSAP_ResetSapConfigAddIE(pConfig, eUPDATE_IE_ALL); @@ -7694,7 +7711,7 @@ static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, MTRACE(vos_trace(VOS_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_START_AP, pAdapter->sessionId, - params-> beacon_interval)); + params->beacon_interval)); if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, @@ -7735,7 +7752,8 @@ static int wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, if (old) return -EALREADY; - status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, ¶ms->beacon, params->dtim_period); + status = wlan_hdd_cfg80211_alloc_new_beacon(pAdapter, &new, + ¶ms->beacon, params->dtim_period); if (status != 0) { diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c index 6d8e610c2b02..d79d23b30d30 100755 --- a/CORE/HDD/src/wlan_hdd_main.c +++ b/CORE/HDD/src/wlan_hdd_main.c @@ -963,8 +963,10 @@ static void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter) #ifdef CFG80211_DEL_STA_V2 struct station_del_parameters delStaParams; #endif + tsap_Config_t *pConfig; pHddApCtx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter); + pConfig = &ap_adapter->sessionCtx.ap.sapConfig; mutex_lock(&pHddCtx->sap_lock); if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) { @@ -1001,6 +1003,12 @@ static void wlan_hdd_restart_sap(hdd_adapter_t *ap_adapter) wlan_hdd_decr_active_session(pHddCtx, ap_adapter->device_mode); hddLog(LOGE, FL("SAP Stop Success")); + if (0 != wlan_hdd_cfg80211_update_apies(ap_adapter)) { + hddLog(LOGE, FL("SAP Not able to set AP IEs")); + WLANSAP_ResetSapConfigAddIE(pConfig, eUPDATE_IE_ALL); + goto end; + } + if (WLANSAP_StartBss( #ifdef WLAN_FEATURE_MBSSID pHddApCtx->sapContext, @@ -15053,6 +15061,7 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) hdd_hostapd_state_t *hostapd_state; VOS_STATUS vos_status; hdd_context_t *hdd_ctx; + tsap_Config_t *pConfig; if (NULL == ap_adapter) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, @@ -15063,6 +15072,7 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) hdd_ctx = WLAN_HDD_GET_CTX(ap_adapter); hdd_ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(ap_adapter); hostapd_state = WLAN_HDD_GET_HOSTAP_STATE_PTR(ap_adapter); + pConfig = &ap_adapter->sessionCtx.ap.sapConfig; if (0 != wlan_hdd_validate_context(hdd_ctx)) { @@ -15071,15 +15081,19 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) return; } mutex_lock(&hdd_ctx->sap_lock); - if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) { - return; + if (test_bit(SOFTAP_BSS_STARTED, &ap_adapter->event_flags)) + goto end; + + if (0 != wlan_hdd_cfg80211_update_apies(ap_adapter)) { + hddLog(LOGE, FL("SAP Not able to set AP IEs")); + WLANSAP_ResetSapConfigAddIE(pConfig, eUPDATE_IE_ALL); + goto end; } if (WLANSAP_StartBss(hdd_ap_ctx->sapContext, hdd_hostapd_SAPEventCB, &hdd_ap_ctx->sapConfig, (v_PVOID_t)ap_adapter->dev) != VOS_STATUS_SUCCESS) { - mutex_unlock(&hdd_ctx->sap_lock); - return; + goto end; } VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, @@ -15088,8 +15102,7 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) if (!VOS_IS_STATUS_SUCCESS(vos_status)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR, FL("SAP Start failed")); - mutex_unlock(&hdd_ctx->sap_lock); - return; + goto end; } VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO_HIGH, FL("SAP Start Success")); @@ -15097,6 +15110,7 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter) wlan_hdd_incr_active_session(hdd_ctx, ap_adapter->device_mode); hostapd_state->bCommit = TRUE; +end: mutex_unlock(&hdd_ctx->sap_lock); return; } |
