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