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