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