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