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