Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 2 | * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 22 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * This file limProcessMlmMessages.cc contains the code |
| 30 | * for processing MLM request messages. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/12/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | * |
| 37 | */ |
| 38 | #include "palTypes.h" |
Satyanarayana Dash | 6f43827 | 2015-03-03 18:01:06 +0530 | [diff] [blame] | 39 | #include "wniCfg.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 40 | #include "aniGlobal.h" |
| 41 | #include "sirApi.h" |
| 42 | #include "sirParams.h" |
| 43 | #include "cfgApi.h" |
| 44 | |
| 45 | #include "schApi.h" |
| 46 | #include "utilsApi.h" |
| 47 | #include "limUtils.h" |
| 48 | #include "limAssocUtils.h" |
| 49 | #include "limPropExtsUtils.h" |
| 50 | #include "limSecurityUtils.h" |
| 51 | #include "limSendMessages.h" |
| 52 | #include "pmmApi.h" |
| 53 | #include "limSendMessages.h" |
| 54 | //#include "limSessionUtils.h" |
| 55 | #include "limSessionUtils.h" |
| 56 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 57 | #include <limFT.h> |
| 58 | #endif |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 59 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 60 | #include "vos_diag_core_log.h" |
| 61 | #endif |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 62 | #ifdef WLAN_FEATURE_LFR_MBB |
| 63 | #include "lim_mbb.h" |
| 64 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 65 | |
| 66 | |
| 67 | // MLM REQ processing function templates |
| 68 | static void limProcessMlmStartReq(tpAniSirGlobal, tANI_U32 *); |
| 69 | static void limProcessMlmScanReq(tpAniSirGlobal, tANI_U32 *); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 70 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 71 | static void limProcessMlmOemDataReq(tpAniSirGlobal, tANI_U32 *); |
| 72 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | static void limProcessMlmJoinReq(tpAniSirGlobal, tANI_U32 *); |
| 74 | static void limProcessMlmAuthReq(tpAniSirGlobal, tANI_U32 *); |
| 75 | static void limProcessMlmAssocReq(tpAniSirGlobal, tANI_U32 *); |
| 76 | static void limProcessMlmReassocReq(tpAniSirGlobal, tANI_U32 *); |
| 77 | static void limProcessMlmDisassocReq(tpAniSirGlobal, tANI_U32 *); |
| 78 | static void limProcessMlmDeauthReq(tpAniSirGlobal, tANI_U32 *); |
| 79 | static void limProcessMlmSetKeysReq(tpAniSirGlobal, tANI_U32 *); |
| 80 | |
| 81 | static void limProcessMlmAddBAReq( tpAniSirGlobal, tANI_U32 * ); |
| 82 | static void limProcessMlmAddBARsp( tpAniSirGlobal, tANI_U32 * ); |
| 83 | static void limProcessMlmDelBAReq( tpAniSirGlobal, tANI_U32 * ); |
| 84 | |
| 85 | // MLM Timeout event handler templates |
| 86 | static void limProcessMinChannelTimeout(tpAniSirGlobal); |
| 87 | static void limProcessMaxChannelTimeout(tpAniSirGlobal); |
| 88 | static void limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac); |
| 89 | static void limProcessJoinFailureTimeout(tpAniSirGlobal); |
| 90 | static void limProcessAuthFailureTimeout(tpAniSirGlobal); |
| 91 | static void limProcessAuthRspTimeout(tpAniSirGlobal, tANI_U32); |
| 92 | static void limProcessAssocFailureTimeout(tpAniSirGlobal, tANI_U32); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 93 | static void limProcessPeriodicJoinProbeReqTimer(tpAniSirGlobal); |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 94 | static void limProcessAuthRetryTimer(tpAniSirGlobal); |
| 95 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 96 | |
| 97 | static void limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 * pMsgBuf); |
| 98 | void |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 99 | limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 100 | #define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_AGGRESSIVE_BACKGROUND_SCAN) |
Madan Mohan Koyyalamudi | 9b87678 | 2012-10-11 16:22:51 -0700 | [diff] [blame] | 101 | #define IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac) (pMac->lim.gpLimMlmScanReq->backgroundScanMode == eSIR_NORMAL_BACKGROUND_SCAN) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | |
Abhinav Kumar | 626f865 | 2019-08-05 16:20:39 +0530 | [diff] [blame] | 103 | /** |
| 104 | * lim_process_sae_auth_timeout() - This function is called to process sae |
| 105 | * auth timeout |
| 106 | * @mac_ctx: Pointer to Global MAC structure |
| 107 | * |
| 108 | * @Return: None |
| 109 | */ |
| 110 | static void lim_process_sae_auth_timeout(tpAniSirGlobal mac_ctx) |
| 111 | { |
| 112 | tpPESession session; |
| 113 | |
| 114 | session = peFindSessionBySessionId(mac_ctx, |
| 115 | mac_ctx->lim.limTimers.sae_auth_timer.sessionId); |
| 116 | if (session == NULL) { |
| 117 | limLog(mac_ctx, LOGE, |
| 118 | FL("Session does not exist for given session id")); |
| 119 | return; |
| 120 | } |
| 121 | |
| 122 | limLog(mac_ctx, LOG1, |
| 123 | FL("SAE auth timeout sessionid %d mlmstate %X SmeState %X"), |
| 124 | session->peSessionId, session->limMlmState, session->limSmeState); |
| 125 | |
| 126 | switch (session->limMlmState) { |
| 127 | case eLIM_MLM_WT_SAE_AUTH_STATE: |
| 128 | /* |
| 129 | * SAE authentication is not completed. Restore from |
| 130 | * auth state. |
| 131 | */ |
| 132 | if (session->pePersona == VOS_STA_MODE) |
| 133 | limRestoreFromAuthState(mac_ctx, eSIR_SME_AUTH_TIMEOUT_RESULT_CODE, |
| 134 | eSIR_MAC_UNSPEC_FAILURE_REASON, session); |
| 135 | break; |
| 136 | default: |
| 137 | /* SAE authentication is timed out in unexpected state */ |
| 138 | limLog(mac_ctx, LOGE, |
| 139 | FL("received unexpected SAE auth timeout in state %X"), |
| 140 | session->limMlmState); |
| 141 | limPrintMlmState(mac_ctx, LOGE, session->limMlmState); |
| 142 | break; |
| 143 | } |
| 144 | } |
| 145 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 146 | /** |
| 147 | * limProcessMlmReqMessages() |
| 148 | * |
| 149 | *FUNCTION: |
| 150 | * This function is called by limPostMlmMessage(). This |
| 151 | * function handles MLM primitives invoked by SME. |
| 152 | * |
| 153 | *LOGIC: |
| 154 | * Depending on the message type, corresponding function will be |
| 155 | * called. |
| 156 | * |
| 157 | *ASSUMPTIONS: |
| 158 | * 1. Upon receiving Beacon in WT_JOIN_STATE, MLM module invokes |
| 159 | * APIs exposed by Beacon Processing module for setting parameters |
| 160 | * at MAC hardware. |
| 161 | * 2. If attempt to Reassociate with an AP fails, link with current |
| 162 | * AP is restored back. |
| 163 | * |
| 164 | *NOTE: |
| 165 | * |
| 166 | * @param pMac Pointer to Global MAC structure |
| 167 | * @param msgType Indicates the MLM primitive message type |
| 168 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 169 | * |
| 170 | * @return None |
| 171 | */ |
| 172 | |
| 173 | void |
| 174 | limProcessMlmReqMessages(tpAniSirGlobal pMac, tpSirMsgQ Msg) |
| 175 | { |
| 176 | switch (Msg->type) |
| 177 | { |
| 178 | case LIM_MLM_START_REQ: limProcessMlmStartReq(pMac, Msg->bodyptr); break; |
| 179 | case LIM_MLM_SCAN_REQ: limProcessMlmScanReq(pMac, Msg->bodyptr); break; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 180 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 181 | case LIM_MLM_OEM_DATA_REQ: limProcessMlmOemDataReq(pMac, Msg->bodyptr); break; |
| 182 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | case LIM_MLM_JOIN_REQ: limProcessMlmJoinReq(pMac, Msg->bodyptr); break; |
| 184 | case LIM_MLM_AUTH_REQ: limProcessMlmAuthReq(pMac, Msg->bodyptr); break; |
| 185 | case LIM_MLM_ASSOC_REQ: limProcessMlmAssocReq(pMac, Msg->bodyptr); break; |
| 186 | case LIM_MLM_REASSOC_REQ: limProcessMlmReassocReq(pMac, Msg->bodyptr); break; |
| 187 | case LIM_MLM_DISASSOC_REQ: limProcessMlmDisassocReq(pMac, Msg->bodyptr); break; |
| 188 | case LIM_MLM_DEAUTH_REQ: limProcessMlmDeauthReq(pMac, Msg->bodyptr); break; |
| 189 | case LIM_MLM_SETKEYS_REQ: limProcessMlmSetKeysReq(pMac, Msg->bodyptr); break; |
| 190 | case LIM_MLM_REMOVEKEY_REQ: limProcessMlmRemoveKeyReq(pMac, Msg->bodyptr); break; |
| 191 | case SIR_LIM_MIN_CHANNEL_TIMEOUT: limProcessMinChannelTimeout(pMac); break; |
| 192 | case SIR_LIM_MAX_CHANNEL_TIMEOUT: limProcessMaxChannelTimeout(pMac); break; |
| 193 | case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT: |
| 194 | limProcessPeriodicProbeReqTimer(pMac); break; |
| 195 | case SIR_LIM_JOIN_FAIL_TIMEOUT: limProcessJoinFailureTimeout(pMac); break; |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 196 | case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT: |
| 197 | limProcessPeriodicJoinProbeReqTimer(pMac); break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 198 | case SIR_LIM_AUTH_FAIL_TIMEOUT: limProcessAuthFailureTimeout(pMac); break; |
| 199 | case SIR_LIM_AUTH_RSP_TIMEOUT: limProcessAuthRspTimeout(pMac, Msg->bodyval); break; |
| 200 | case SIR_LIM_ASSOC_FAIL_TIMEOUT: limProcessAssocFailureTimeout(pMac, Msg->bodyval); break; |
| 201 | #ifdef WLAN_FEATURE_VOWIFI_11R |
| 202 | case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:limProcessFTPreauthRspTimeout(pMac); break; |
| 203 | #endif |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 204 | #ifdef WLAN_FEATURE_LFR_MBB |
| 205 | case SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT: |
| 206 | lim_process_preauth_mbb_rsp_timeout(pMac); |
| 207 | break; |
Padma, Santhosh Kumar | f4966dc | 2017-01-03 18:56:00 +0530 | [diff] [blame] | 208 | case SIR_LIM_REASSOC_MBB_RSP_TIMEOUT: |
| 209 | lim_process_reassoc_mbb_rsp_timeout(pMac); |
| 210 | break; |
Padma, Santhosh Kumar | 67f479b | 2016-12-28 15:43:42 +0530 | [diff] [blame] | 211 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 212 | case SIR_LIM_REMAIN_CHN_TIMEOUT: limProcessRemainOnChnTimeout(pMac); break; |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 213 | case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT: |
| 214 | limProcessInsertSingleShotNOATimeout(pMac); break; |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 215 | case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE: |
| 216 | limConvertActiveChannelToPassiveChannel(pMac); break; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 217 | case SIR_LIM_AUTH_RETRY_TIMEOUT: |
| 218 | limProcessAuthRetryTimer(pMac); |
| 219 | break; |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 220 | case SIR_LIM_DISASSOC_ACK_TIMEOUT: limProcessDisassocAckTimeout(pMac); break; |
| 221 | case SIR_LIM_DEAUTH_ACK_TIMEOUT: limProcessDeauthAckTimeout(pMac); break; |
Abhishek Singh | 550aa8c | 2017-10-30 17:34:53 +0530 | [diff] [blame] | 222 | case SIR_LIM_SAP_ECSA_TIMEOUT: lim_process_ap_ecsa_timeout(pMac);break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 223 | case LIM_MLM_ADDBA_REQ: limProcessMlmAddBAReq( pMac, Msg->bodyptr ); break; |
| 224 | case LIM_MLM_ADDBA_RSP: limProcessMlmAddBARsp( pMac, Msg->bodyptr ); break; |
| 225 | case LIM_MLM_DELBA_REQ: limProcessMlmDelBAReq( pMac, Msg->bodyptr ); break; |
Abhinav Kumar | 626f865 | 2019-08-05 16:20:39 +0530 | [diff] [blame] | 226 | case SIR_LIM_AUTH_SAE_TIMEOUT: |
| 227 | lim_process_sae_auth_timeout(pMac); |
| 228 | break; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 229 | case LIM_MLM_TSPEC_REQ: |
| 230 | default: |
| 231 | break; |
| 232 | } // switch (msgType) |
| 233 | } /*** end limProcessMlmReqMessages() ***/ |
| 234 | |
| 235 | |
| 236 | /** |
| 237 | * limSetScanMode() |
| 238 | * |
| 239 | *FUNCTION: |
| 240 | * This function is called to setup system into Scan mode |
| 241 | * |
| 242 | *LOGIC: |
| 243 | * NA |
| 244 | * |
| 245 | *ASSUMPTIONS: |
| 246 | * NA |
| 247 | * |
| 248 | *NOTE: |
| 249 | * |
| 250 | * @param pMac - Pointer to Global MAC structure |
| 251 | * @return None |
| 252 | */ |
| 253 | |
| 254 | void |
| 255 | limSetScanMode(tpAniSirGlobal pMac) |
| 256 | { |
| 257 | tSirLinkTrafficCheck checkTraffic; |
| 258 | |
| 259 | /// Set current scan channel id to the first in the channel list |
| 260 | pMac->lim.gLimCurrentScanChannelId = 0; |
| 261 | |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 262 | if ( IS_MLM_SCAN_REQ_BACKGROUND_SCAN_AGGRESSIVE(pMac) ) |
| 263 | { |
| 264 | checkTraffic = eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN; |
| 265 | } |
| 266 | else if (IS_MLM_SCAN_REQ_BACKGROUND_SCAN_NORMAL(pMac)) |
| 267 | { |
| 268 | checkTraffic = eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN; |
| 269 | } |
| 270 | else |
| 271 | checkTraffic = eSIR_CHECK_ROAMING_SCAN; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 272 | |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 273 | limLog(pMac, LOG1, FL("Calling limSendHalInitScanReq")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 274 | limSendHalInitScanReq(pMac, eLIM_HAL_INIT_SCAN_WAIT_STATE, checkTraffic); |
| 275 | |
| 276 | return ; |
| 277 | } /*** end limSetScanMode() ***/ |
| 278 | |
| 279 | //WLAN_SUSPEND_LINK Related |
| 280 | |
| 281 | /* limIsLinkSuspended() |
| 282 | * |
| 283 | *FUNCTION: |
| 284 | * This function returns is link is suspended or not. |
| 285 | * |
| 286 | *LOGIC: |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 287 | * Since Suspend link uses init scan, it just returns |
| 288 | * gLimSystemInScanLearnMode flag. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 289 | * |
| 290 | *ASSUMPTIONS: |
| 291 | * NA |
| 292 | * |
| 293 | *NOTE: |
| 294 | * |
| 295 | * @param pMac - Pointer to Global MAC structure |
| 296 | * @return None |
| 297 | */ |
| 298 | tANI_U8 |
| 299 | limIsLinkSuspended(tpAniSirGlobal pMac) |
| 300 | { |
| 301 | return pMac->lim.gLimSystemInScanLearnMode; |
| 302 | } |
| 303 | /** |
| 304 | * limSuspendLink() |
| 305 | * |
| 306 | *FUNCTION: |
| 307 | * This function is called to suspend traffic. Internally this function uses WDA_INIT_SCAN_REQ. |
| 308 | * |
| 309 | *LOGIC: |
| 310 | * NA |
| 311 | * |
| 312 | *ASSUMPTIONS: |
| 313 | * NA |
| 314 | * |
| 315 | *NOTE: |
| 316 | * |
| 317 | * @param pMac - Pointer to Global MAC structure |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 318 | * @param trafficCheck - Takes value from enum tSirLinkTrafficCheck. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 319 | * @param callback - Callback function to be called after suspending the link. |
| 320 | * @param data - Pointer to any buffer that will be passed to callback. |
| 321 | * @return None |
| 322 | */ |
| 323 | void |
| 324 | limSuspendLink(tpAniSirGlobal pMac, tSirLinkTrafficCheck trafficCheck, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data) |
| 325 | { |
| 326 | if( NULL == callback ) |
| 327 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 328 | limLog( pMac, LOGE, "%s:%d: Invalid parameters", __func__, __LINE__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 329 | return; |
| 330 | } |
| 331 | |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 332 | if( pMac->lim.gpLimSuspendCallback || |
| 333 | pMac->lim.gLimSystemInScanLearnMode ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 334 | { |
Jeff Johnson | 0fe596e | 2017-09-19 08:36:48 -0700 | [diff] [blame] | 335 | limLog( pMac, LOGE, FL("Something is wrong, SuspendLinkCbk:%pK " |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 336 | "IsSystemInScanLearnMode:%d"), pMac->lim.gpLimSuspendCallback, |
| 337 | pMac->lim.gLimSystemInScanLearnMode ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 338 | callback( pMac, eHAL_STATUS_FAILURE, data ); |
| 339 | return; |
| 340 | } |
| 341 | |
| 342 | pMac->lim.gLimSystemInScanLearnMode = 1; |
| 343 | pMac->lim.gpLimSuspendCallback = callback; |
| 344 | pMac->lim.gpLimSuspendData = data; |
| 345 | limSendHalInitScanReq(pMac, eLIM_HAL_SUSPEND_LINK_WAIT_STATE, trafficCheck ); |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 346 | |
| 347 | WDA_TrafficStatsTimerActivate(FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 348 | } |
| 349 | |
| 350 | /** |
| 351 | * limResumeLink() |
| 352 | * |
| 353 | *FUNCTION: |
| 354 | * This function is called to Resume traffic after a suspend. Internally this function uses WDA_FINISH_SCAN_REQ. |
| 355 | * |
| 356 | *LOGIC: |
| 357 | * NA |
| 358 | * |
| 359 | *ASSUMPTIONS: |
| 360 | * NA |
| 361 | * |
| 362 | *NOTE: |
| 363 | * |
| 364 | * @param pMac - Pointer to Global MAC structure |
| 365 | * @param callback - Callback function to be called after Resuming the link. |
| 366 | * @param data - Pointer to any buffer that will be passed to callback. |
| 367 | * @return None |
| 368 | */ |
| 369 | void |
| 370 | limResumeLink(tpAniSirGlobal pMac, SUSPEND_RESUME_LINK_CALLBACK callback, tANI_U32 *data) |
| 371 | { |
| 372 | if( NULL == callback ) |
| 373 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 374 | limLog( pMac, LOGE, "%s:%d: Invalid parameters", __func__, __LINE__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 375 | return; |
| 376 | } |
| 377 | |
| 378 | if( pMac->lim.gpLimResumeCallback ) |
| 379 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 380 | limLog( pMac, LOGE, "%s:%d: gLimResumeLink callback is not NULL...something is wrong", __func__, __LINE__ ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 381 | callback( pMac, eHAL_STATUS_FAILURE, data ); |
| 382 | return; |
| 383 | } |
| 384 | |
| 385 | pMac->lim.gpLimResumeCallback = callback; |
| 386 | pMac->lim.gpLimResumeData = data; |
Abhishek Singh | 53bfb33 | 2013-12-12 18:03:29 +0530 | [diff] [blame] | 387 | |
| 388 | /* eLIM_HAL_IDLE_SCAN_STATE state indicate limSendHalInitScanReq failed. |
| 389 | * In case limSendHalInitScanReq is success, Scanstate would be |
| 390 | * eLIM_HAL_SUSPEND_LINK_STATE |
| 391 | */ |
| 392 | if( eLIM_HAL_IDLE_SCAN_STATE != pMac->lim.gLimHalScanState ) |
| 393 | { |
| 394 | limSendHalFinishScanReq(pMac, eLIM_HAL_RESUME_LINK_WAIT_STATE ); |
| 395 | } |
| 396 | else |
| 397 | { |
| 398 | limLog(pMac, LOGW, FL("Init Scan failed, we will not call finish scan." |
| 399 | " calling the callback with failure status")); |
| 400 | pMac->lim.gpLimResumeCallback( pMac, eSIR_FAILURE, pMac->lim.gpLimResumeData); |
| 401 | pMac->lim.gpLimResumeCallback = NULL; |
| 402 | pMac->lim.gpLimResumeData = NULL; |
| 403 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 404 | } |
Madan Mohan Koyyalamudi | 01cba04 | 2013-01-10 21:56:05 -0800 | [diff] [blame] | 405 | |
| 406 | if(limIsInMCC(pMac)) |
| 407 | { |
| 408 | WDA_TrafficStatsTimerActivate(TRUE); |
| 409 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 410 | } |
| 411 | //end WLAN_SUSPEND_LINK Related |
| 412 | |
| 413 | |
| 414 | /** |
| 415 | * |
| 416 | * limChangeChannelWithCallback() |
| 417 | * |
| 418 | * FUNCTION: |
| 419 | * This function is called to change channel and perform off channel operation |
| 420 | * if required. The caller registers a callback to be called at the end of the |
Jeff Johnson | 62c2798 | 2013-02-27 17:53:55 -0800 | [diff] [blame] | 421 | * channel change. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 422 | * |
| 423 | */ |
| 424 | void |
| 425 | limChangeChannelWithCallback(tpAniSirGlobal pMac, tANI_U8 newChannel, |
| 426 | CHANGE_CHANNEL_CALLBACK callback, |
| 427 | tANI_U32 *cbdata, tpPESession psessionEntry) |
| 428 | { |
| 429 | // Sanity checks for the current and new channel |
| 430 | #if defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 431 | PELOGE(limLog( pMac, LOGE, "Switching channel to %d", newChannel);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 432 | #endif |
| 433 | psessionEntry->channelChangeReasonCode=LIM_SWITCH_CHANNEL_OPERATION; |
| 434 | |
| 435 | pMac->lim.gpchangeChannelCallback = callback; |
| 436 | pMac->lim.gpchangeChannelData = cbdata; |
| 437 | |
| 438 | limSendSwitchChnlParams(pMac, newChannel, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 439 | PHY_SINGLE_CHANNEL_CENTERED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 440 | psessionEntry->maxTxPower, psessionEntry->peSessionId); |
| 441 | |
| 442 | return; |
| 443 | } |
| 444 | |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 445 | /** |
| 446 | * lim_is_spoofing_needed() - Check whether spoofing is needed for scan |
| 447 | * @mac: Pointer to mac |
| 448 | * |
| 449 | * Return: If spoofing is needed then return true else false. |
| 450 | */ |
| 451 | static bool lim_is_spoofing_needed(tpAniSirGlobal mac) |
| 452 | { |
| 453 | /* |
| 454 | * If mac spoofing response from firmware is not enabled |
| 455 | * then disable spoofing. |
| 456 | */ |
| 457 | if (!mac->lim.isSpoofingEnabled) |
| 458 | return false; |
| 459 | |
| 460 | /* |
| 461 | * If all the octets of spoof mac-address are zero |
| 462 | * then disable spoofing. |
| 463 | */ |
| 464 | if (vos_is_macaddr_zero((v_MACADDR_t *)&mac->lim.spoofMacAddr)) |
| 465 | return false; |
| 466 | |
| 467 | /* |
| 468 | * If disableP2PMacSpoof is enabled and scan is P2P scan |
| 469 | * then disable spoofing. |
| 470 | */ |
| 471 | if (mac->roam.configParam.disableP2PMacSpoofing && |
| 472 | mac->lim.gpLimMlmScanReq->p2pSearch) |
| 473 | return false; |
| 474 | |
| 475 | /* Randomize NL (cfg80211) scan only when scan_randomize is set */ |
| 476 | if (mac->lim.gpLimMlmScanReq->nl_scan) |
| 477 | return mac->lim.gpLimMlmScanReq->scan_randomize; |
| 478 | |
| 479 | /* Randomize all other scans only when spoof_mac_oui is set */ |
| 480 | return mac->lim.spoof_mac_oui; |
| 481 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 482 | |
| 483 | /** |
| 484 | * limContinuePostChannelScan() |
| 485 | * |
| 486 | *FUNCTION: |
| 487 | * This function is called to scan the current channel. |
| 488 | * |
| 489 | *LOGIC: |
| 490 | * |
| 491 | *ASSUMPTIONS: |
| 492 | * NA |
| 493 | * |
| 494 | *NOTE: |
| 495 | * NA |
| 496 | * |
| 497 | * @param pMac - Pointer to Global MAC structure |
| 498 | * |
| 499 | * @return None |
| 500 | */ |
| 501 | |
| 502 | void limContinuePostChannelScan(tpAniSirGlobal pMac) |
| 503 | { |
| 504 | tANI_U8 channelNum; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 505 | tANI_U8 i = 0; |
| 506 | tSirRetStatus status = eSIR_SUCCESS; |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 507 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 508 | if( pMac->lim.abortScan || (NULL == pMac->lim.gpLimMlmScanReq ) || |
| 509 | (pMac->lim.gLimCurrentScanChannelId > |
| 510 | (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1))) |
| 511 | { |
| 512 | pMac->lim.abortScan = 0; |
| 513 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 514 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 515 | //Set the resume channel to Any valid channel (invalid). |
| 516 | //This will instruct HAL to set it to any previous valid channel. |
| 517 | peSetResumeChannel(pMac, 0, 0); |
| 518 | |
| 519 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 520 | return; |
| 521 | } |
| 522 | |
| 523 | channelNum = limGetCurrentScanChannel(pMac); |
Agarwal Ashish | 7fed381 | 2014-04-14 15:17:31 +0530 | [diff] [blame] | 524 | |
| 525 | if (channelNum == limGetCurrentOperatingChannel(pMac) && |
| 526 | limIsconnectedOnDFSChannel(channelNum)) |
| 527 | { |
| 528 | limCovertChannelScanType(pMac, channelNum, true); |
| 529 | } |
| 530 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 531 | if ((pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN) && |
| 532 | (limActiveScanAllowed(pMac, channelNum))) |
| 533 | { |
| 534 | TX_TIMER *periodicScanTimer; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 535 | |
Praveen Kumar Sirisilla | 7ea8dc9 | 2013-12-22 16:35:05 -0800 | [diff] [blame] | 536 | pMac->lim.probeCounter++; |
Abhishek Singh | 795e1b8 | 2015-09-25 15:35:03 +0530 | [diff] [blame] | 537 | /* Prepare and send Probe Request frame for all |
| 538 | * the SSIDs present in the saved MLM |
| 539 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 540 | do |
| 541 | { |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 542 | tSirMacAddr gSelfMacAddr; |
| 543 | bool spoof = lim_is_spoofing_needed(pMac); |
Abhishek Singh | 795e1b8 | 2015-09-25 15:35:03 +0530 | [diff] [blame] | 544 | |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 545 | if (spoof) |
| 546 | vos_mem_copy(gSelfMacAddr, pMac->lim.spoofMacAddr, |
| 547 | VOS_MAC_ADDRESS_LEN); |
| 548 | else |
| 549 | vos_mem_copy(gSelfMacAddr, pMac->lim.gSelfMacAddr, |
| 550 | VOS_MAC_ADDRESS_LEN); |
| 551 | |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 552 | limLog(pMac, LOG1, |
Agarwal Ashish | fb3b1c8 | 2015-08-18 16:57:31 +0530 | [diff] [blame] | 553 | FL(" Mac Addr "MAC_ADDRESS_STR " used in sending ProbeReq number %d, for SSID %s on channel: %d"), |
| 554 | MAC_ADDR_ARRAY(gSelfMacAddr) ,i, pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 555 | // include additional IE if there is |
| 556 | status = limSendProbeReqMgmtFrame( pMac, &pMac->lim.gpLimMlmScanReq->ssId[i], |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 557 | pMac->lim.gpLimMlmScanReq->bssId, channelNum, gSelfMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 558 | pMac->lim.gpLimMlmScanReq->dot11mode, |
| 559 | pMac->lim.gpLimMlmScanReq->uIEFieldLen, |
| 560 | (tANI_U8 *)(pMac->lim.gpLimMlmScanReq)+pMac->lim.gpLimMlmScanReq->uIEFieldOffset); |
| 561 | |
| 562 | if ( status != eSIR_SUCCESS) |
| 563 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 564 | PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID %s on channel: %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 565 | pMac->lim.gpLimMlmScanReq->ssId[i].ssId, channelNum);) |
| 566 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 567 | limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE); |
| 568 | return; |
| 569 | } |
| 570 | i++; |
| 571 | } while (i < pMac->lim.gpLimMlmScanReq->numSsid); |
| 572 | |
| 573 | { |
| 574 | #if defined WLAN_FEATURE_VOWIFI |
| 575 | //If minChannelTime is set to zero, SME is requesting scan to not use min channel timer. |
| 576 | //This is used in 11k to request for beacon measurement request with a fixed duration in |
| 577 | //max channel time. |
| 578 | if( pMac->lim.gpLimMlmScanReq->minChannelTime != 0 ) |
| 579 | { |
| 580 | #endif |
| 581 | /// TXP has sent Probe Request |
| 582 | /// Activate minChannelTimer |
| 583 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 584 | |
| 585 | #ifdef GEN6_TODO |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 586 | /* revisit this piece of code to assign the appropriate sessionId |
| 587 | * below priority - LOW/might not be needed |
| 588 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 589 | pMac->lim.limTimers.gLimMinChannelTimer.sessionId = sessionId; |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 590 | #endif |
| 591 | if (tx_timer_activate(&pMac->lim.limTimers.gLimMinChannelTimer) != |
| 592 | TX_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 593 | { |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 594 | limLog(pMac, LOGE, FL("could not start min channel timer")); |
| 595 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 596 | limSendHalEndScanReq(pMac, channelNum, |
| 597 | eLIM_HAL_END_SCAN_WAIT_STATE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 598 | return; |
| 599 | } |
| 600 | |
| 601 | // Initialize max timer too |
| 602 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
Yeshwanth Sriram Guntuka | ed0d3d0 | 2018-02-23 16:10:46 +0530 | [diff] [blame] | 603 | if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) != |
| 604 | TX_SUCCESS) |
| 605 | { |
| 606 | limLog(pMac, LOGE, FL("could not start max channel timer")); |
| 607 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 608 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 609 | limSendHalEndScanReq(pMac, channelNum, |
| 610 | eLIM_HAL_END_SCAN_WAIT_STATE); |
| 611 | return; |
| 612 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 613 | #if defined WLAN_FEATURE_VOWIFI |
| 614 | } |
| 615 | else |
| 616 | { |
| 617 | #if defined WLAN_VOWIFI_DEBUG |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 618 | PELOGE(limLog( pMac, LOGE, "Min channel time == 0, Use only max chan timer" );) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 619 | #endif |
| 620 | //No Need to start Min channel timer. Start Max Channel timer. |
| 621 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 622 | if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) |
| 623 | == TX_TIMER_ERROR) |
| 624 | { |
| 625 | /// Could not activate max channel timer. |
| 626 | // Log error |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 627 | limLog(pMac,LOGE, FL("could not start max channel timer")); |
| 628 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 629 | limSendHalEndScanReq(pMac, |
| 630 | channelNum, eLIM_HAL_END_SCAN_WAIT_STATE); |
| 631 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 632 | } |
| 633 | |
| 634 | } |
| 635 | #endif |
| 636 | } |
| 637 | /* Start peridic timer which will trigger probe req based on min/max |
| 638 | channel timer */ |
| 639 | periodicScanTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer; |
Sachin Ahuja | 49dedd7 | 2014-11-24 16:35:24 +0530 | [diff] [blame] | 640 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 641 | if (tx_timer_activate(periodicScanTimer) != TX_SUCCESS) |
| 642 | { |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 643 | limLog(pMac, LOGE, FL("could not start periodic probe req " |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 644 | "timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 645 | } |
| 646 | periodicScanTimer->sessionId = channelNum; |
| 647 | } |
| 648 | else |
| 649 | { |
| 650 | tANI_U32 val; |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 651 | limLog(pMac, LOG1, FL("START PASSIVE Scan chan %d"), channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 652 | |
| 653 | /// Passive Scanning. Activate maxChannelTimer |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 654 | if (tx_timer_deactivate(&pMac->lim.limTimers.gLimMaxChannelTimer) |
| 655 | != TX_SUCCESS) |
| 656 | { |
| 657 | // Could not deactivate max channel timer. |
| 658 | // Log error |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 659 | limLog(pMac, LOGE, FL("Unable to deactivate max channel timer")); |
| 660 | limSendHalEndScanReq(pMac, channelNum, |
| 661 | eLIM_HAL_END_SCAN_WAIT_STATE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 662 | } |
| 663 | else |
| 664 | { |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 665 | if (pMac->miracast_mode) |
| 666 | { |
| 667 | val = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST + |
| 668 | DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST; |
| 669 | } |
| 670 | else if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 671 | &val) != eSIR_SUCCESS) |
| 672 | { |
| 673 | /** |
| 674 | * Could not get max channel value |
| 675 | * from CFG. Log error. |
| 676 | */ |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 677 | limLog(pMac, LOGE, |
| 678 | FL("could not retrieve passive max chan value, Use Def val")); |
| 679 | val= WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 680 | } |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 681 | |
| 682 | val = SYS_MS_TO_TICKS(val); |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 683 | if (tx_timer_change(&pMac->lim.limTimers.gLimMaxChannelTimer, |
| 684 | val, 0) != TX_SUCCESS) |
| 685 | { |
| 686 | // Could not change max channel timer. |
| 687 | // Log error |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 688 | limLog(pMac, LOGE, FL("Unable to change max channel timer")); |
| 689 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 690 | limSendHalEndScanReq(pMac, channelNum, |
| 691 | eLIM_HAL_END_SCAN_WAIT_STATE); |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 692 | return; |
| 693 | } |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 694 | else if (tx_timer_activate(&pMac->lim.limTimers.gLimMaxChannelTimer) |
| 695 | != TX_SUCCESS) |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 696 | { |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 697 | |
| 698 | limLog(pMac, LOGE, FL("could not start max channel timer")); |
| 699 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 700 | limSendHalEndScanReq(pMac, channelNum, |
| 701 | eLIM_HAL_END_SCAN_WAIT_STATE); |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 702 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 703 | } |
| 704 | } |
| 705 | // Wait for Beacons to arrive |
| 706 | } // if (pMac->lim.gLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN) |
| 707 | |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 708 | limAddScanChannelInfo(pMac, channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 709 | return; |
| 710 | } |
| 711 | |
| 712 | |
| 713 | |
| 714 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 715 | |
| 716 | /* limCovertChannelScanType() |
| 717 | * |
| 718 | *FUNCTION: |
| 719 | * This function is called to get the list, change the channel type and set again. |
| 720 | * |
| 721 | *LOGIC: |
| 722 | * |
| 723 | *ASSUMPTIONS: |
| 724 | * NA |
| 725 | * |
| 726 | *NOTE: If a channel is ACTIVE, this function will make it as PASSIVE |
| 727 | * If a channel is PASSIVE, this fucntion will make it as ACTIVE |
| 728 | * NA |
| 729 | * |
| 730 | * @param pMac - Pointer to Global MAC structure |
| 731 | * channelNum - Channel which need to be convert |
| 732 | PassiveToActive - Boolean flag to convert channel |
| 733 | * |
| 734 | * @return None |
| 735 | */ |
| 736 | |
| 737 | |
| 738 | void limCovertChannelScanType(tpAniSirGlobal pMac,tANI_U8 channelNum, tANI_BOOLEAN passiveToActive) |
| 739 | { |
| 740 | |
| 741 | tANI_U32 i; |
| 742 | tANI_U8 channelPair[WNI_CFG_SCAN_CONTROL_LIST_LEN]; |
| 743 | tANI_U32 len = WNI_CFG_SCAN_CONTROL_LIST_LEN; |
Hanumantha Reddy Pothula | 97ea095 | 2015-10-09 11:29:39 +0530 | [diff] [blame] | 744 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 745 | if (wlan_cfgGetStr(pMac, WNI_CFG_SCAN_CONTROL_LIST, channelPair, &len) |
| 746 | != eSIR_SUCCESS) |
| 747 | { |
| 748 | PELOGE(limLog(pMac, LOGE, FL("Unable to get scan control list"));) |
| 749 | return ; |
| 750 | } |
| 751 | if (len > WNI_CFG_SCAN_CONTROL_LIST_LEN) |
| 752 | { |
| 753 | limLog(pMac, LOGE, FL("Invalid scan control list length:%d"), len); |
| 754 | return ; |
| 755 | } |
Padma, Santhosh Kumar | 778d838 | 2015-03-04 17:41:22 +0530 | [diff] [blame] | 756 | if (pMac->fActiveScanOnDFSChannels) |
| 757 | { |
| 758 | limLog(pMac, LOG1, FL("DFS feature triggered," |
| 759 | "block scan type conversion")); |
| 760 | return ; |
| 761 | } |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 762 | for (i=0; (i+1) < len; i+=2) |
| 763 | { |
| 764 | if (channelPair[i] == channelNum) |
| 765 | { |
| 766 | if ((eSIR_PASSIVE_SCAN == channelPair[i+1]) && TRUE == passiveToActive) |
| 767 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 768 | limLog(pMac, LOG1, FL("Channel %d changed from Passive to Active"), |
| 769 | channelNum); |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 770 | channelPair[i+1] = eSIR_ACTIVE_SCAN; |
| 771 | break ; |
| 772 | } |
| 773 | if ((eSIR_ACTIVE_SCAN == channelPair[i+1]) && FALSE == passiveToActive) |
| 774 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 775 | limLog(pMac, LOG1, FL("Channel %d changed from Active to Passive"), |
| 776 | channelNum); |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 777 | channelPair[i+1] = eSIR_PASSIVE_SCAN; |
| 778 | break ; |
| 779 | } |
| 780 | } |
| 781 | } |
| 782 | |
| 783 | cfgSetStrNotify(pMac, WNI_CFG_SCAN_CONTROL_LIST, (tANI_U8 *)channelPair, len, FALSE); |
| 784 | return ; |
| 785 | } |
| 786 | |
| 787 | |
| 788 | |
| 789 | |
| 790 | /* limSetDFSChannelList() |
| 791 | * |
| 792 | *FUNCTION: |
| 793 | * This function is called to convert DFS channel list to active channel list when any |
| 794 | * beacon is present on that channel. This function store time for passive channels |
| 795 | * which help to know that for how much time channel has been passive. |
| 796 | * |
| 797 | *LOGIC: |
| 798 | * |
| 799 | *ASSUMPTIONS: |
| 800 | * NA |
| 801 | * |
| 802 | *NOTE: If a channel is ACTIVE, it won't store any time |
| 803 | * If a channel is PAssive, it will store time as timestamp |
| 804 | * NA |
| 805 | * |
| 806 | * @param pMac - Pointer to Global MAC structure |
| 807 | * dfsChannelList - DFS channel list. |
| 808 | * @return None |
| 809 | */ |
| 810 | |
| 811 | void limSetDFSChannelList(tpAniSirGlobal pMac,tANI_U8 channelNum, tSirDFSChannelList *dfsChannelList) |
| 812 | { |
| 813 | |
| 814 | tANI_BOOLEAN passiveToActive = TRUE; |
Hanumantha Reddy Pothula | 97ea095 | 2015-10-09 11:29:39 +0530 | [diff] [blame] | 815 | tANI_U32 cfgVal; |
| 816 | |
| 817 | if (eSIR_SUCCESS == wlan_cfgGetInt(pMac, WNI_CFG_ACTIVE_PASSIVE_CON, |
| 818 | &cfgVal)) |
| 819 | { |
| 820 | limLog(pMac, LOG1, FL("WNI_CFG_ACTIVE_PASSIVE_CON: %d"), cfgVal); |
| 821 | if (!cfgVal) |
| 822 | return; |
| 823 | } |
| 824 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 825 | if ((1 <= channelNum) && (165 >= channelNum)) |
| 826 | { |
| 827 | if (eANI_BOOLEAN_TRUE == limIsconnectedOnDFSChannel(channelNum)) |
| 828 | { |
| 829 | if (dfsChannelList->timeStamp[channelNum] == 0) |
| 830 | { |
| 831 | //Received first beacon; Convert DFS channel to Active channel. |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 832 | limLog(pMac, LOG1, FL("Received first beacon on DFS channel: %d"), channelNum); |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 833 | limCovertChannelScanType(pMac,channelNum, passiveToActive); |
| 834 | } |
Abhishek Singh | 6fcdf65 | 2016-11-23 10:59:12 +0530 | [diff] [blame] | 835 | |
| 836 | if (!pMac->fActiveScanOnDFSChannels && |
| 837 | dfsChannelList->timeStamp[channelNum] && |
| 838 | !limActiveScanAllowed(pMac, channelNum)) |
| 839 | limLog(pMac, LOGE, |
| 840 | FL("Received beacon on DFS channel %d with dfs time stamp %lu, but channel is still DFS"), |
| 841 | channelNum, dfsChannelList->timeStamp[channelNum]); |
| 842 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 843 | dfsChannelList->timeStamp[channelNum] = vos_timer_get_system_time(); |
| 844 | } |
| 845 | else |
| 846 | { |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 847 | return; |
| 848 | } |
| 849 | if (!tx_timer_running(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer)) |
| 850 | { |
| 851 | tx_timer_activate(&pMac->lim.limTimers.gLimActiveToPassiveChannelTimer); |
| 852 | } |
| 853 | } |
| 854 | else |
| 855 | { |
| 856 | PELOGE(limLog(pMac, LOGE, FL("Invalid Channel: %d"), channelNum);) |
| 857 | return; |
| 858 | } |
| 859 | |
| 860 | return; |
| 861 | } |
| 862 | |
Paul Zhang | 8328979 | 2017-02-28 18:58:52 +0800 | [diff] [blame] | 863 | void limDoSendAuthMgmtFrame(tpAniSirGlobal pMac, tpPESession psessionEntry) |
| 864 | { |
| 865 | tSirMacAuthFrameBody authFrameBody; |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 866 | |
Abhinav Kumar | 6920f5a | 2019-08-05 18:55:11 +0530 | [diff] [blame] | 867 | /* Mark auth algo as open when auth type is SAE and PMK is cached */ |
| 868 | if ((pMac->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) && |
| 869 | psessionEntry->sae_pmk_cached) { |
| 870 | authFrameBody.authAlgoNumber = eSIR_OPEN_SYSTEM; |
| 871 | } else { |
| 872 | authFrameBody.authAlgoNumber = |
| 873 | (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType; |
| 874 | } |
Paul Zhang | 8328979 | 2017-02-28 18:58:52 +0800 | [diff] [blame] | 875 | //Prepare & send Authentication frame |
Paul Zhang | 8328979 | 2017-02-28 18:58:52 +0800 | [diff] [blame] | 876 | authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1; |
| 877 | authFrameBody.authStatusCode = 0; |
| 878 | pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD; |
| 879 | limSendAuthMgmtFrame(pMac, |
| 880 | &authFrameBody, |
| 881 | pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 882 | LIM_NO_WEP_IN_FC, psessionEntry, eSIR_TRUE); |
| 883 | if (tx_timer_activate(&pMac->lim.limTimers.gLimAuthFailureTimer) |
| 884 | != TX_SUCCESS) { |
| 885 | //Could not start Auth failure timer. |
| 886 | //Log error |
| 887 | limLog(pMac, LOGP, |
| 888 | FL("could not start Auth failure timer")); |
| 889 | //Cleanup as if auth timer expired |
| 890 | limProcessAuthFailureTimeout(pMac); |
| 891 | } else { |
| 892 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, |
| 893 | psessionEntry->peSessionId, eLIM_AUTH_RETRY_TIMER)); |
| 894 | //Activate Auth Retry timer |
| 895 | if (tx_timer_activate |
| 896 | (&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer) |
| 897 | != TX_SUCCESS) { |
| 898 | limLog(pMac, LOGP, |
| 899 | FL("could not activate Auth Retry timer")); |
| 900 | } |
| 901 | } |
| 902 | return; |
| 903 | } |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 904 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 905 | /* |
| 906 | * Creates a Raw frame to be sent before every Scan, if required. |
| 907 | * If only infra link is active (mlmState = Link Estb), then send Data Null |
| 908 | * If only BT-AMP-AP link is active(mlmState = BSS_STARTED), then send CTS2Self frame. |
| 909 | * If only BT-AMP-STA link is active(mlmState = BSS_STARTED or Link Est) then send CTS2Self |
| 910 | * If Only IBSS link is active, then send CTS2Self |
| 911 | * for concurrent scenario: Infra+BT or Infra+IBSS, always send CTS2Self, no need to send Data Null |
| 912 | * |
| 913 | */ |
| 914 | static void __limCreateInitScanRawFrame(tpAniSirGlobal pMac, |
| 915 | tpInitScanParams pInitScanParam) |
| 916 | { |
| 917 | tANI_U8 i; |
| 918 | pInitScanParam->scanEntry.activeBSScnt = 0; |
| 919 | |
| 920 | /* Don't send CTS to self as we have issue with BTQM queues where BTQM can |
| 921 | * not handle transmition of CTS2self frames. Sending CTS 2 self at this |
| 922 | * juncture also doesn't serve much purpose as probe request frames go out |
| 923 | * immediately, No need to notify BSS in IBSS case. |
| 924 | * */ |
| 925 | |
| 926 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 927 | { |
| 928 | if(pMac->lim.gpSession[i].valid == TRUE) |
| 929 | { |
| 930 | if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 931 | { |
| 932 | if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) && |
| 933 | (pInitScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID)) |
| 934 | { |
| 935 | pInitScanParam->scanEntry.bssIdx[pInitScanParam->scanEntry.activeBSScnt] |
| 936 | = pMac->lim.gpSession[i].bssIdx; |
| 937 | pInitScanParam->scanEntry.activeBSScnt++; |
| 938 | |
| 939 | } |
| 940 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 941 | else if( (eLIM_AP_ROLE == pMac->lim.gpSession[i].limSystemRole ) |
| 942 | && ( VOS_P2P_GO_MODE == pMac->lim.gpSession[i].pePersona ) |
| 943 | ) |
| 944 | { |
| 945 | pInitScanParam->useNoA = TRUE; |
| 946 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 947 | } |
| 948 | } |
| 949 | if (pInitScanParam->scanEntry.activeBSScnt) |
| 950 | { |
| 951 | pInitScanParam->notifyBss = TRUE; |
| 952 | pInitScanParam->frameType = SIR_MAC_DATA_FRAME; |
| 953 | pInitScanParam->frameLength = 0; |
| 954 | } |
| 955 | } |
| 956 | |
| 957 | /* |
| 958 | * Creates a Raw frame to be sent during finish scan, if required. |
| 959 | * Send data null frame, only when there is just one session active and that session is |
| 960 | * in 'link Estb' state. |
| 961 | * if more than one session is active, don't send any frame. |
| 962 | * for concurrent scenario: Infra+BT or Infra+IBSS, no need to send Data Null |
| 963 | * |
| 964 | */ |
| 965 | static void __limCreateFinishScanRawFrame(tpAniSirGlobal pMac, |
| 966 | tpFinishScanParams pFinishScanParam) |
| 967 | { |
| 968 | tANI_U8 i; |
| 969 | pFinishScanParam->scanEntry.activeBSScnt = 0; |
| 970 | |
| 971 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 972 | { |
| 973 | if(pMac->lim.gpSession[i].valid == TRUE) |
| 974 | { |
| 975 | if(pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) |
| 976 | { |
| 977 | //BT-STA can either be in LINK-ESTB state or BSS_STARTED State |
| 978 | //for BT, need to send CTS2Self |
| 979 | if ((pMac->lim.gpSession[i].limSystemRole != eLIM_BT_AMP_STA_ROLE) && |
| 980 | (pFinishScanParam->scanEntry.activeBSScnt < HAL_NUM_BSSID)) |
| 981 | { |
| 982 | pFinishScanParam->scanEntry.bssIdx[pFinishScanParam->scanEntry.activeBSScnt] |
| 983 | = pMac->lim.gpSession[i].bssIdx; |
| 984 | pFinishScanParam->scanEntry.activeBSScnt++; |
| 985 | } |
| 986 | } |
| 987 | } |
| 988 | } |
| 989 | |
| 990 | if (pFinishScanParam->scanEntry.activeBSScnt) |
| 991 | { |
| 992 | pFinishScanParam->notifyBss = TRUE; |
| 993 | pFinishScanParam->frameType = SIR_MAC_DATA_FRAME; |
| 994 | pFinishScanParam->frameLength = 0; |
| 995 | } |
| 996 | } |
| 997 | |
| 998 | void |
| 999 | limSendHalInitScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState, tSirLinkTrafficCheck trafficCheck) |
| 1000 | { |
| 1001 | |
| 1002 | |
| 1003 | tSirMsgQ msg; |
| 1004 | tpInitScanParams pInitScanParam; |
| 1005 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1006 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1007 | pInitScanParam = vos_mem_malloc(sizeof(*pInitScanParam)); |
| 1008 | if ( NULL == pInitScanParam ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1009 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1010 | PELOGW(limLog(pMac, LOGW, FL("AllocateMemory() failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1011 | goto error; |
| 1012 | } |
| 1013 | |
| 1014 | /*Initialize the pInitScanParam with 0*/ |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1015 | vos_mem_set((tANI_U8 *)pInitScanParam, sizeof(*pInitScanParam), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1016 | |
| 1017 | msg.type = WDA_INIT_SCAN_REQ; |
| 1018 | msg.bodyptr = pInitScanParam; |
| 1019 | msg.bodyval = 0; |
| 1020 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1021 | vos_mem_set((tANI_U8 *)&pInitScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1022 | if (nextState == eLIM_HAL_INIT_LEARN_WAIT_STATE) |
| 1023 | { |
| 1024 | pInitScanParam->notifyBss = TRUE; |
| 1025 | pInitScanParam->notifyHost = FALSE; |
Madan Mohan Koyyalamudi | 9b87678 | 2012-10-11 16:22:51 -0700 | [diff] [blame] | 1026 | if (eSIR_CHECK_ROAMING_SCAN == trafficCheck) |
| 1027 | { |
| 1028 | pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SCAN; |
| 1029 | } |
| 1030 | else |
| 1031 | { |
| 1032 | pInitScanParam->scanMode = eHAL_SYS_MODE_LEARN; |
| 1033 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1034 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1035 | pInitScanParam->frameType = SIR_MAC_CTRL_CTS; |
| 1036 | __limCreateInitScanRawFrame(pMac, pInitScanParam); |
| 1037 | pInitScanParam->checkLinkTraffic = trafficCheck; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1038 | } |
| 1039 | else |
| 1040 | { |
| 1041 | if(nextState == eLIM_HAL_SUSPEND_LINK_WAIT_STATE) |
| 1042 | { |
Madan Mohan Koyyalamudi | 9b87678 | 2012-10-11 16:22:51 -0700 | [diff] [blame] | 1043 | if (eSIR_CHECK_ROAMING_SCAN == trafficCheck) |
| 1044 | { |
| 1045 | pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SUSPEND_LINK; |
| 1046 | } |
| 1047 | else |
| 1048 | { |
| 1049 | pInitScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK; |
| 1050 | } |
| 1051 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1052 | } |
| 1053 | else |
| 1054 | { |
Madan Mohan Koyyalamudi | 94d111d | 2012-11-19 20:11:26 -0800 | [diff] [blame] | 1055 | if (eSIR_CHECK_ROAMING_SCAN == trafficCheck) |
| 1056 | { |
| 1057 | pInitScanParam->scanMode = eHAL_SYS_MODE_ROAM_SCAN; |
| 1058 | } |
| 1059 | else |
| 1060 | { |
| 1061 | pInitScanParam->scanMode = eHAL_SYS_MODE_SCAN; |
| 1062 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1063 | } |
| 1064 | __limCreateInitScanRawFrame(pMac, pInitScanParam); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1065 | if (pInitScanParam->useNoA) |
| 1066 | { |
| 1067 | pInitScanParam->scanDuration = pMac->lim.gTotalScanDuration; |
| 1068 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1069 | /* Inform HAL whether it should check for traffic on the link |
| 1070 | * prior to performing a background scan |
| 1071 | */ |
| 1072 | pInitScanParam->checkLinkTraffic = trafficCheck; |
| 1073 | } |
| 1074 | |
| 1075 | pMac->lim.gLimHalScanState = nextState; |
| 1076 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1077 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1078 | |
| 1079 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1080 | if (rc == eSIR_SUCCESS) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1081 | PELOG3(limLog(pMac, LOG3, FL("wdaPostCtrlMsg() return eSIR_SUCCESS pMac=%x nextState=%d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | pMac, pMac->lim.gLimHalScanState);) |
| 1083 | return; |
| 1084 | } |
| 1085 | |
| 1086 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1087 | vos_mem_free(pInitScanParam); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1088 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1089 | |
| 1090 | error: |
| 1091 | switch(nextState) |
| 1092 | { |
| 1093 | case eLIM_HAL_START_SCAN_WAIT_STATE: |
Padma, Santhosh Kumar | 9a3eea1 | 2015-02-18 14:05:03 +0530 | [diff] [blame] | 1094 | case eLIM_HAL_INIT_SCAN_WAIT_STATE: |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1095 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED); |
| 1096 | break; |
| 1097 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1098 | |
| 1099 | //WLAN_SUSPEND_LINK Related |
| 1100 | case eLIM_HAL_SUSPEND_LINK_WAIT_STATE: |
| 1101 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 1102 | if( pMac->lim.gpLimSuspendCallback ) |
| 1103 | { |
| 1104 | pMac->lim.gpLimSuspendCallback( pMac, rc, pMac->lim.gpLimSuspendData ); |
| 1105 | pMac->lim.gpLimSuspendCallback = NULL; |
| 1106 | pMac->lim.gpLimSuspendData = NULL; |
| 1107 | } |
| 1108 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 1109 | break; |
| 1110 | //end WLAN_SUSPEND_LINK Related |
| 1111 | default: |
| 1112 | break; |
| 1113 | } |
| 1114 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 1115 | |
| 1116 | return ; |
| 1117 | } |
| 1118 | |
| 1119 | void |
| 1120 | limSendHalStartScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState) |
| 1121 | { |
| 1122 | tSirMsgQ msg; |
| 1123 | tpStartScanParams pStartScanParam; |
| 1124 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1125 | |
| 1126 | /** |
| 1127 | * The Start scan request to be sent only if Start Scan is not already requested |
| 1128 | */ |
| 1129 | if(pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE) |
| 1130 | { |
| 1131 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1132 | pStartScanParam = vos_mem_malloc(sizeof(*pStartScanParam)); |
| 1133 | if ( NULL == pStartScanParam ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1134 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1135 | PELOGW(limLog(pMac, LOGW, FL("AllocateMemory() failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1136 | goto error; |
| 1137 | } |
| 1138 | |
| 1139 | msg.type = WDA_START_SCAN_REQ; |
| 1140 | msg.bodyptr = pStartScanParam; |
| 1141 | msg.bodyval = 0; |
| 1142 | pStartScanParam->status = eHAL_STATUS_SUCCESS; |
| 1143 | pStartScanParam->scanChannel = (tANI_U8)channelNum; |
| 1144 | |
| 1145 | pMac->lim.gLimHalScanState = nextState; |
| 1146 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 1147 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1148 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1149 | |
| 1150 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1151 | if (rc == eSIR_SUCCESS) { |
| 1152 | return; |
| 1153 | } |
| 1154 | |
| 1155 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1156 | vos_mem_free(pStartScanParam); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1157 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1158 | |
| 1159 | error: |
| 1160 | switch(nextState) |
| 1161 | { |
| 1162 | case eLIM_HAL_START_SCAN_WAIT_STATE: |
| 1163 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_INIT_FAILED); |
| 1164 | break; |
| 1165 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1166 | |
| 1167 | default: |
| 1168 | break; |
| 1169 | } |
| 1170 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 1171 | |
| 1172 | } |
| 1173 | else |
| 1174 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1175 | PELOGW(limLog(pMac, LOGW, FL("Invalid state for START_SCAN_REQ message=%d"), pMac->lim.gLimHalScanState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1176 | } |
| 1177 | |
| 1178 | return; |
| 1179 | } |
| 1180 | |
| 1181 | void limSendHalEndScanReq(tpAniSirGlobal pMac, tANI_U8 channelNum, tLimLimHalScanState nextState) |
| 1182 | { |
| 1183 | tSirMsgQ msg; |
| 1184 | tpEndScanParams pEndScanParam; |
| 1185 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1186 | |
| 1187 | /** |
| 1188 | * The End scan request to be sent only if End Scan is not already requested or |
Leela Venkata Kiran Kumar Reddy Chirala | 66639a6 | 2013-08-29 15:38:19 -0700 | [diff] [blame] | 1189 | * Start scan is not already requestd. |
| 1190 | * after finish scan rsp from firmware host is sending endscan request so adding |
| 1191 | * check for IDLE SCAN STATE also added to avoid this issue |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1192 | */ |
| 1193 | if((pMac->lim.gLimHalScanState != eLIM_HAL_END_SCAN_WAIT_STATE) && |
Leela Venkata Kiran Kumar Reddy Chirala | 66639a6 | 2013-08-29 15:38:19 -0700 | [diff] [blame] | 1194 | (pMac->lim.gLimHalScanState != eLIM_HAL_IDLE_SCAN_STATE) && |
Praveen Kumar Sirisilla | ac600a8 | 2013-10-18 11:07:47 -0700 | [diff] [blame] | 1195 | (pMac->lim.gLimHalScanState == eLIM_HAL_SCANNING_STATE) && |
| 1196 | (pMac->lim.gLimHalScanState != eLIM_HAL_FINISH_SCAN_WAIT_STATE) && |
| 1197 | (pMac->lim.gLimHalScanState != eLIM_HAL_START_SCAN_WAIT_STATE)) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1198 | { |
| 1199 | pEndScanParam = vos_mem_malloc(sizeof(*pEndScanParam)); |
| 1200 | if ( NULL == pEndScanParam ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1201 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1202 | PELOGW(limLog(pMac, LOGW, FL("AllocateMemory() failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1203 | goto error; |
| 1204 | } |
| 1205 | |
| 1206 | msg.type = WDA_END_SCAN_REQ; |
| 1207 | msg.bodyptr = pEndScanParam; |
| 1208 | msg.bodyval = 0; |
| 1209 | pEndScanParam->status = eHAL_STATUS_SUCCESS; |
| 1210 | pEndScanParam->scanChannel = (tANI_U8)channelNum; |
| 1211 | |
| 1212 | pMac->lim.gLimHalScanState = nextState; |
| 1213 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1214 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1215 | |
| 1216 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1217 | if (rc == eSIR_SUCCESS) { |
| 1218 | return; |
| 1219 | } |
| 1220 | |
| 1221 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1222 | vos_mem_free(pEndScanParam); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1223 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1224 | |
| 1225 | error: |
| 1226 | switch(nextState) |
| 1227 | { |
| 1228 | case eLIM_HAL_END_SCAN_WAIT_STATE: |
| 1229 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_END_FAILED); |
| 1230 | break; |
| 1231 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1232 | |
| 1233 | default: |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1234 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg Rcvd invalid nextState %d"), nextState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1235 | break; |
| 1236 | } |
| 1237 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1238 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1239 | } |
| 1240 | else |
| 1241 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1242 | PELOGW(limLog(pMac, LOGW, FL("Invalid state for END_SCAN_REQ message=%d"), pMac->lim.gLimHalScanState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1243 | } |
| 1244 | |
| 1245 | |
| 1246 | return; |
| 1247 | } |
| 1248 | |
Bhargav Shah | e3a6ff0 | 2016-04-11 16:31:49 +0530 | [diff] [blame] | 1249 | |
| 1250 | void limSendTLPauseInd(tpAniSirGlobal pMac, uint16_t staId) |
| 1251 | { |
| 1252 | tSirMsgQ msg; |
| 1253 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1254 | |
| 1255 | msg.type = WDA_PAUSE_TL_IND; |
| 1256 | msg.bodyval = staId; |
| 1257 | |
| 1258 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
| 1259 | |
| 1260 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1261 | if (rc == eSIR_SUCCESS) { |
| 1262 | return; |
| 1263 | } |
| 1264 | |
| 1265 | limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc); |
| 1266 | |
| 1267 | return; |
| 1268 | } |
| 1269 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1270 | /** |
| 1271 | * limSendHalFinishScanReq() |
| 1272 | * |
| 1273 | *FUNCTION: |
| 1274 | * This function is called to finish scan/learn request.. |
| 1275 | * |
| 1276 | *LOGIC: |
| 1277 | * |
| 1278 | *ASSUMPTIONS: |
| 1279 | * NA |
| 1280 | * |
| 1281 | *NOTE: |
| 1282 | * NA |
| 1283 | * |
| 1284 | * @param pMac - Pointer to Global MAC structure |
| 1285 | * @param nextState - this parameters determines whether this call is for scan or learn |
| 1286 | * |
| 1287 | * @return None |
| 1288 | */ |
| 1289 | void limSendHalFinishScanReq(tpAniSirGlobal pMac, tLimLimHalScanState nextState) |
| 1290 | { |
| 1291 | |
| 1292 | tSirMsgQ msg; |
| 1293 | tpFinishScanParams pFinishScanParam; |
| 1294 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1295 | |
| 1296 | if(pMac->lim.gLimHalScanState == nextState) |
| 1297 | { |
| 1298 | /* |
| 1299 | * PE may receive multiple probe responses, while waiting for HAL to send 'FINISH_SCAN_RSP' message |
| 1300 | * PE was sending multiple finish scan req messages to HAL |
| 1301 | * this check will avoid that. |
| 1302 | * If PE is already waiting for the 'finish_scan_rsp' message from HAL, it will ignore this request. |
| 1303 | */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1304 | PELOGW(limLog(pMac, LOGW, FL("Next Scan State is same as the current state: %d "), nextState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1305 | return; |
| 1306 | } |
| 1307 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1308 | pFinishScanParam = vos_mem_malloc(sizeof(*pFinishScanParam)); |
| 1309 | if ( NULL == pFinishScanParam ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1310 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1311 | PELOGW(limLog(pMac, LOGW, FL("AllocateMemory() failed"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1312 | goto error; |
| 1313 | } |
| 1314 | |
| 1315 | msg.type = WDA_FINISH_SCAN_REQ; |
| 1316 | msg.bodyptr = pFinishScanParam; |
| 1317 | msg.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1318 | |
| 1319 | peGetResumeChannel(pMac, &pFinishScanParam->currentOperChannel, &pFinishScanParam->cbState); |
| 1320 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1321 | vos_mem_set((tANI_U8 *)&pFinishScanParam->macMgmtHdr, sizeof(tSirMacMgmtHdr), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1322 | |
| 1323 | if (nextState == eLIM_HAL_FINISH_LEARN_WAIT_STATE) |
| 1324 | { |
| 1325 | //AP - No pkt need to be transmitted |
| 1326 | pFinishScanParam->scanMode = eHAL_SYS_MODE_LEARN; |
| 1327 | pFinishScanParam->notifyBss = FALSE; |
| 1328 | pFinishScanParam->notifyHost = FALSE; |
| 1329 | pFinishScanParam->frameType = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1330 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1331 | pFinishScanParam->frameLength = 0; |
| 1332 | pMac->lim.gLimHalScanState = nextState; |
| 1333 | } |
| 1334 | else |
| 1335 | { |
| 1336 | /* If STA is associated with an AP (ie. STA is in |
| 1337 | * LINK_ESTABLISHED state), then STA need to inform |
| 1338 | * the AP via either DATA-NULL |
| 1339 | */ |
| 1340 | if (nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE) |
| 1341 | { |
| 1342 | pFinishScanParam->scanMode = eHAL_SYS_MODE_SUSPEND_LINK; |
| 1343 | } |
| 1344 | else |
| 1345 | { |
| 1346 | pFinishScanParam->scanMode = eHAL_SYS_MODE_SCAN; |
| 1347 | } |
| 1348 | pFinishScanParam->notifyHost = FALSE; |
| 1349 | __limCreateFinishScanRawFrame(pMac, pFinishScanParam); |
| 1350 | //WLAN_SUSPEND_LINK Related |
| 1351 | pMac->lim.gLimHalScanState = nextState; |
| 1352 | //end WLAN_SUSPEND_LINK Related |
| 1353 | } |
| 1354 | |
| 1355 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1356 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1357 | |
| 1358 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1359 | if (rc == eSIR_SUCCESS) { |
| 1360 | return; |
| 1361 | } |
| 1362 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1363 | vos_mem_free(pFinishScanParam); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1364 | PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg failed, error code %d"), rc);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1365 | |
| 1366 | error: |
| 1367 | if(nextState == eLIM_HAL_FINISH_SCAN_WAIT_STATE) |
| 1368 | limCompleteMlmScan(pMac, eSIR_SME_HAL_SCAN_FINISH_FAILED); |
| 1369 | //WLAN_SUSPEND_LINK Related |
| 1370 | else if ( nextState == eLIM_HAL_RESUME_LINK_WAIT_STATE ) |
| 1371 | { |
| 1372 | if( pMac->lim.gpLimResumeCallback ) |
| 1373 | { |
| 1374 | pMac->lim.gpLimResumeCallback( pMac, rc, pMac->lim.gpLimResumeData ); |
| 1375 | pMac->lim.gpLimResumeCallback = NULL; |
| 1376 | pMac->lim.gpLimResumeData = NULL; |
| 1377 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 1378 | } |
| 1379 | } |
| 1380 | //end WLAN_SUSPEND_LINK Related |
| 1381 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 1382 | return; |
| 1383 | } |
| 1384 | |
| 1385 | /** |
| 1386 | * limContinueChannelScan() |
| 1387 | * |
| 1388 | *FUNCTION: |
| 1389 | * This function is called by limPerformChannelScan(). |
| 1390 | * This function is called to continue channel scanning when |
| 1391 | * Beacon/Probe Response frame are received. |
| 1392 | * |
| 1393 | *LOGIC: |
| 1394 | * Scan criteria stored in pMac->lim.gLimMlmScanReq is used |
| 1395 | * to perform channel scan. In this function MLM sub module |
| 1396 | * makes channel switch, sends PROBE REQUEST frame in case of |
| 1397 | * ACTIVE SCANNING, starts min/max channel timers, programs |
| 1398 | * NAV to probeDelay timer and waits for Beacon/Probe Response. |
| 1399 | * Once all required channels are scanned, LIM_MLM_SCAN_CNF |
| 1400 | * primitive is used to send Scan results to SME sub module. |
| 1401 | * |
| 1402 | *ASSUMPTIONS: |
| 1403 | * 1. In case of Active scanning, start MAX channel time iff |
| 1404 | * MIN channel timer expired and activity is observed on |
| 1405 | * the channel. |
| 1406 | * |
| 1407 | *NOTE: |
| 1408 | * NA |
| 1409 | * |
| 1410 | * @param pMac Pointer to Global MAC structure |
| 1411 | * @return None |
| 1412 | */ |
| 1413 | void |
| 1414 | limContinueChannelScan(tpAniSirGlobal pMac) |
| 1415 | { |
| 1416 | tANI_U8 channelNum; |
| 1417 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1418 | if (pMac->lim.gLimCurrentScanChannelId > |
| 1419 | (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1) |
| 1420 | || pMac->lim.abortScan) |
| 1421 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1422 | pMac->lim.abortScan = 0; |
| 1423 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 1424 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 1425 | |
| 1426 | //Set the resume channel to Any valid channel (invalid). |
| 1427 | //This will instruct HAL to set it to any previous valid channel. |
| 1428 | peSetResumeChannel(pMac, 0, 0); |
| 1429 | |
| 1430 | /// Done scanning all required channels |
| 1431 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1432 | return; |
| 1433 | } |
| 1434 | |
| 1435 | /// Atleast one more channel is to be scanned |
| 1436 | |
| 1437 | if ((pMac->lim.gLimReturnAfterFirstMatch & 0x40) || |
| 1438 | (pMac->lim.gLimReturnAfterFirstMatch & 0x80)) |
| 1439 | { |
| 1440 | while (pMac->lim.gLimCurrentScanChannelId <= |
| 1441 | (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)) |
| 1442 | { |
| 1443 | if (((limGetCurrentScanChannel(pMac) <= 14) && |
| 1444 | pMac->lim.gLim24Band11dScanDone) || |
| 1445 | ((limGetCurrentScanChannel(pMac) > 14) && |
| 1446 | pMac->lim.gLim50Band11dScanDone)) |
| 1447 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1448 | limLog(pMac, LOGW, FL("skipping chan %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1449 | limGetCurrentScanChannel(pMac)); |
| 1450 | pMac->lim.gLimCurrentScanChannelId++; |
| 1451 | } |
| 1452 | else |
| 1453 | break; |
| 1454 | } |
| 1455 | |
| 1456 | if (pMac->lim.gLimCurrentScanChannelId > |
| 1457 | (tANI_U32) (pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)) |
| 1458 | { |
| 1459 | pMac->lim.abortScan = 0; |
| 1460 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 1461 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 1462 | /// Done scanning all required channels |
| 1463 | //Set the resume channel to Any valid channel (invalid). |
| 1464 | //This will instruct HAL to set it to any previous valid channel. |
| 1465 | peSetResumeChannel(pMac, 0, 0); |
| 1466 | limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE); |
| 1467 | return; |
| 1468 | } |
| 1469 | } |
| 1470 | |
| 1471 | channelNum = limGetCurrentScanChannel(pMac); |
Abhishek Singh | 525045c | 2014-12-15 17:18:45 +0530 | [diff] [blame] | 1472 | limLog(pMac, LOG1, FL("Current Channel to be scanned is %d"), |
| 1473 | channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1474 | |
| 1475 | limSendHalStartScanReq(pMac, channelNum, eLIM_HAL_START_SCAN_WAIT_STATE); |
| 1476 | return; |
| 1477 | } /*** end limContinueChannelScan() ***/ |
| 1478 | |
| 1479 | |
| 1480 | |
| 1481 | /** |
| 1482 | * limRestorePreScanState() |
| 1483 | * |
| 1484 | *FUNCTION: |
| 1485 | * This function is called by limContinueChannelScan() |
| 1486 | * to restore HW state prior to entering 'scan state' |
| 1487 | * |
| 1488 | *LOGIC |
| 1489 | * |
| 1490 | *ASSUMPTIONS: |
| 1491 | * |
| 1492 | *NOTE: |
| 1493 | * NA |
| 1494 | * |
| 1495 | * @param pMac Pointer to Global MAC structure |
| 1496 | * @return None |
| 1497 | */ |
| 1498 | void |
| 1499 | limRestorePreScanState(tpAniSirGlobal pMac) |
| 1500 | { |
| 1501 | int i; |
| 1502 | |
| 1503 | /// Deactivate MIN/MAX channel timers if running |
| 1504 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 1505 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 1506 | |
| 1507 | /* Re-activate Heartbeat timers for connected sessions as scan |
Madan Mohan Koyyalamudi | 70bb4cb | 2012-10-18 19:31:25 -0700 | [diff] [blame] | 1508 | * is done if the DUT is in active mode |
| 1509 | * AND it is not a ROAMING ("background") scan */ |
| 1510 | if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) || |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1511 | (ePMM_STATE_READY == pMac->pmm.gPmmState)) |
Madan Mohan Koyyalamudi | 70bb4cb | 2012-10-18 19:31:25 -0700 | [diff] [blame] | 1512 | && (pMac->lim.gLimBackgroundScanMode != eSIR_ROAMING_SCAN )) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1513 | { |
| 1514 | for(i=0;i<pMac->lim.maxBssId;i++) |
| 1515 | { |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 1516 | if((peFindSessionBySessionId(pMac,i) != NULL) && |
| 1517 | (pMac->lim.gpSession[i].valid == TRUE) && |
Yathish | 9f22e66 | 2012-12-10 14:21:35 -0800 | [diff] [blame] | 1518 | (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState) && |
| 1519 | (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1520 | { |
| 1521 | limReactivateHeartBeatTimer(pMac, peFindSessionBySessionId(pMac,i)); |
| 1522 | } |
| 1523 | } |
| 1524 | } |
| 1525 | |
| 1526 | /** |
| 1527 | * clean up message queue. |
| 1528 | * If SME messages, redirect to deferred queue. |
| 1529 | * The rest will be discarded. |
| 1530 | */ |
| 1531 | //limCleanupMsgQ(pMac); |
| 1532 | |
| 1533 | pMac->lim.gLimSystemInScanLearnMode = 0; |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 1534 | limLog(pMac, LOG1, FL("Scan ended, took %ld tu"), |
| 1535 | (tx_time_get() - pMac->lim.scanStartTime)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1536 | } /*** limRestorePreScanState() ***/ |
| 1537 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1538 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 1539 | |
| 1540 | void limSendHalOemDataReq(tpAniSirGlobal pMac) |
| 1541 | { |
| 1542 | tSirMsgQ msg; |
| 1543 | tpStartOemDataReq pStartOemDataReq = NULL; |
| 1544 | tSirRetStatus rc = eSIR_SUCCESS; |
| 1545 | tpLimMlmOemDataRsp pMlmOemDataRsp; |
| 1546 | tANI_U32 reqLen = 0; |
| 1547 | if(NULL == pMac->lim.gpLimMlmOemDataReq) |
| 1548 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1549 | PELOGE(limLog(pMac, LOGE, FL("Null pointer"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1550 | goto error; |
| 1551 | } |
| 1552 | |
| 1553 | reqLen = sizeof(tStartOemDataReq); |
| 1554 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1555 | pStartOemDataReq = vos_mem_malloc(reqLen); |
| 1556 | if ( NULL == pStartOemDataReq ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1557 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1558 | PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Could not allocate memory for pStartOemDataReq"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1559 | goto error; |
| 1560 | } |
| 1561 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1562 | vos_mem_set((tANI_U8*)(pStartOemDataReq), reqLen, 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1563 | |
| 1564 | //Now copy over the information to the OEM DATA REQ to HAL |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1565 | vos_mem_copy(pStartOemDataReq->selfMacAddr, |
| 1566 | pMac->lim.gpLimMlmOemDataReq->selfMacAddr, |
| 1567 | sizeof(tSirMacAddr)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1568 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1569 | vos_mem_copy(pStartOemDataReq->oemDataReq, |
| 1570 | pMac->lim.gpLimMlmOemDataReq->oemDataReq, |
| 1571 | OEM_DATA_REQ_SIZE); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1572 | |
| 1573 | //Create the message to be passed to HAL |
| 1574 | msg.type = WDA_START_OEM_DATA_REQ; |
| 1575 | msg.bodyptr = pStartOemDataReq; |
| 1576 | msg.bodyval = 0; |
| 1577 | |
| 1578 | SET_LIM_PROCESS_DEFD_MESGS(pMac, false); |
| 1579 | MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type)); |
| 1580 | |
| 1581 | rc = wdaPostCtrlMsg(pMac, &msg); |
| 1582 | if(rc == eSIR_SUCCESS) |
| 1583 | { |
| 1584 | return; |
| 1585 | } |
| 1586 | |
| 1587 | SET_LIM_PROCESS_DEFD_MESGS(pMac, true); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1588 | vos_mem_free(pStartOemDataReq); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1589 | PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: posting WDA_START_OEM_DATA_REQ to HAL failed"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1590 | |
| 1591 | error: |
| 1592 | pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; |
Varun Reddy Yeturu | e3bbf6e | 2013-02-08 18:50:55 -0800 | [diff] [blame] | 1593 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1594 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1595 | pMlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp)); |
| 1596 | if ( NULL == pMlmOemDataRsp ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1597 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1598 | limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1599 | return; |
| 1600 | } |
| 1601 | |
| 1602 | if(NULL != pMac->lim.gpLimMlmOemDataReq) |
| 1603 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1604 | vos_mem_free(pMac->lim.gpLimMlmOemDataReq); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1605 | pMac->lim.gpLimMlmOemDataReq = NULL; |
| 1606 | } |
| 1607 | |
| 1608 | limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp); |
| 1609 | |
| 1610 | return; |
| 1611 | } |
| 1612 | /** |
| 1613 | * limSetOemDataReqModeFailed() |
| 1614 | * |
| 1615 | * FUNCTION: |
| 1616 | * This function is used as callback to resume link after the suspend fails while |
| 1617 | * starting oem data req mode. |
| 1618 | * LOGIC: |
| 1619 | * NA |
| 1620 | * |
| 1621 | * ASSUMPTIONS: |
| 1622 | * NA |
| 1623 | * |
| 1624 | * NOTE: |
| 1625 | * |
| 1626 | * @param pMac - Pointer to Global MAC structure |
| 1627 | * @return None |
| 1628 | */ |
| 1629 | |
| 1630 | void limSetOemDataReqModeFailed(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data) |
| 1631 | { |
| 1632 | tpLimMlmOemDataRsp pMlmOemDataRsp; |
| 1633 | |
| 1634 | pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; |
Varun Reddy Yeturu | e3bbf6e | 2013-02-08 18:50:55 -0800 | [diff] [blame] | 1635 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1636 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1637 | pMlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp)); |
| 1638 | if ( NULL == pMlmOemDataRsp ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1639 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1640 | limLog(pMac->hHdd, LOGP, FL("OEM_DATA: memory allocation for pMlmOemDataRsp failed under suspend link failure")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1641 | return; |
| 1642 | } |
| 1643 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1644 | if (NULL != pMac->lim.gpLimMlmOemDataReq) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1645 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1646 | vos_mem_free(pMac->lim.gpLimMlmOemDataReq); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1647 | pMac->lim.gpLimMlmOemDataReq = NULL; |
| 1648 | } |
| 1649 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1650 | vos_mem_set(pMlmOemDataRsp, sizeof(tLimMlmOemDataRsp), 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1651 | |
| 1652 | limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp); |
| 1653 | |
| 1654 | return; |
| 1655 | } |
| 1656 | |
| 1657 | /** |
| 1658 | * limSetOemDataReqMode() |
| 1659 | * |
| 1660 | *FUNCTION: |
| 1661 | * This function is called to setup system into OEM DATA REQ mode |
| 1662 | * |
| 1663 | *LOGIC: |
| 1664 | * NA |
| 1665 | * |
| 1666 | *ASSUMPTIONS: |
| 1667 | * NA |
| 1668 | * |
| 1669 | *NOTE: |
| 1670 | * |
| 1671 | * @param pMac - Pointer to Global MAC structure |
| 1672 | * @return None |
| 1673 | */ |
| 1674 | |
| 1675 | void limSetOemDataReqMode(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* data) |
| 1676 | { |
| 1677 | if(status != eHAL_STATUS_SUCCESS) |
| 1678 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1679 | limLog(pMac, LOGE, FL("OEM_DATA: failed in suspend link")); |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 1680 | /* If failed to suspend the link, there is no need |
| 1681 | * to resume link. Return failure. |
| 1682 | */ |
| 1683 | limSetOemDataReqModeFailed(pMac, status, data); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1684 | } |
| 1685 | else |
| 1686 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1687 | PELOGE(limLog(pMac, LOGE, FL("OEM_DATA: Calling limSendHalOemDataReq"));) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1688 | limSendHalOemDataReq(pMac); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1689 | } |
| 1690 | |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 1691 | return; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1692 | } /*** end limSendHalOemDataReq() ***/ |
| 1693 | |
| 1694 | #endif //FEATURE_OEM_DATA_SUPPORT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1695 | |
| 1696 | static void |
| 1697 | mlm_add_sta( |
| 1698 | tpAniSirGlobal pMac, |
| 1699 | tpAddStaParams pSta, |
| 1700 | tANI_U8 *pBssid, |
| 1701 | tANI_U8 htCapable, |
| 1702 | tpPESession psessionEntry) //psessionEntry may required in future |
| 1703 | { |
| 1704 | tANI_U32 val; |
| 1705 | int i; |
| 1706 | |
| 1707 | |
| 1708 | pSta->staType = STA_ENTRY_SELF; // Identifying self |
| 1709 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1710 | vos_mem_copy(pSta->bssId, pBssid, sizeof( tSirMacAddr )); |
| 1711 | vos_mem_copy(pSta->staMac, psessionEntry->selfMacAddr, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1712 | |
| 1713 | /* Configuration related parameters to be changed to support BT-AMP */ |
| 1714 | |
| 1715 | if( eSIR_SUCCESS != wlan_cfgGetInt( pMac, WNI_CFG_LISTEN_INTERVAL, &val )) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1716 | limLog(pMac, LOGP, FL("Couldn't get LISTEN_INTERVAL")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1717 | |
| 1718 | pSta->listenInterval = (tANI_U16) val; |
| 1719 | |
| 1720 | if (eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SHORT_PREAMBLE, &val) ) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1721 | limLog(pMac, LOGP, FL("Couldn't get SHORT_PREAMBLE")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1722 | pSta->shortPreambleSupported = (tANI_U8)val; |
| 1723 | |
| 1724 | pSta->assocId = 0; // Is SMAC OK with this? |
| 1725 | pSta->wmmEnabled = 0; |
| 1726 | pSta->uAPSD = 0; |
| 1727 | pSta->maxSPLen = 0; |
| 1728 | pSta->us32MaxAmpduDuration = 0; |
| 1729 | pSta->maxAmpduSize = 0; // 0: 8k, 1: 16k,2: 32k,3: 64k |
| 1730 | |
| 1731 | |
Gopichand Nakkala | b2d2c31 | 2013-01-04 11:41:02 -0800 | [diff] [blame] | 1732 | /* For Self STA get the LDPC capability from config.ini*/ |
| 1733 | pSta->htLdpcCapable = |
| 1734 | (psessionEntry->txLdpcIniFeatureEnabled & 0x01); |
| 1735 | pSta->vhtLdpcCapable = |
| 1736 | ((psessionEntry->txLdpcIniFeatureEnabled >> 1)& 0x01); |
| 1737 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1738 | if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) |
| 1739 | { |
| 1740 | pSta->htCapable = htCapable; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1741 | pSta->greenFieldCapable = limGetHTCapability( pMac, eHT_GREENFIELD, psessionEntry); |
| 1742 | pSta->txChannelWidthSet = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, psessionEntry ); |
| 1743 | pSta->mimoPS = (tSirMacHTMIMOPowerSaveState)limGetHTCapability( pMac, eHT_MIMO_POWER_SAVE, psessionEntry ); |
| 1744 | pSta->rifsMode = limGetHTCapability( pMac, eHT_RIFS_MODE, psessionEntry ); |
| 1745 | pSta->lsigTxopProtection = limGetHTCapability( pMac, eHT_LSIG_TXOP_PROTECTION, psessionEntry ); |
| 1746 | pSta->delBASupport = limGetHTCapability( pMac, eHT_DELAYED_BA, psessionEntry ); |
| 1747 | pSta->maxAmpduDensity = limGetHTCapability( pMac, eHT_MPDU_DENSITY, psessionEntry ); |
| 1748 | pSta->maxAmsduSize = limGetHTCapability( pMac, eHT_MAX_AMSDU_LENGTH, psessionEntry ); |
| 1749 | pSta->fDsssCckMode40Mhz = limGetHTCapability( pMac, eHT_DSSS_CCK_MODE_40MHZ, psessionEntry); |
| 1750 | pSta->fShortGI20Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_20MHZ, psessionEntry); |
| 1751 | pSta->fShortGI40Mhz = limGetHTCapability( pMac, eHT_SHORT_GI_40MHZ, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1752 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1753 | #ifdef WLAN_FEATURE_11AC |
| 1754 | if (psessionEntry->vhtCapability) |
| 1755 | { |
| 1756 | pSta->vhtCapable = VOS_TRUE; |
Shailender Karmuchi | 08f87c2 | 2013-01-17 12:51:24 -0800 | [diff] [blame] | 1757 | pSta->vhtTxBFCapable = psessionEntry->txBFIniFeatureEnabled; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1758 | } |
| 1759 | #endif |
| 1760 | #ifdef WLAN_FEATURE_11AC |
| 1761 | limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry,NULL); |
| 1762 | #else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1763 | limPopulateOwnRateSet(pMac, &pSta->supportedRates, NULL, false,psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1764 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1765 | limFillSupportedRatesInfo(pMac, NULL, &pSta->supportedRates,psessionEntry); |
| 1766 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1767 | limLog( pMac, LOGE, FL( "GF: %d, ChnlWidth: %d, MimoPS: %d, lsigTXOP: %d, dsssCCK: %d, SGI20: %d, SGI40%d") , |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1768 | pSta->greenFieldCapable, pSta->txChannelWidthSet, pSta->mimoPS, pSta->lsigTxopProtection, |
| 1769 | pSta->fDsssCckMode40Mhz,pSta->fShortGI20Mhz, pSta->fShortGI40Mhz); |
| 1770 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1771 | if (VOS_P2P_GO_MODE == psessionEntry->pePersona) |
| 1772 | { |
| 1773 | pSta->p2pCapableSta = 1; |
| 1774 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1775 | |
| 1776 | //Disable BA. It will be set as part of ADDBA negotiation. |
| 1777 | for( i = 0; i < STACFG_MAX_TC; i++ ) |
| 1778 | { |
| 1779 | pSta->staTCParams[i].txUseBA = eBA_DISABLE; |
| 1780 | pSta->staTCParams[i].rxUseBA = eBA_DISABLE; |
| 1781 | } |
| 1782 | |
| 1783 | } |
| 1784 | |
| 1785 | // |
| 1786 | // New HAL interface - WDA_ADD_BSS_REQ |
| 1787 | // Package WDA_ADD_BSS_REQ to HAL, in order to start a BSS |
| 1788 | // |
| 1789 | tSirResultCodes |
| 1790 | limMlmAddBss ( |
| 1791 | tpAniSirGlobal pMac, |
| 1792 | tLimMlmStartReq *pMlmStartReq, |
| 1793 | tpPESession psessionEntry) |
| 1794 | { |
| 1795 | tSirMsgQ msgQ; |
| 1796 | tpAddBssParams pAddBssParams = NULL; |
| 1797 | tANI_U32 retCode; |
| 1798 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1799 | // Package WDA_ADD_BSS_REQ message parameters |
| 1800 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1801 | pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams )); |
| 1802 | if ( NULL == pAddBssParams ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1803 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1804 | limLog( pMac, LOGE, FL( "Unable to allocate memory during ADD_BSS" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1805 | // Respond to SME with LIM_MLM_START_CNF |
| 1806 | return eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 1807 | } |
| 1808 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1809 | vos_mem_set(pAddBssParams, sizeof(tAddBssParams), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1810 | |
| 1811 | // Fill in tAddBssParams members |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1812 | vos_mem_copy(pAddBssParams->bssId, pMlmStartReq->bssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1813 | sizeof( tSirMacAddr )); |
| 1814 | |
| 1815 | // Fill in tAddBssParams selfMacAddr |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1816 | vos_mem_copy (pAddBssParams->selfMacAddr, |
| 1817 | psessionEntry->selfMacAddr, |
| 1818 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1819 | |
| 1820 | pAddBssParams->bssType = pMlmStartReq->bssType; |
| 1821 | if ((pMlmStartReq->bssType == eSIR_IBSS_MODE) || |
| 1822 | (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE)|| |
| 1823 | (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE)) { |
| 1824 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA; |
| 1825 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1826 | else if (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE){ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1827 | pAddBssParams->operMode = BSS_OPERATIONAL_MODE_AP; |
| 1828 | } |
| 1829 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1830 | pAddBssParams->shortSlotTimeSupported = psessionEntry->shortSlotTimeSupported; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1831 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1832 | pAddBssParams->beaconInterval = pMlmStartReq->beaconPeriod; |
| 1833 | pAddBssParams->dtimPeriod = pMlmStartReq->dtimPeriod; |
| 1834 | pAddBssParams->cfParamSet.cfpCount = pMlmStartReq->cfParamSet.cfpCount; |
| 1835 | pAddBssParams->cfParamSet.cfpPeriod = pMlmStartReq->cfParamSet.cfpPeriod; |
| 1836 | pAddBssParams->cfParamSet.cfpMaxDuration = pMlmStartReq->cfParamSet.cfpMaxDuration; |
| 1837 | pAddBssParams->cfParamSet.cfpDurRemaining = pMlmStartReq->cfParamSet.cfpDurRemaining; |
| 1838 | |
| 1839 | pAddBssParams->rateSet.numRates = pMlmStartReq->rateSet.numRates; |
Abhishek Singh | 70c0eb1 | 2018-06-27 15:28:52 +0530 | [diff] [blame] | 1840 | if (pAddBssParams->rateSet.numRates > SIR_MAC_RATESET_EID_MAX) { |
| 1841 | limLog(pMac, LOGW, |
| 1842 | FL("num of sup rates %d exceeding the limit %d, resetting"), |
| 1843 | pAddBssParams->rateSet.numRates, |
| 1844 | SIR_MAC_RATESET_EID_MAX); |
| 1845 | pAddBssParams->rateSet.numRates = SIR_MAC_RATESET_EID_MAX; |
| 1846 | } |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1847 | vos_mem_copy(pAddBssParams->rateSet.rate, |
lifeng | 62aa8d5 | 2018-08-09 18:38:43 +0800 | [diff] [blame] | 1848 | pMlmStartReq->rateSet.rate, pAddBssParams->rateSet.numRates); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1849 | |
| 1850 | pAddBssParams->nwType = pMlmStartReq->nwType; |
| 1851 | |
| 1852 | pAddBssParams->htCapable = pMlmStartReq->htCapable; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1853 | #ifdef WLAN_FEATURE_11AC |
| 1854 | pAddBssParams->vhtCapable = psessionEntry->vhtCapability; |
| 1855 | pAddBssParams->vhtTxChannelWidthSet = psessionEntry->vhtTxChannelWidthSet; |
| 1856 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1857 | pAddBssParams->htOperMode = pMlmStartReq->htOperMode; |
| 1858 | pAddBssParams->dualCTSProtection = pMlmStartReq->dualCTSProtection; |
| 1859 | pAddBssParams->txChannelWidthSet = pMlmStartReq->txChannelWidthSet; |
| 1860 | |
| 1861 | pAddBssParams->currentOperChannel = pMlmStartReq->channelNumber; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1862 | pAddBssParams->currentExtChannel = pMlmStartReq->cbMode; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1863 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 1864 | #ifdef WLAN_FEATURE_11W |
| 1865 | pAddBssParams->rmfEnabled = psessionEntry->limRmfEnabled; |
| 1866 | #endif |
| 1867 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1868 | /* Update PE sessionId*/ |
| 1869 | pAddBssParams->sessionId = pMlmStartReq->sessionId; |
| 1870 | |
| 1871 | //Send the SSID to HAL to enable SSID matching for IBSS |
Abhishek Singh | 70c0eb1 | 2018-06-27 15:28:52 +0530 | [diff] [blame] | 1872 | pAddBssParams->ssId.length = pMlmStartReq->ssId.length; |
| 1873 | if (pAddBssParams->ssId.length > SIR_MAC_MAX_SSID_LENGTH) { |
| 1874 | limLog(pMac, LOGE, |
| 1875 | FL("Invalid ssid length %d, max length allowed %d"), |
| 1876 | pAddBssParams->ssId.length, |
| 1877 | SIR_MAC_MAX_SSID_LENGTH); |
| 1878 | vos_mem_free(pAddBssParams); |
| 1879 | return eSIR_SME_INVALID_PARAMETERS; |
| 1880 | } |
| 1881 | vos_mem_copy(pAddBssParams->ssId.ssId, |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1882 | pMlmStartReq->ssId.ssId, |
lifeng | 62aa8d5 | 2018-08-09 18:38:43 +0800 | [diff] [blame] | 1883 | pAddBssParams->ssId.length); |
Abhishek Singh | 70c0eb1 | 2018-06-27 15:28:52 +0530 | [diff] [blame] | 1884 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1885 | pAddBssParams->bHiddenSSIDEn = pMlmStartReq->ssidHidden; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1886 | limLog( pMac, LOGE, FL( "TRYING TO HIDE SSID %d" ),pAddBssParams->bHiddenSSIDEn); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1887 | // CR309183. Disable Proxy Probe Rsp. Host handles Probe Requests. Until FW fixed. |
| 1888 | pAddBssParams->bProxyProbeRespEn = 0; |
| 1889 | pAddBssParams->obssProtEnabled = pMlmStartReq->obssProtEnabled; |
| 1890 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1891 | #if defined WLAN_FEATURE_VOWIFI |
| 1892 | pAddBssParams->maxTxPower = psessionEntry->maxTxPower; |
| 1893 | #endif |
| 1894 | mlm_add_sta(pMac, &pAddBssParams->staContext, |
| 1895 | pAddBssParams->bssId, pAddBssParams->htCapable,psessionEntry); |
| 1896 | |
| 1897 | pAddBssParams->status = eHAL_STATUS_SUCCESS; |
| 1898 | pAddBssParams->respReqd = 1; |
| 1899 | |
| 1900 | // Set a new state for MLME |
| 1901 | psessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1902 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1903 | |
| 1904 | pAddBssParams->halPersona=psessionEntry->pePersona; //pass on the session persona to hal |
| 1905 | |
| 1906 | pAddBssParams->bSpectrumMgtEnabled = psessionEntry->spectrumMgtEnabled; |
| 1907 | |
| 1908 | #if defined WLAN_FEATURE_VOWIFI_11R |
| 1909 | pAddBssParams->extSetStaKeyParamValid = 0; |
| 1910 | #endif |
| 1911 | |
| 1912 | // |
| 1913 | // FIXME_GEN4 |
| 1914 | // A global counter (dialog token) is required to keep track of |
| 1915 | // all PE <-> HAL communication(s) |
| 1916 | // |
| 1917 | msgQ.type = WDA_ADD_BSS_REQ; |
| 1918 | msgQ.reserved = 0; |
| 1919 | msgQ.bodyptr = pAddBssParams; |
| 1920 | msgQ.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1921 | MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1922 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1923 | limLog( pMac, LOGW, FL( "Sending WDA_ADD_BSS_REQ..." )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1924 | if( eSIR_SUCCESS != (retCode = wdaPostCtrlMsg( pMac, &msgQ ))) |
| 1925 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1926 | limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"), retCode ); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 1927 | vos_mem_free(pAddBssParams); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1928 | return eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 1929 | } |
| 1930 | |
| 1931 | return eSIR_SME_SUCCESS; |
| 1932 | } |
| 1933 | |
| 1934 | |
| 1935 | /** |
| 1936 | * limProcessMlmStartReq() |
| 1937 | * |
| 1938 | *FUNCTION: |
| 1939 | * This function is called to process MLM_START_REQ message |
| 1940 | * from SME |
| 1941 | * |
| 1942 | *LOGIC: |
| 1943 | * 1) MLME receives LIM_MLM_START_REQ from LIM |
| 1944 | * 2) MLME sends WDA_ADD_BSS_REQ to HAL |
| 1945 | * 3) MLME changes state to eLIM_MLM_WT_ADD_BSS_RSP_STATE |
| 1946 | * MLME now waits for HAL to send WDA_ADD_BSS_RSP |
| 1947 | * |
| 1948 | *ASSUMPTIONS: |
| 1949 | * |
| 1950 | *NOTE: |
| 1951 | * |
| 1952 | * @param pMac Pointer to Global MAC structure |
| 1953 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 1954 | * @return None |
| 1955 | */ |
| 1956 | |
| 1957 | static void |
| 1958 | limProcessMlmStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1959 | { |
| 1960 | tLimMlmStartReq *pMlmStartReq; |
| 1961 | tLimMlmStartCnf mlmStartCnf; |
| 1962 | tpPESession psessionEntry = NULL; |
| 1963 | |
| 1964 | if(pMsgBuf == NULL) |
| 1965 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1966 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1967 | return; |
| 1968 | } |
| 1969 | |
| 1970 | pMlmStartReq = (tLimMlmStartReq *) pMsgBuf; |
| 1971 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmStartReq->sessionId))==NULL) |
| 1972 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1973 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1974 | mlmStartCnf.resultCode = eSIR_SME_REFUSED; |
| 1975 | goto end; |
| 1976 | } |
| 1977 | |
| 1978 | if (psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE) |
| 1979 | { |
| 1980 | /** |
| 1981 | * Should not have received Start req in states other than idle. |
| 1982 | * Return Start confirm with failure code. |
| 1983 | */ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1984 | PELOGE(limLog(pMac, LOGE, FL("received unexpected MLM_START_REQ in state %X"),psessionEntry->limMlmState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1985 | limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState); |
| 1986 | mlmStartCnf.resultCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED; |
| 1987 | goto end; |
| 1988 | } |
| 1989 | |
| 1990 | #if 0 |
| 1991 | if (cfgSetInt(pMac, WNI_CFG_CURRENT_CHANNEL, pMlmStartReq->channelNumber)!= eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 1992 | limLog(pMac, LOGP, FL("could not set CURRENT_CHANNEL at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1993 | |
| 1994 | pMac->lim.gLimCurrentChannelId = pMlmStartReq->channelNumber; |
| 1995 | #endif //TO SUPPORT BT-AMP |
| 1996 | |
| 1997 | |
| 1998 | // Update BSSID & SSID at CFG database |
| 1999 | #if 0 //We are not using the BSSID and SSID from the config file, instead we are reading form the session table |
| 2000 | if (cfgSetStr(pMac, WNI_CFG_BSSID, (tANI_U8 *) pMlmStartReq->bssId, sizeof(tSirMacAddr)) |
| 2001 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2002 | limLog(pMac, LOGP, FL("could not update BSSID at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2003 | |
| 2004 | |
| 2005 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2006 | vos_mem_copy( pMac->lim.gLimCurrentBssId, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2007 | pMlmStartReq->bssId, |
| 2008 | sizeof(tSirMacAddr)); |
| 2009 | #endif //TO SUPPORT BT-AMP |
| 2010 | |
| 2011 | #if 0 |
| 2012 | if (cfgSetStr(pMac, WNI_CFG_SSID, (tANI_U8 *) &pMlmStartReq->ssId.ssId, pMlmStartReq->ssId.length) |
| 2013 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2014 | limLog(pMac, LOGP, FL("could not update SSID at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2015 | #endif //To SUPPORT BT-AMP |
| 2016 | |
| 2017 | |
| 2018 | // pMac->lim.gLimCurrentSSID.length = pMlmStartReq->ssId.length; |
| 2019 | |
| 2020 | #if 0 |
| 2021 | if (cfgSetStr(pMac, WNI_CFG_OPERATIONAL_RATE_SET, |
| 2022 | (tANI_U8 *) &pMac->lim.gpLimStartBssReq->operationalRateSet.rate, |
| 2023 | pMac->lim.gpLimStartBssReq->operationalRateSet.numRates) |
| 2024 | != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2025 | limLog(pMac, LOGP, FL("could not update Operational Rateset at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2026 | #endif //TO SUPPORT BT-AMP |
| 2027 | |
| 2028 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2029 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2030 | #if 0 // Periodic timer for remove WPS PBC proble response entry in PE is disbaled now. |
| 2031 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 2032 | { |
| 2033 | if(pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated == eANI_BOOLEAN_FALSE) |
| 2034 | { |
| 2035 | if (tx_timer_create(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer, |
| 2036 | "PS OVERLAP Timer", |
| 2037 | limWPSOverlapTimerHandler, |
| 2038 | SIR_LIM_WPS_OVERLAP_TIMEOUT, // expiration_input |
| 2039 | SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // initial_ticks |
| 2040 | SYS_MS_TO_TICKS(LIM_WPS_OVERLAP_TIMER_MS), // reschedule_ticks |
| 2041 | TX_AUTO_ACTIVATE /* TX_NO_ACTIVATE*/) != TX_SUCCESS) |
| 2042 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2043 | limLog(pMac, LOGP, FL("failed to create WPS overlap Timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2044 | } |
| 2045 | |
| 2046 | pMac->lim.limTimers.gLimWPSOverlapTimerObj.sessionId = pMlmStartReq->sessionId; |
| 2047 | pMac->lim.limTimers.gLimWPSOverlapTimerObj.isTimerCreated = eANI_BOOLEAN_TRUE; |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2048 | limLog(pMac, LOGE, FL("Create WPS overlap Timer, session=%d"), pMlmStartReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2049 | |
| 2050 | if (tx_timer_activate(&pMac->lim.limTimers.gLimWPSOverlapTimerObj.gLimWPSOverlapTimer) != TX_SUCCESS) |
| 2051 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2052 | limLog(pMac, LOGP, FL("tx_timer_activate failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2053 | } |
| 2054 | } |
| 2055 | } |
| 2056 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2057 | |
| 2058 | |
| 2059 | |
| 2060 | mlmStartCnf.resultCode = limMlmAddBss(pMac, pMlmStartReq,psessionEntry); |
| 2061 | |
| 2062 | end: |
| 2063 | /* Update PE session Id */ |
| 2064 | mlmStartCnf.sessionId = pMlmStartReq->sessionId; |
| 2065 | |
| 2066 | /// Free up buffer allocated for LimMlmScanReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2067 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2068 | |
| 2069 | // |
| 2070 | // Respond immediately to LIM, only if MLME has not been |
| 2071 | // successfully able to send WDA_ADD_BSS_REQ to HAL. |
| 2072 | // Else, LIM_MLM_START_CNF will be sent after receiving |
| 2073 | // WDA_ADD_BSS_RSP from HAL |
| 2074 | // |
| 2075 | if( eSIR_SME_SUCCESS != mlmStartCnf.resultCode ) |
| 2076 | limPostSmeMessage(pMac, LIM_MLM_START_CNF, (tANI_U32 *) &mlmStartCnf); |
| 2077 | } /*** limProcessMlmStartReq() ***/ |
| 2078 | |
| 2079 | |
| 2080 | /* |
| 2081 | * This function checks if Scan is allowed or not. |
| 2082 | * It checks each session and if any session is not in the normal state, |
| 2083 | * it will return false. |
| 2084 | * Note: BTAMP_STA can be in LINK_EST as well as BSS_STARTED State, so |
| 2085 | * both cases are handled below. |
| 2086 | */ |
| 2087 | |
| 2088 | static tANI_U8 __limMlmScanAllowed(tpAniSirGlobal pMac) |
| 2089 | { |
| 2090 | int i; |
| 2091 | |
Jeff Johnson | 43971f5 | 2012-07-17 12:26:56 -0700 | [diff] [blame] | 2092 | if(pMac->lim.gLimMlmState != eLIM_MLM_IDLE_STATE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2093 | { |
| 2094 | return FALSE; |
| 2095 | } |
| 2096 | for(i =0; i < pMac->lim.maxBssId; i++) |
| 2097 | { |
| 2098 | if(pMac->lim.gpSession[i].valid == TRUE) |
| 2099 | { |
| 2100 | if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) || |
| 2101 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&& |
| 2102 | (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE) )|| |
| 2103 | |
| 2104 | ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)|| |
| 2105 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)|| |
| 2106 | (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&& |
| 2107 | (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2108 | || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE) |
| 2109 | && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) ) |
| 2110 | || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) ) |
| 2111 | && (pMac->lim.gpSession[i].limMlmState == eLIM_MLM_BSS_STARTED_STATE) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2112 | )) |
| 2113 | { |
| 2114 | return FALSE; |
| 2115 | |
| 2116 | } |
| 2117 | } |
| 2118 | } |
| 2119 | |
| 2120 | return TRUE; |
| 2121 | } |
| 2122 | |
| 2123 | |
| 2124 | |
| 2125 | /** |
| 2126 | * limProcessMlmScanReq() |
| 2127 | * |
| 2128 | *FUNCTION: |
| 2129 | * This function is called to process MLM_SCAN_REQ message |
| 2130 | * from SME |
| 2131 | * |
| 2132 | *LOGIC: |
| 2133 | * |
| 2134 | *ASSUMPTIONS: |
| 2135 | * |
| 2136 | *NOTE: |
| 2137 | * |
| 2138 | * @param pMac Pointer to Global MAC structure |
| 2139 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 2140 | * @return None |
| 2141 | */ |
| 2142 | |
| 2143 | static void |
| 2144 | limProcessMlmScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2145 | { |
| 2146 | tLimMlmScanCnf mlmScanCnf; |
Maleka Vinay | d500cd4 | 2012-12-10 12:37:09 -0800 | [diff] [blame] | 2147 | tANI_U8 i = 0; |
| 2148 | tANI_U32 val = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2149 | |
| 2150 | if (pMac->lim.gLimSystemInScanLearnMode) |
| 2151 | { |
| 2152 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2153 | FL("Sending START_SCAN from LIM while one req is pending"));) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2154 | vos_mem_free(pMsgBuf); |
Madan Mohan Koyyalamudi | d4b301b | 2012-10-11 14:15:54 -0700 | [diff] [blame] | 2155 | /*Send back a failure*/ |
| 2156 | mlmScanCnf.resultCode = eSIR_SME_SCAN_FAILED; |
| 2157 | mlmScanCnf.scanResultLength = 0; |
| 2158 | limPostSmeMessage(pMac, |
| 2159 | LIM_MLM_SCAN_CNF, |
| 2160 | (tANI_U32 *) &mlmScanCnf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2161 | return; |
| 2162 | } |
| 2163 | |
| 2164 | if(__limMlmScanAllowed(pMac) && |
| 2165 | (((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels != 0)) |
| 2166 | |
| 2167 | { |
| 2168 | /// Hold onto SCAN REQ criteria |
| 2169 | pMac->lim.gpLimMlmScanReq = (tLimMlmScanReq *) pMsgBuf; |
| 2170 | |
Abhishek Singh | 127a844 | 2014-12-15 17:31:27 +0530 | [diff] [blame] | 2171 | limLog(pMac, LOG1, FL("Number of channels to scan are %d "), |
| 2172 | pMac->lim.gpLimMlmScanReq->channelList.numChannels); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2173 | |
| 2174 | pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState; |
| 2175 | |
| 2176 | if (pMac->lim.gpLimMlmScanReq->scanType == eSIR_ACTIVE_SCAN) |
| 2177 | pMac->lim.gLimMlmState = eLIM_MLM_WT_PROBE_RESP_STATE; |
| 2178 | else // eSIR_PASSIVE_SCAN |
| 2179 | pMac->lim.gLimMlmState = eLIM_MLM_PASSIVE_SCAN_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2180 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2181 | |
| 2182 | pMac->lim.gLimSystemInScanLearnMode = 1; |
| 2183 | |
Maleka Vinay | d500cd4 | 2012-12-10 12:37:09 -0800 | [diff] [blame] | 2184 | /* temporary fix to handle case where NOA duration calculation is incorrect |
| 2185 | * for scanning on DFS channels */ |
| 2186 | |
| 2187 | pMac->lim.gTotalScanDuration = 0; |
| 2188 | |
| 2189 | if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS) |
| 2190 | { |
| 2191 | /* |
| 2192 | * Could not get max channel value |
| 2193 | * from CFG. Log error. |
| 2194 | */ |
Abhishek Singh | 95f7b25 | 2015-10-14 14:15:35 +0530 | [diff] [blame] | 2195 | limLog(pMac, LOGP, |
| 2196 | FL("could not retrieve passive max channel value use def")); |
| 2197 | /* use a default value */ |
| 2198 | val= WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME_STADEF; |
Maleka Vinay | d500cd4 | 2012-12-10 12:37:09 -0800 | [diff] [blame] | 2199 | } |
| 2200 | |
| 2201 | for (i = 0; i < pMac->lim.gpLimMlmScanReq->channelList.numChannels; i++) { |
| 2202 | tANI_U8 channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[i]; |
| 2203 | |
Ganesh Kondabattini | 8f6e3b3 | 2014-08-25 16:07:54 +0530 | [diff] [blame] | 2204 | if (pMac->miracast_mode) { |
| 2205 | pMac->lim.gTotalScanDuration += (DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST + |
| 2206 | DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST); |
| 2207 | } else if (limActiveScanAllowed(pMac, channelNum)) { |
Maleka Vinay | d500cd4 | 2012-12-10 12:37:09 -0800 | [diff] [blame] | 2208 | /* Use min + max channel time to calculate the total duration of scan */ |
| 2209 | pMac->lim.gTotalScanDuration += pMac->lim.gpLimMlmScanReq->minChannelTime + pMac->lim.gpLimMlmScanReq->maxChannelTime; |
| 2210 | } else { |
| 2211 | /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in |
| 2212 | * void limContinuePostChannelScan(tpAniSirGlobal pMac) |
| 2213 | */ |
| 2214 | pMac->lim.gTotalScanDuration += val; |
| 2215 | } |
| 2216 | } |
| 2217 | |
| 2218 | /* Adding an overhead of 5ms to account for the scan messaging delays */ |
| 2219 | pMac->lim.gTotalScanDuration += 5; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2220 | limSetScanMode(pMac); |
| 2221 | } |
| 2222 | else |
| 2223 | { |
| 2224 | /** |
| 2225 | * Should not have received SCAN req in other states |
| 2226 | * OR should not have received LIM_MLM_SCAN_REQ with |
| 2227 | * zero number of channels |
| 2228 | * Log error |
| 2229 | */ |
| 2230 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2231 | FL("received unexpected MLM_SCAN_REQ in state %d OR zero number of channels: %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2232 | pMac->lim.gLimMlmState, ((tLimMlmScanReq *) pMsgBuf)->channelList.numChannels); |
| 2233 | limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState); |
| 2234 | |
| 2235 | /// Free up buffer allocated for |
| 2236 | /// pMac->lim.gLimMlmScanReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2237 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2238 | |
| 2239 | /// Return Scan confirm with INVALID_PARAMETERS |
| 2240 | |
| 2241 | mlmScanCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2242 | mlmScanCnf.scanResultLength = 0; |
| 2243 | limPostSmeMessage(pMac, |
| 2244 | LIM_MLM_SCAN_CNF, |
| 2245 | (tANI_U32 *) &mlmScanCnf); |
| 2246 | } |
| 2247 | } /*** limProcessMlmScanReq() ***/ |
| 2248 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2249 | #ifdef FEATURE_OEM_DATA_SUPPORT |
| 2250 | static void limProcessMlmOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2251 | { |
| 2252 | tLimMlmOemDataRsp* pMlmOemDataRsp; |
| 2253 | |
| 2254 | if (((pMac->lim.gLimMlmState == eLIM_MLM_IDLE_STATE) || |
| 2255 | (pMac->lim.gLimMlmState == eLIM_MLM_JOINED_STATE) || |
| 2256 | (pMac->lim.gLimMlmState == eLIM_MLM_AUTHENTICATED_STATE) || |
| 2257 | (pMac->lim.gLimMlmState == eLIM_MLM_BSS_STARTED_STATE) || |
| 2258 | (pMac->lim.gLimMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE))) |
| 2259 | { |
| 2260 | //Hold onto the oem data request criteria |
| 2261 | pMac->lim.gpLimMlmOemDataReq = (tLimMlmOemDataReq*)pMsgBuf; |
| 2262 | |
| 2263 | pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState; |
| 2264 | |
| 2265 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
| 2266 | |
| 2267 | //Now request for link suspension |
| 2268 | limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, limSetOemDataReqMode, NULL); |
| 2269 | } |
| 2270 | else |
| 2271 | { |
| 2272 | /** |
| 2273 | * Should not have received oem data req in other states |
| 2274 | * Log error |
| 2275 | */ |
| 2276 | |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2277 | PELOGW(limLog(pMac, LOGW, FL("OEM_DATA: unexpected LIM_MLM_OEM_DATA_REQ in invalid state %d"),pMac->lim.gLimMlmState);) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2278 | |
| 2279 | limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState); |
| 2280 | |
| 2281 | /// Free up buffer allocated |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2282 | vos_mem_free(pMsgBuf); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2283 | |
| 2284 | /// Return Meas confirm with INVALID_PARAMETERS |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2285 | pMlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp)); |
| 2286 | if ( pMlmOemDataRsp != NULL) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2287 | { |
| 2288 | limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)pMlmOemDataRsp); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2289 | vos_mem_free(pMlmOemDataRsp); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2290 | } |
| 2291 | else |
| 2292 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2293 | limLog(pMac, LOGP, FL("Could not allocate memory for pMlmOemDataRsp")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2294 | return; |
| 2295 | } |
| 2296 | } |
| 2297 | |
| 2298 | return; |
| 2299 | } |
| 2300 | #endif //FEATURE_OEM_DATA_SUPPORT |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2301 | |
| 2302 | |
| 2303 | /** |
| 2304 | * limProcessMlmPostJoinSuspendLink() |
| 2305 | * |
| 2306 | *FUNCTION: |
| 2307 | * This function is called after the suspend link while joining |
| 2308 | * off channel. |
| 2309 | * |
| 2310 | *LOGIC: |
| 2311 | * Check for suspend state. |
| 2312 | * If success, proceed with setting link state to recieve the |
| 2313 | * probe response/beacon from intended AP. |
| 2314 | * Switch to the APs channel. |
| 2315 | * On an error case, send the MLM_JOIN_CNF with error status. |
| 2316 | * |
| 2317 | *ASSUMPTIONS: |
| 2318 | * |
| 2319 | *NOTE: |
| 2320 | * |
| 2321 | * @param pMac Pointer to Global MAC structure |
| 2322 | * @param status status of suspend link. |
| 2323 | * @param ctx passed while calling suspend link(psessionEntry) |
| 2324 | * @return None |
| 2325 | */ |
| 2326 | static void |
| 2327 | limProcessMlmPostJoinSuspendLink(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *ctx) |
| 2328 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2329 | tANI_U8 chanNum, secChanOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2330 | tLimMlmJoinCnf mlmJoinCnf; |
| 2331 | tpPESession psessionEntry = (tpPESession)ctx; |
| 2332 | tSirLinkState linkState; |
| 2333 | |
| 2334 | if( eHAL_STATUS_SUCCESS != status ) |
| 2335 | { |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 2336 | limLog(pMac, LOGE, FL("Sessionid %d Suspend link(NOTIFY_BSS) failed. " |
| 2337 | "still proceeding with join"),psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2338 | } |
| 2339 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 2340 | psessionEntry->limMlmState = eLIM_MLM_WT_JOIN_BEACON_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2341 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2342 | |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 2343 | limLog(pMac, LOG1, FL("Sessionid %d prev lim state %d new lim state %d " |
| 2344 | "systemrole = %d"), psessionEntry->peSessionId, |
| 2345 | psessionEntry->limPrevMlmState, |
| 2346 | psessionEntry->limMlmState,psessionEntry->limSystemRole); |
| 2347 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2348 | limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER); |
| 2349 | |
| 2350 | //assign appropriate sessionId to the timer object |
| 2351 | pMac->lim.limTimers.gLimJoinFailureTimer.sessionId = psessionEntry->peSessionId; |
| 2352 | |
| 2353 | linkState = ((psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ? eSIR_LINK_BTAMP_PREASSOC_STATE : eSIR_LINK_PREASSOC_STATE); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2354 | limLog(pMac, LOG1, FL("[limProcessMlmJoinReq]: linkState:%d"),linkState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2355 | |
| 2356 | if (limSetLinkState(pMac, linkState, |
| 2357 | psessionEntry->pLimMlmJoinReq->bssDescription.bssId, |
| 2358 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS ) |
| 2359 | { |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2360 | limLog(pMac, LOGE, |
| 2361 | FL("SessionId:%d limSetLinkState to eSIR_LINK_PREASSOC_STATE" |
| 2362 | " Failed!!"),psessionEntry->peSessionId); |
| 2363 | limPrintMacAddr(pMac, |
| 2364 | psessionEntry->pLimMlmJoinReq->bssDescription.bssId,LOGE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2365 | mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2366 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
| 2367 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2368 | goto error; |
| 2369 | } |
| 2370 | |
| 2371 | /** Derive channel from BSS description and store it in the CFG */ |
| 2372 | // chanNum = pMac->lim.gpLimMlmJoinReq->bssDescription.channelId; |
| 2373 | |
| 2374 | chanNum = psessionEntry->currentOperChannel; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2375 | secChanOffset = psessionEntry->htSecondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2376 | //store the channel switch sessionEntry in the lim global var |
| 2377 | psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_JOIN; |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2378 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 2379 | psessionEntry->pLimMlmReassocRetryReq = NULL; |
| 2380 | #endif |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 2381 | |
| 2382 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2383 | limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT, |
| 2384 | psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_JOIN); |
| 2385 | #endif |
| 2386 | |
Dino Mycle | a7f1845 | 2014-04-24 08:55:31 +0530 | [diff] [blame] | 2387 | limLog(pMac, LOG1, FL("[limProcessMlmJoinReq]: suspend link success(%d) " |
| 2388 | "on sessionid: %d setting channel to: %d with secChanOffset:%d " |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 2389 | "and maxtxPower: %d"), status, psessionEntry->peSessionId, |
| 2390 | chanNum, secChanOffset, psessionEntry->maxTxPower); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2391 | limSetChannel(pMac, chanNum, secChanOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2392 | |
| 2393 | return; |
| 2394 | error: |
| 2395 | mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2396 | mlmJoinCnf.sessionId = psessionEntry->peSessionId; |
| 2397 | mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2398 | limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf); |
| 2399 | |
| 2400 | } |
| 2401 | |
| 2402 | |
| 2403 | |
| 2404 | /** |
| 2405 | * limProcessMlmJoinReq() |
| 2406 | * |
| 2407 | *FUNCTION: |
| 2408 | * This function is called to process MLM_JOIN_REQ message |
| 2409 | * from SME |
| 2410 | * |
| 2411 | *LOGIC: |
| 2412 | * 1) Initialize LIM, HAL, DPH |
| 2413 | * 2) Configure the BSS for which the JOIN REQ was received |
| 2414 | * a) Send WDA_ADD_BSS_REQ to HAL - |
| 2415 | * This will identify the BSS that we are interested in |
| 2416 | * --AND-- |
| 2417 | * Add a STA entry for the AP (in a STA context) |
| 2418 | * b) Wait for WDA_ADD_BSS_RSP |
| 2419 | * c) Send WDA_ADD_STA_REQ to HAL |
| 2420 | * This will add the "local STA" entry to the STA table |
| 2421 | * 3) Continue as before, i.e, |
| 2422 | * a) Send a PROBE REQ |
| 2423 | * b) Wait for PROBE RSP/BEACON containing the SSID that |
| 2424 | * we are interested in |
| 2425 | * c) Then start an AUTH seq |
| 2426 | * d) Followed by the ASSOC seq |
| 2427 | * |
| 2428 | *ASSUMPTIONS: |
| 2429 | * |
| 2430 | *NOTE: |
| 2431 | * |
| 2432 | * @param pMac Pointer to Global MAC structure |
| 2433 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 2434 | * @return None |
| 2435 | */ |
| 2436 | |
| 2437 | static void |
| 2438 | limProcessMlmJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2439 | { |
| 2440 | tLimMlmJoinCnf mlmJoinCnf; |
| 2441 | tANI_U8 sessionId; |
| 2442 | tpPESession psessionEntry; |
| 2443 | |
| 2444 | sessionId = ((tpLimMlmJoinReq)pMsgBuf)->sessionId; |
| 2445 | |
| 2446 | if((psessionEntry = peFindSessionBySessionId(pMac,sessionId))== NULL) |
| 2447 | { |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2448 | limLog(pMac, LOGE, FL("SessionId:%d session does not exist"),sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2449 | goto error; |
| 2450 | } |
| 2451 | |
| 2452 | if (( (psessionEntry->limSystemRole != eLIM_AP_ROLE ) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE )) && |
| 2453 | ( (psessionEntry->limMlmState == eLIM_MLM_IDLE_STATE) || |
| 2454 | (psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE)) && |
| 2455 | (SIR_MAC_GET_ESS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo) != |
| 2456 | SIR_MAC_GET_IBSS( ((tpLimMlmJoinReq) pMsgBuf)->bssDescription.capabilityInfo))) |
| 2457 | { |
| 2458 | #if 0 |
| 2459 | if (pMac->lim.gpLimMlmJoinReq) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2460 | vos_mem_free(pMac->lim.gpLimMlmJoinReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2461 | #endif //TO SUPPORT BT-AMP , review 23sep |
| 2462 | |
| 2463 | /// Hold onto Join request parameters |
| 2464 | |
| 2465 | psessionEntry->pLimMlmJoinReq =(tpLimMlmJoinReq) pMsgBuf; |
| 2466 | |
| 2467 | if( isLimSessionOffChannel(pMac, sessionId) ) |
| 2468 | { |
| 2469 | //suspend link |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 2470 | limLog(pMac, LOG1, FL("Suspend link as LimSession on sessionid %d" |
| 2471 | "is off channel"),sessionId); |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 2472 | if (limIsLinkSuspended(pMac)) |
| 2473 | { |
| 2474 | limLog(pMac, LOGE, FL("Link is already suspended for some other" |
| 2475 | " reason. Return failure on sessionId:%d"), sessionId); |
| 2476 | goto error; |
| 2477 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2478 | limSuspendLink(pMac, eSIR_DONT_CHECK_LINK_TRAFFIC_BEFORE_SCAN, |
| 2479 | limProcessMlmPostJoinSuspendLink, (tANI_U32*)psessionEntry ); |
| 2480 | } |
| 2481 | else |
| 2482 | { |
| 2483 | //No need to suspend link. |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2484 | limLog(pMac,LOG1,"SessionId:%d Join request on current channel", |
| 2485 | sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2486 | limProcessMlmPostJoinSuspendLink( pMac, eHAL_STATUS_SUCCESS, |
| 2487 | (tANI_U32*) psessionEntry ); |
| 2488 | } |
| 2489 | |
| 2490 | return; |
| 2491 | } |
| 2492 | else |
| 2493 | { |
| 2494 | /** |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 2495 | * Should not have received JOIN req in states other than |
| 2496 | * Idle state or on AP. |
| 2497 | * Return join confirm with invalid parameters code. |
| 2498 | */ |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2499 | limLog(pMac, LOGE, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2500 | FL("SessionId:%d Unexpected Join request for role %d state %d "), |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2501 | psessionEntry->peSessionId,psessionEntry->limSystemRole, |
| 2502 | psessionEntry->limMlmState); |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 2503 | limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2504 | } |
| 2505 | |
| 2506 | error: |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 2507 | vos_mem_free(pMsgBuf); |
| 2508 | if (psessionEntry != NULL) |
| 2509 | psessionEntry->pLimMlmJoinReq = NULL; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2510 | |
Kanchanapally, Vidyullatha | 3557087 | 2015-03-18 17:26:57 +0530 | [diff] [blame] | 2511 | mlmJoinCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 2512 | mlmJoinCnf.sessionId = sessionId; |
| 2513 | mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2514 | limPostSmeMessage(pMac, LIM_MLM_JOIN_CNF, (tANI_U32 *) &mlmJoinCnf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2515 | } /*** limProcessMlmJoinReq() ***/ |
| 2516 | |
Abhinav Kumar | d6d8dd2 | 2019-08-05 12:38:50 +0530 | [diff] [blame] | 2517 | #ifdef WLAN_FEATURE_SAE |
| 2518 | /** |
| 2519 | * lim_process_mlm_auth_req_sae() - Handle SAE authentication |
| 2520 | * @mac_ctx: global MAC context |
| 2521 | * @session: PE session entry |
| 2522 | * |
| 2523 | * This function is called by lim_process_mlm_auth_req to handle SAE |
| 2524 | * authentication. |
| 2525 | * |
| 2526 | * Return: tSirRetStatus |
| 2527 | */ |
| 2528 | static VOS_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx, |
| 2529 | tpPESession session) |
| 2530 | { |
| 2531 | VOS_STATUS status = VOS_STATUS_SUCCESS; |
| 2532 | struct sir_sae_info *sae_info; |
| 2533 | vos_msg_t msg; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2534 | |
Abhinav Kumar | d6d8dd2 | 2019-08-05 12:38:50 +0530 | [diff] [blame] | 2535 | sae_info = vos_mem_malloc(sizeof(*sae_info)); |
| 2536 | if (sae_info == NULL) { |
| 2537 | limLog(mac_ctx, LOGP, FL("Memory allocation failed")); |
| 2538 | return VOS_STATUS_E_FAILURE; |
| 2539 | } |
| 2540 | |
| 2541 | sae_info->msg_type = eWNI_SME_TRIGGER_SAE; |
| 2542 | sae_info->msg_len = sizeof(*sae_info); |
| 2543 | sae_info->vdev_id = session->smeSessionId; |
| 2544 | |
| 2545 | vos_mem_copy(sae_info->peer_mac_addr.bytes, session->bssId, |
| 2546 | VOS_MAC_ADDR_SIZE); |
| 2547 | |
| 2548 | sae_info->ssid.length = session->ssId.length; |
| 2549 | vos_mem_copy(sae_info->ssid.ssId, session->ssId.ssId, |
| 2550 | session->ssId.length); |
| 2551 | limLog(mac_ctx, LOG1, FL("vdev_id %d ssid %.*s "MAC_ADDRESS_STR""), |
| 2552 | sae_info->vdev_id, sae_info->ssid.length,sae_info->ssid.ssId, |
| 2553 | MAC_ADDR_ARRAY(sae_info->peer_mac_addr.bytes)); |
| 2554 | |
| 2555 | msg.type = eWNI_SME_TRIGGER_SAE; |
| 2556 | msg.bodyptr = sae_info; |
| 2557 | msg.bodyval = 0; |
| 2558 | |
| 2559 | if (VOS_STATUS_SUCCESS != vos_mq_post_message(VOS_MQ_ID_SME, &msg)) |
| 2560 | { |
Abhinav Kumar | 626f865 | 2019-08-05 16:20:39 +0530 | [diff] [blame] | 2561 | limLog(mac_ctx, LOGE, FL("%s failed to post msg to self "), |
Abhinav Kumar | d6d8dd2 | 2019-08-05 12:38:50 +0530 | [diff] [blame] | 2562 | __func__); |
| 2563 | vos_mem_free((void *)sae_info); |
| 2564 | status = VOS_STATUS_E_FAILURE; |
| 2565 | } |
| 2566 | |
| 2567 | session->limMlmState = eLIM_MLM_WT_SAE_AUTH_STATE; |
| 2568 | |
| 2569 | MTRACE(macTrace(mac_ctx, TRACE_CODE_MLM_STATE, session->peSessionId, |
| 2570 | session->limMlmState)); |
| 2571 | |
Abhinav Kumar | 626f865 | 2019-08-05 16:20:39 +0530 | [diff] [blame] | 2572 | mac_ctx->lim.limTimers.sae_auth_timer.sessionId = session->peSessionId; |
| 2573 | /* Activate SAE auth timer */ |
| 2574 | MTRACE(macTrace(mac_ctx, TRACE_CODE_TIMER_ACTIVATE, |
| 2575 | session->peSessionId, eLIM_AUTH_SAE_TIMER)); |
| 2576 | if (tx_timer_activate(&mac_ctx->lim.limTimers.sae_auth_timer) |
| 2577 | != TX_SUCCESS) { |
| 2578 | limLog(mac_ctx, LOGE, FL("could not start Auth SAE timer")); |
| 2579 | } |
| 2580 | |
Abhinav Kumar | d6d8dd2 | 2019-08-05 12:38:50 +0530 | [diff] [blame] | 2581 | return status; |
| 2582 | } |
| 2583 | #else |
| 2584 | static VOS_STATUS lim_process_mlm_auth_req_sae(tpAniSirGlobal mac_ctx, |
| 2585 | tpPESession session) |
| 2586 | { |
| 2587 | return VOS_STATUS_E_NOSUPPORT; |
| 2588 | } |
| 2589 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2590 | |
| 2591 | /** |
| 2592 | * limProcessMlmAuthReq() |
| 2593 | * |
| 2594 | *FUNCTION: |
| 2595 | * This function is called to process MLM_AUTH_REQ message |
| 2596 | * from SME |
| 2597 | * |
| 2598 | *LOGIC: |
| 2599 | * |
| 2600 | *ASSUMPTIONS: |
| 2601 | * |
| 2602 | *NOTE: |
| 2603 | * |
| 2604 | * @param pMac Pointer to Global MAC structure |
| 2605 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 2606 | * @return None |
| 2607 | */ |
| 2608 | |
| 2609 | static void |
| 2610 | limProcessMlmAuthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2611 | { |
| 2612 | tANI_U32 numPreAuthContexts; |
| 2613 | tSirMacAddr currentBssId; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2614 | tLimMlmAuthCnf mlmAuthCnf; |
| 2615 | struct tLimPreAuthNode *preAuthNode; |
| 2616 | tpDphHashNode pStaDs; |
| 2617 | tANI_U8 sessionId; |
| 2618 | tpPESession psessionEntry; |
| 2619 | |
| 2620 | if(pMsgBuf == NULL) |
| 2621 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2622 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2623 | return; |
| 2624 | } |
| 2625 | |
| 2626 | pMac->lim.gpLimMlmAuthReq = (tLimMlmAuthReq *) pMsgBuf; |
| 2627 | sessionId = pMac->lim.gpLimMlmAuthReq->sessionId; |
| 2628 | if((psessionEntry= peFindSessionBySessionId(pMac,sessionId) )== NULL) |
| 2629 | { |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2630 | limLog(pMac, LOGP, FL("SessionId:%d Session Does not exist"),sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2631 | return; |
| 2632 | } |
| 2633 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2634 | limLog(pMac, LOG1,FL("Process Auth Req on sessionID %d Systemrole %d" |
| 2635 | "mlmstate %d from: "MAC_ADDRESS_STR" with authtype %d"), sessionId, |
| 2636 | psessionEntry->limSystemRole,psessionEntry->limMlmState, |
| 2637 | MAC_ADDR_ARRAY(pMac->lim.gpLimMlmAuthReq->peerMacAddr), |
| 2638 | pMac->lim.gpLimMlmAuthReq->authType); |
| 2639 | |
| 2640 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2641 | /** |
| 2642 | * Expect Auth request only when: |
| 2643 | * 1. STA joined/associated with a BSS or |
| 2644 | * 2. STA is in IBSS mode |
| 2645 | * and STA is going to authenticate with a unicast |
| 2646 | * adress and requested authentication algorithm is |
| 2647 | * supported. |
| 2648 | */ |
| 2649 | #if 0 |
| 2650 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != |
| 2651 | eSIR_SUCCESS) |
| 2652 | { |
| 2653 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2654 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2655 | } |
| 2656 | #endif //To SuppoRT BT-AMP |
| 2657 | |
| 2658 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 2659 | |
| 2660 | if (((((psessionEntry->limSystemRole== eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) && |
| 2661 | ((psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) || |
| 2662 | (psessionEntry->limMlmState == |
| 2663 | eLIM_MLM_LINK_ESTABLISHED_STATE))) || |
| 2664 | ((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) && |
| 2665 | (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))) && |
| 2666 | (limIsGroupAddr(pMac->lim.gpLimMlmAuthReq->peerMacAddr) |
| 2667 | == false) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2668 | (limIsAuthAlgoSupported( |
| 2669 | pMac, |
| 2670 | pMac->lim.gpLimMlmAuthReq->authType, |
| 2671 | psessionEntry) == true) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2672 | ) |
| 2673 | { |
| 2674 | /** |
| 2675 | * This is a request for pre-authentication. |
| 2676 | * Check if there exists context already for |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 2677 | * the requested peer OR |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2678 | * if this request is for the AP we're currently |
| 2679 | * associated with. |
| 2680 | * If yes, return auth confirm immediately when |
| 2681 | * requested auth type is same as the one used before. |
| 2682 | */ |
| 2683 | if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )&& |
| 2684 | (psessionEntry->limMlmState == |
| 2685 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 2686 | (((pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable)) != NULL) && |
| 2687 | (pMac->lim.gpLimMlmAuthReq->authType == |
| 2688 | pStaDs->mlmStaContext.authType)) && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2689 | (vos_mem_compare(pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2690 | currentBssId, |
| 2691 | sizeof(tSirMacAddr)) )) || |
| 2692 | (((preAuthNode = |
| 2693 | limSearchPreAuthList( |
| 2694 | pMac, |
| 2695 | pMac->lim.gpLimMlmAuthReq->peerMacAddr)) != NULL) && |
| 2696 | (preAuthNode->authType == |
| 2697 | pMac->lim.gpLimMlmAuthReq->authType))) |
| 2698 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2699 | limLog(pMac, LOG2, |
| 2700 | FL("Already have pre-auth context with peer: "MAC_ADDRESS_STR), |
| 2701 | MAC_ADDR_ARRAY(pMac->lim.gpLimMlmAuthReq->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2702 | |
| 2703 | mlmAuthCnf.resultCode = (tSirResultCodes) |
| 2704 | eSIR_MAC_SUCCESS_STATUS; |
| 2705 | |
| 2706 | |
| 2707 | goto end; |
| 2708 | } |
| 2709 | else |
| 2710 | { |
| 2711 | if (wlan_cfgGetInt(pMac, WNI_CFG_MAX_NUM_PRE_AUTH, |
| 2712 | (tANI_U32 *) &numPreAuthContexts) != eSIR_SUCCESS) |
| 2713 | { |
| 2714 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2715 | FL("Could not retrieve NumPreAuthLimit from CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2716 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2717 | |
| 2718 | if (pMac->lim.gLimNumPreAuthContexts == numPreAuthContexts) |
| 2719 | { |
| 2720 | PELOGW(limLog(pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2721 | FL("Number of pre-auth reached max limit"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2722 | |
| 2723 | /// Return Auth confirm with reject code |
| 2724 | mlmAuthCnf.resultCode = |
| 2725 | eSIR_SME_MAX_NUM_OF_PRE_AUTH_REACHED; |
| 2726 | |
| 2727 | goto end; |
| 2728 | } |
| 2729 | } |
| 2730 | |
| 2731 | // Delete pre-auth node if exists |
| 2732 | if (preAuthNode) |
| 2733 | limDeletePreAuthNode(pMac, |
| 2734 | pMac->lim.gpLimMlmAuthReq->peerMacAddr); |
| 2735 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2736 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
Abhinav Kumar | 6920f5a | 2019-08-05 18:55:11 +0530 | [diff] [blame] | 2737 | if ((pMac->lim.gpLimMlmAuthReq->authType == eSIR_AUTH_TYPE_SAE) && |
| 2738 | !psessionEntry->sae_pmk_cached) { |
Abhinav Kumar | d6d8dd2 | 2019-08-05 12:38:50 +0530 | [diff] [blame] | 2739 | if (lim_process_mlm_auth_req_sae(pMac, psessionEntry) != |
| 2740 | VOS_STATUS_SUCCESS) { |
| 2741 | mlmAuthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2742 | goto end; |
| 2743 | } else { |
| 2744 | limLog(pMac, LOG1, |
| 2745 | FL("lim_process_mlm_auth_req_sae is successful")); |
| 2746 | return; |
| 2747 | } |
| 2748 | } else { |
| 2749 | psessionEntry->limMlmState = eLIM_MLM_WT_AUTH_FRAME2_STATE; |
| 2750 | } |
| 2751 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2752 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2753 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2754 | //assign appropriate sessionId to the timer object |
| 2755 | pMac->lim.limTimers.gLimAuthFailureTimer.sessionId = sessionId; |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 2756 | /* assign appropriate sessionId to the timer object */ |
| 2757 | pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId = sessionId; |
| 2758 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2759 | // Activate Auth failure timer |
| 2760 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_AUTH_FAIL_TIMER)); |
Paul Zhang | 8328979 | 2017-02-28 18:58:52 +0800 | [diff] [blame] | 2761 | |
| 2762 | limDoSendAuthMgmtFrame(pMac, psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2763 | return; |
| 2764 | } |
| 2765 | else |
| 2766 | { |
| 2767 | /** |
| 2768 | * Unexpected auth request. |
| 2769 | * Return Auth confirm with Invalid parameters code. |
| 2770 | */ |
| 2771 | mlmAuthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2772 | |
| 2773 | goto end; |
| 2774 | } |
| 2775 | |
| 2776 | end: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2777 | vos_mem_copy((tANI_U8 *) &mlmAuthCnf.peerMacAddr, |
| 2778 | (tANI_U8 *) &pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 2779 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2780 | |
| 2781 | mlmAuthCnf.authType = pMac->lim.gpLimMlmAuthReq->authType; |
| 2782 | mlmAuthCnf.sessionId = sessionId; |
| 2783 | |
| 2784 | /// Free up buffer allocated |
| 2785 | /// for pMac->lim.gLimMlmAuthReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2786 | vos_mem_free( pMac->lim.gpLimMlmAuthReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2787 | pMac->lim.gpLimMlmAuthReq = NULL; |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2788 | limLog(pMac,LOG1,"SessionId:%d LimPostSme LIM_MLM_AUTH_CNF ",sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2789 | limPostSmeMessage(pMac, LIM_MLM_AUTH_CNF, (tANI_U32 *) &mlmAuthCnf); |
| 2790 | } /*** limProcessMlmAuthReq() ***/ |
| 2791 | |
| 2792 | |
| 2793 | |
| 2794 | /** |
| 2795 | * limProcessMlmAssocReq() |
| 2796 | * |
| 2797 | *FUNCTION: |
| 2798 | * This function is called to process MLM_ASSOC_REQ message |
| 2799 | * from SME |
| 2800 | * |
| 2801 | *LOGIC: |
| 2802 | * |
| 2803 | *ASSUMPTIONS: |
| 2804 | * |
| 2805 | *NOTE: |
| 2806 | * |
| 2807 | * @param pMac Pointer to Global MAC structure |
| 2808 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 2809 | * @return None |
| 2810 | */ |
| 2811 | |
| 2812 | static void |
| 2813 | limProcessMlmAssocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2814 | { |
| 2815 | tSirMacAddr currentBssId; |
| 2816 | tLimMlmAssocReq *pMlmAssocReq; |
| 2817 | tLimMlmAssocCnf mlmAssocCnf; |
| 2818 | tpPESession psessionEntry; |
| 2819 | // tANI_U8 sessionId; |
| 2820 | |
| 2821 | if(pMsgBuf == NULL) |
| 2822 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2823 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2824 | return; |
| 2825 | } |
| 2826 | pMlmAssocReq = (tLimMlmAssocReq *) pMsgBuf; |
| 2827 | |
| 2828 | if( (psessionEntry = peFindSessionBySessionId(pMac,pMlmAssocReq->sessionId) )== NULL) |
| 2829 | { |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2830 | limLog(pMac, LOGP,FL("SessionId:%d Session Does not exist"), |
| 2831 | pMlmAssocReq->sessionId); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2832 | vos_mem_free(pMlmAssocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2833 | return; |
| 2834 | } |
| 2835 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2836 | limLog(pMac, LOG1,FL("Process Assoc Req on sessionID %d Systemrole %d" |
| 2837 | "mlmstate %d from: "MAC_ADDRESS_STR), pMlmAssocReq->sessionId, |
| 2838 | psessionEntry->limSystemRole, psessionEntry->limMlmState, |
| 2839 | MAC_ADDR_ARRAY(pMlmAssocReq->peerMacAddr)); |
| 2840 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2841 | #if 0 |
| 2842 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != |
| 2843 | eSIR_SUCCESS) |
| 2844 | { |
| 2845 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2846 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2847 | } |
| 2848 | #endif //TO SUPPORT BT-AMP |
| 2849 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 2850 | |
| 2851 | if ( (psessionEntry->limSystemRole != eLIM_AP_ROLE && psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE) && |
| 2852 | (psessionEntry->limMlmState == eLIM_MLM_AUTHENTICATED_STATE || psessionEntry->limMlmState == eLIM_MLM_JOINED_STATE) && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2853 | (vos_mem_compare(pMlmAssocReq->peerMacAddr, currentBssId, sizeof(tSirMacAddr))) ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2854 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2855 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2856 | /// map the session entry pointer to the AssocFailureTimer |
| 2857 | pMac->lim.limTimers.gLimAssocFailureTimer.sessionId = pMlmAssocReq->sessionId; |
| 2858 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2859 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 2860 | psessionEntry->limMlmState = eLIM_MLM_WT_ASSOC_RSP_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2861 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2862 | limLog(pMac,LOG1,"SessionId:%d Sending Assoc_Req Frame", |
| 2863 | psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2864 | |
| 2865 | /// Prepare and send Association request frame |
| 2866 | limSendAssocReqMgmtFrame(pMac, pMlmAssocReq,psessionEntry); |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 2867 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 2868 | limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_REQ_EVENT, psessionEntry, |
| 2869 | eSIR_SUCCESS, eSIR_SUCCESS); |
| 2870 | #endif |
| 2871 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2872 | |
| 2873 | //Set the link state to postAssoc, so HW can start receiving frames from AP. |
| 2874 | if ((psessionEntry->bssType == eSIR_BTAMP_STA_MODE)|| |
| 2875 | ((psessionEntry->bssType == eSIR_BTAMP_AP_MODE) && (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))) |
| 2876 | { |
| 2877 | if(limSetLinkState(pMac, eSIR_LINK_BTAMP_POSTASSOC_STATE, currentBssId, |
| 2878 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2879 | PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2880 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2881 | /// Start association failure timer |
| 2882 | MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ASSOC_FAIL_TIMER)); |
| 2883 | if (tx_timer_activate(&pMac->lim.limTimers.gLimAssocFailureTimer) |
| 2884 | != TX_SUCCESS) |
| 2885 | { |
| 2886 | /// Could not start Assoc failure timer. |
| 2887 | // Log error |
| 2888 | limLog(pMac, LOGP, |
Padma, Santhosh Kumar | 2b47ca8 | 2014-01-03 16:57:27 +0530 | [diff] [blame] | 2889 | FL("SessionId:%d could not start Association failure timer"), |
| 2890 | psessionEntry->peSessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2891 | // Cleanup as if assoc timer expired |
| 2892 | limProcessAssocFailureTimeout(pMac,LIM_ASSOC ); |
| 2893 | |
| 2894 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2895 | |
| 2896 | return; |
| 2897 | } |
| 2898 | else |
| 2899 | { |
| 2900 | /** |
| 2901 | * Received Association request either in invalid state |
| 2902 | * or to a peer MAC entity whose address is different |
| 2903 | * from one that STA is currently joined with or on AP. |
| 2904 | * Return Assoc confirm with Invalid parameters code. |
| 2905 | */ |
| 2906 | |
| 2907 | // Log error |
| 2908 | PELOGW(limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 2909 | FL("received unexpected MLM_ASSOC_CNF in state %d for role=%d, MAC addr= " |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2910 | MAC_ADDRESS_STR), psessionEntry->limMlmState, |
| 2911 | psessionEntry->limSystemRole, MAC_ADDR_ARRAY(pMlmAssocReq->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2912 | limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); |
| 2913 | |
| 2914 | mlmAssocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 2915 | mlmAssocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 2916 | |
| 2917 | goto end; |
| 2918 | } |
| 2919 | |
| 2920 | end: |
| 2921 | /* Update PE session Id*/ |
| 2922 | mlmAssocCnf.sessionId = pMlmAssocReq->sessionId; |
| 2923 | |
| 2924 | /// Free up buffer allocated for assocReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2925 | vos_mem_free(pMlmAssocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2926 | |
| 2927 | limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf); |
| 2928 | } /*** limProcessMlmAssocReq() ***/ |
| 2929 | |
| 2930 | |
| 2931 | |
| 2932 | /** |
| 2933 | * limProcessMlmReassocReq() |
| 2934 | * |
| 2935 | *FUNCTION: |
| 2936 | * This function is called to process MLM_REASSOC_REQ message |
| 2937 | * from SME |
| 2938 | * |
| 2939 | *LOGIC: |
| 2940 | * |
| 2941 | *ASSUMPTIONS: |
| 2942 | * |
| 2943 | *NOTE: |
| 2944 | * |
| 2945 | * @param pMac Pointer to Global MAC structure |
| 2946 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 2947 | * @return None |
| 2948 | */ |
| 2949 | |
| 2950 | static void |
| 2951 | limProcessMlmReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 2952 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 2953 | tANI_U8 chanNum, secChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2954 | struct tLimPreAuthNode *pAuthNode; |
| 2955 | tLimMlmReassocReq *pMlmReassocReq; |
| 2956 | tLimMlmReassocCnf mlmReassocCnf; |
| 2957 | tpPESession psessionEntry; |
| 2958 | |
| 2959 | if(pMsgBuf == NULL) |
| 2960 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 2961 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2962 | return; |
| 2963 | } |
| 2964 | |
| 2965 | pMlmReassocReq = (tLimMlmReassocReq *) pMsgBuf; |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2966 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2967 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmReassocReq->sessionId)) == NULL) |
| 2968 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2969 | limLog(pMac, LOGE,FL("Session Does not exist for given sessionId %d"), |
| 2970 | pMlmReassocReq->sessionId); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2971 | vos_mem_free(pMlmReassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2972 | return; |
| 2973 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 2974 | |
| 2975 | limLog(pMac, LOG1,FL("Process ReAssoc Req on sessionID %d Systemrole %d" |
| 2976 | "mlmstate %d from: "MAC_ADDRESS_STR), pMlmReassocReq->sessionId, |
| 2977 | psessionEntry->limSystemRole, psessionEntry->limMlmState, |
| 2978 | MAC_ADDR_ARRAY(pMlmReassocReq->peerMacAddr)); |
| 2979 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2980 | if (((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) && |
| 2981 | (psessionEntry->limMlmState == eLIM_MLM_LINK_ESTABLISHED_STATE)) |
| 2982 | { |
| 2983 | if (psessionEntry->pLimMlmReassocReq) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2984 | vos_mem_free(psessionEntry->pLimMlmReassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2985 | |
| 2986 | /* Hold Re-Assoc request as part of Session, knock-out pMac */ |
| 2987 | /// Hold onto Reassoc request parameters |
| 2988 | psessionEntry->pLimMlmReassocReq = pMlmReassocReq; |
| 2989 | |
| 2990 | // See if we have pre-auth context with new AP |
| 2991 | pAuthNode = limSearchPreAuthList(pMac, psessionEntry->limReAssocbssId); |
| 2992 | |
| 2993 | if (!pAuthNode && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 2994 | (!vos_mem_compare(pMlmReassocReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 2995 | psessionEntry->bssId, |
| 2996 | sizeof(tSirMacAddr)) )) |
| 2997 | { |
| 2998 | // Either pre-auth context does not exist AND |
| 2999 | // we are not reassociating with currently |
| 3000 | // associated AP. |
| 3001 | // Return Reassoc confirm with not authenticated |
| 3002 | mlmReassocCnf.resultCode = eSIR_SME_STA_NOT_AUTHENTICATED; |
| 3003 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3004 | |
| 3005 | goto end; |
| 3006 | } |
| 3007 | |
| 3008 | //assign the sessionId to the timer object |
| 3009 | pMac->lim.limTimers.gLimReassocFailureTimer.sessionId = pMlmReassocReq->sessionId; |
| 3010 | |
| 3011 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 3012 | psessionEntry->limMlmState = eLIM_MLM_WT_REASSOC_RSP_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3013 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3014 | |
| 3015 | #if 0 |
| 3016 | // Update BSSID at CFG database |
| 3017 | if (wlan_cfgSetStr(pMac, WNI_CFG_BSSID, |
| 3018 | pMac->lim.gLimReassocBssId, |
| 3019 | sizeof(tSirMacAddr)) != eSIR_SUCCESS) |
| 3020 | { |
| 3021 | /// Could not update BSSID at CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3022 | limLog(pMac, LOGP, FL("could not update BSSID at CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3023 | } |
| 3024 | #endif //TO SUPPORT BT-AMP |
| 3025 | |
| 3026 | /* Copy Global Reassoc ID*/ |
| 3027 | // sirCopyMacAddr(psessionEntry->reassocbssId,pMac->lim.gLimReAssocBssId); |
| 3028 | |
| 3029 | /** |
| 3030 | * Derive channel from BSS description and |
| 3031 | * store it at CFG. |
| 3032 | */ |
| 3033 | |
| 3034 | chanNum = psessionEntry->limReassocChannelId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3035 | secChannelOffset = psessionEntry->reAssocHtSecondaryChannelOffset; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3036 | |
| 3037 | /* To Support BT-AMP .. read channel number from psessionEntry*/ |
| 3038 | //chanNum = psessionEntry->currentOperChannel; |
| 3039 | |
| 3040 | // Apply previously set configuration at HW |
| 3041 | limApplyConfiguration(pMac,psessionEntry); |
| 3042 | |
| 3043 | //store the channel switch sessionEntry in the lim global var |
| 3044 | /* We have already saved the ReAssocreq Pointer abobe */ |
| 3045 | //psessionEntry->pLimReAssocReq = (void *)pMlmReassocReq; |
| 3046 | psessionEntry->channelChangeReasonCode = LIM_SWITCH_CHANNEL_REASSOC; |
| 3047 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3048 | /** Switch channel to the new Operating channel for Reassoc*/ |
Sushant Kaushik | b97a008 | 2015-08-31 12:36:45 +0530 | [diff] [blame] | 3049 | |
| 3050 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 3051 | limDiagEventReport(pMac, WLAN_PE_DIAG_CHANNEL_SWITCH_ANOUNCEMENT, |
| 3052 | psessionEntry, eSIR_SUCCESS, LIM_SWITCH_CHANNEL_REASSOC); |
| 3053 | #endif |
| 3054 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3055 | limSetChannel(pMac, chanNum, secChannelOffset, psessionEntry->maxTxPower, psessionEntry->peSessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3056 | |
| 3057 | return; |
| 3058 | } |
| 3059 | else |
| 3060 | { |
| 3061 | /** |
| 3062 | * Received Reassoc request in invalid state or |
| 3063 | * in AP role.Return Reassoc confirm with Invalid |
| 3064 | * parameters code. |
| 3065 | */ |
| 3066 | |
| 3067 | // Log error |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3068 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 3069 | FL("received unexpected MLM_REASSOC_CNF in state %d for role=%d, " |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3070 | "MAC addr= " |
| 3071 | MAC_ADDRESS_STR), psessionEntry->limMlmState, |
| 3072 | psessionEntry->limSystemRole, |
| 3073 | MAC_ADDR_ARRAY(pMlmReassocReq->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3074 | limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); |
| 3075 | |
| 3076 | mlmReassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3077 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3078 | |
| 3079 | goto end; |
| 3080 | } |
| 3081 | |
| 3082 | end: |
| 3083 | mlmReassocCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 3084 | /* Update PE sessio Id*/ |
| 3085 | mlmReassocCnf.sessionId = pMlmReassocReq->sessionId; |
| 3086 | /// Free up buffer allocated for reassocReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3087 | vos_mem_free(pMlmReassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3088 | psessionEntry->pLimReAssocReq = NULL; |
| 3089 | |
| 3090 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmReassocCnf); |
| 3091 | } /*** limProcessMlmReassocReq() ***/ |
| 3092 | |
| 3093 | |
| 3094 | static void |
Madan Mohan Koyyalamudi | 27ecc28 | 2012-11-06 15:07:28 -0800 | [diff] [blame] | 3095 | limProcessMlmDisassocReqNtf(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3096 | { |
| 3097 | tANI_U16 aid; |
| 3098 | tSirMacAddr currentBssId; |
| 3099 | tpDphHashNode pStaDs; |
| 3100 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3101 | tLimMlmDisassocCnf mlmDisassocCnf; |
| 3102 | tpPESession psessionEntry; |
| 3103 | extern tANI_BOOLEAN sendDisassocFrame; |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3104 | tSirSmeDisassocRsp *pSirSmeDisassocRsp; |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3105 | tANI_U8 *pBuf; |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3106 | vos_msg_t msg = {0}; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3107 | |
| 3108 | if(eHAL_STATUS_SUCCESS != suspendStatus) |
| 3109 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3110 | PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X"), suspendStatus);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3111 | #if 0 |
| 3112 | //It can ignore the status and proceed with the disassoc processing. |
| 3113 | mlmDisassocCnf.resultCode = eSIR_SME_REFUSED; |
| 3114 | goto end; |
| 3115 | #endif |
| 3116 | } |
| 3117 | |
| 3118 | pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf; |
| 3119 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3120 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDisassocReq->sessionId))== NULL) |
| 3121 | { |
| 3122 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3123 | limLog(pMac, LOGE, |
| 3124 | FL("session does not exist for given sessionId %d"), |
| 3125 | pMlmDisassocReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3126 | mlmDisassocCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3127 | goto end; |
| 3128 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3129 | limLog(pMac, LOG1,FL("Process DisAssoc Req on sessionID %d Systemrole %d" |
| 3130 | "mlmstate %d from: "MAC_ADDRESS_STR), pMlmDisassocReq->sessionId, |
| 3131 | psessionEntry->limSystemRole, psessionEntry->limMlmState, |
| 3132 | MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr)); |
| 3133 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3134 | #if 0 |
| 3135 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != |
| 3136 | eSIR_SUCCESS) |
| 3137 | { |
| 3138 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3139 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3140 | } |
| 3141 | #endif //BT-AMP Support |
| 3142 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 3143 | |
| 3144 | switch (psessionEntry->limSystemRole) |
| 3145 | { |
| 3146 | case eLIM_STA_ROLE: |
| 3147 | case eLIM_BT_AMP_STA_ROLE: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3148 | if ( !vos_mem_compare(pMlmDisassocReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3149 | currentBssId, |
| 3150 | sizeof(tSirMacAddr)) ) |
| 3151 | { |
| 3152 | PELOGW(limLog(pMac, LOGW, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3153 | FL("received MLM_DISASSOC_REQ with invalid BSS id from: " |
| 3154 | MAC_ADDRESS_STR), |
| 3155 | MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3156 | |
| 3157 | /// Prepare and Send LIM_MLM_DISASSOC_CNF |
| 3158 | |
| 3159 | mlmDisassocCnf.resultCode = |
| 3160 | eSIR_SME_INVALID_PARAMETERS; |
| 3161 | |
| 3162 | goto end; |
| 3163 | } |
| 3164 | |
| 3165 | break; |
| 3166 | |
| 3167 | case eLIM_STA_IN_IBSS_ROLE: |
| 3168 | |
| 3169 | break; |
| 3170 | |
| 3171 | default: // eLIM_AP_ROLE |
| 3172 | |
| 3173 | // Fall through |
| 3174 | break; |
| 3175 | |
| 3176 | } // end switch (psessionEntry->limSystemRole) |
| 3177 | |
| 3178 | /** |
| 3179 | * Check if there exists a context for the peer entity |
| 3180 | * to be disassociated with. |
| 3181 | */ |
| 3182 | pStaDs = dphLookupHashEntry(pMac, pMlmDisassocReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3183 | if ((pStaDs == NULL) || |
| 3184 | (pStaDs && |
| 3185 | ((pStaDs->mlmStaContext.mlmState != |
| 3186 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 3187 | (pStaDs->mlmStaContext.mlmState != |
| 3188 | eLIM_MLM_WT_ASSOC_CNF_STATE) && |
| 3189 | (pStaDs->mlmStaContext.mlmState != |
| 3190 | eLIM_MLM_ASSOCIATED_STATE)))) |
| 3191 | { |
| 3192 | /** |
| 3193 | * Received LIM_MLM_DISASSOC_REQ for STA that does not |
| 3194 | * have context or in some transit state. |
| 3195 | * Log error |
| 3196 | */ |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 3197 | limLog(pMac, LOGE, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3198 | FL("received MLM_DISASSOC_REQ for STA that either has no context " |
| 3199 | "or in some transit state, Addr= " |
Sachin Ahuja | 2fea3d1 | 2014-12-18 17:31:31 +0530 | [diff] [blame] | 3200 | MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr)); |
| 3201 | if (pStaDs != NULL) |
| 3202 | limLog(pMac, LOGE, FL("Sta MlmState : %d"), |
| 3203 | pStaDs->mlmStaContext.mlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3204 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3205 | /* |
| 3206 | * Disassociation response due to |
| 3207 | * host triggered disassociation |
| 3208 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3209 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3210 | pSirSmeDisassocRsp = vos_mem_malloc(sizeof(tSirSmeDisassocRsp)); |
| 3211 | if ( NULL == pSirSmeDisassocRsp ) |
| 3212 | { |
| 3213 | // Log error |
| 3214 | limLog(pMac, LOGP, |
| 3215 | FL("call to AllocateMemory failed for eWNI_SME_DISASSOC_RSP")); |
| 3216 | return; |
| 3217 | } |
| 3218 | limLog(pMac, LOG1, FL("send eWNI_SME_DISASSOC_RSP with " |
| 3219 | "retCode: %d for "MAC_ADDRESS_STR),eSIR_SME_DEAUTH_STATUS, |
| 3220 | MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr)); |
| 3221 | pSirSmeDisassocRsp->messageType = eWNI_SME_DISASSOC_RSP; |
| 3222 | pSirSmeDisassocRsp->length = sizeof(tSirSmeDisassocRsp); |
| 3223 | pSirSmeDisassocRsp->sessionId = pMlmDisassocReq->sessionId; |
| 3224 | pSirSmeDisassocRsp->transactionId = 0; |
| 3225 | pSirSmeDisassocRsp->statusCode = eSIR_SME_DEAUTH_STATUS; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3226 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3227 | pBuf = (tANI_U8 *) pSirSmeDisassocRsp->peerMacAddr; |
| 3228 | vos_mem_copy( pBuf, pMlmDisassocReq->peerMacAddr, sizeof(tSirMacAddr)); |
| 3229 | |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3230 | msg.type = eWNI_SME_DISASSOC_RSP; |
| 3231 | msg.bodyptr = pSirSmeDisassocRsp; |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3232 | |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3233 | if (pMac->lim.sme_msg_callback) |
| 3234 | pMac->lim.sme_msg_callback(pMac, &msg); |
| 3235 | else |
| 3236 | limLog(pMac, LOGE, FL("Sme msg callback is NULL")); |
| 3237 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3238 | return; |
| 3239 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3240 | } |
| 3241 | |
| 3242 | //pStaDs->mlmStaContext.rxPurgeReq = 1; |
| 3243 | pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes) |
| 3244 | pMlmDisassocReq->reasonCode; |
| 3245 | pStaDs->mlmStaContext.cleanupTrigger = pMlmDisassocReq->disassocTrigger; |
Mukul Sharma | 91947a2 | 2014-06-09 11:07:51 +0530 | [diff] [blame] | 3246 | /** Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE |
| 3247 | * This is to address the issue of race condition between |
| 3248 | * disconnect request from the HDD and deauth from AP |
| 3249 | */ |
| 3250 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3251 | |
| 3252 | /// Send Disassociate frame to peer entity |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3253 | if (sendDisassocFrame && (pMlmDisassocReq->reasonCode != eSIR_MAC_DISASSOC_DUE_TO_FTHANDOFF_REASON)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3254 | { |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3255 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = pMlmDisassocReq; |
Edhar, Mahesh Kumar | 03cf7ff | 2015-11-26 17:59:29 +0530 | [diff] [blame] | 3256 | if (IS_FW_IN_TX_PATH_FEATURE_ENABLE) |
Sandeep Puligilla | 2572828 | 2013-12-01 19:44:14 +0530 | [diff] [blame] | 3257 | { |
Edhar, Mahesh Kumar | 03cf7ff | 2015-11-26 17:59:29 +0530 | [diff] [blame] | 3258 | limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode, |
Sandeep Puligilla | 2572828 | 2013-12-01 19:44:14 +0530 | [diff] [blame] | 3259 | pMlmDisassocReq->peerMacAddr, |
| 3260 | psessionEntry, FALSE); |
Edhar, Mahesh Kumar | 03cf7ff | 2015-11-26 17:59:29 +0530 | [diff] [blame] | 3261 | /* Send Disassoc CNF and receive path cleanup */ |
| 3262 | limSendDisassocCnf(pMac); |
Sandeep Puligilla | 2572828 | 2013-12-01 19:44:14 +0530 | [diff] [blame] | 3263 | } |
| 3264 | else |
| 3265 | { |
Edhar, Mahesh Kumar | 03cf7ff | 2015-11-26 17:59:29 +0530 | [diff] [blame] | 3266 | limSendDisassocMgmtFrame(pMac, pMlmDisassocReq->reasonCode, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3267 | pMlmDisassocReq->peerMacAddr, |
| 3268 | psessionEntry, TRUE); |
Sandeep Puligilla | 2572828 | 2013-12-01 19:44:14 +0530 | [diff] [blame] | 3269 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3270 | } |
| 3271 | else |
| 3272 | { |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3273 | /* Disassoc frame is not sent OTA */ |
| 3274 | sendDisassocFrame = 1; |
| 3275 | // Receive path cleanup with dummy packet |
| 3276 | if(eSIR_SUCCESS != limCleanupRxPath(pMac, pStaDs,psessionEntry)) |
| 3277 | { |
| 3278 | mlmDisassocCnf.resultCode = eSIR_SME_RESOURCES_UNAVAILABLE; |
| 3279 | goto end; |
| 3280 | } |
| 3281 | // Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3282 | vos_mem_free(pMlmDisassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3283 | } |
| 3284 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3285 | return; |
| 3286 | |
| 3287 | end: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3288 | vos_mem_copy((tANI_U8 *) &mlmDisassocCnf.peerMacAddr, |
| 3289 | (tANI_U8 *) pMlmDisassocReq->peerMacAddr, |
| 3290 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3291 | mlmDisassocCnf.aid = pMlmDisassocReq->aid; |
| 3292 | mlmDisassocCnf.disassocTrigger = pMlmDisassocReq->disassocTrigger; |
| 3293 | |
| 3294 | /* Update PE session ID*/ |
| 3295 | mlmDisassocCnf.sessionId = pMlmDisassocReq->sessionId; |
| 3296 | |
| 3297 | /// Free up buffer allocated for mlmDisassocReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3298 | vos_mem_free(pMlmDisassocReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3299 | |
| 3300 | limPostSmeMessage(pMac, |
| 3301 | LIM_MLM_DISASSOC_CNF, |
| 3302 | (tANI_U32 *) &mlmDisassocCnf); |
| 3303 | } |
| 3304 | |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3305 | tANI_BOOLEAN limCheckDisassocDeauthAckPending(tpAniSirGlobal pMac, |
| 3306 | tANI_U8 *staMac |
| 3307 | ) |
| 3308 | { |
| 3309 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3310 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3311 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3312 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3313 | if ( |
| 3314 | (pMlmDisassocReq && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3315 | (vos_mem_compare((tANI_U8 *) staMac, |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3316 | (tANI_U8 *) &pMlmDisassocReq->peerMacAddr, |
| 3317 | sizeof(tSirMacAddr)))) |
| 3318 | || |
| 3319 | (pMlmDeauthReq && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3320 | (vos_mem_compare((tANI_U8 *) staMac, |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3321 | (tANI_U8 *) &pMlmDeauthReq->peerMacAddr, |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3322 | sizeof(tSirMacAddr)))) |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3323 | ) |
| 3324 | { |
Srinivas Girigowda | c03c5a8 | 2013-07-01 13:44:54 -0700 | [diff] [blame] | 3325 | PELOG1(limLog(pMac, LOG1, FL("Disassoc/Deauth ack pending"));) |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3326 | return eANI_BOOLEAN_TRUE; |
| 3327 | } |
| 3328 | else |
| 3329 | { |
Srinivas Girigowda | c03c5a8 | 2013-07-01 13:44:54 -0700 | [diff] [blame] | 3330 | PELOG1(limLog(pMac, LOG1, FL("Disassoc/Deauth Ack not pending"));) |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 3331 | return eANI_BOOLEAN_FALSE; |
| 3332 | } |
| 3333 | } |
| 3334 | |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 3335 | void limCleanUpDisassocDeauthReq(tpAniSirGlobal pMac, |
| 3336 | tANI_U8 *staMac, |
| 3337 | tANI_BOOLEAN cleanRxPath) |
| 3338 | { |
| 3339 | tLimMlmDisassocReq *pMlmDisassocReq; |
| 3340 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3341 | pMlmDisassocReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq; |
| 3342 | if (pMlmDisassocReq && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3343 | (vos_mem_compare((tANI_U8 *) staMac, |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 3344 | (tANI_U8 *) &pMlmDisassocReq->peerMacAddr, |
| 3345 | sizeof(tSirMacAddr)))) |
| 3346 | { |
| 3347 | if (cleanRxPath) |
| 3348 | { |
| 3349 | limProcessDisassocAckTimeout(pMac); |
| 3350 | } |
| 3351 | else |
| 3352 | { |
| 3353 | if (tx_timer_running(&pMac->lim.limTimers.gLimDisassocAckTimer)) |
| 3354 | { |
| 3355 | limDeactivateAndChangeTimer(pMac, eLIM_DISASSOC_ACK_TIMER); |
| 3356 | } |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3357 | vos_mem_free(pMlmDisassocReq); |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 3358 | pMac->lim.limDisassocDeauthCnfReq.pMlmDisassocReq = NULL; |
| 3359 | } |
| 3360 | } |
| 3361 | |
| 3362 | pMlmDeauthReq = pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq; |
| 3363 | if (pMlmDeauthReq && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3364 | (vos_mem_compare((tANI_U8 *) staMac, |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 3365 | (tANI_U8 *) &pMlmDeauthReq->peerMacAddr, |
| 3366 | sizeof(tSirMacAddr)))) |
| 3367 | { |
| 3368 | if (cleanRxPath) |
| 3369 | { |
| 3370 | limProcessDeauthAckTimeout(pMac); |
| 3371 | } |
| 3372 | else |
| 3373 | { |
| 3374 | if (tx_timer_running(&pMac->lim.limTimers.gLimDeauthAckTimer)) |
| 3375 | { |
| 3376 | limDeactivateAndChangeTimer(pMac, eLIM_DEAUTH_ACK_TIMER); |
| 3377 | } |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3378 | vos_mem_free(pMlmDeauthReq); |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 3379 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = NULL; |
| 3380 | } |
| 3381 | } |
| 3382 | } |
| 3383 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3384 | void limProcessDisassocAckTimeout(tpAniSirGlobal pMac) |
| 3385 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3386 | limLog(pMac, LOG1, FL("")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3387 | limSendDisassocCnf(pMac); |
| 3388 | } |
| 3389 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3390 | /** |
| 3391 | * limProcessMlmDisassocReq() |
| 3392 | * |
| 3393 | *FUNCTION: |
| 3394 | * This function is called to process MLM_DISASSOC_REQ message |
| 3395 | * from SME |
| 3396 | * |
| 3397 | *LOGIC: |
| 3398 | * |
| 3399 | *ASSUMPTIONS: |
| 3400 | * |
| 3401 | *NOTE: |
| 3402 | * |
| 3403 | * @param pMac Pointer to Global MAC structure |
| 3404 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 3405 | * @return None |
| 3406 | */ |
| 3407 | |
| 3408 | static void |
| 3409 | limProcessMlmDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3410 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3411 | tLimMlmDisassocReq *pMlmDisassocReq; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3412 | |
| 3413 | if(pMsgBuf == NULL) |
| 3414 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3415 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3416 | return; |
| 3417 | } |
| 3418 | |
| 3419 | pMlmDisassocReq = (tLimMlmDisassocReq *) pMsgBuf; |
Kanchanapally, Vidyullatha | c796fc6 | 2015-03-17 10:45:28 +0530 | [diff] [blame] | 3420 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3421 | limLog(pMac, LOG1,FL("Process DisAssoc Req on sessionID %d " |
| 3422 | "from: "MAC_ADDRESS_STR), pMlmDisassocReq->sessionId, |
| 3423 | MAC_ADDR_ARRAY(pMlmDisassocReq->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3424 | |
Madan Mohan Koyyalamudi | 27ecc28 | 2012-11-06 15:07:28 -0800 | [diff] [blame] | 3425 | limProcessMlmDisassocReqNtf( pMac, eHAL_STATUS_SUCCESS, (tANI_U32*) pMsgBuf ); |
Madan Mohan Koyyalamudi | b6af061 | 2012-11-19 13:45:45 -0800 | [diff] [blame] | 3426 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3427 | } /*** limProcessMlmDisassocReq() ***/ |
| 3428 | |
| 3429 | static void |
Madan Mohan Koyyalamudi | 27ecc28 | 2012-11-06 15:07:28 -0800 | [diff] [blame] | 3430 | limProcessMlmDeauthReqNtf(tpAniSirGlobal pMac, eHalStatus suspendStatus, tANI_U32 *pMsgBuf) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3431 | { |
| 3432 | tANI_U16 aid; |
| 3433 | tSirMacAddr currentBssId; |
| 3434 | tpDphHashNode pStaDs; |
| 3435 | struct tLimPreAuthNode *pAuthNode; |
| 3436 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3437 | tLimMlmDeauthCnf mlmDeauthCnf; |
| 3438 | tpPESession psessionEntry; |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3439 | tSirSmeDeauthRsp *pSirSmeDeauthRsp; |
| 3440 | tANI_U8 *pBuf; |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3441 | vos_msg_t msg = {0}; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3442 | |
| 3443 | if(eHAL_STATUS_SUCCESS != suspendStatus) |
| 3444 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3445 | PELOGE(limLog(pMac, LOGE,FL("Suspend Status is not success %X"), suspendStatus);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3446 | #if 0 |
| 3447 | //It can ignore the status and proceed with the disassoc processing. |
| 3448 | mlmDisassocCnf.resultCode = eSIR_SME_REFUSED; |
| 3449 | goto end; |
| 3450 | #endif |
| 3451 | } |
| 3452 | |
| 3453 | pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf; |
| 3454 | |
| 3455 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL) |
| 3456 | { |
| 3457 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3458 | limLog(pMac, LOGE, FL("session does not exist for given sessionId %d"), |
| 3459 | pMlmDeauthReq->sessionId); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3460 | vos_mem_free(pMlmDeauthReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3461 | return; |
| 3462 | } |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3463 | limLog(pMac, LOG1,FL("Process Deauth Req on sessionID %d Systemrole %d" |
| 3464 | "mlmstate %d from: "MAC_ADDRESS_STR), pMlmDeauthReq->sessionId, |
| 3465 | psessionEntry->limSystemRole, psessionEntry->limMlmState, |
| 3466 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3467 | #if 0 |
| 3468 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) != |
| 3469 | eSIR_SUCCESS) |
| 3470 | { |
| 3471 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3472 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3473 | } |
| 3474 | #endif //SUPPORT BT-AMP |
| 3475 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 3476 | |
| 3477 | switch (psessionEntry->limSystemRole) |
| 3478 | { |
| 3479 | case eLIM_STA_ROLE: |
| 3480 | case eLIM_BT_AMP_STA_ROLE: |
| 3481 | switch (psessionEntry->limMlmState) |
| 3482 | { |
| 3483 | case eLIM_MLM_IDLE_STATE: |
| 3484 | // Attempting to Deauthenticate |
| 3485 | // with a pre-authenticated peer. |
| 3486 | // Deauthetiate with peer if there |
| 3487 | // exists a pre-auth context below. |
| 3488 | break; |
| 3489 | |
| 3490 | case eLIM_MLM_AUTHENTICATED_STATE: |
| 3491 | case eLIM_MLM_WT_ASSOC_RSP_STATE: |
| 3492 | case eLIM_MLM_LINK_ESTABLISHED_STATE: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3493 | if (!vos_mem_compare(pMlmDeauthReq->peerMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3494 | currentBssId, |
| 3495 | sizeof(tSirMacAddr)) ) |
| 3496 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3497 | limLog(pMac, LOGE, |
| 3498 | FL("received MLM_DEAUTH_REQ with invalid BSS id " |
| 3499 | "Peer MAC: "MAC_ADDRESS_STR " CFG BSSID Addr : " |
| 3500 | MAC_ADDRESS_STR), |
| 3501 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr), |
| 3502 | MAC_ADDR_ARRAY(currentBssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3503 | |
| 3504 | /// Prepare and Send LIM_MLM_DEAUTH_CNF |
| 3505 | |
| 3506 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3507 | |
| 3508 | goto end; |
| 3509 | } |
| 3510 | |
| 3511 | if ((psessionEntry->limMlmState == |
| 3512 | eLIM_MLM_AUTHENTICATED_STATE) || |
| 3513 | (psessionEntry->limMlmState == |
| 3514 | eLIM_MLM_WT_ASSOC_RSP_STATE)) |
| 3515 | { |
| 3516 | // Send Deauthentication frame |
| 3517 | // to peer entity |
| 3518 | limSendDeauthMgmtFrame( |
| 3519 | pMac, |
| 3520 | pMlmDeauthReq->reasonCode, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3521 | pMlmDeauthReq->peerMacAddr, |
| 3522 | psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3523 | |
| 3524 | /// Prepare and Send LIM_MLM_DEAUTH_CNF |
| 3525 | mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS; |
| 3526 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 3527 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3528 | goto end; |
| 3529 | } |
| 3530 | else |
| 3531 | { |
| 3532 | // LINK_ESTABLISED_STATE |
| 3533 | // Cleanup RX & TX paths |
| 3534 | // below |
| 3535 | } |
| 3536 | |
| 3537 | break; |
| 3538 | |
| 3539 | default: |
| 3540 | |
| 3541 | PELOGW(limLog(pMac, LOGW, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3542 | FL("received MLM_DEAUTH_REQ with in state %d for peer "MAC_ADDRESS_STR), |
| 3543 | psessionEntry->limMlmState,MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3544 | limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); |
| 3545 | |
| 3546 | /// Prepare and Send LIM_MLM_DEAUTH_CNF |
| 3547 | mlmDeauthCnf.resultCode = |
| 3548 | eSIR_SME_STA_NOT_AUTHENTICATED; |
| 3549 | |
| 3550 | goto end; |
| 3551 | } |
| 3552 | |
| 3553 | break; |
| 3554 | |
| 3555 | case eLIM_STA_IN_IBSS_ROLE: |
Abhishek Singh | 92fbac2 | 2015-03-24 17:57:36 +0530 | [diff] [blame] | 3556 | limLog(pMac, LOGE, |
| 3557 | FL("received MLM_DEAUTH_REQ IBSS Mode ")); |
| 3558 | mlmDeauthCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3559 | goto end; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3560 | default: // eLIM_AP_ROLE |
| 3561 | break; |
| 3562 | |
| 3563 | } // end switch (psessionEntry->limSystemRole) |
| 3564 | |
| 3565 | /** |
| 3566 | * Check if there exists a context for the peer entity |
| 3567 | * to be deauthenticated with. |
| 3568 | */ |
| 3569 | pStaDs = dphLookupHashEntry(pMac, pMlmDeauthReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable); |
| 3570 | |
| 3571 | if (pStaDs == NULL) |
| 3572 | { |
| 3573 | /// Check if there exists pre-auth context for this STA |
| 3574 | pAuthNode = limSearchPreAuthList(pMac, |
| 3575 | pMlmDeauthReq->peerMacAddr); |
| 3576 | |
| 3577 | if (pAuthNode == NULL) |
| 3578 | { |
| 3579 | /** |
| 3580 | * Received DEAUTH REQ for a STA that is neither |
| 3581 | * Associated nor Pre-authenticated. Log error, |
| 3582 | * Prepare and Send LIM_MLM_DEAUTH_CNF |
| 3583 | */ |
| 3584 | PELOGW(limLog(pMac, LOGW, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3585 | FL("received MLM_DEAUTH_REQ in mlme state %d for STA that " |
| 3586 | "does not have context, Addr="MAC_ADDRESS_STR), |
| 3587 | psessionEntry->limMlmState, |
| 3588 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3589 | |
| 3590 | mlmDeauthCnf.resultCode = |
| 3591 | eSIR_SME_STA_NOT_AUTHENTICATED; |
| 3592 | } |
| 3593 | else |
| 3594 | { |
| 3595 | mlmDeauthCnf.resultCode = eSIR_SME_SUCCESS; |
| 3596 | |
| 3597 | /// Delete STA from pre-auth STA list |
| 3598 | limDeletePreAuthNode(pMac, pMlmDeauthReq->peerMacAddr); |
| 3599 | |
| 3600 | /// Send Deauthentication frame to peer entity |
| 3601 | limSendDeauthMgmtFrame(pMac, |
| 3602 | pMlmDeauthReq->reasonCode, |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3603 | pMlmDeauthReq->peerMacAddr, |
| 3604 | psessionEntry, FALSE); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3605 | } |
| 3606 | |
| 3607 | goto end; |
| 3608 | } |
| 3609 | else if ((pStaDs->mlmStaContext.mlmState != |
| 3610 | eLIM_MLM_LINK_ESTABLISHED_STATE) && |
| 3611 | (pStaDs->mlmStaContext.mlmState != |
| 3612 | eLIM_MLM_WT_ASSOC_CNF_STATE)) |
| 3613 | { |
| 3614 | /** |
| 3615 | * Received LIM_MLM_DEAUTH_REQ for STA that is n |
| 3616 | * some transit state. Log error. |
| 3617 | */ |
| 3618 | PELOGW(limLog(pMac, LOGW, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3619 | FL("received MLM_DEAUTH_REQ for STA that either has no context or in some transit state, Addr=" |
| 3620 | MAC_ADDRESS_STR),MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3621 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3622 | /* |
| 3623 | * Deauthentication response to host triggered |
| 3624 | * deauthentication. |
| 3625 | */ |
| 3626 | pSirSmeDeauthRsp = vos_mem_malloc(sizeof(tSirSmeDeauthRsp)); |
| 3627 | if ( NULL == pSirSmeDeauthRsp ) |
| 3628 | { |
| 3629 | // Log error |
| 3630 | limLog(pMac, LOGP, |
| 3631 | FL("call to AllocateMemory failed for eWNI_SME_DEAUTH_RSP")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3632 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3633 | return; |
| 3634 | } |
| 3635 | limLog(pMac, LOG1, FL("send eWNI_SME_DEAUTH_RSP with " |
| 3636 | "retCode: %d for"MAC_ADDRESS_STR),eSIR_SME_DEAUTH_STATUS, |
| 3637 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr)); |
| 3638 | pSirSmeDeauthRsp->messageType = eWNI_SME_DEAUTH_RSP; |
| 3639 | pSirSmeDeauthRsp->length = sizeof(tSirSmeDeauthRsp); |
| 3640 | pSirSmeDeauthRsp->statusCode = eSIR_SME_DEAUTH_STATUS; |
| 3641 | pSirSmeDeauthRsp->sessionId = pMlmDeauthReq->sessionId; |
| 3642 | pSirSmeDeauthRsp->transactionId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3643 | |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3644 | pBuf = (tANI_U8 *) pSirSmeDeauthRsp->peerMacAddr; |
| 3645 | vos_mem_copy( pBuf, pMlmDeauthReq->peerMacAddr, sizeof(tSirMacAddr)); |
| 3646 | |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3647 | msg.type = eWNI_SME_DEAUTH_RSP; |
| 3648 | msg.bodyptr = pSirSmeDeauthRsp; |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3649 | |
Yeshwanth Sriram Guntuka | 802101a | 2018-06-29 16:41:02 +0530 | [diff] [blame] | 3650 | if (pMac->lim.sme_msg_callback) |
| 3651 | pMac->lim.sme_msg_callback(pMac, &msg); |
| 3652 | else |
| 3653 | limLog(pMac, LOGE, FL("Sme msg callback is NULL")); |
Padma, Santhosh Kumar | 05600d3 | 2015-07-24 13:00:57 +0530 | [diff] [blame] | 3654 | |
| 3655 | return; |
| 3656 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3657 | } |
| 3658 | |
| 3659 | //pStaDs->mlmStaContext.rxPurgeReq = 1; |
| 3660 | pStaDs->mlmStaContext.disassocReason = (tSirMacReasonCodes) |
| 3661 | pMlmDeauthReq->reasonCode; |
| 3662 | pStaDs->mlmStaContext.cleanupTrigger = pMlmDeauthReq->deauthTrigger; |
| 3663 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3664 | pMac->lim.limDisassocDeauthCnfReq.pMlmDeauthReq = pMlmDeauthReq; |
Abhishek Singh | 9415293 | 2014-01-16 19:04:51 +0530 | [diff] [blame] | 3665 | |
| 3666 | /* Set state to mlm State to eLIM_MLM_WT_DEL_STA_RSP_STATE |
| 3667 | * This is to address the issue of race condition between |
| 3668 | * disconnect request from the HDD and disassoc from |
| 3669 | * inactivity timer. This will make sure that we will not |
| 3670 | * process disassoc if deauth is in progress for the station |
| 3671 | * and thus mlmStaContext.cleanupTrigger will not be overwritten. |
| 3672 | */ |
| 3673 | pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_DEL_STA_RSP_STATE; |
| 3674 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3675 | /// Send Deauthentication frame to peer entity |
Kanchanapally, Vidyullatha | f9426e5 | 2013-12-24 17:28:54 +0530 | [diff] [blame] | 3676 | /* If FW_IN_TX_PATH feature is enabled |
| 3677 | do not wait for ACK */ |
| 3678 | if( IS_FW_IN_TX_PATH_FEATURE_ENABLE ) |
| 3679 | { |
| 3680 | limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode, |
| 3681 | pMlmDeauthReq->peerMacAddr, |
| 3682 | psessionEntry, FALSE); |
| 3683 | |
| 3684 | /* Send Deauth CNF and receive path cleanup */ |
| 3685 | limSendDeauthCnf(pMac); |
| 3686 | } |
| 3687 | else |
| 3688 | { |
| 3689 | limSendDeauthMgmtFrame(pMac, pMlmDeauthReq->reasonCode, |
| 3690 | pMlmDeauthReq->peerMacAddr, |
| 3691 | psessionEntry, TRUE); |
| 3692 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3693 | |
| 3694 | return; |
| 3695 | |
| 3696 | end: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3697 | vos_mem_copy((tANI_U8 *) &mlmDeauthCnf.peerMacAddr, |
| 3698 | (tANI_U8 *) pMlmDeauthReq->peerMacAddr, |
| 3699 | sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3700 | mlmDeauthCnf.deauthTrigger = pMlmDeauthReq->deauthTrigger; |
| 3701 | mlmDeauthCnf.aid = pMlmDeauthReq->aid; |
| 3702 | mlmDeauthCnf.sessionId = pMlmDeauthReq->sessionId; |
| 3703 | |
| 3704 | // Free up buffer allocated |
| 3705 | // for mlmDeauthReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3706 | vos_mem_free(pMlmDeauthReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3707 | |
| 3708 | limPostSmeMessage(pMac, |
| 3709 | LIM_MLM_DEAUTH_CNF, |
| 3710 | (tANI_U32 *) &mlmDeauthCnf); |
| 3711 | |
| 3712 | } |
| 3713 | |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3714 | |
| 3715 | void limProcessDeauthAckTimeout(tpAniSirGlobal pMac) |
| 3716 | { |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3717 | limLog(pMac, LOG1, FL("")); |
Madan Mohan Koyyalamudi | 521ff19 | 2012-11-15 17:13:08 -0800 | [diff] [blame] | 3718 | limSendDeauthCnf(pMac); |
| 3719 | } |
| 3720 | |
Abhishek Singh | 550aa8c | 2017-10-30 17:34:53 +0530 | [diff] [blame] | 3721 | void lim_process_ap_ecsa_timeout(tpAniSirGlobal mac_ctx) |
| 3722 | { |
| 3723 | tSirMsgQ msg = {0}; |
| 3724 | struct sir_ecsa_ie_complete_ind *ecsa_ie_cmp_ind; |
| 3725 | tpPESession session; |
| 3726 | |
| 3727 | session = peFindSessionBySessionId(mac_ctx, |
| 3728 | mac_ctx->lim.limTimers.g_lim_ap_ecsa_timer.sessionId); |
| 3729 | |
| 3730 | if(!session) |
| 3731 | { |
| 3732 | limLog(mac_ctx, LOGE, FL("session does not exist for given sessionId %d"), |
| 3733 | mac_ctx->lim.limTimers.g_lim_ap_ecsa_timer.sessionId); |
| 3734 | return; |
| 3735 | } |
| 3736 | limLog(mac_ctx, LOG1, FL("session id %d switch count %d"), |
| 3737 | mac_ctx->lim.limTimers.g_lim_ap_ecsa_timer.sessionId, |
| 3738 | session->gLimChannelSwitch.switchCount); |
| 3739 | /* |
| 3740 | * For each beacon interval decrement switch count to use proper value |
| 3741 | * in probe resp sent by host. Once it becomes 0 send tx complete |
| 3742 | * indication to SME. |
| 3743 | */ |
| 3744 | if (session->gLimChannelSwitch.switchCount > 0) { |
| 3745 | session->gLimChannelSwitch.switchCount--; |
Abhishek Singh | 449c537 | 2017-12-19 17:21:20 +0530 | [diff] [blame] | 3746 | lim_send_chan_switch_action_frame(mac_ctx, |
| 3747 | session->gLimChannelSwitch.primaryChannel, session); |
Abhishek Singh | 550aa8c | 2017-10-30 17:34:53 +0530 | [diff] [blame] | 3748 | mac_ctx->lim.limTimers.g_lim_ap_ecsa_timer.sessionId = |
| 3749 | session->peSessionId; |
| 3750 | limDeactivateAndChangeTimer(mac_ctx, eLIM_AP_ECSA_TIMER); |
| 3751 | |
| 3752 | if (tx_timer_activate(&mac_ctx->lim.limTimers.g_lim_ap_ecsa_timer) != |
| 3753 | TX_SUCCESS) |
| 3754 | { |
| 3755 | limLog(mac_ctx, LOGE, FL("Couldn't activate g_lim_ap_ecsa_timer")); |
| 3756 | lim_process_ap_ecsa_timeout(mac_ctx); |
| 3757 | } |
| 3758 | return; |
| 3759 | } |
| 3760 | |
| 3761 | session->include_ecsa_ie = false; |
| 3762 | session->include_wide_ch_bw_ie = false; |
| 3763 | |
| 3764 | ecsa_ie_cmp_ind = vos_mem_malloc(sizeof(*ecsa_ie_cmp_ind)); |
| 3765 | if(!ecsa_ie_cmp_ind) |
| 3766 | { |
| 3767 | limLog(mac_ctx, LOGE, FL("failed to allocate ecsa_ie_cmp_ind")); |
| 3768 | return; |
| 3769 | } |
| 3770 | ecsa_ie_cmp_ind->session_id = session->smeSessionId; |
| 3771 | |
| 3772 | msg.type = eWNI_SME_ECSA_IE_BEACON_COMP_IND; |
| 3773 | msg.bodyptr = ecsa_ie_cmp_ind; |
| 3774 | limSysProcessMmhMsgApi(mac_ctx, &msg, ePROT); |
| 3775 | return; |
| 3776 | } |
| 3777 | |
| 3778 | void lim_send_sme_ap_channel_switch_resp(tpAniSirGlobal mac_ctx, |
| 3779 | tpPESession session, tpSwitchChannelParams chan_params) |
| 3780 | { |
| 3781 | tSirMsgQ msg = {0}; |
| 3782 | struct sir_channel_chanege_rsp *params; |
| 3783 | |
| 3784 | params = vos_mem_malloc(sizeof(*params)); |
| 3785 | if (!params) { |
| 3786 | limLog(mac_ctx, LOGE, FL("AllocateMemory failed for pSmeSwithChnlParams")); |
| 3787 | return; |
| 3788 | } |
| 3789 | |
| 3790 | params->sme_session_id = session->smeSessionId; |
| 3791 | params->new_channel = chan_params->channelNumber; |
| 3792 | params->status = chan_params->status; |
| 3793 | |
| 3794 | msg.type = eWNI_SME_ECSA_CHAN_CHANGE_RSP; |
| 3795 | msg.bodyptr = params; |
| 3796 | msg.bodyval = 0; |
| 3797 | limSysProcessMmhMsgApi(mac_ctx, &msg, ePROT); |
| 3798 | |
| 3799 | if (chan_params->channelNumber == session->currentOperChannel) { |
| 3800 | limApplyConfiguration(mac_ctx, session); |
| 3801 | limSendBeaconInd(mac_ctx, session); |
| 3802 | } else { |
| 3803 | limLog(mac_ctx, LOGE, FL("channel switch resp chan %d and session channel doesnt match %d"), |
| 3804 | chan_params->channelNumber, session->currentOperChannel); |
| 3805 | } |
| 3806 | |
| 3807 | return; |
| 3808 | } |
| 3809 | |
| 3810 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3811 | /** |
| 3812 | * limProcessMlmDeauthReq() |
| 3813 | * |
| 3814 | *FUNCTION: |
| 3815 | * This function is called to process MLM_DEAUTH_REQ message |
| 3816 | * from SME |
| 3817 | * |
| 3818 | *LOGIC: |
| 3819 | * |
| 3820 | *ASSUMPTIONS: |
| 3821 | * |
| 3822 | *NOTE: |
| 3823 | * |
| 3824 | * @param pMac Pointer to Global MAC structure |
| 3825 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 3826 | * @return None |
| 3827 | */ |
| 3828 | |
| 3829 | static void |
| 3830 | limProcessMlmDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3831 | { |
| 3832 | // tANI_U16 aid; |
| 3833 | // tSirMacAddr currentBssId; |
| 3834 | // tpDphHashNode pStaDs; |
| 3835 | // struct tLimPreAuthNode *pAuthNode; |
| 3836 | tLimMlmDeauthReq *pMlmDeauthReq; |
| 3837 | // tLimMlmDeauthCnf mlmDeauthCnf; |
| 3838 | tpPESession psessionEntry; |
| 3839 | |
| 3840 | if(pMsgBuf == NULL) |
| 3841 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3842 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3843 | return; |
| 3844 | } |
| 3845 | |
| 3846 | pMlmDeauthReq = (tLimMlmDeauthReq *) pMsgBuf; |
| 3847 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3848 | limLog(pMac, LOG1,FL("Process Deauth Req on sessionID %d " |
| 3849 | "from: "MAC_ADDRESS_STR), pMlmDeauthReq->sessionId, |
| 3850 | MAC_ADDR_ARRAY(pMlmDeauthReq->peerMacAddr)); |
| 3851 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3852 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDeauthReq->sessionId))== NULL) |
| 3853 | { |
| 3854 | |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 3855 | limLog(pMac, LOGE, FL("session does not exist for given sessionId %d"), |
| 3856 | pMlmDeauthReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3857 | return; |
| 3858 | } |
Madan Mohan Koyyalamudi | 27ecc28 | 2012-11-06 15:07:28 -0800 | [diff] [blame] | 3859 | limProcessMlmDeauthReqNtf( pMac, eHAL_STATUS_SUCCESS, (tANI_U32*) pMsgBuf ); |
| 3860 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3861 | } /*** limProcessMlmDeauthReq() ***/ |
| 3862 | |
| 3863 | |
| 3864 | |
| 3865 | /** |
| 3866 | * @function : limProcessMlmSetKeysReq() |
| 3867 | * |
| 3868 | * @brief : This function is called to process MLM_SETKEYS_REQ message |
| 3869 | * from SME |
| 3870 | * |
| 3871 | *LOGIC: |
| 3872 | * |
| 3873 | *ASSUMPTIONS: |
| 3874 | * |
| 3875 | *NOTE: |
| 3876 | * |
| 3877 | * @param pMac Pointer to Global MAC structure |
| 3878 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 3879 | * @return None |
| 3880 | */ |
| 3881 | |
| 3882 | static void |
| 3883 | limProcessMlmSetKeysReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 3884 | { |
| 3885 | tANI_U16 aid; |
| 3886 | tANI_U16 staIdx = 0; |
| 3887 | tANI_U32 defaultKeyId = 0; |
| 3888 | tSirMacAddr currentBssId; |
| 3889 | tpDphHashNode pStaDs; |
| 3890 | tLimMlmSetKeysReq *pMlmSetKeysReq; |
| 3891 | tLimMlmSetKeysCnf mlmSetKeysCnf; |
| 3892 | tpPESession psessionEntry; |
| 3893 | |
| 3894 | if(pMsgBuf == NULL) |
| 3895 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3896 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3897 | return; |
| 3898 | } |
| 3899 | |
| 3900 | |
| 3901 | pMlmSetKeysReq = (tLimMlmSetKeysReq *) pMsgBuf; |
| 3902 | // Hold onto the SetKeys request parameters |
| 3903 | pMac->lim.gpLimMlmSetKeysReq = (void *) pMlmSetKeysReq; |
| 3904 | |
| 3905 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmSetKeysReq->sessionId))== NULL) |
| 3906 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3907 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given sessionId"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3908 | return; |
| 3909 | } |
| 3910 | |
| 3911 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3912 | FL( "Received MLM_SETKEYS_REQ with parameters:" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3913 | "AID [%d], ED Type [%d], # Keys [%d] & Peer MAC Addr - "), |
| 3914 | pMlmSetKeysReq->aid, |
| 3915 | pMlmSetKeysReq->edType, |
| 3916 | pMlmSetKeysReq->numKeys ); |
| 3917 | limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW ); |
| 3918 | |
| 3919 | #if 0 |
| 3920 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, WNI_CFG_BSSID, currentBssId, &cfg )) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3921 | limLog( pMac, LOGP, FL("Could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3922 | return; |
| 3923 | } |
| 3924 | #endif //TO SUPPORT BT-AMP |
| 3925 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 3926 | |
| 3927 | switch( psessionEntry->limSystemRole ) { |
| 3928 | case eLIM_STA_ROLE: |
| 3929 | case eLIM_BT_AMP_STA_ROLE: |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3930 | //In case of TDLS, peerMac address need not be BssId. Skip this check |
| 3931 | //if TDLS is enabled. |
| 3932 | #ifndef FEATURE_WLAN_TDLS |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3933 | if((!limIsAddrBC( pMlmSetKeysReq->peerMacAddr ) ) && |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 3934 | (!vos_mem_compare(pMlmSetKeysReq->peerMacAddr, |
| 3935 | currentBssId, sizeof(tSirMacAddr))) ){ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3936 | limLog( pMac, LOGW, FL("Received MLM_SETKEYS_REQ with invalid BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3937 | limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW ); |
| 3938 | |
| 3939 | // Prepare and Send LIM_MLM_SETKEYS_CNF with error code |
| 3940 | mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3941 | goto end; |
| 3942 | } |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 3943 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3944 | // Fall thru' & 'Plumb' keys below |
| 3945 | break; |
| 3946 | case eLIM_STA_IN_IBSS_ROLE: |
| 3947 | default: // others |
| 3948 | // Fall thru... |
| 3949 | break; |
| 3950 | } |
| 3951 | |
| 3952 | /** |
| 3953 | * Use the "unicast" parameter to determine if the "Group Keys" |
| 3954 | * are being set. |
| 3955 | * pMlmSetKeysReq->key.unicast = 0 -> Multicast/broadcast |
| 3956 | * pMlmSetKeysReq->key.unicast - 1 -> Unicast keys are being set |
| 3957 | */ |
| 3958 | if( limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3959 | limLog( pMac, LOG1, FL("Trying to set Group Keys...%d "), pMlmSetKeysReq->sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3960 | /** When trying to set Group Keys for any |
| 3961 | * security mode other than WEP, use the |
| 3962 | * STA Index corresponding to the AP... |
| 3963 | */ |
| 3964 | switch( pMlmSetKeysReq->edType ) { |
| 3965 | case eSIR_ED_CCMP: |
| 3966 | |
| 3967 | #ifdef WLAN_FEATURE_11W |
| 3968 | case eSIR_ED_AES_128_CMAC: |
| 3969 | #endif |
| 3970 | staIdx = psessionEntry->staId; |
| 3971 | break; |
| 3972 | |
| 3973 | default: |
| 3974 | break; |
| 3975 | } |
| 3976 | }else { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 3977 | limLog( pMac, LOG1, FL("Trying to set Unicast Keys...")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3978 | /** |
| 3979 | * Check if there exists a context for the |
| 3980 | * peer entity for which keys need to be set. |
| 3981 | */ |
| 3982 | |
| 3983 | |
| 3984 | pStaDs = dphLookupHashEntry( pMac, pMlmSetKeysReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable); |
| 3985 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3986 | if ((pStaDs == NULL) || |
| 3987 | ((pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE) && (psessionEntry->limSystemRole != eLIM_AP_ROLE))) { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 3988 | /** |
| 3989 | * Received LIM_MLM_SETKEYS_REQ for STA |
| 3990 | * that does not have context or in some |
| 3991 | * transit state. Log error. |
| 3992 | */ |
| 3993 | limLog( pMac, LOG1, |
| 3994 | FL("Received MLM_SETKEYS_REQ for STA that either has no context or in some transit state, Addr = ")); |
| 3995 | limPrintMacAddr( pMac, pMlmSetKeysReq->peerMacAddr, LOGW ); |
| 3996 | |
| 3997 | // Prepare and Send LIM_MLM_SETKEYS_CNF |
| 3998 | mlmSetKeysCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 3999 | goto end; |
| 4000 | } else |
| 4001 | staIdx = pStaDs->staIndex; |
| 4002 | } |
| 4003 | |
| 4004 | if ((pMlmSetKeysReq->numKeys == 0) && (pMlmSetKeysReq->edType != eSIR_ED_NONE)) { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4005 | // |
| 4006 | // Broadcast/Multicast Keys (for WEP!!) are NOT sent |
| 4007 | // via this interface!! |
| 4008 | // |
| 4009 | // This indicates to HAL that the WEP Keys need to be |
| 4010 | // extracted from the CFG and applied to hardware |
| 4011 | defaultKeyId = 0xff; |
| 4012 | }else if(pMlmSetKeysReq->key[0].keyId && |
| 4013 | ((pMlmSetKeysReq->edType == eSIR_ED_WEP40) || |
| 4014 | (pMlmSetKeysReq->edType == eSIR_ED_WEP104))){ |
| 4015 | /* If the Key Id is non zero and encryption mode is WEP, |
| 4016 | * the key index is coming from the upper layers so that key only |
| 4017 | * need to be used as the default tx key, This is being used only |
| 4018 | * in case of WEP mode in HAL */ |
| 4019 | defaultKeyId = pMlmSetKeysReq->key[0].keyId; |
| 4020 | }else |
| 4021 | defaultKeyId = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4022 | |
| 4023 | limLog( pMac, LOG1, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4024 | FL( "Trying to set keys for STA Index [%d], using defaultKeyId [%d]" ), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4025 | staIdx, |
| 4026 | defaultKeyId ); |
| 4027 | |
| 4028 | if(limIsAddrBC( pMlmSetKeysReq->peerMacAddr )) { |
| 4029 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 4030 | psessionEntry->limMlmState = eLIM_MLM_WT_SET_BSS_KEY_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4031 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4032 | limLog( pMac, LOG1, FL("Trying to set Group Keys...%d "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4033 | psessionEntry->peSessionId); |
| 4034 | |
| 4035 | // Package WDA_SET_BSSKEY_REQ message parameters |
| 4036 | limSendSetBssKeyReq(pMac, pMlmSetKeysReq,psessionEntry); |
| 4037 | return; |
| 4038 | }else { |
| 4039 | // Package WDA_SET_STAKEY_REQ / WDA_SET_STA_BCASTKEY_REQ message parameters |
| 4040 | limSendSetStaKeyReq(pMac, pMlmSetKeysReq, staIdx, (tANI_U8) defaultKeyId,psessionEntry); |
| 4041 | return; |
| 4042 | } |
| 4043 | |
| 4044 | end: |
| 4045 | mlmSetKeysCnf.sessionId= pMlmSetKeysReq->sessionId; |
| 4046 | limPostSmeSetKeysCnf( pMac, pMlmSetKeysReq, &mlmSetKeysCnf ); |
| 4047 | |
| 4048 | } /*** limProcessMlmSetKeysReq() ***/ |
| 4049 | |
| 4050 | /** |
| 4051 | * limProcessMlmRemoveKeyReq() |
| 4052 | * |
| 4053 | *FUNCTION: |
| 4054 | * This function is called to process MLM_REMOVEKEY_REQ message |
| 4055 | * from SME |
| 4056 | * |
| 4057 | *LOGIC: |
| 4058 | * |
| 4059 | *ASSUMPTIONS: |
| 4060 | * |
| 4061 | *NOTE: |
| 4062 | * |
| 4063 | * @param pMac Pointer to Global MAC structure |
| 4064 | * @param *pMsgBuf A pointer to the MLM message buffer |
| 4065 | * @return None |
| 4066 | */ |
| 4067 | |
| 4068 | static void |
| 4069 | limProcessMlmRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 4070 | { |
| 4071 | tANI_U16 aid; |
| 4072 | tANI_U16 staIdx = 0; |
| 4073 | tSirMacAddr currentBssId; |
| 4074 | tpDphHashNode pStaDs; |
| 4075 | tLimMlmRemoveKeyReq *pMlmRemoveKeyReq; |
| 4076 | tLimMlmRemoveKeyCnf mlmRemoveKeyCnf; |
| 4077 | tpPESession psessionEntry; |
| 4078 | |
| 4079 | if(pMsgBuf == NULL) |
| 4080 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4081 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4082 | return; |
| 4083 | } |
| 4084 | |
| 4085 | pMlmRemoveKeyReq = (tLimMlmRemoveKeyReq *) pMsgBuf; |
| 4086 | |
| 4087 | |
| 4088 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmRemoveKeyReq->sessionId))== NULL) |
| 4089 | { |
| 4090 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4091 | FL("session does not exist for given sessionId"));) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4092 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4093 | return; |
| 4094 | } |
| 4095 | |
| 4096 | |
| 4097 | if( pMac->lim.gpLimMlmRemoveKeyReq != NULL ) |
| 4098 | { |
| 4099 | // Free any previous requests. |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4100 | vos_mem_free(pMac->lim.gpLimMlmRemoveKeyReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4101 | pMac->lim.gpLimMlmRemoveKeyReq = NULL; |
| 4102 | } |
| 4103 | // Hold onto the RemoveKeys request parameters |
| 4104 | pMac->lim.gpLimMlmRemoveKeyReq = (void *) pMlmRemoveKeyReq; |
| 4105 | |
| 4106 | #if 0 |
| 4107 | if( eSIR_SUCCESS != wlan_cfgGetStr( pMac, |
| 4108 | WNI_CFG_BSSID, |
| 4109 | currentBssId, |
| 4110 | &cfg )) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4111 | limLog( pMac, LOGP, FL("Could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4112 | #endif //TO-SUPPORT BT-AMP |
| 4113 | sirCopyMacAddr(currentBssId,psessionEntry->bssId); |
| 4114 | |
| 4115 | switch( psessionEntry->limSystemRole ) |
| 4116 | { |
| 4117 | case eLIM_STA_ROLE: |
| 4118 | case eLIM_BT_AMP_STA_ROLE: |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4119 | if (( limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr ) != true ) && |
| 4120 | (!vos_mem_compare(pMlmRemoveKeyReq->peerMacAddr, |
| 4121 | currentBssId, |
| 4122 | sizeof(tSirMacAddr)))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4123 | { |
| 4124 | limLog( pMac, LOGW, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4125 | FL("Received MLM_REMOVEKEY_REQ with invalid BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4126 | limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW ); |
| 4127 | |
| 4128 | // Prepare and Send LIM_MLM_REMOVEKEY_CNF with error code |
| 4129 | mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4130 | goto end; |
| 4131 | } |
| 4132 | break; |
| 4133 | |
| 4134 | case eLIM_STA_IN_IBSS_ROLE: |
| 4135 | default: // eLIM_AP_ROLE |
| 4136 | // Fall thru... |
| 4137 | break; |
| 4138 | } |
| 4139 | |
| 4140 | |
| 4141 | psessionEntry->limPrevMlmState = psessionEntry->limMlmState; |
| 4142 | if(limIsAddrBC( pMlmRemoveKeyReq->peerMacAddr )) //Second condition for IBSS or AP role. |
| 4143 | { |
| 4144 | psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_BSS_KEY_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4145 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4146 | // Package WDA_REMOVE_BSSKEY_REQ message parameters |
| 4147 | limSendRemoveBssKeyReq( pMac,pMlmRemoveKeyReq,psessionEntry); |
| 4148 | return; |
| 4149 | } |
| 4150 | |
| 4151 | /** |
| 4152 | * Check if there exists a context for the |
| 4153 | * peer entity for which keys need to be removed. |
| 4154 | */ |
| 4155 | pStaDs = dphLookupHashEntry( pMac, pMlmRemoveKeyReq->peerMacAddr, &aid, &psessionEntry->dph.dphHashTable ); |
| 4156 | if ((pStaDs == NULL) || |
| 4157 | (pStaDs && |
| 4158 | (pStaDs->mlmStaContext.mlmState != |
| 4159 | eLIM_MLM_LINK_ESTABLISHED_STATE))) |
| 4160 | { |
| 4161 | /** |
| 4162 | * Received LIM_MLM_REMOVEKEY_REQ for STA |
| 4163 | * that does not have context or in some |
| 4164 | * transit state. Log error. |
| 4165 | */ |
| 4166 | limLog( pMac, LOGW, |
| 4167 | FL("Received MLM_REMOVEKEYS_REQ for STA that either has no context or in some transit state, Addr = ")); |
| 4168 | limPrintMacAddr( pMac, pMlmRemoveKeyReq->peerMacAddr, LOGW ); |
| 4169 | |
| 4170 | // Prepare and Send LIM_MLM_REMOVEKEY_CNF |
| 4171 | mlmRemoveKeyCnf.resultCode = eSIR_SME_INVALID_PARAMETERS; |
| 4172 | mlmRemoveKeyCnf.sessionId = pMlmRemoveKeyReq->sessionId; |
| 4173 | |
| 4174 | |
| 4175 | goto end; |
| 4176 | } |
| 4177 | else |
| 4178 | staIdx = pStaDs->staIndex; |
| 4179 | |
| 4180 | |
| 4181 | |
| 4182 | psessionEntry->limMlmState = eLIM_MLM_WT_REMOVE_STA_KEY_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4183 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4184 | |
| 4185 | // Package WDA_REMOVE_STAKEY_REQ message parameters |
| 4186 | limSendRemoveStaKeyReq( pMac,pMlmRemoveKeyReq,staIdx,psessionEntry); |
| 4187 | return; |
| 4188 | |
| 4189 | end: |
| 4190 | limPostSmeRemoveKeyCnf( pMac, |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4191 | psessionEntry, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4192 | pMlmRemoveKeyReq, |
| 4193 | &mlmRemoveKeyCnf ); |
| 4194 | |
| 4195 | } /*** limProcessMlmRemoveKeyReq() ***/ |
| 4196 | |
| 4197 | |
| 4198 | /** |
| 4199 | * limProcessMinChannelTimeout() |
| 4200 | * |
| 4201 | *FUNCTION: |
| 4202 | * This function is called to process Min Channel Timeout |
| 4203 | * during channel scan. |
| 4204 | * |
| 4205 | *LOGIC: |
| 4206 | * |
| 4207 | *ASSUMPTIONS: |
| 4208 | * |
| 4209 | *NOTE: |
| 4210 | * |
| 4211 | * @param pMac Pointer to Global MAC structure |
| 4212 | * @return None |
| 4213 | */ |
| 4214 | |
| 4215 | static void |
| 4216 | limProcessMinChannelTimeout(tpAniSirGlobal pMac) |
| 4217 | { |
| 4218 | tANI_U8 channelNum; |
| 4219 | |
| 4220 | #ifdef GEN6_TODO |
| 4221 | //if the min Channel is maintained per session, then use the below seesionEntry |
| 4222 | //priority - LOW/might not be needed |
| 4223 | |
| 4224 | //TBD-RAJESH HOW TO GET sessionEntry????? |
| 4225 | tpPESession psessionEntry; |
| 4226 | |
| 4227 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimMinChannelTimer.sessionId))== NULL) |
| 4228 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4229 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4230 | return; |
| 4231 | } |
| 4232 | #endif |
| 4233 | |
Abhishek Singh | 89e1d67 | 2013-11-28 15:13:42 +0530 | [diff] [blame] | 4234 | /*do not process if we are in finish scan wait state i.e. |
| 4235 | scan is aborted or finished*/ |
| 4236 | if (pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE && |
| 4237 | pMac->lim.gLimHalScanState != eLIM_HAL_FINISH_SCAN_WAIT_STATE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4238 | { |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4239 | /// Min channel timer timed out |
| 4240 | pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff; |
| 4241 | limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER); |
| 4242 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER); |
Yeshwanth Sriram Guntuka | ed0d3d0 | 2018-02-23 16:10:46 +0530 | [diff] [blame] | 4243 | /* |
| 4244 | * Deactivate Max Channel timer as well since no probe resp/beacons |
| 4245 | * are received. |
| 4246 | */ |
| 4247 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
Praveen Kumar Sirisilla | 7ea8dc9 | 2013-12-22 16:35:05 -0800 | [diff] [blame] | 4248 | pMac->lim.probeCounter = 0; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4249 | if (pMac->lim.gLimCurrentScanChannelId <= |
| 4250 | (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)) |
| 4251 | { |
| 4252 | channelNum = (tANI_U8)limGetCurrentScanChannel(pMac); |
| 4253 | } |
| 4254 | else |
| 4255 | { |
| 4256 | // This shouldn't be the case, but when this happens, this timeout should be for the last channelId. |
| 4257 | // Get the channelNum as close to correct as possible. |
| 4258 | if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber) |
| 4259 | { |
| 4260 | channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1]; |
| 4261 | } |
| 4262 | else |
| 4263 | { |
| 4264 | channelNum = 1; |
| 4265 | } |
| 4266 | } |
| 4267 | |
Praveen Kumar Sirisilla | ac600a8 | 2013-10-18 11:07:47 -0700 | [diff] [blame] | 4268 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4269 | FL("Sending End Scan req from MIN_CH_TIMEOUT in state %d ch-%d"), |
Praveen Kumar Sirisilla | ac600a8 | 2013-10-18 11:07:47 -0700 | [diff] [blame] | 4270 | pMac->lim.gLimMlmState,channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4271 | limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE); |
| 4272 | } |
| 4273 | else |
| 4274 | { |
| 4275 | /** |
| 4276 | * MIN channel timer should not have timed out |
| 4277 | * in states other than wait_probe_response. |
| 4278 | * Log error. |
| 4279 | */ |
| 4280 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4281 | FL("received unexpected MIN channel timeout in mlme state %d and hal scan State %d"), |
Abhishek Singh | 89e1d67 | 2013-11-28 15:13:42 +0530 | [diff] [blame] | 4282 | pMac->lim.gLimMlmState,pMac->lim.gLimHalScanState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4283 | limPrintMlmState(pMac, LOGE, pMac->lim.gLimMlmState); |
| 4284 | } |
| 4285 | } /*** limProcessMinChannelTimeout() ***/ |
| 4286 | |
| 4287 | |
| 4288 | |
| 4289 | /** |
| 4290 | * limProcessMaxChannelTimeout() |
| 4291 | * |
| 4292 | *FUNCTION: |
| 4293 | * This function is called to process Max Channel Timeout |
| 4294 | * during channel scan. |
| 4295 | * |
| 4296 | *LOGIC: |
| 4297 | * |
| 4298 | *ASSUMPTIONS: |
| 4299 | * |
| 4300 | *NOTE: |
| 4301 | * |
| 4302 | * @param pMac Pointer to Global MAC structure |
| 4303 | * @return None |
| 4304 | */ |
| 4305 | |
| 4306 | static void |
| 4307 | limProcessMaxChannelTimeout(tpAniSirGlobal pMac) |
| 4308 | { |
| 4309 | tANI_U8 channelNum; |
| 4310 | |
Abhishek Singh | 89e1d67 | 2013-11-28 15:13:42 +0530 | [diff] [blame] | 4311 | /*do not process if we are in finish scan wait state i.e. |
| 4312 | scan is aborted or finished*/ |
| 4313 | if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE || |
| 4314 | pMac->lim.gLimMlmState == eLIM_MLM_PASSIVE_SCAN_STATE) && |
| 4315 | pMac->lim.gLimHalScanState != eLIM_HAL_FINISH_SCAN_WAIT_STATE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4316 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4317 | limLog(pMac, LOG1, FL("Scanning : Max channel timed out")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4318 | /** |
| 4319 | * MAX channel timer timed out |
| 4320 | * Continue channel scan. |
| 4321 | */ |
| 4322 | limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER); |
| 4323 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_PROBE_REQ_TIMER); |
| 4324 | pMac->lim.limTimers.gLimPeriodicProbeReqTimer.sessionId = 0xff; |
Praveen Kumar Sirisilla | 7ea8dc9 | 2013-12-22 16:35:05 -0800 | [diff] [blame] | 4325 | pMac->lim.probeCounter = 0; |
| 4326 | |
Kiet Lam | aa8e15a | 2014-02-11 23:30:06 -0800 | [diff] [blame] | 4327 | if (pMac->lim.gLimCurrentScanChannelId <= |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4328 | (tANI_U32)(pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1)) |
| 4329 | { |
| 4330 | channelNum = limGetCurrentScanChannel(pMac); |
| 4331 | } |
| 4332 | else |
| 4333 | { |
| 4334 | if(pMac->lim.gpLimMlmScanReq->channelList.channelNumber) |
| 4335 | { |
| 4336 | channelNum = pMac->lim.gpLimMlmScanReq->channelList.channelNumber[pMac->lim.gpLimMlmScanReq->channelList.numChannels - 1]; |
| 4337 | } |
| 4338 | else |
| 4339 | { |
| 4340 | channelNum = 1; |
| 4341 | } |
| 4342 | } |
Praveen Kumar Sirisilla | ac600a8 | 2013-10-18 11:07:47 -0700 | [diff] [blame] | 4343 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4344 | FL("Sending End Scan req from MAX_CH_TIMEOUT in state %d on ch-%d"), |
Praveen Kumar Sirisilla | ac600a8 | 2013-10-18 11:07:47 -0700 | [diff] [blame] | 4345 | pMac->lim.gLimMlmState,channelNum); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4346 | limSendHalEndScanReq(pMac, channelNum, eLIM_HAL_END_SCAN_WAIT_STATE); |
| 4347 | } |
| 4348 | else |
| 4349 | { |
| 4350 | /** |
| 4351 | * MAX channel timer should not have timed out |
| 4352 | * in states other than wait_scan. |
| 4353 | * Log error. |
| 4354 | */ |
| 4355 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4356 | FL("received unexpected MAX channel timeout in mlme state %d and hal scan state %d"), |
Abhishek Singh | 89e1d67 | 2013-11-28 15:13:42 +0530 | [diff] [blame] | 4357 | pMac->lim.gLimMlmState, pMac->lim.gLimHalScanState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4358 | limPrintMlmState(pMac, LOGW, pMac->lim.gLimMlmState); |
| 4359 | } |
| 4360 | } /*** limProcessMaxChannelTimeout() ***/ |
| 4361 | |
| 4362 | /** |
| 4363 | * limProcessPeriodicProbeReqTimer() |
| 4364 | * |
| 4365 | *FUNCTION: |
| 4366 | * This function is called to process periodic probe request |
| 4367 | * to send during scan. |
| 4368 | * |
| 4369 | *LOGIC: |
| 4370 | * |
| 4371 | *ASSUMPTIONS: |
| 4372 | * |
| 4373 | *NOTE: |
| 4374 | * |
| 4375 | * @param pMac Pointer to Global MAC structure |
| 4376 | * @return None |
| 4377 | */ |
| 4378 | |
| 4379 | static void |
| 4380 | limProcessPeriodicProbeReqTimer(tpAniSirGlobal pMac) |
| 4381 | { |
| 4382 | tANI_U8 channelNum; |
| 4383 | tANI_U8 i = 0; |
| 4384 | tSirRetStatus status = eSIR_SUCCESS; |
| 4385 | TX_TIMER *pPeriodicProbeReqTimer; |
| 4386 | pPeriodicProbeReqTimer = &pMac->lim.limTimers.gLimPeriodicProbeReqTimer; |
| 4387 | |
| 4388 | if(vos_timer_getCurrentState(&pPeriodicProbeReqTimer->vosTimer) |
| 4389 | != VOS_TIMER_STATE_STOPPED) |
| 4390 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4391 | limLog(pMac, LOG1, FL("Invalid state of timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4392 | return; |
| 4393 | } |
| 4394 | |
| 4395 | if ((pMac->lim.gLimMlmState == eLIM_MLM_WT_PROBE_RESP_STATE) && |
Praveen Kumar Sirisilla | 7ea8dc9 | 2013-12-22 16:35:05 -0800 | [diff] [blame] | 4396 | (pPeriodicProbeReqTimer->sessionId != 0xff) && (pMac->lim.probeCounter < pMac->lim.maxProbe)) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4397 | { |
| 4398 | tLimMlmScanReq *pLimMlmScanReq = pMac->lim.gpLimMlmScanReq; |
Praveen Kumar Sirisilla | 7ea8dc9 | 2013-12-22 16:35:05 -0800 | [diff] [blame] | 4399 | pMac->lim.probeCounter++; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4400 | /** |
| 4401 | * Periodic channel timer timed out |
| 4402 | * to send probe request. |
| 4403 | */ |
| 4404 | channelNum = limGetCurrentScanChannel(pMac); |
Abhishek Singh | 795e1b8 | 2015-09-25 15:35:03 +0530 | [diff] [blame] | 4405 | /* Prepare and send Probe Request frame for all the SSIDs |
| 4406 | * present in the saved MLM |
| 4407 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4408 | do |
| 4409 | { |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 4410 | tSirMacAddr gSelfMacAddr; |
| 4411 | bool spoof = lim_is_spoofing_needed(pMac); |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 4412 | |
Rajeev Kumar Sirasanagandla | 2bb30b8 | 2019-01-07 22:30:16 +0530 | [diff] [blame] | 4413 | if (spoof) |
| 4414 | vos_mem_copy(gSelfMacAddr, pMac->lim.spoofMacAddr, |
| 4415 | VOS_MAC_ADDRESS_LEN); |
| 4416 | else |
| 4417 | vos_mem_copy(gSelfMacAddr, pMac->lim.gSelfMacAddr, |
| 4418 | VOS_MAC_ADDRESS_LEN); |
| 4419 | |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 4420 | limLog( pMac, LOG1, FL("Mac Addr used in Probe Req is :"MAC_ADDRESS_STR), |
| 4421 | MAC_ADDR_ARRAY(gSelfMacAddr)); |
| 4422 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4423 | /* |
| 4424 | * PELOGE(limLog(pMac, LOGW, FL("sending ProbeReq number %d," |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4425 | * " for SSID %s on channel: %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4426 | * i, pLimMlmScanReq->ssId[i].ssId, |
| 4427 | * channelNum);) |
| 4428 | */ |
| 4429 | status = limSendProbeReqMgmtFrame( pMac, &pLimMlmScanReq->ssId[i], |
Siddharth Bhal | 4f3187c | 2014-10-09 21:38:08 +0530 | [diff] [blame] | 4430 | pLimMlmScanReq->bssId, channelNum, gSelfMacAddr, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4431 | pLimMlmScanReq->dot11mode, pLimMlmScanReq->uIEFieldLen, |
| 4432 | (tANI_U8 *)(pLimMlmScanReq) + pLimMlmScanReq->uIEFieldOffset); |
| 4433 | |
| 4434 | |
| 4435 | if ( status != eSIR_SUCCESS) |
| 4436 | { |
| 4437 | PELOGE(limLog(pMac, LOGE, FL("send ProbeReq failed for SSID " |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4438 | "%s on channel: %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4439 | pLimMlmScanReq->ssId[i].ssId, |
| 4440 | channelNum);) |
| 4441 | return; |
| 4442 | } |
| 4443 | i++; |
| 4444 | } while (i < pLimMlmScanReq->numSsid); |
| 4445 | |
| 4446 | /* Activate timer again */ |
| 4447 | if (tx_timer_activate(pPeriodicProbeReqTimer) != TX_SUCCESS) |
| 4448 | { |
| 4449 | limLog(pMac, LOGP, FL("could not start periodic probe" |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4450 | " req timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4451 | return; |
| 4452 | } |
| 4453 | } |
| 4454 | else |
| 4455 | { |
| 4456 | /** |
| 4457 | * Periodic scan is timeout is happening in |
| 4458 | * in states other than wait_scan. |
| 4459 | * Log error. |
| 4460 | */ |
Mohit Khanna | 2386376 | 2012-09-11 17:40:09 -0700 | [diff] [blame] | 4461 | limLog(pMac, LOG1, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4462 | FL("received unexpected Periodic scan timeout in state %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4463 | pMac->lim.gLimMlmState); |
| 4464 | } |
| 4465 | } /*** limProcessPeriodicProbeReqTimer() ***/ |
| 4466 | |
| 4467 | /** |
| 4468 | * limProcessJoinFailureTimeout() |
| 4469 | * |
| 4470 | *FUNCTION: |
| 4471 | * This function is called to process JoinFailureTimeout |
| 4472 | * |
| 4473 | *LOGIC: |
| 4474 | * |
| 4475 | *ASSUMPTIONS: |
| 4476 | * |
| 4477 | *NOTE: |
| 4478 | * |
| 4479 | * @param pMac Pointer to Global MAC structure |
| 4480 | * @return None |
| 4481 | */ |
| 4482 | |
| 4483 | static void |
| 4484 | limProcessJoinFailureTimeout(tpAniSirGlobal pMac) |
| 4485 | { |
| 4486 | tLimMlmJoinCnf mlmJoinCnf; |
| 4487 | tSirMacAddr bssid; |
| 4488 | tANI_U32 len; |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4489 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4490 | vos_log_rssi_pkt_type *pRssiLog = NULL; |
| 4491 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4492 | |
| 4493 | //fetch the sessionEntry based on the sessionId |
| 4494 | tpPESession psessionEntry; |
| 4495 | |
| 4496 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimJoinFailureTimer.sessionId))== NULL) |
| 4497 | { |
Srinivas Girigowda | 2a69dcf | 2013-09-13 14:48:34 -0700 | [diff] [blame] | 4498 | limLog(pMac, LOGE, FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4499 | return; |
| 4500 | } |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4501 | |
| 4502 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4503 | WLAN_VOS_DIAG_LOG_ALLOC(pRssiLog, |
| 4504 | vos_log_rssi_pkt_type, LOG_WLAN_RSSI_UPDATE_C); |
| 4505 | if (pRssiLog) |
| 4506 | { |
| 4507 | pRssiLog->rssi = psessionEntry->rssi; |
| 4508 | } |
| 4509 | WLAN_VOS_DIAG_LOG_REPORT(pRssiLog); |
| 4510 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4511 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4512 | if (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE) |
| 4513 | { |
| 4514 | len = sizeof(tSirMacAddr); |
| 4515 | |
| 4516 | if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, bssid, &len) != |
| 4517 | eSIR_SUCCESS) |
| 4518 | { |
| 4519 | /// Could not get BSSID from CFG. Log error. |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4520 | limLog(pMac, LOGP, FL("could not retrieve BSSID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4521 | return; |
| 4522 | } |
| 4523 | |
| 4524 | // 'Change' timer for future activations |
| 4525 | limDeactivateAndChangeTimer(pMac, eLIM_JOIN_FAIL_TIMER); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 4526 | // Change Periodic probe req timer for future activation |
| 4527 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4528 | /** |
| 4529 | * Issue MLM join confirm with timeout reason code |
| 4530 | */ |
Kiet Lam | 82004c6 | 2013-11-11 13:24:28 +0530 | [diff] [blame] | 4531 | PELOGE(limLog(pMac, LOGE, FL(" In state eLIM_MLM_WT_JOIN_BEACON_STATE."));) |
| 4532 | PELOGE(limLog(pMac, LOGE, FL(" Join Failure Timeout occurred for session %d with BSS "), |
| 4533 | psessionEntry->peSessionId); |
| 4534 | limPrintMacAddr(pMac, psessionEntry->bssId, LOGE);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4535 | |
| 4536 | mlmJoinCnf.resultCode = eSIR_SME_JOIN_TIMEOUT_RESULT_CODE; |
| 4537 | mlmJoinCnf.protStatusCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 4538 | |
| 4539 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4540 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4541 | if(limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, psessionEntry->bssId, |
| 4542 | psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4543 | PELOGE(limLog(pMac, LOGE, FL("Failed to set the LinkState"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4544 | /* Update PE session Id */ |
| 4545 | mlmJoinCnf.sessionId = psessionEntry->peSessionId; |
| 4546 | |
| 4547 | |
| 4548 | // Freeup buffer allocated to join request |
| 4549 | if (psessionEntry->pLimMlmJoinReq) |
| 4550 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4551 | vos_mem_free(psessionEntry->pLimMlmJoinReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4552 | psessionEntry->pLimMlmJoinReq = NULL; |
| 4553 | } |
| 4554 | |
| 4555 | limPostSmeMessage(pMac, |
| 4556 | LIM_MLM_JOIN_CNF, |
| 4557 | (tANI_U32 *) &mlmJoinCnf); |
| 4558 | |
| 4559 | return; |
| 4560 | } |
| 4561 | else |
| 4562 | { |
| 4563 | /** |
| 4564 | * Join failure timer should not have timed out |
| 4565 | * in states other than wait_join_beacon state. |
| 4566 | * Log error. |
| 4567 | */ |
| 4568 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4569 | FL("received unexpected JOIN failure timeout in state %d"),psessionEntry->limMlmState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4570 | limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); |
| 4571 | } |
| 4572 | } /*** limProcessJoinFailureTimeout() ***/ |
| 4573 | |
| 4574 | |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 4575 | /** |
| 4576 | * limProcessPeriodicJoinProbeReqTimer() |
| 4577 | * |
| 4578 | *FUNCTION: |
| 4579 | * This function is called to process periodic probe request |
| 4580 | * send during joining process. |
| 4581 | * |
| 4582 | *LOGIC: |
| 4583 | * |
| 4584 | *ASSUMPTIONS: |
| 4585 | * |
| 4586 | *NOTE: |
| 4587 | * |
| 4588 | * @param pMac Pointer to Global MAC structure |
| 4589 | * @return None |
| 4590 | */ |
| 4591 | |
| 4592 | static void limProcessPeriodicJoinProbeReqTimer(tpAniSirGlobal pMac) |
| 4593 | { |
| 4594 | tpPESession psessionEntry; |
| 4595 | tSirMacSSid ssId; |
| 4596 | |
| 4597 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId))== NULL) |
| 4598 | { |
Kiet Lam | 82004c6 | 2013-11-11 13:24:28 +0530 | [diff] [blame] | 4599 | limLog(pMac, LOGE,FL("session does not exist for given SessionId : %d"), |
| 4600 | pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer.sessionId); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 4601 | return; |
| 4602 | } |
| 4603 | |
| 4604 | if((VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimJoinFailureTimer)) && |
| 4605 | (psessionEntry->limMlmState == eLIM_MLM_WT_JOIN_BEACON_STATE)) |
| 4606 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4607 | vos_mem_copy(ssId.ssId, |
| 4608 | psessionEntry->ssId.ssId, |
| 4609 | psessionEntry->ssId.length); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 4610 | ssId.length = psessionEntry->ssId.length; |
| 4611 | |
| 4612 | limSendProbeReqMgmtFrame( pMac, &ssId, |
| 4613 | psessionEntry->pLimMlmJoinReq->bssDescription.bssId, psessionEntry->currentOperChannel/*chanNum*/, |
| 4614 | psessionEntry->selfMacAddr, psessionEntry->dot11mode, |
| 4615 | psessionEntry->pLimJoinReq->addIEScan.length, psessionEntry->pLimJoinReq->addIEScan.addIEdata); |
| 4616 | |
| 4617 | limDeactivateAndChangeTimer(pMac, eLIM_PERIODIC_JOIN_PROBE_REQ_TIMER); |
| 4618 | |
| 4619 | // Activate Join Periodic Probe Req timer |
| 4620 | if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicJoinProbeReqTimer) != TX_SUCCESS) |
| 4621 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4622 | limLog(pMac, LOGP, FL("could not activate Periodic Join req failure timer")); |
Madan Mohan Koyyalamudi | 9aff9ff | 2012-11-29 11:27:25 -0800 | [diff] [blame] | 4623 | return; |
| 4624 | } |
| 4625 | } |
| 4626 | return; |
| 4627 | } /*** limProcessPeriodicJoinProbeReqTimer() ***/ |
| 4628 | |
Sushant Kaushik | 9e92387 | 2015-04-02 17:09:31 +0530 | [diff] [blame] | 4629 | /** |
| 4630 | * limProcessAuthRetryTimer() |
| 4631 | * |
| 4632 | *FUNCTION: |
| 4633 | * This function is called to process Auth Retry request |
| 4634 | * send during joining process. |
| 4635 | * |
| 4636 | *LOGIC: |
| 4637 | * |
| 4638 | *ASSUMPTIONS: |
| 4639 | * |
| 4640 | *NOTE: |
| 4641 | * |
| 4642 | * @param pMac Pointer to Global MAC structure |
| 4643 | * @return None |
| 4644 | */ |
| 4645 | |
| 4646 | static void limProcessAuthRetryTimer(tpAniSirGlobal pMac) |
| 4647 | { |
| 4648 | tpPESession psessionEntry; |
| 4649 | limLog(pMac, LOG1, FL(" ENTER ")); |
| 4650 | if ((psessionEntry = |
| 4651 | peFindSessionBySessionId(pMac, |
| 4652 | pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId)) == NULL) |
| 4653 | { |
| 4654 | limLog(pMac, LOGE,FL("session does not exist for given SessionId : %d"), |
| 4655 | pMac->lim.limTimers.gLimPeriodicAuthRetryTimer.sessionId); |
| 4656 | return; |
| 4657 | } |
| 4658 | |
| 4659 | if ((VOS_TRUE == |
| 4660 | tx_timer_running(&pMac->lim.limTimers.gLimAuthFailureTimer)) && |
| 4661 | (psessionEntry->limMlmState == eLIM_MLM_WT_AUTH_FRAME2_STATE) && |
| 4662 | (LIM_AUTH_ACK_RCD_SUCCESS != pMac->authAckStatus)) |
| 4663 | { |
| 4664 | tSirMacAuthFrameBody authFrameBody; |
| 4665 | |
| 4666 | /* Send the auth retry only in case we have received ack failure |
| 4667 | * else just restart the retry timer. |
| 4668 | */ |
| 4669 | if (LIM_AUTH_ACK_RCD_FAILURE == pMac->authAckStatus) |
| 4670 | { |
| 4671 | /// Prepare & send Authentication frame |
| 4672 | authFrameBody.authAlgoNumber = |
| 4673 | (tANI_U8) pMac->lim.gpLimMlmAuthReq->authType; |
| 4674 | authFrameBody.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1; |
| 4675 | authFrameBody.authStatusCode = 0; |
| 4676 | limLog(pMac, LOGW, FL("Retry Auth ")); |
| 4677 | pMac->authAckStatus = LIM_AUTH_ACK_NOT_RCD; |
| 4678 | limSendAuthMgmtFrame(pMac, |
| 4679 | &authFrameBody, |
| 4680 | pMac->lim.gpLimMlmAuthReq->peerMacAddr, |
| 4681 | LIM_NO_WEP_IN_FC, psessionEntry, eSIR_TRUE); |
| 4682 | } |
| 4683 | |
| 4684 | limDeactivateAndChangeTimer(pMac, eLIM_AUTH_RETRY_TIMER); |
| 4685 | |
| 4686 | // Activate Auth Retry timer |
| 4687 | if (tx_timer_activate(&pMac->lim.limTimers.gLimPeriodicAuthRetryTimer) |
| 4688 | != TX_SUCCESS) |
| 4689 | { |
| 4690 | limLog(pMac, LOGE, |
| 4691 | FL("could not activate Auth Retry failure timer")); |
| 4692 | return; |
| 4693 | } |
| 4694 | } |
| 4695 | return; |
| 4696 | } /*** limProcessAuthRetryTimer() ***/ |
| 4697 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4698 | |
| 4699 | /** |
| 4700 | * limProcessAuthFailureTimeout() |
| 4701 | * |
| 4702 | *FUNCTION: |
| 4703 | * This function is called to process Min Channel Timeout |
| 4704 | * during channel scan. |
| 4705 | * |
| 4706 | *LOGIC: |
| 4707 | * |
| 4708 | *ASSUMPTIONS: |
| 4709 | * |
| 4710 | *NOTE: |
| 4711 | * |
| 4712 | * @param pMac Pointer to Global MAC structure |
| 4713 | * @return None |
| 4714 | */ |
| 4715 | |
| 4716 | static void |
| 4717 | limProcessAuthFailureTimeout(tpAniSirGlobal pMac) |
| 4718 | { |
| 4719 | //fetch the sessionEntry based on the sessionId |
| 4720 | tpPESession psessionEntry; |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4721 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4722 | vos_log_rssi_pkt_type *pRssiLog = NULL; |
| 4723 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4724 | if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAuthFailureTimer.sessionId))== NULL) |
| 4725 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4726 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4727 | return; |
| 4728 | } |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 4729 | limLog(pMac, LOGE, FL("received AUTH failure timeout in sessionid %d " |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4730 | "limMlmstate %d limSmeState %d"), psessionEntry->peSessionId, |
Abhishek Singh | dcbd827 | 2014-01-09 14:16:01 +0530 | [diff] [blame] | 4731 | psessionEntry->limMlmState, psessionEntry->limSmeState); |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4732 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4733 | WLAN_VOS_DIAG_LOG_ALLOC(pRssiLog, |
| 4734 | vos_log_rssi_pkt_type, LOG_WLAN_RSSI_UPDATE_C); |
| 4735 | if (pRssiLog) |
| 4736 | { |
| 4737 | pRssiLog->rssi = psessionEntry->rssi; |
| 4738 | } |
| 4739 | WLAN_VOS_DIAG_LOG_REPORT(pRssiLog); |
| 4740 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4741 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4742 | switch (psessionEntry->limMlmState) |
| 4743 | { |
| 4744 | case eLIM_MLM_WT_AUTH_FRAME2_STATE: |
| 4745 | case eLIM_MLM_WT_AUTH_FRAME4_STATE: |
| 4746 | /** |
| 4747 | * Requesting STA did not receive next auth frame |
| 4748 | * before Auth Failure timeout. |
| 4749 | * Issue MLM auth confirm with timeout reason code |
| 4750 | */ |
Madan Mohan Koyyalamudi | 666d33a | 2012-11-29 11:32:59 -0800 | [diff] [blame] | 4751 | //Restore default failure timeout |
| 4752 | if (VOS_P2P_CLIENT_MODE == psessionEntry->pePersona && psessionEntry->defaultAuthFailureTimeout) |
| 4753 | { |
| 4754 | ccmCfgSetInt(pMac,WNI_CFG_AUTHENTICATE_FAILURE_TIMEOUT , |
| 4755 | psessionEntry->defaultAuthFailureTimeout, NULL, eANI_BOOLEAN_FALSE); |
| 4756 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4757 | limRestoreFromAuthState(pMac,eSIR_SME_AUTH_TIMEOUT_RESULT_CODE,eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry); |
| 4758 | break; |
| 4759 | |
| 4760 | default: |
| 4761 | /** |
| 4762 | * Auth failure timer should not have timed out |
| 4763 | * in states other than wt_auth_frame2/4 |
| 4764 | * Log error. |
| 4765 | */ |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4766 | PELOGE(limLog(pMac, LOGE, FL("received unexpected AUTH failure timeout in state %d"), psessionEntry->limMlmState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4767 | limPrintMlmState(pMac, LOGE, psessionEntry->limMlmState); |
| 4768 | |
| 4769 | break; |
| 4770 | } |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 4771 | /* Reinit scan results to remove the unreachable BSS */ |
| 4772 | limReInitScanResults(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4773 | } /*** limProcessAuthFailureTimeout() ***/ |
| 4774 | |
| 4775 | |
| 4776 | |
| 4777 | /** |
| 4778 | * limProcessAuthRspTimeout() |
| 4779 | * |
| 4780 | *FUNCTION: |
| 4781 | * This function is called to process Min Channel Timeout |
| 4782 | * during channel scan. |
| 4783 | * |
| 4784 | *LOGIC: |
| 4785 | * |
| 4786 | *ASSUMPTIONS: |
| 4787 | * |
| 4788 | *NOTE: |
| 4789 | * |
| 4790 | * @param pMac Pointer to Global MAC structure |
| 4791 | * @return None |
| 4792 | */ |
| 4793 | |
| 4794 | static void |
| 4795 | limProcessAuthRspTimeout(tpAniSirGlobal pMac, tANI_U32 authIndex) |
| 4796 | { |
| 4797 | struct tLimPreAuthNode *pAuthNode; |
| 4798 | tpPESession psessionEntry; |
| 4799 | tANI_U8 sessionId; |
| 4800 | |
| 4801 | pAuthNode = limGetPreAuthNodeFromIndex(pMac, &pMac->lim.gLimPreAuthTimerTable, authIndex); |
| 4802 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4803 | if (NULL == pAuthNode) |
| 4804 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4805 | limLog(pMac, LOGW, FL("Invalid auth node")); |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4806 | return; |
| 4807 | } |
| 4808 | |
| 4809 | if ((psessionEntry = peFindSessionByBssid(pMac, pAuthNode->peerMacAddr, &sessionId)) == NULL) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4810 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4811 | limLog(pMac, LOGW, FL("session does not exist for given BSSID ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4812 | return; |
| 4813 | } |
| 4814 | |
| 4815 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE || |
| 4816 | psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) |
| 4817 | { |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4818 | if (pAuthNode->mlmState != eLIM_MLM_WT_AUTH_FRAME3_STATE) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4819 | { |
| 4820 | /** |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4821 | * Authentication response timer timedout |
| 4822 | * in unexpected state. Log error |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4823 | */ |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4824 | PELOGE(limLog(pMac, LOGE, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4825 | FL("received AUTH rsp timeout in unexpected state " |
| 4826 | "for MAC address: "MAC_ADDRESS_STR), |
| 4827 | MAC_ADDR_ARRAY(pAuthNode->peerMacAddr));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4828 | } |
| 4829 | else |
| 4830 | { |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4831 | // Authentication response timer |
| 4832 | // timedout for an STA. |
| 4833 | pAuthNode->mlmState = eLIM_MLM_AUTH_RSP_TIMEOUT_STATE; |
| 4834 | pAuthNode->fTimerStarted = 0; |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4835 | limLog(pMac, LOG1, |
Abhishek Singh | cd09b56 | 2013-12-24 16:02:20 +0530 | [diff] [blame] | 4836 | FL("AUTH rsp timedout for MAC address "MAC_ADDRESS_STR), |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4837 | MAC_ADDR_ARRAY(pAuthNode->peerMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4838 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4839 | // Change timer to reactivate it in future |
| 4840 | limDeactivateAndChangePerStaIdTimer(pMac, |
| 4841 | eLIM_AUTH_RSP_TIMER, |
| 4842 | pAuthNode->authNodeIdx); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4843 | |
Pratik Bhalgat | aa1ae39 | 2012-11-22 17:44:33 +0530 | [diff] [blame] | 4844 | limDeletePreAuthNode(pMac, pAuthNode->peerMacAddr); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4845 | } |
| 4846 | } |
| 4847 | } /*** limProcessAuthRspTimeout() ***/ |
| 4848 | |
| 4849 | |
| 4850 | /** |
| 4851 | * limProcessAssocFailureTimeout() |
| 4852 | * |
| 4853 | *FUNCTION: |
| 4854 | * This function is called to process Min Channel Timeout |
| 4855 | * during channel scan. |
| 4856 | * |
| 4857 | *LOGIC: |
| 4858 | * |
| 4859 | *ASSUMPTIONS: |
| 4860 | * |
| 4861 | *NOTE: |
| 4862 | * |
| 4863 | * @param pMac Pointer to Global MAC structure |
| 4864 | * @return None |
| 4865 | */ |
| 4866 | |
| 4867 | static void |
| 4868 | limProcessAssocFailureTimeout(tpAniSirGlobal pMac, tANI_U32 MsgType) |
| 4869 | { |
| 4870 | |
| 4871 | tLimMlmAssocCnf mlmAssocCnf; |
| 4872 | tpPESession psessionEntry; |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4873 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4874 | vos_log_rssi_pkt_type *pRssiLog = NULL; |
| 4875 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4876 | |
| 4877 | //to fetch the lim/mlm state based on the sessionId, use the below sessionEntry |
| 4878 | tANI_U8 sessionId; |
| 4879 | |
| 4880 | if(MsgType == LIM_ASSOC) |
| 4881 | { |
| 4882 | sessionId = pMac->lim.limTimers.gLimAssocFailureTimer.sessionId; |
| 4883 | } |
| 4884 | else |
| 4885 | { |
| 4886 | sessionId = pMac->lim.limTimers.gLimReassocFailureTimer.sessionId; |
| 4887 | } |
| 4888 | |
| 4889 | if((psessionEntry = peFindSessionBySessionId(pMac, sessionId))== NULL) |
| 4890 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4891 | limLog(pMac, LOGP,FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4892 | return; |
| 4893 | } |
krunal soni | 8d13b09 | 2013-07-19 13:23:29 -0700 | [diff] [blame] | 4894 | #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4895 | WLAN_VOS_DIAG_LOG_ALLOC(pRssiLog, |
| 4896 | vos_log_rssi_pkt_type, LOG_WLAN_RSSI_UPDATE_C); |
| 4897 | if (pRssiLog) |
| 4898 | { |
| 4899 | pRssiLog->rssi = psessionEntry->rssi; |
| 4900 | } |
| 4901 | WLAN_VOS_DIAG_LOG_REPORT(pRssiLog); |
| 4902 | #endif //FEATURE_WLAN_DIAG_SUPPORT_LIM |
| 4903 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4904 | /** |
| 4905 | * Expected Re/Association Response frame |
| 4906 | * not received within Re/Association Failure Timeout. |
| 4907 | */ |
| 4908 | |
| 4909 | |
| 4910 | |
| 4911 | |
Abhishek Singh | 70af9c7 | 2016-03-09 17:23:30 +0530 | [diff] [blame] | 4912 | /* |
| 4913 | * CR: vos packet memory is leaked when assoc rsp timeouted/failed. |
| 4914 | * notify TL that association is failed so that TL can flush the |
| 4915 | * cached frame |
| 4916 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4917 | WLANTL_AssocFailed (psessionEntry->staId); |
| 4918 | |
Abhishek Singh | 70af9c7 | 2016-03-09 17:23:30 +0530 | [diff] [blame] | 4919 | /* Log error */ |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4920 | limLog(pMac, LOG1, |
| 4921 | FL("Re/Association Response not received before timeout ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4922 | |
Abhishek Singh | 70af9c7 | 2016-03-09 17:23:30 +0530 | [diff] [blame] | 4923 | /* |
| 4924 | * Send Deauth to handle the scenareo where association timeout happened |
| 4925 | * when device has missed the assoc resp sent by peer. |
| 4926 | * By sending deauth try to clear the session created on peer device. |
| 4927 | */ |
| 4928 | limLog(pMac, LOGE, |
| 4929 | FL("Sessionid: %d try sending Send deauth on channel %d to BSSID: " |
| 4930 | MAC_ADDRESS_STR ), psessionEntry->peSessionId, |
| 4931 | psessionEntry->currentOperChannel, |
| 4932 | MAC_ADDR_ARRAY(psessionEntry->bssId)); |
| 4933 | |
| 4934 | limSendDeauthMgmtFrame(pMac, eSIR_MAC_UNSPEC_FAILURE_REASON, |
| 4935 | psessionEntry->bssId, |
| 4936 | psessionEntry, FALSE); |
| 4937 | |
| 4938 | if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) || |
| 4939 | (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )|| |
| 4940 | ((psessionEntry->limMlmState != eLIM_MLM_WT_ASSOC_RSP_STATE) && |
| 4941 | (psessionEntry->limMlmState != eLIM_MLM_WT_REASSOC_RSP_STATE) && |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4942 | (psessionEntry->limMlmState != eLIM_MLM_WT_FT_REASSOC_RSP_STATE))) |
| 4943 | { |
| 4944 | /** |
| 4945 | * Re/Assoc failure timer should not have timedout on AP |
| 4946 | * or in a state other than wt_re/assoc_response. |
| 4947 | */ |
| 4948 | |
| 4949 | // Log error |
| 4950 | limLog(pMac, LOGW, |
Sushant Kaushik | 1b64538 | 2014-10-13 16:39:36 +0530 | [diff] [blame] | 4951 | FL("received unexpected REASSOC failure timeout in state %d for role %d"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4952 | psessionEntry->limMlmState, psessionEntry->limSystemRole); |
| 4953 | limPrintMlmState(pMac, LOGW, psessionEntry->limMlmState); |
| 4954 | } |
| 4955 | else |
| 4956 | { |
| 4957 | |
| 4958 | if ((MsgType == LIM_ASSOC) || |
| 4959 | ((MsgType == LIM_REASSOC) && (psessionEntry->limMlmState == eLIM_MLM_WT_FT_REASSOC_RSP_STATE))) |
| 4960 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 4961 | PELOGE(limLog(pMac, LOGE, FL("(Re)Assoc Failure Timeout occurred."));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4962 | |
| 4963 | psessionEntry->limMlmState = eLIM_MLM_IDLE_STATE; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 4964 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
| 4965 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4966 | // 'Change' timer for future activations |
| 4967 | limDeactivateAndChangeTimer(pMac, eLIM_ASSOC_FAIL_TIMER); |
| 4968 | |
| 4969 | // Free up buffer allocated for JoinReq held by |
| 4970 | // MLM state machine |
| 4971 | if (psessionEntry->pLimMlmJoinReq) |
| 4972 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 4973 | vos_mem_free(psessionEntry->pLimMlmJoinReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4974 | psessionEntry->pLimMlmJoinReq = NULL; |
| 4975 | } |
| 4976 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4977 | //To remove the preauth node in case of fail to associate |
| 4978 | if (limSearchPreAuthList(pMac, psessionEntry->bssId)) |
| 4979 | { |
Abhishek Singh | 3cbf605 | 2014-12-15 16:46:42 +0530 | [diff] [blame] | 4980 | limLog(pMac, LOG1, FL(" delete pre auth node for " |
| 4981 | MAC_ADDRESS_STR), MAC_ADDR_ARRAY(psessionEntry->bssId)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4982 | limDeletePreAuthNode(pMac, psessionEntry->bssId); |
| 4983 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4984 | |
| 4985 | mlmAssocCnf.resultCode = |
| 4986 | eSIR_SME_ASSOC_TIMEOUT_RESULT_CODE; |
| 4987 | mlmAssocCnf.protStatusCode = |
| 4988 | eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 4989 | |
| 4990 | /* Update PE session Id*/ |
| 4991 | mlmAssocCnf.sessionId = psessionEntry->peSessionId; |
| 4992 | if (MsgType == LIM_ASSOC) |
| 4993 | limPostSmeMessage(pMac, LIM_MLM_ASSOC_CNF, (tANI_U32 *) &mlmAssocCnf); |
| 4994 | else |
| 4995 | { |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 4996 | /* Will come here only in case of 11r, ESE, FT when reassoc rsp |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 4997 | is not received and we receive a reassoc - timesout */ |
| 4998 | mlmAssocCnf.resultCode = eSIR_SME_FT_REASSOC_TIMEOUT_FAILURE; |
| 4999 | limPostSmeMessage(pMac, LIM_MLM_REASSOC_CNF, (tANI_U32 *) &mlmAssocCnf); |
| 5000 | } |
| 5001 | } |
| 5002 | else |
| 5003 | { |
| 5004 | /** |
| 5005 | * Restore pre-reassoc req state. |
| 5006 | * Set BSSID to currently associated AP address. |
| 5007 | */ |
| 5008 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5009 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5010 | |
| 5011 | limRestorePreReassocState(pMac, |
| 5012 | eSIR_SME_REASSOC_TIMEOUT_RESULT_CODE, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry); |
| 5013 | } |
| 5014 | } |
Abhishek Singh | bfb3c9e | 2016-07-22 11:25:43 +0530 | [diff] [blame] | 5015 | /* Reinit scan results to remove the unreachable BSS */ |
| 5016 | limReInitScanResults(pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5017 | } /*** limProcessAssocFailureTimeout() ***/ |
| 5018 | |
| 5019 | |
| 5020 | |
| 5021 | /** |
| 5022 | * limCompleteMlmScan() |
| 5023 | * |
| 5024 | *FUNCTION: |
| 5025 | * This function is called to send MLM_SCAN_CNF message |
| 5026 | * to SME state machine. |
| 5027 | * |
| 5028 | *LOGIC: |
| 5029 | * |
| 5030 | *ASSUMPTIONS: |
| 5031 | * |
| 5032 | *NOTE: |
| 5033 | * |
| 5034 | * @param pMac Pointer to Global MAC structure |
| 5035 | * @param retCode Result code to be sent |
| 5036 | * @return None |
| 5037 | */ |
| 5038 | |
| 5039 | void |
| 5040 | limCompleteMlmScan(tpAniSirGlobal pMac, tSirResultCodes retCode) |
| 5041 | { |
| 5042 | tLimMlmScanCnf mlmScanCnf; |
| 5043 | |
| 5044 | /// Restore previous MLM state |
| 5045 | pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5046 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, NO_SESSION, pMac->lim.gLimMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5047 | limRestorePreScanState(pMac); |
| 5048 | |
| 5049 | // Free up pMac->lim.gLimMlmScanReq |
| 5050 | if( NULL != pMac->lim.gpLimMlmScanReq ) |
| 5051 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5052 | vos_mem_free(pMac->lim.gpLimMlmScanReq); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5053 | pMac->lim.gpLimMlmScanReq = NULL; |
| 5054 | } |
| 5055 | |
| 5056 | mlmScanCnf.resultCode = retCode; |
| 5057 | mlmScanCnf.scanResultLength = pMac->lim.gLimMlmScanResultLength; |
| 5058 | |
| 5059 | limPostSmeMessage(pMac, LIM_MLM_SCAN_CNF, (tANI_U32 *) &mlmScanCnf); |
| 5060 | |
| 5061 | } /*** limCompleteMlmScan() ***/ |
| 5062 | |
| 5063 | /** |
| 5064 | * \brief Setup an A-MPDU/BA session |
| 5065 | * |
| 5066 | * \sa limProcessMlmAddBAReq |
| 5067 | * |
| 5068 | * \param pMac The global tpAniSirGlobal object |
| 5069 | * |
| 5070 | * \param pMsgBuf The MLME ADDBA Req message buffer |
| 5071 | * |
| 5072 | * \return none |
| 5073 | */ |
| 5074 | void limProcessMlmAddBAReq( tpAniSirGlobal pMac, |
| 5075 | tANI_U32 *pMsgBuf ) |
| 5076 | { |
| 5077 | tSirRetStatus status = eSIR_SUCCESS; |
| 5078 | tpLimMlmAddBAReq pMlmAddBAReq; |
| 5079 | tpLimMlmAddBACnf pMlmAddBACnf; |
| 5080 | tpPESession psessionEntry; |
| 5081 | |
| 5082 | if(pMsgBuf == NULL) |
| 5083 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5084 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5085 | return; |
| 5086 | } |
| 5087 | |
| 5088 | pMlmAddBAReq = (tpLimMlmAddBAReq) pMsgBuf; |
| 5089 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBAReq->sessionId))== NULL) |
| 5090 | { |
| 5091 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5092 | FL("session does not exist for given sessionId"));) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5093 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5094 | return; |
| 5095 | } |
| 5096 | |
| 5097 | |
| 5098 | // Send ADDBA Req over the air |
| 5099 | status = limSendAddBAReq( pMac, pMlmAddBAReq,psessionEntry); |
| 5100 | |
| 5101 | // |
| 5102 | // Respond immediately to LIM, only if MLME has not been |
| 5103 | // successfully able to send WDA_ADDBA_REQ to HAL. |
| 5104 | // Else, LIM_MLM_ADDBA_CNF will be sent after receiving |
| 5105 | // ADDBA Rsp from peer entity |
| 5106 | // |
| 5107 | if( eSIR_SUCCESS != status ) |
| 5108 | { |
| 5109 | // Allocate for LIM_MLM_ADDBA_CNF |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5110 | |
| 5111 | pMlmAddBACnf = vos_mem_malloc(sizeof( tLimMlmAddBACnf )); |
| 5112 | if ( NULL == pMlmAddBACnf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5113 | { |
| 5114 | limLog( pMac, LOGP, |
Jeff Johnson | 0f4d0bc | 2013-11-03 17:48:50 -0800 | [diff] [blame] | 5115 | FL("AllocateMemory failed")); |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5116 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5117 | return; |
| 5118 | } |
| 5119 | else |
| 5120 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5121 | vos_mem_set((void *) pMlmAddBACnf, sizeof( tLimMlmAddBACnf ), 0); |
| 5122 | vos_mem_copy((void *) pMlmAddBACnf->peerMacAddr, |
| 5123 | (void *) pMlmAddBAReq->peerMacAddr, |
| 5124 | sizeof( tSirMacAddr )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5125 | |
| 5126 | pMlmAddBACnf->baDialogToken = pMlmAddBAReq->baDialogToken; |
| 5127 | pMlmAddBACnf->baTID = pMlmAddBAReq->baTID; |
| 5128 | pMlmAddBACnf->baPolicy = pMlmAddBAReq->baPolicy; |
| 5129 | pMlmAddBACnf->baBufferSize = pMlmAddBAReq->baBufferSize; |
| 5130 | pMlmAddBACnf->baTimeout = pMlmAddBAReq->baTimeout; |
| 5131 | pMlmAddBACnf->sessionId = pMlmAddBAReq->sessionId; |
| 5132 | |
| 5133 | // Update the result code |
| 5134 | pMlmAddBACnf->addBAResultCode = eSIR_MAC_UNSPEC_FAILURE_STATUS; |
| 5135 | |
| 5136 | limPostSmeMessage( pMac, |
| 5137 | LIM_MLM_ADDBA_CNF, |
| 5138 | (tANI_U32 *) pMlmAddBACnf ); |
| 5139 | } |
| 5140 | |
| 5141 | // Restore MLME state |
| 5142 | psessionEntry->limMlmState = psessionEntry->limPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5143 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, psessionEntry->peSessionId, psessionEntry->limMlmState)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5144 | |
| 5145 | } |
| 5146 | |
| 5147 | // Free the buffer allocated for tLimMlmAddBAReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5148 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5149 | |
| 5150 | } |
| 5151 | |
| 5152 | /** |
| 5153 | * \brief Send an ADDBA Rsp to peer STA in response |
| 5154 | * to an ADDBA Req received earlier |
| 5155 | * |
| 5156 | * \sa limProcessMlmAddBARsp |
| 5157 | * |
| 5158 | * \param pMac The global tpAniSirGlobal object |
| 5159 | * |
| 5160 | * \param pMsgBuf The MLME ADDBA Rsp message buffer |
| 5161 | * |
| 5162 | * \return none |
| 5163 | */ |
| 5164 | void limProcessMlmAddBARsp( tpAniSirGlobal pMac, |
| 5165 | tANI_U32 *pMsgBuf ) |
| 5166 | { |
| 5167 | tpLimMlmAddBARsp pMlmAddBARsp; |
| 5168 | tANI_U16 aid; |
| 5169 | tpDphHashNode pSta; |
| 5170 | tpPESession psessionEntry; |
| 5171 | |
| 5172 | |
| 5173 | if(pMsgBuf == NULL) |
| 5174 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5175 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5176 | return; |
| 5177 | } |
| 5178 | |
| 5179 | pMlmAddBARsp = (tpLimMlmAddBARsp) pMsgBuf; |
| 5180 | |
| 5181 | if(( psessionEntry = peFindSessionBySessionId(pMac,pMlmAddBARsp->sessionId))== NULL) |
| 5182 | { |
| 5183 | PELOGE(limLog(pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5184 | FL("session does not exist for given session ID"));) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5185 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5186 | return; |
| 5187 | } |
| 5188 | |
| 5189 | |
| 5190 | // Send ADDBA Rsp over the air |
| 5191 | if( eSIR_SUCCESS != limSendAddBARsp( pMac,pMlmAddBARsp,psessionEntry)) |
| 5192 | { |
| 5193 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5194 | FL("Failed to send ADDBA Rsp to peer ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5195 | limPrintMacAddr( pMac, pMlmAddBARsp->peerMacAddr, LOGE ); |
| 5196 | /* Clean the BA context maintained by HAL and TL on failure */ |
| 5197 | pSta = dphLookupHashEntry( pMac, pMlmAddBARsp->peerMacAddr, &aid, |
| 5198 | &psessionEntry->dph.dphHashTable); |
| 5199 | if( NULL != pSta ) |
| 5200 | { |
| 5201 | limPostMsgDelBAInd( pMac, pSta, pMlmAddBARsp->baTID, eBA_RECIPIENT, |
| 5202 | psessionEntry); |
| 5203 | } |
| 5204 | } |
| 5205 | |
| 5206 | // Time to post a WDA_DELBA_IND to HAL in order |
| 5207 | // to cleanup the HAL and SoftMAC entries |
| 5208 | |
| 5209 | |
| 5210 | // Free the buffer allocated for tLimMlmAddBARsp |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5211 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5212 | |
| 5213 | } |
| 5214 | |
| 5215 | /** |
| 5216 | * \brief Setup an A-MPDU/BA session |
| 5217 | * |
| 5218 | * \sa limProcessMlmDelBAReq |
| 5219 | * |
| 5220 | * \param pMac The global tpAniSirGlobal object |
| 5221 | * |
| 5222 | * \param pMsgBuf The MLME DELBA Req message buffer |
| 5223 | * |
| 5224 | * \return none |
| 5225 | */ |
| 5226 | void limProcessMlmDelBAReq( tpAniSirGlobal pMac, |
| 5227 | tANI_U32 *pMsgBuf ) |
| 5228 | { |
| 5229 | tSirRetStatus status = eSIR_SUCCESS; |
| 5230 | tpLimMlmDelBAReq pMlmDelBAReq; |
| 5231 | tpLimMlmDelBACnf pMlmDelBACnf; |
| 5232 | tpPESession psessionEntry; |
| 5233 | |
| 5234 | |
| 5235 | if(pMsgBuf == NULL) |
| 5236 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5237 | PELOGE(limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5238 | return; |
| 5239 | } |
| 5240 | |
| 5241 | // TODO - Need to validate MLME state |
| 5242 | pMlmDelBAReq = (tpLimMlmDelBAReq) pMsgBuf; |
| 5243 | |
| 5244 | if((psessionEntry = peFindSessionBySessionId(pMac,pMlmDelBAReq->sessionId))== NULL) |
| 5245 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5246 | PELOGE(limLog(pMac, LOGE,FL("session does not exist for given bssId"));) |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5247 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5248 | return; |
| 5249 | } |
| 5250 | |
| 5251 | // Send DELBA Ind over the air |
| 5252 | if( eSIR_SUCCESS != |
| 5253 | (status = limSendDelBAInd( pMac, pMlmDelBAReq,psessionEntry))) |
| 5254 | status = eSIR_SME_HAL_SEND_MESSAGE_FAIL; |
| 5255 | else |
| 5256 | { |
| 5257 | tANI_U16 aid; |
| 5258 | tpDphHashNode pSta; |
| 5259 | |
| 5260 | // Time to post a WDA_DELBA_IND to HAL in order |
| 5261 | // to cleanup the HAL and SoftMAC entries |
| 5262 | pSta = dphLookupHashEntry( pMac, pMlmDelBAReq->peerMacAddr, &aid , &psessionEntry->dph.dphHashTable); |
| 5263 | if( NULL != pSta ) |
| 5264 | { |
| 5265 | status = limPostMsgDelBAInd( pMac, |
| 5266 | pSta, |
| 5267 | pMlmDelBAReq->baTID, |
| 5268 | pMlmDelBAReq->baDirection,psessionEntry); |
| 5269 | |
| 5270 | } |
| 5271 | } |
| 5272 | |
| 5273 | // |
| 5274 | // Respond immediately to SME with DELBA CNF using |
| 5275 | // LIM_MLM_DELBA_CNF with appropriate status |
| 5276 | // |
| 5277 | |
| 5278 | // Allocate for LIM_MLM_DELBA_CNF |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5279 | |
| 5280 | pMlmDelBACnf = vos_mem_malloc(sizeof( tLimMlmDelBACnf )); |
| 5281 | if ( NULL == pMlmDelBACnf ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5282 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5283 | limLog( pMac, LOGP, FL("AllocateMemory failed")); |
| 5284 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5285 | return; |
| 5286 | } |
| 5287 | else |
| 5288 | { |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5289 | vos_mem_set((void *) pMlmDelBACnf, sizeof( tLimMlmDelBACnf ), 0); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5290 | |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5291 | vos_mem_copy((void *) pMlmDelBACnf, |
| 5292 | (void *) pMlmDelBAReq, |
| 5293 | sizeof( tLimMlmDelBAReq )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5294 | |
| 5295 | // Update DELBA result code |
| 5296 | pMlmDelBACnf->delBAReasonCode = pMlmDelBAReq->delBAReasonCode; |
| 5297 | |
| 5298 | /* Update PE session Id*/ |
| 5299 | pMlmDelBACnf->sessionId = pMlmDelBAReq->sessionId; |
| 5300 | |
| 5301 | limPostSmeMessage( pMac, |
| 5302 | LIM_MLM_DELBA_CNF, |
| 5303 | (tANI_U32 *) pMlmDelBACnf ); |
| 5304 | } |
| 5305 | |
| 5306 | // Free the buffer allocated for tLimMlmDelBAReq |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5307 | vos_mem_free(pMsgBuf); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5308 | |
| 5309 | } |
| 5310 | |
| 5311 | /** |
| 5312 | * @function : limSMPowerSaveStateInd( ) |
| 5313 | * |
| 5314 | * @brief : This function is called upon receiving the PMC Indication to update the STA's MimoPs State. |
| 5315 | * |
| 5316 | * LOGIC: |
| 5317 | * |
| 5318 | * ASSUMPTIONS: |
| 5319 | * NA |
| 5320 | * |
| 5321 | * NOTE: |
| 5322 | * NA |
| 5323 | * |
| 5324 | * @param pMac - Pointer to Global MAC structure |
| 5325 | * @param limMsg - Lim Message structure object with the MimoPSparam in body |
| 5326 | * @return None |
| 5327 | */ |
| 5328 | |
| 5329 | tSirRetStatus |
| 5330 | limSMPowerSaveStateInd(tpAniSirGlobal pMac, tSirMacHTMIMOPowerSaveState state) |
| 5331 | { |
| 5332 | #if 0 |
| 5333 | tSirRetStatus retStatus = eSIR_SUCCESS; |
| 5334 | #if 0 |
| 5335 | tANI_U32 cfgVal1; |
| 5336 | tANI_U16 cfgVal2; |
| 5337 | tSirMacHTCapabilityInfo *pHTCapabilityInfo; |
| 5338 | tpDphHashNode pSta = NULL; |
| 5339 | |
| 5340 | tpPESession psessionEntry = &pMac->lim.gpSession[0]; //TBD-RAJESH HOW TO GET sessionEntry????? |
| 5341 | /** Verify the Mode of operation */ |
| 5342 | if (pMac->lim.gLimSystemRole != eSYSTEM_STA_ROLE) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5343 | PELOGE(limLog(pMac, LOGE, FL("Got PMC indication when System not in the STA Role"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5344 | return eSIR_FAILURE; |
| 5345 | } |
| 5346 | |
| 5347 | if ((pMac->lim.gHTMIMOPSState == state) || (state == eSIR_HT_MIMO_PS_NA )) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5348 | PELOGE(limLog(pMac, LOGE, FL("Got Indication when already in the same mode or State passed is NA:%d "), state);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5349 | return eSIR_FAILURE; |
| 5350 | } |
| 5351 | |
| 5352 | if (!pMac->lim.htCapability){ |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5353 | PELOGW(limLog(pMac, LOGW, FL(" Not in 11n or HT capable mode"));) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5354 | return eSIR_FAILURE; |
| 5355 | } |
| 5356 | |
| 5357 | /** Update the CFG about the default MimoPS State */ |
| 5358 | if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgVal1) != eSIR_SUCCESS) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5359 | limLog(pMac, LOGP, FL("could not retrieve HT Cap CFG ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5360 | return eSIR_FAILURE; |
| 5361 | } |
| 5362 | |
| 5363 | cfgVal2 = (tANI_U16)cfgVal1; |
| 5364 | pHTCapabilityInfo = (tSirMacHTCapabilityInfo *) &cfgVal2; |
| 5365 | pHTCapabilityInfo->mimoPowerSave = state; |
| 5366 | |
| 5367 | if(cfgSetInt(pMac, WNI_CFG_HT_CAP_INFO, *(tANI_U16*)pHTCapabilityInfo) != eSIR_SUCCESS) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5368 | limLog(pMac, LOGP, FL("could not update HT Cap Info CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5369 | return eSIR_FAILURE; |
| 5370 | } |
| 5371 | |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5372 | PELOG2(limLog(pMac, LOG2, FL(" The HT Capability for Mimo Pwr is updated to State: %u "),state);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5373 | if (pMac->lim.gLimSmeState != eLIM_SME_LINK_EST_STATE) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5374 | PELOG2(limLog(pMac, LOG2,FL(" The STA is not in the Connected/Link Est Sme_State: %d "), pMac->lim.gLimSmeState);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5375 | /** Update in the LIM the MIMO PS state of the SELF */ |
| 5376 | pMac->lim.gHTMIMOPSState = state; |
| 5377 | return eSIR_SUCCESS; |
| 5378 | } |
| 5379 | |
| 5380 | pSta = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable); |
| 5381 | if (!pSta->mlmStaContext.htCapability) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5382 | limLog( pMac, LOGE,FL( "limSendSMPowerState: Peer is not HT Capable " )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5383 | return eSIR_FAILURE; |
| 5384 | } |
| 5385 | |
| 5386 | if (isEnteringMimoPS(pMac->lim.gHTMIMOPSState, state)) { |
| 5387 | tSirMacAddr macAddr; |
| 5388 | /** Obtain the AP's Mac Address */ |
Bansidhar Gopalachari | 1d9c616 | 2013-07-11 10:24:30 +0530 | [diff] [blame] | 5389 | vos_mem_copy((tANI_U8 *)macAddr, psessionEntry->bssId, sizeof(tSirMacAddr)); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5390 | /** Send Action Frame with the corresponding mode */ |
| 5391 | retStatus = limSendSMPowerStateFrame(pMac, macAddr, state); |
| 5392 | if (retStatus != eSIR_SUCCESS) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5393 | PELOGE(limLog(pMac, LOGE, "Update SM POWER: Sending Action Frame has failed");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5394 | return retStatus; |
| 5395 | } |
| 5396 | } |
| 5397 | |
| 5398 | /** Update MlmState about the SetMimoPS State */ |
| 5399 | pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState; |
| 5400 | pMac->lim.gLimMlmState = eLIM_MLM_WT_SET_MIMOPS_STATE; |
| 5401 | MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, 0, pMac->lim.gLimMlmState)); |
| 5402 | |
| 5403 | /** Update the HAL and s/w mac about the mode to be set */ |
| 5404 | retStatus = limPostSMStateUpdate( pMac,psessionEntry->staId, state); |
| 5405 | |
| 5406 | PELOG2(limLog(pMac, LOG2, " Updated the New SMPS State");) |
| 5407 | /** Update in the LIM the MIMO PS state of the SELF */ |
| 5408 | pMac->lim.gHTMIMOPSState = state; |
| 5409 | #endif |
| 5410 | return retStatus; |
| 5411 | #endif |
| 5412 | return eSIR_SUCCESS; |
| 5413 | } |
| 5414 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5415 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5416 | ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset,tANI_U8 peerCenterChan, tpPESession psessionEntry) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5417 | { |
| 5418 | ePhyChanBondState cbState = PHY_SINGLE_CHANNEL_CENTERED; |
| 5419 | |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5420 | if(!psessionEntry->apChanWidth) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5421 | { |
| 5422 | return htSecondaryChannelOffset; |
| 5423 | } |
| 5424 | |
| 5425 | if ( (htSecondaryChannelOffset |
| 5426 | == PHY_DOUBLE_CHANNEL_LOW_PRIMARY) |
| 5427 | ) |
| 5428 | { |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5429 | if ((channel + 2 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5430 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5431 | else if ((channel + 6 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5432 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5433 | else if ((channel - 2 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5434 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH; |
| 5435 | else |
| 5436 | limLog (pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5437 | FL("Invalid Channel Number = %d Center Chan = %d "), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5438 | channel, peerCenterChan); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5439 | } |
| 5440 | if ( (htSecondaryChannelOffset |
| 5441 | == PHY_DOUBLE_CHANNEL_HIGH_PRIMARY) |
| 5442 | ) |
| 5443 | { |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5444 | if ((channel - 2 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5445 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5446 | else if ((channel + 2 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5447 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW; |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5448 | else if ((channel - 6 ) == peerCenterChan ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5449 | cbState = PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH; |
| 5450 | else |
| 5451 | limLog (pMac, LOGP, |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5452 | FL("Invalid Channel Number = %d Center Chan = %d "), |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5453 | channel, peerCenterChan); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5454 | } |
| 5455 | return cbState; |
| 5456 | } |
| 5457 | |
| 5458 | #endif |
| 5459 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5460 | void |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5461 | limSetChannel(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 secChannelOffset, tPowerdBm maxTxPower, tANI_U8 peSessionId) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5462 | { |
| 5463 | #if !defined WLAN_FEATURE_VOWIFI |
| 5464 | tANI_U32 localPwrConstraint; |
| 5465 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5466 | tpPESession peSession; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5467 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5468 | peSession = peFindSessionBySessionId (pMac, peSessionId); |
| 5469 | |
| 5470 | if ( NULL == peSession) |
| 5471 | { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5472 | limLog (pMac, LOGP, FL("Invalid PE session = %d"), peSessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5473 | return; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5474 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5475 | #if defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5476 | #ifdef WLAN_FEATURE_11AC |
| 5477 | if ( peSession->vhtCapability ) |
| 5478 | { |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5479 | limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset,peSession->apCenterChan, peSession), maxTxPower, peSessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5480 | } |
| 5481 | else |
| 5482 | #endif |
| 5483 | { |
| 5484 | limSendSwitchChnlParams( pMac, channel, secChannelOffset, maxTxPower, peSessionId); |
| 5485 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5486 | #else |
| 5487 | if (wlan_cfgGetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, &localPwrConstraint) != eSIR_SUCCESS) { |
Kiran Kumar Lokere | 531ca70 | 2013-04-01 13:24:23 -0700 | [diff] [blame] | 5488 | limLog(pMac, LOGP, FL("could not read WNI_CFG_LOCAL_POWER_CONSTRAINT from CFG")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5489 | return; |
| 5490 | } |
| 5491 | // Send WDA_CHNL_SWITCH_IND to HAL |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5492 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5493 | if ( peSession->vhtCapability && peSession->vhtCapabilityPresentInBeacon) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5494 | { |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 5495 | limSendSwitchChnlParams( pMac, channel, limGet11ACPhyCBState( pMac,channel,secChannelOffset,peSession->apCenterChan, peSession), maxTxPower, peSessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5496 | } |
| 5497 | else |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5498 | #endif |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 5499 | { |
| 5500 | limSendSwitchChnlParams( pMac, channel, secChannelOffset, (tPowerdBm)localPwrConstraint, peSessionId); |
| 5501 | } |
| 5502 | #endif |
| 5503 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 5504 | } |