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