Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 5 | * |
| 6 | * |
| 7 | * Permission to use, copy, modify, and/or distribute this software for |
| 8 | * any purpose with or without fee is hereby granted, provided that the |
| 9 | * above copyright notice and this permission notice appear in all |
| 10 | * copies. |
| 11 | * |
| 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 13 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 14 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 15 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 16 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 17 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 18 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 19 | * PERFORMANCE OF THIS SOFTWARE. |
| 20 | */ |
| 21 | /* |
Jeff Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 24 | * Previously licensed under the ISC license by Qualcomm Atheros, Inc. |
| 25 | * |
| 26 | * |
| 27 | * Permission to use, copy, modify, and/or distribute this software for |
| 28 | * any purpose with or without fee is hereby granted, provided that the |
| 29 | * above copyright notice and this permission notice appear in all |
| 30 | * copies. |
| 31 | * |
| 32 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
| 33 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
| 34 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE |
| 35 | * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL |
| 36 | * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR |
| 37 | * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER |
| 38 | * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR |
| 39 | * PERFORMANCE OF THIS SOFTWARE. |
| 40 | */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 41 | /*=========================================================================== |
| 42 | L I M _ P 2 P . C |
| 43 | |
| 44 | OVERVIEW: |
| 45 | |
| 46 | This software unit holds the implementation of the WLAN Protocol Engine for |
| 47 | P2P. |
| 48 | |
| 49 | Copyright (c) 2011 QUALCOMM Incorporated. |
| 50 | All Rights Reserved. |
| 51 | Qualcomm Confidential and Proprietary |
| 52 | ===========================================================================*/ |
| 53 | |
| 54 | /*=========================================================================== |
| 55 | |
| 56 | EDIT HISTORY FOR FILE |
| 57 | |
| 58 | |
| 59 | This section contains comments describing changes made to the module. |
| 60 | Notice that changes are listed in reverse chronological order. |
| 61 | |
| 62 | |
| 63 | $Header$$DateTime$$Author$ |
| 64 | |
| 65 | |
| 66 | when who what, where, why |
| 67 | ---------- --- -------------------------------------------------------- |
| 68 | 2011-05-02 djindal Corrected file indentation and changed remain on channel |
| 69 | handling for concurrency. |
| 70 | ===========================================================================*/ |
| 71 | |
| 72 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 73 | #include "limUtils.h" |
| 74 | #include "limSessionUtils.h" |
| 75 | #include "wlan_qct_wda.h" |
| 76 | |
| 77 | #define PROBE_RSP_IE_OFFSET 36 |
| 78 | #define BSSID_OFFSET 16 |
| 79 | #define ADDR2_OFFSET 10 |
| 80 | #define ACTION_OFFSET 24 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 81 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 82 | /* A DFS channel can be ACTIVE for max 30000 msec, from the last |
| 83 | received Beacon/Prpbe Resp. */ |
| 84 | #define MAX_TIME_TO_BE_ACTIVE_CHANNEL 30000 |
| 85 | |
| 86 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | |
| 88 | void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status, |
| 89 | tANI_U32 *data); |
| 90 | void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status, |
| 91 | tANI_U32 *data, tpPESession psessionEntry); |
| 92 | void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status, |
| 93 | tANI_U32 *data, tpPESession psessionEntry); |
| 94 | void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data); |
| 95 | extern tSirRetStatus limSetLinkState( |
| 96 | tpAniSirGlobal pMac, tSirLinkState state, |
| 97 | tSirMacAddr bssId, tSirMacAddr selfMacAddr, |
| 98 | tpSetLinkStateCallback callback, void *callbackArg); |
| 99 | |
| 100 | static tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 101 | eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 102 | /*------------------------------------------------------------------ |
| 103 | * |
| 104 | * Below function is callback function, it is called when |
| 105 | * WDA_SET_LINK_STATE_RSP is received from WDI. callback function for |
| 106 | * P2P of limSetLinkState |
| 107 | * |
| 108 | *------------------------------------------------------------------*/ |
| 109 | void limSetLinkStateP2PCallback(tpAniSirGlobal pMac, void *callbackArg) |
| 110 | { |
| 111 | //Send Ready on channel indication to SME |
| 112 | if(pMac->lim.gpLimRemainOnChanReq) |
| 113 | { |
| 114 | limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RDY_IND, eHAL_STATUS_SUCCESS, |
| 115 | pMac->lim.gpLimRemainOnChanReq->sessionId, 0); |
| 116 | } |
| 117 | else |
| 118 | { |
| 119 | //This is possible in case remain on channel is aborted |
| 120 | limLog( pMac, LOGE, FL(" NULL pointer of gpLimRemainOnChanReq") ); |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | /*------------------------------------------------------------------ |
| 125 | * |
| 126 | * Remain on channel req handler. Initiate the INIT_SCAN, CHN_CHANGE |
| 127 | * and SET_LINK Request from SME, chnNum and duration to remain on channel. |
| 128 | * |
| 129 | *------------------------------------------------------------------*/ |
| 130 | |
| 131 | |
| 132 | int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg) |
| 133 | { |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 134 | |
| 135 | /* CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE - Currently removed the special optimization when a concurrent session |
| 136 | * exists with operating channel same as P2P listen channel since it was causing issues in P2P search. The reason was |
| 137 | * STA-AP link entering BMPS when returning to home channel causing P2P search to miss Probe Reqs and hence not |
| 138 | * respond with Probe Rsp causing peer device to NOT find us. |
| 139 | * If we need this optimization, we need to find a way to keep the STA-AP link awake (no BMPS) on home channel when in listen state |
| 140 | */ |
| 141 | #ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 142 | tANI_U8 i; |
| 143 | tpPESession psessionEntry; |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 144 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | #ifdef WLAN_FEATURE_P2P_INTERNAL |
| 146 | tpPESession pP2pSession; |
| 147 | #endif |
| 148 | |
| 149 | tSirRemainOnChnReq *MsgBuff = (tSirRemainOnChnReq *)pMsg; |
| 150 | pMac->lim.gpLimRemainOnChanReq = MsgBuff; |
| 151 | |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 152 | #ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 153 | for (i =0; i < pMac->lim.maxBssId;i++) |
| 154 | { |
| 155 | psessionEntry = peFindSessionBySessionId(pMac,i); |
| 156 | |
| 157 | if ( (psessionEntry != NULL) ) |
| 158 | { |
| 159 | if (psessionEntry->currentOperChannel == MsgBuff->chnNum) |
| 160 | { |
| 161 | tANI_U32 val; |
| 162 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 163 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 164 | pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time(); |
| 165 | pMac->lim.gTotalScanDuration = MsgBuff->duration; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 166 | |
| 167 | /* get the duration from the request */ |
| 168 | val = SYS_MS_TO_TICKS(MsgBuff->duration); |
| 169 | |
Madan Mohan Koyyalamudi | 709790c | 2012-09-24 12:12:51 -0700 | [diff] [blame] | 170 | limLog( pMac, LOG2, "Start listen duration = %d", val); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | if (tx_timer_change( |
| 172 | &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0) |
| 173 | != TX_SUCCESS) |
| 174 | { |
| 175 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 176 | FL("Unable to change remain on channel Timer val")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | goto error; |
| 178 | } |
| 179 | else if(TX_SUCCESS != tx_timer_activate( |
| 180 | &pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 181 | { |
| 182 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 183 | FL("Unable to activate remain on channel Timer")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 185 | goto error; |
| 186 | } |
| 187 | |
| 188 | #ifdef WLAN_FEATURE_P2P_INTERNAL |
| 189 | //Session is needed to send probe rsp |
| 190 | if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &pP2pSession)) |
| 191 | { |
| 192 | limLog( pMac, LOGE, "Unable to create session"); |
| 193 | goto error; |
| 194 | } |
| 195 | #endif |
| 196 | |
Gopichand Nakkala | 924e455 | 2013-05-08 19:18:14 +0530 | [diff] [blame^] | 197 | if ((limSetLinkState(pMac, MsgBuff->isProbeRequestAllowed? |
| 198 | eSIR_LINK_LISTEN_STATE:eSIR_LINK_SEND_ACTION_STATE, |
| 199 | nullBssid, pMac->lim.gSelfMacAddr, |
| 200 | limSetLinkStateP2PCallback, NULL)) != eSIR_SUCCESS) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | { |
| 202 | limLog( pMac, LOGE, "Unable to change link state"); |
| 203 | goto error; |
| 204 | } |
| 205 | return FALSE; |
| 206 | } |
| 207 | } |
| 208 | } |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 209 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | pMac->lim.gLimPrevMlmState = pMac->lim.gLimMlmState; |
| 211 | pMac->lim.gLimMlmState = eLIM_MLM_P2P_LISTEN_STATE; |
| 212 | |
| 213 | pMac->lim.gTotalScanDuration = MsgBuff->duration; |
| 214 | |
| 215 | /* 1st we need to suspend link with callback to initiate change channel */ |
| 216 | limSuspendLink(pMac, eSIR_CHECK_LINK_TRAFFIC_BEFORE_SCAN, |
| 217 | limRemainOnChnlSuspendLinkHdlr, NULL); |
| 218 | return FALSE; |
| 219 | |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 220 | #ifdef CONC_OPER_AND_LISTEN_CHNL_SAME_OPTIMIZE |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | error: |
| 222 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 223 | /* pMsg is freed by the caller */ |
| 224 | return FALSE; |
Pratik Bhalgat | a1bf8bb | 2012-11-22 17:02:26 +0530 | [diff] [blame] | 225 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | |
| 229 | tSirRetStatus limCreateSessionForRemainOnChn(tpAniSirGlobal pMac, tPESession **ppP2pSession) |
| 230 | { |
| 231 | tSirRetStatus nSirStatus = eSIR_FAILURE; |
| 232 | tpPESession psessionEntry; |
| 233 | tANI_U8 sessionId; |
| 234 | tANI_U32 val; |
| 235 | |
| 236 | if(pMac->lim.gpLimRemainOnChanReq && ppP2pSession) |
| 237 | { |
| 238 | if((psessionEntry = peCreateSession(pMac, |
| 239 | pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId, 1)) == NULL) |
| 240 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 241 | limLog(pMac, LOGE, FL("Session Can not be created ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 242 | /* send remain on chn failure */ |
| 243 | return nSirStatus; |
| 244 | } |
| 245 | /* Store PE sessionId in session Table */ |
| 246 | psessionEntry->peSessionId = sessionId; |
| 247 | |
| 248 | psessionEntry->limSystemRole = eLIM_P2P_DEVICE_ROLE; |
| 249 | CFG_GET_STR( nSirStatus, pMac, WNI_CFG_SUPPORTED_RATES_11A, |
| 250 | psessionEntry->rateSet.rate, val , SIR_MAC_MAX_NUMBER_OF_RATES ); |
| 251 | psessionEntry->rateSet.numRates = val; |
| 252 | |
| 253 | CFG_GET_STR( nSirStatus, pMac, WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET, |
| 254 | psessionEntry->extRateSet.rate, val, |
| 255 | WNI_CFG_EXTENDED_OPERATIONAL_RATE_SET_LEN ); |
| 256 | psessionEntry->extRateSet.numRates = val; |
| 257 | |
| 258 | sirCopyMacAddr(psessionEntry->selfMacAddr, |
| 259 | pMac->lim.gpLimRemainOnChanReq->selfMacAddr); |
| 260 | |
| 261 | psessionEntry->currentOperChannel = pMac->lim.gpLimRemainOnChanReq->chnNum; |
| 262 | nSirStatus = eSIR_SUCCESS; |
| 263 | *ppP2pSession = psessionEntry; |
| 264 | } |
| 265 | |
| 266 | return nSirStatus; |
| 267 | } |
| 268 | |
| 269 | |
| 270 | /*------------------------------------------------------------------ |
| 271 | * |
| 272 | * limSuspenLink callback, on success link suspend, trigger change chn |
| 273 | * |
| 274 | * |
| 275 | *------------------------------------------------------------------*/ |
| 276 | |
| 277 | tSirRetStatus limRemainOnChnlChangeChnReq(tpAniSirGlobal pMac, |
| 278 | eHalStatus status, tANI_U32 *data) |
| 279 | { |
| 280 | tpPESession psessionEntry; |
| 281 | tANI_U8 sessionId = 0; |
| 282 | tSirRetStatus nSirStatus = eSIR_FAILURE; |
| 283 | |
| 284 | if( NULL == pMac->lim.gpLimRemainOnChanReq ) |
| 285 | { |
| 286 | //RemainOnChannel may have aborted |
| 287 | PELOGE(limLog( pMac, LOGE, FL(" gpLimRemainOnChanReq is NULL") );) |
| 288 | return nSirStatus; |
| 289 | } |
| 290 | |
| 291 | /* The link is not suspended */ |
| 292 | if (status != eHAL_STATUS_SUCCESS) |
| 293 | { |
| 294 | PELOGE(limLog( pMac, LOGE, FL(" Suspend link Failure ") );) |
| 295 | goto error; |
| 296 | } |
| 297 | |
| 298 | |
| 299 | if((psessionEntry = peFindSessionByBssid( |
| 300 | pMac,pMac->lim.gpLimRemainOnChanReq->selfMacAddr, &sessionId)) != NULL) |
| 301 | { |
| 302 | goto change_channel; |
| 303 | } |
| 304 | else /* Session Entry does not exist for given BSSId */ |
| 305 | { |
| 306 | /* Try to Create a new session */ |
| 307 | if(eSIR_SUCCESS != limCreateSessionForRemainOnChn(pMac, &psessionEntry)) |
| 308 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 309 | limLog(pMac, LOGE, FL("Session Can not be created ")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 310 | /* send remain on chn failure */ |
| 311 | goto error; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | change_channel: |
| 316 | /* change channel to the requested by RemainOn Chn*/ |
| 317 | limChangeChannelWithCallback(pMac, |
| 318 | pMac->lim.gpLimRemainOnChanReq->chnNum, |
| 319 | limRemainOnChnlSetLinkStat, NULL, psessionEntry); |
| 320 | return eSIR_SUCCESS; |
| 321 | |
| 322 | error: |
| 323 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 324 | return eSIR_FAILURE; |
| 325 | } |
| 326 | |
| 327 | void limRemainOnChnlSuspendLinkHdlr(tpAniSirGlobal pMac, eHalStatus status, |
| 328 | tANI_U32 *data) |
| 329 | { |
| 330 | limRemainOnChnlChangeChnReq(pMac, status, data); |
| 331 | return; |
| 332 | } |
| 333 | |
| 334 | /*------------------------------------------------------------------ |
| 335 | * |
| 336 | * Set the LINK state to LISTEN to allow only PROBE_REQ and Action frames |
| 337 | * |
| 338 | *------------------------------------------------------------------*/ |
| 339 | void limRemainOnChnlSetLinkStat(tpAniSirGlobal pMac, eHalStatus status, |
| 340 | tANI_U32 *data, tpPESession psessionEntry) |
| 341 | { |
| 342 | tANI_U32 val; |
| 343 | tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq; |
| 344 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 345 | |
| 346 | if (status != eHAL_STATUS_SUCCESS) |
| 347 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 348 | limLog( pMac, LOGE, "%s: Change channel not successful"); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 349 | goto error1; |
| 350 | } |
| 351 | |
| 352 | // Start timer here to come back to operating channel. |
| 353 | pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId = |
| 354 | psessionEntry->peSessionId; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 355 | pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time(); |
| 356 | pMac->lim.gTotalScanDuration = MsgRemainonChannel->duration; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 357 | |
| 358 | /* get the duration from the request */ |
| 359 | val = SYS_MS_TO_TICKS(MsgRemainonChannel->duration); |
| 360 | |
Madan Mohan Koyyalamudi | 709790c | 2012-09-24 12:12:51 -0700 | [diff] [blame] | 361 | limLog( pMac, LOG2, "Start listen duration = %d", val); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 362 | if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer, |
| 363 | val, 0) != TX_SUCCESS) |
| 364 | { |
| 365 | /** |
| 366 | * Could not change Remain on channel Timer. Log error. |
| 367 | */ |
| 368 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 369 | FL("Unable to change remain on channel Timer val")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 370 | goto error; |
| 371 | } |
| 372 | |
| 373 | if(TX_SUCCESS != |
| 374 | tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 375 | { |
| 376 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 377 | "%s: remain on channel Timer Start Failed", __func__); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 378 | goto error; |
| 379 | } |
| 380 | |
Gopichand Nakkala | 924e455 | 2013-05-08 19:18:14 +0530 | [diff] [blame^] | 381 | if ((limSetLinkState(pMac, MsgRemainonChannel->isProbeRequestAllowed? |
| 382 | eSIR_LINK_LISTEN_STATE:eSIR_LINK_SEND_ACTION_STATE,nullBssid, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 383 | pMac->lim.gSelfMacAddr, limSetLinkStateP2PCallback, |
| 384 | NULL)) != eSIR_SUCCESS) |
| 385 | { |
| 386 | limLog( pMac, LOGE, "Unable to change link state"); |
| 387 | goto error; |
| 388 | } |
| 389 | |
| 390 | return; |
| 391 | error: |
| 392 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 393 | error1: |
| 394 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 395 | return; |
| 396 | } |
| 397 | |
| 398 | /*------------------------------------------------------------------ |
| 399 | * |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 400 | * lim Insert NOA timer timeout callback - when timer fires, deactivate it and send |
| 401 | * scan rsp to csr/hdd |
| 402 | * |
| 403 | *------------------------------------------------------------------*/ |
| 404 | void limProcessInsertSingleShotNOATimeout(tpAniSirGlobal pMac) |
| 405 | { |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 406 | /* timeout means start NOA did not arrive; we need to deactivate and change the timer for |
| 407 | * future activations |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 408 | */ |
| 409 | limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 410 | |
Viral Modi | d440e68 | 2013-03-06 02:25:31 -0800 | [diff] [blame] | 411 | /* Even if insert NOA timedout, go ahead and process/send stored SME request */ |
| 412 | limProcessRegdDefdSmeReqAfterNOAStart(pMac); |
Gopichand Nakkala | 4261ea5 | 2012-12-31 16:43:00 -0800 | [diff] [blame] | 413 | |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 414 | return; |
| 415 | } |
| 416 | |
Gopichand Nakkala | d492d20 | 2013-05-10 02:50:47 +0530 | [diff] [blame] | 417 | /*----------------------------------------------------------------- |
| 418 | * lim Insert Timer callback function to check active DFS channels |
| 419 | * and convert them to passive channels if there was no |
| 420 | * beacon/proberesp for MAX_TIME_TO_BE_ACTIVE_CHANNEL time |
| 421 | *------------------------------------------------------------------*/ |
| 422 | void limConvertActiveChannelToPassiveChannel(tpAniSirGlobal pMac ) |
| 423 | { |
| 424 | tANI_U32 currentTime; |
| 425 | tANI_U32 lastTime = 0; |
| 426 | tANI_U32 timeDiff; |
| 427 | tANI_U8 i; |
| 428 | currentTime = vos_timer_get_system_time(); |
| 429 | for (i = 1; i < SIR_MAX_24G_5G_CHANNEL_RANGE ; i++) |
| 430 | { |
| 431 | if ((pMac->lim.dfschannelList.timeStamp[i]) != 0) |
| 432 | { |
| 433 | lastTime = pMac->lim.dfschannelList.timeStamp[i]; |
| 434 | if (currentTime >= lastTime) |
| 435 | { |
| 436 | timeDiff = (currentTime - lastTime); |
| 437 | } |
| 438 | else |
| 439 | { |
| 440 | timeDiff = (0xFFFFFFFF - lastTime) + currentTime; |
| 441 | } |
| 442 | |
| 443 | if (timeDiff >= MAX_TIME_TO_BE_ACTIVE_CHANNEL) |
| 444 | { |
| 445 | limCovertChannelScanType( pMac, i,FALSE); |
| 446 | pMac->lim.dfschannelList.timeStamp[i] = 0; |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | /* lastTime is zero if there is no DFS active channels in the list. |
| 451 | * If this is non zero then we have active DFS channels so restart the timer. |
| 452 | */ |
| 453 | if (lastTime != 0) |
| 454 | { |
| 455 | if (tx_timer_activate( |
| 456 | &pMac->lim.limTimers.gLimActiveToPassiveChannelTimer) |
| 457 | != TX_SUCCESS) |
| 458 | { |
| 459 | limLog(pMac, LOGE, FL("Could not activate Active to Passive Channel timer")); |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | return; |
| 464 | |
| 465 | } |
| 466 | |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 467 | /*------------------------------------------------------------------ |
| 468 | * |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 469 | * limchannelchange callback, on success channel change, set the |
| 470 | * link_state to LISTEN |
| 471 | * |
| 472 | *------------------------------------------------------------------*/ |
| 473 | |
| 474 | void limProcessRemainOnChnTimeout(tpAniSirGlobal pMac) |
| 475 | { |
| 476 | tpPESession psessionEntry; |
| 477 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 478 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 479 | //Timer might get extended while Sending Action Frame |
| 480 | //In that case don't process Channel Timeout |
| 481 | if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 482 | { |
| 483 | limLog( pMac, LOGE, |
| 484 | "still timer is running already and not processing limProcessRemainOnChnTimeout"); |
| 485 | return; |
| 486 | } |
| 487 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 488 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 489 | |
| 490 | if (NULL == pMac->lim.gpLimRemainOnChanReq) |
| 491 | { |
| 492 | limLog( pMac, LOGE, "No Remain on channel pending"); |
| 493 | return; |
| 494 | } |
| 495 | |
| 496 | /* get the previous valid LINK state */ |
| 497 | if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid, |
| 498 | pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 499 | { |
| 500 | limLog( pMac, LOGE, "Unable to change link state"); |
| 501 | return; |
| 502 | } |
| 503 | |
| 504 | if (pMac->lim.gLimMlmState != eLIM_MLM_P2P_LISTEN_STATE ) |
| 505 | { |
| 506 | limRemainOnChnRsp(pMac,eHAL_STATUS_SUCCESS, NULL); |
| 507 | } |
| 508 | else |
| 509 | { |
| 510 | /* get the session */ |
| 511 | if((psessionEntry = peFindSessionBySessionId(pMac, |
| 512 | pMac->lim.limTimers.gLimRemainOnChannelTimer.sessionId))== NULL) |
| 513 | { |
| 514 | limLog(pMac, LOGE, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 515 | FL("Session Does not exist for given sessionID")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 516 | goto error; |
| 517 | } |
| 518 | |
| 519 | limExitRemainOnChannel(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry); |
| 520 | return; |
| 521 | error: |
| 522 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 523 | } |
| 524 | return; |
| 525 | } |
| 526 | |
| 527 | |
| 528 | /*------------------------------------------------------------------ |
| 529 | * |
| 530 | * limchannelchange callback, on success channel change, set the link_state |
| 531 | * to LISTEN |
| 532 | * |
| 533 | *------------------------------------------------------------------*/ |
| 534 | |
| 535 | void limExitRemainOnChannel(tpAniSirGlobal pMac, eHalStatus status, |
| 536 | tANI_U32 *data, tpPESession psessionEntry) |
| 537 | { |
| 538 | |
| 539 | if (status != eHAL_STATUS_SUCCESS) |
| 540 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 541 | PELOGE(limLog( pMac, LOGE, "Remain on Channel Failed");) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 542 | goto error; |
| 543 | } |
| 544 | //Set the resume channel to Any valid channel (invalid). |
| 545 | //This will instruct HAL to set it to any previous valid channel. |
| 546 | peSetResumeChannel(pMac, 0, 0); |
| 547 | limResumeLink(pMac, limRemainOnChnRsp, NULL); |
| 548 | return; |
| 549 | error: |
| 550 | limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL); |
| 551 | return; |
| 552 | } |
| 553 | |
| 554 | /*------------------------------------------------------------------ |
| 555 | * |
| 556 | * Send remain on channel respone: Success/ Failure |
| 557 | * |
| 558 | *------------------------------------------------------------------*/ |
| 559 | void limRemainOnChnRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data) |
| 560 | { |
| 561 | tpPESession psessionEntry; |
| 562 | tANI_U8 sessionId; |
| 563 | tSirRemainOnChnReq *MsgRemainonChannel = pMac->lim.gpLimRemainOnChanReq; |
| 564 | tSirMacAddr nullBssid = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
| 565 | |
| 566 | if ( NULL == MsgRemainonChannel ) |
| 567 | { |
| 568 | PELOGE(limLog( pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 569 | "%s: No Pointer for Remain on Channel Req", __func__);) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 570 | return; |
| 571 | } |
| 572 | |
| 573 | //Incase of the Remain on Channel Failure Case |
| 574 | //Cleanup Everything |
| 575 | if(eHAL_STATUS_FAILURE == status) |
| 576 | { |
| 577 | //Deactivate Remain on Channel Timer |
| 578 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 579 | |
| 580 | //Set the Link State to Idle |
| 581 | /* get the previous valid LINK state */ |
| 582 | if (limSetLinkState(pMac, eSIR_LINK_IDLE_STATE, nullBssid, |
| 583 | pMac->lim.gSelfMacAddr, NULL, NULL) != eSIR_SUCCESS) |
| 584 | { |
| 585 | limLog( pMac, LOGE, "Unable to change link state"); |
| 586 | } |
| 587 | |
| 588 | pMac->lim.gLimSystemInScanLearnMode = 0; |
| 589 | pMac->lim.gLimHalScanState = eLIM_HAL_IDLE_SCAN_STATE; |
| 590 | } |
| 591 | |
| 592 | /* delete the session */ |
| 593 | if((psessionEntry = peFindSessionByBssid(pMac, |
| 594 | MsgRemainonChannel->selfMacAddr,&sessionId)) != NULL) |
| 595 | { |
| 596 | if ( eLIM_P2P_DEVICE_ROLE == psessionEntry->limSystemRole ) |
| 597 | { |
| 598 | peDeleteSession( pMac, psessionEntry); |
| 599 | } |
| 600 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 601 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 602 | /* Post the meessage to Sme */ |
| 603 | limSendSmeRsp(pMac, eWNI_SME_REMAIN_ON_CHN_RSP, status, |
| 604 | MsgRemainonChannel->sessionId, 0); |
| 605 | |
| 606 | palFreeMemory( pMac->hHdd, pMac->lim.gpLimRemainOnChanReq ); |
| 607 | pMac->lim.gpLimRemainOnChanReq = NULL; |
| 608 | |
| 609 | pMac->lim.gLimMlmState = pMac->lim.gLimPrevMlmState; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 610 | |
| 611 | /* If remain on channel timer expired and action frame is pending then |
| 612 | * indicaiton confirmation with status failure */ |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 613 | if (pMac->lim.mgmtFrameSessionId != 0xff) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 614 | { |
| 615 | limP2PActionCnf(pMac, 0); |
| 616 | } |
| 617 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 618 | return; |
| 619 | } |
| 620 | |
| 621 | /*------------------------------------------------------------------ |
| 622 | * |
| 623 | * Indicate the Mgmt Frame received to SME to HDD callback |
| 624 | * handle Probe_req/Action frame currently |
| 625 | * |
| 626 | *------------------------------------------------------------------*/ |
| 627 | void limSendSmeMgmtFrameInd( |
| 628 | tpAniSirGlobal pMac, tANI_U8 frameType, |
| 629 | tANI_U8 *frame, tANI_U32 frameLen, tANI_U16 sessionId, |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 630 | tANI_U32 rxChannel, tpPESession psessionEntry, |
| 631 | tANI_S8 rxRssi) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 632 | { |
| 633 | tSirMsgQ mmhMsg; |
| 634 | tpSirSmeMgmtFrameInd pSirSmeMgmtFrame = NULL; |
| 635 | tANI_U16 length; |
| 636 | |
| 637 | length = sizeof(tSirSmeMgmtFrameInd) + frameLen; |
| 638 | |
| 639 | if( eHAL_STATUS_SUCCESS != |
| 640 | palAllocateMemory( pMac->hHdd, (void **)&pSirSmeMgmtFrame, length )) |
| 641 | { |
| 642 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 643 | FL("palAllocateMemory failed for eWNI_SME_LISTEN_RSP")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 644 | return; |
| 645 | } |
| 646 | palZeroMemory(pMac->hHdd, (void*)pSirSmeMgmtFrame, length); |
| 647 | |
| 648 | pSirSmeMgmtFrame->mesgType = eWNI_SME_MGMT_FRM_IND; |
| 649 | pSirSmeMgmtFrame->mesgLen = length; |
| 650 | pSirSmeMgmtFrame->sessionId = sessionId; |
| 651 | pSirSmeMgmtFrame->frameType = frameType; |
Chilam NG | 571c65a | 2013-01-19 12:27:36 +0530 | [diff] [blame] | 652 | pSirSmeMgmtFrame->rxRssi = rxRssi; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 653 | |
Sunil Ravi | f099894 | 2013-02-04 07:01:12 -0800 | [diff] [blame] | 654 | /* |
| 655 | * Work around to address LIM sending wrong channel to HDD for p2p action |
| 656 | * frames(In case of auto GO) recieved on 5GHz channel. |
| 657 | * As RXP has only 4bits to store the channel, we need some mechanism to |
| 658 | * to distinguish between 2.4Ghz/5GHz channel. if gLimRemainOnChannelTImer |
| 659 | * is not running and if we get a frame then pass the Go session |
| 660 | * operating channel to HDD. Some vendors create separate p2p interface |
| 661 | * after group formation. In that case LIM session entry will be NULL for |
| 662 | * p2p device address. So search for p2p go session and pass it's |
| 663 | * operating channel. |
| 664 | * Need to revisit this path in case of GO+CLIENT concurrency. |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 665 | */ |
Sunil Ravi | f099894 | 2013-02-04 07:01:12 -0800 | [diff] [blame] | 666 | if( VOS_FALSE == |
| 667 | tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer) ) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 668 | { |
Sunil Ravi | f099894 | 2013-02-04 07:01:12 -0800 | [diff] [blame] | 669 | tpPESession pTempSessionEntry = psessionEntry; |
| 670 | if( ( (NULL != pTempSessionEntry) || |
| 671 | (pTempSessionEntry = limIsApSessionActive(pMac)) ) && |
| 672 | (SIR_BAND_5_GHZ == limGetRFBand(pTempSessionEntry->currentOperChannel)) ) |
| 673 | { |
| 674 | rxChannel = pTempSessionEntry->currentOperChannel; |
| 675 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 676 | } |
Sunil Ravi | f099894 | 2013-02-04 07:01:12 -0800 | [diff] [blame] | 677 | |
| 678 | pSirSmeMgmtFrame->rxChan = rxChannel; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 679 | |
| 680 | vos_mem_zero(pSirSmeMgmtFrame->frameBuf,frameLen); |
| 681 | vos_mem_copy(pSirSmeMgmtFrame->frameBuf,frame,frameLen); |
| 682 | |
| 683 | mmhMsg.type = eWNI_SME_MGMT_FRM_IND; |
| 684 | mmhMsg.bodyptr = pSirSmeMgmtFrame; |
| 685 | mmhMsg.bodyval = 0; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 686 | |
| 687 | if(VOS_TRUE == tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer) && |
| 688 | ( (psessionEntry != NULL) && (psessionEntry->pePersona != VOS_P2P_GO_MODE)) && |
| 689 | (frameType == SIR_MAC_MGMT_ACTION)) |
| 690 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 691 | unsigned int chanWaitTime, vStatus ; |
| 692 | |
Gopichand Nakkala | 6265d6f | 2013-03-20 23:32:50 +0530 | [diff] [blame] | 693 | limLog( pMac, LOG1, FL("Rx: Extend the gLimRemainOnChannelTimer = %d "), |
| 694 | pMac->lim.gTotalScanDuration); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 695 | |
| 696 | pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time(); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 697 | |
Gopichand Nakkala | 6265d6f | 2013-03-20 23:32:50 +0530 | [diff] [blame] | 698 | chanWaitTime = SYS_MS_TO_TICKS(pMac->lim.gTotalScanDuration); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 699 | vStatus = tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer); |
| 700 | |
| 701 | if (VOS_STATUS_SUCCESS != vStatus) |
| 702 | { |
| 703 | limLog( pMac, LOGE, FL("Rx: Extend the gLimRemainOnChannelTimer")); |
| 704 | } |
| 705 | |
| 706 | if (tx_timer_change(&pMac->lim.limTimers.gLimRemainOnChannelTimer, chanWaitTime, 0) != TX_SUCCESS) |
| 707 | { |
| 708 | limLog( pMac, LOGE, FL("Unable to change the gLimRemainOnChannelTimer")); |
| 709 | } |
| 710 | |
| 711 | if (tx_timer_activate(&pMac->lim.limTimers.gLimRemainOnChannelTimer) != 0) |
| 712 | { |
| 713 | limLog( pMac, LOGE, FL("Unable to active the gLimRemainOnChannelTimer")); |
| 714 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 715 | } |
| 716 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 717 | limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT); |
| 718 | return; |
| 719 | } /*** end limSendSmeListenRsp() ***/ |
| 720 | |
| 721 | |
| 722 | eHalStatus limP2PActionCnf(tpAniSirGlobal pMac, tANI_U32 txCompleteSuccess) |
| 723 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 724 | if (pMac->lim.mgmtFrameSessionId != 0xff) |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 725 | { |
| 726 | /* The session entry might be invalid(0xff) action confirmation received after |
| 727 | * remain on channel timer expired */ |
| 728 | limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, |
| 729 | (txCompleteSuccess ? eSIR_SME_SUCCESS : eSIR_SME_SEND_ACTION_FAIL), |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 730 | pMac->lim.mgmtFrameSessionId, 0); |
| 731 | pMac->lim.mgmtFrameSessionId = 0xff; |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 732 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 733 | |
| 734 | return eHAL_STATUS_SUCCESS; |
| 735 | } |
| 736 | |
| 737 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 738 | void limSetHtCaps(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pIeStartPtr,tANI_U32 nBytes) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 739 | { |
| 740 | v_U8_t *pIe=NULL; |
| 741 | tDot11fIEHTCaps dot11HtCap; |
| 742 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 743 | PopulateDot11fHTCaps(pMac, psessionEntry, &dot11HtCap); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 744 | pIe = limGetIEPtr(pMac,pIeStartPtr, nBytes, |
| 745 | DOT11F_EID_HTCAPS,ONE_BYTE); |
Madan Mohan Koyyalamudi | 8bdd311 | 2012-09-24 13:55:14 -0700 | [diff] [blame] | 746 | limLog( pMac, LOG2, FL("pIe 0x%x dot11HtCap.supportedMCSSet[0]=0x%x"), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 747 | (tANI_U32)pIe,dot11HtCap.supportedMCSSet[0]); |
| 748 | if(pIe) |
| 749 | { |
| 750 | tHtCaps *pHtcap = (tHtCaps *)&pIe[2]; //convert from unpacked to packed structure |
| 751 | pHtcap->advCodingCap = dot11HtCap.advCodingCap; |
| 752 | pHtcap->supportedChannelWidthSet = dot11HtCap.supportedChannelWidthSet; |
| 753 | pHtcap->mimoPowerSave = dot11HtCap.mimoPowerSave; |
| 754 | pHtcap->greenField = dot11HtCap.greenField; |
| 755 | pHtcap->shortGI20MHz = dot11HtCap.shortGI20MHz; |
| 756 | pHtcap->shortGI40MHz = dot11HtCap.shortGI40MHz; |
| 757 | pHtcap->txSTBC = dot11HtCap.txSTBC; |
| 758 | pHtcap->rxSTBC = dot11HtCap.rxSTBC; |
| 759 | pHtcap->delayedBA = dot11HtCap.delayedBA ; |
| 760 | pHtcap->maximalAMSDUsize = dot11HtCap.maximalAMSDUsize; |
| 761 | pHtcap->dsssCckMode40MHz = dot11HtCap.dsssCckMode40MHz; |
| 762 | pHtcap->psmp = dot11HtCap.psmp; |
| 763 | pHtcap->stbcControlFrame = dot11HtCap.stbcControlFrame; |
| 764 | pHtcap->lsigTXOPProtection = dot11HtCap.lsigTXOPProtection; |
| 765 | pHtcap->maxRxAMPDUFactor = dot11HtCap.maxRxAMPDUFactor; |
| 766 | pHtcap->mpduDensity = dot11HtCap.mpduDensity; |
| 767 | palCopyMemory( pMac->hHdd, (void *)pHtcap->supportedMCSSet, |
| 768 | (void *)(dot11HtCap.supportedMCSSet), |
| 769 | sizeof(pHtcap->supportedMCSSet)); |
| 770 | pHtcap->pco = dot11HtCap.pco; |
| 771 | pHtcap->transitionTime = dot11HtCap.transitionTime; |
| 772 | pHtcap->mcsFeedback = dot11HtCap.mcsFeedback; |
| 773 | pHtcap->txBF = dot11HtCap.txBF; |
| 774 | pHtcap->rxStaggeredSounding = dot11HtCap.rxStaggeredSounding; |
| 775 | pHtcap->txStaggeredSounding = dot11HtCap.txStaggeredSounding; |
| 776 | pHtcap->rxZLF = dot11HtCap.rxZLF; |
| 777 | pHtcap->txZLF = dot11HtCap.txZLF; |
| 778 | pHtcap->implicitTxBF = dot11HtCap.implicitTxBF; |
| 779 | pHtcap->calibration = dot11HtCap.calibration; |
| 780 | pHtcap->explicitCSITxBF = dot11HtCap.explicitCSITxBF; |
| 781 | pHtcap->explicitUncompressedSteeringMatrix = |
| 782 | dot11HtCap.explicitUncompressedSteeringMatrix; |
| 783 | pHtcap->explicitBFCSIFeedback = dot11HtCap.explicitBFCSIFeedback; |
| 784 | pHtcap->explicitUncompressedSteeringMatrixFeedback = |
| 785 | dot11HtCap.explicitUncompressedSteeringMatrixFeedback; |
| 786 | pHtcap->explicitCompressedSteeringMatrixFeedback = |
| 787 | dot11HtCap.explicitCompressedSteeringMatrixFeedback; |
| 788 | pHtcap->csiNumBFAntennae = dot11HtCap.csiNumBFAntennae; |
| 789 | pHtcap->uncompressedSteeringMatrixBFAntennae = |
| 790 | dot11HtCap.uncompressedSteeringMatrixBFAntennae; |
| 791 | pHtcap->compressedSteeringMatrixBFAntennae = |
| 792 | dot11HtCap.compressedSteeringMatrixBFAntennae; |
| 793 | pHtcap->antennaSelection = dot11HtCap.antennaSelection; |
| 794 | pHtcap->explicitCSIFeedbackTx = dot11HtCap.explicitCSIFeedbackTx; |
| 795 | pHtcap->antennaIndicesFeedbackTx = dot11HtCap.antennaIndicesFeedbackTx; |
| 796 | pHtcap->explicitCSIFeedback = dot11HtCap.explicitCSIFeedback; |
| 797 | pHtcap->antennaIndicesFeedback = dot11HtCap.antennaIndicesFeedback; |
| 798 | pHtcap->rxAS = dot11HtCap.rxAS; |
| 799 | pHtcap->txSoundingPPDUs = dot11HtCap.txSoundingPPDUs; |
| 800 | } |
| 801 | } |
| 802 | |
| 803 | |
| 804 | void limSendP2PActionFrame(tpAniSirGlobal pMac, tpSirMsgQ pMsg) |
| 805 | { |
| 806 | tSirMbMsgP2p *pMbMsg = (tSirMbMsgP2p *)pMsg->bodyptr; |
| 807 | tANI_U32 nBytes; |
| 808 | tANI_U8 *pFrame; |
| 809 | void *pPacket; |
| 810 | eHalStatus halstatus; |
| 811 | tANI_U8 txFlag = 0; |
| 812 | tpSirMacFrameCtl pFc = (tpSirMacFrameCtl ) pMbMsg->data; |
| 813 | tANI_U8 noaLen = 0; |
Krunal Soni | c768a93 | 2013-05-15 19:26:30 -0700 | [diff] [blame] | 814 | tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + (2*SIR_P2P_IE_HEADER_LEN)]; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 815 | tANI_U8 origLen = 0; |
| 816 | tANI_U8 sessionId = 0; |
| 817 | v_U8_t *pP2PIe = NULL; |
| 818 | tpPESession psessionEntry; |
| 819 | v_U8_t *pPresenceRspNoaAttr = NULL; |
| 820 | v_U8_t *pNewP2PIe = NULL; |
| 821 | v_U16_t remainLen = 0; |
| 822 | |
| 823 | nBytes = pMbMsg->msgLen - sizeof(tSirMbMsg); |
| 824 | |
| 825 | limLog( pMac, LOG1, FL("sending pFc->type=%d pFc->subType=%d"), |
| 826 | pFc->type, pFc->subType); |
| 827 | |
| 828 | psessionEntry = peFindSessionByBssid(pMac, |
| 829 | (tANI_U8*)pMbMsg->data + BSSID_OFFSET, &sessionId); |
| 830 | |
| 831 | /* Check for session corresponding to ADDR2 As Supplicant is filling |
| 832 | ADDR2 with BSSID */ |
| 833 | if( NULL == psessionEntry ) |
| 834 | { |
| 835 | psessionEntry = peFindSessionByBssid(pMac, |
| 836 | (tANI_U8*)pMbMsg->data + ADDR2_OFFSET, &sessionId); |
| 837 | } |
| 838 | |
| 839 | if( NULL == psessionEntry ) |
| 840 | { |
| 841 | tANI_U8 isSessionActive = 0; |
| 842 | tANI_U8 i; |
| 843 | |
| 844 | /* If we are not able to find psessionEntry entry, then try to find |
| 845 | active session, if found any active sessions then send the |
| 846 | action frame, If no active sessions found then drop the frame */ |
| 847 | for (i =0; i < pMac->lim.maxBssId;i++) |
| 848 | { |
| 849 | psessionEntry = peFindSessionBySessionId(pMac,i); |
| 850 | if ( NULL != psessionEntry) |
| 851 | { |
| 852 | isSessionActive = 1; |
| 853 | break; |
| 854 | } |
| 855 | } |
| 856 | if( !isSessionActive ) |
| 857 | { |
| 858 | limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, |
| 859 | eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0); |
| 860 | return; |
| 861 | } |
| 862 | } |
| 863 | |
| 864 | if ((SIR_MAC_MGMT_FRAME == pFc->type)&& |
| 865 | ((SIR_MAC_MGMT_PROBE_RSP == pFc->subType)|| |
| 866 | (SIR_MAC_MGMT_ACTION == pFc->subType))) |
| 867 | { |
| 868 | //if this is a probe RSP being sent from wpa_supplicant |
| 869 | if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType) |
| 870 | { |
| 871 | //get proper offset for Probe RSP |
| 872 | pP2PIe = limGetP2pIEPtr(pMac, |
| 873 | (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET, |
| 874 | nBytes - PROBE_RSP_IE_OFFSET); |
| 875 | while ((NULL != pP2PIe) && (SIR_MAC_MAX_IE_LENGTH == pP2PIe[1])) |
| 876 | { |
| 877 | remainLen = nBytes - (pP2PIe - (tANI_U8*)pMbMsg->data); |
| 878 | if (remainLen > 2) |
| 879 | { |
| 880 | pNewP2PIe = limGetP2pIEPtr(pMac, |
| 881 | pP2PIe+SIR_MAC_MAX_IE_LENGTH + 2, remainLen); |
| 882 | } |
| 883 | if (pNewP2PIe) |
| 884 | { |
| 885 | pP2PIe = pNewP2PIe; |
| 886 | pNewP2PIe = NULL; |
| 887 | } |
| 888 | else |
| 889 | { |
| 890 | break; |
| 891 | } |
| 892 | } //end of while |
| 893 | } |
| 894 | else |
| 895 | { |
| 896 | if (SIR_MAC_ACTION_VENDOR_SPECIFIC_CATEGORY == |
| 897 | *((v_U8_t *)pMbMsg->data+ACTION_OFFSET)) |
| 898 | { |
| 899 | tpSirMacP2PActionFrameHdr pActionHdr = |
| 900 | (tpSirMacP2PActionFrameHdr)((v_U8_t *)pMbMsg->data + |
| 901 | ACTION_OFFSET); |
| 902 | if ( palEqualMemory( pMac->hHdd, pActionHdr->Oui, |
| 903 | SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE ) && |
| 904 | (SIR_MAC_ACTION_P2P_SUBTYPE_PRESENCE_RSP == |
| 905 | pActionHdr->OuiSubType)) |
| 906 | { //In case of Presence RSP response |
| 907 | pP2PIe = limGetP2pIEPtr(pMac, |
| 908 | (v_U8_t *)pMbMsg->data + ACTION_OFFSET + |
| 909 | sizeof(tSirMacP2PActionFrameHdr), |
| 910 | (nBytes - ACTION_OFFSET - |
| 911 | sizeof(tSirMacP2PActionFrameHdr))); |
| 912 | if( NULL != pP2PIe ) |
| 913 | { |
| 914 | //extract the presence of NoA attribute inside P2P IE |
| 915 | pPresenceRspNoaAttr = |
| 916 | limGetIEPtr(pMac,pP2PIe + SIR_P2P_IE_HEADER_LEN, |
| 917 | pP2PIe[1], SIR_P2P_NOA_ATTR,TWO_BYTE); |
| 918 | } |
| 919 | } |
| 920 | } |
| 921 | } |
| 922 | |
| 923 | if (pP2PIe != NULL) |
| 924 | { |
| 925 | //get NoA attribute stream P2P IE |
| 926 | noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); |
| 927 | //need to append NoA attribute in P2P IE |
| 928 | if (noaLen > 0) |
| 929 | { |
| 930 | origLen = pP2PIe[1]; |
| 931 | //if Presence Rsp has NoAttr |
| 932 | if (pPresenceRspNoaAttr) |
| 933 | { |
| 934 | v_U16_t noaAttrLen = pPresenceRspNoaAttr[1] | |
| 935 | (pPresenceRspNoaAttr[2]<<8); |
| 936 | /*One byte for attribute, 2bytes for length*/ |
| 937 | origLen -= (noaAttrLen + 1 + 2); |
| 938 | //remove those bytes to copy |
| 939 | nBytes -= (noaAttrLen + 1 + 2); |
| 940 | //remove NoA from original Len |
| 941 | pP2PIe[1] = origLen; |
| 942 | } |
| 943 | if ((pP2PIe[1] + (tANI_U16)noaLen)> SIR_MAC_MAX_IE_LENGTH) |
| 944 | { |
| 945 | //Form the new NoA Byte array in multiple P2P IEs |
| 946 | noaLen = limGetNoaAttrStreamInMultP2pIes(pMac, noaStream, |
| 947 | noaLen,((pP2PIe[1] + (tANI_U16)noaLen)- |
| 948 | SIR_MAC_MAX_IE_LENGTH)); |
| 949 | pP2PIe[1] = SIR_MAC_MAX_IE_LENGTH; |
| 950 | } |
| 951 | else |
| 952 | { |
| 953 | pP2PIe[1] += noaLen; //increment the length of P2P IE |
| 954 | } |
| 955 | nBytes += noaLen; |
| 956 | limLog( pMac, LOGE, |
| 957 | FL("noaLen=%d origLen=%d pP2PIe=0x%x" |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 958 | " nBytes=%d nBytesToCopy=%d "), |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 959 | noaLen,origLen,pP2PIe,nBytes, |
| 960 | ((pP2PIe + origLen + 2) - (v_U8_t *)pMbMsg->data)); |
| 961 | } |
| 962 | } |
| 963 | |
| 964 | if (SIR_MAC_MGMT_PROBE_RSP == pFc->subType) |
| 965 | { |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 966 | limSetHtCaps( pMac, psessionEntry, (tANI_U8*)pMbMsg->data + PROBE_RSP_IE_OFFSET, |
Madan Mohan Koyyalamudi | fb29a5d | 2012-10-11 12:14:17 -0700 | [diff] [blame] | 967 | nBytes - PROBE_RSP_IE_OFFSET); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 968 | } |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 969 | |
| 970 | /* The minimum wait for any action frame should be atleast 100 ms. |
| 971 | * If supplicant sends action frame at the end of already running remain on channel time |
| 972 | * Then there is a chance to miss the response of the frame. So increase the remain on channel |
| 973 | * time for all action frame to make sure that we receive the response frame */ |
| 974 | if ((SIR_MAC_MGMT_ACTION == pFc->subType) && |
| 975 | (0 != pMbMsg->wait)) |
| 976 | { |
| 977 | if (tx_timer_running(&pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 978 | { |
| 979 | tANI_U32 val = 0; |
| 980 | tx_timer_deactivate(&pMac->lim.limTimers.gLimRemainOnChannelTimer); |
| 981 | /* get the duration from the request */ |
| 982 | pMac->lim.p2pRemOnChanTimeStamp = vos_timer_get_system_time(); |
| 983 | pMac->lim.gTotalScanDuration = pMbMsg->wait; |
| 984 | |
| 985 | val = SYS_MS_TO_TICKS(pMbMsg->wait); |
| 986 | |
| 987 | limLog(pMac, LOG1, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 988 | FL("Tx: Extending the gLimRemainOnChannelTimer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 989 | if (tx_timer_change( |
| 990 | &pMac->lim.limTimers.gLimRemainOnChannelTimer, val, 0) |
| 991 | != TX_SUCCESS) |
| 992 | { |
| 993 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 994 | FL("Unable to change remain on channel Timer val")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 995 | return; |
| 996 | } |
| 997 | else if(TX_SUCCESS != tx_timer_activate( |
| 998 | &pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 999 | { |
| 1000 | limLog(pMac, LOGP, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1001 | FL("Unable to activate remain on channel Timer")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1002 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 1003 | return; |
| 1004 | } |
| 1005 | } |
| 1006 | else |
| 1007 | { |
Gopichand Nakkala | 6265d6f | 2013-03-20 23:32:50 +0530 | [diff] [blame] | 1008 | limLog(pMac, LOGE, |
| 1009 | FL("Failed to Send Action frame \n")); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1010 | limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, |
| 1011 | eHAL_STATUS_FAILURE, pMbMsg->sessionId, 0); |
| 1012 | return; |
| 1013 | } |
| 1014 | } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1015 | } |
| 1016 | |
| 1017 | |
| 1018 | // Ok-- try to allocate some memory: |
| 1019 | halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, |
| 1020 | (tANI_U16)nBytes, ( void** ) &pFrame, (void**) &pPacket); |
| 1021 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1022 | { |
| 1023 | limLog( pMac, LOGE, FL("Failed to allocate %d bytes for a Probe" |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1024 | " Request."), nBytes ); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1025 | return; |
| 1026 | } |
| 1027 | |
| 1028 | // Paranoia: |
| 1029 | palZeroMemory( pMac->hHdd, pFrame, nBytes ); |
| 1030 | |
Gopichand Nakkala | fa9e298 | 2013-03-29 00:48:18 +0530 | [diff] [blame] | 1031 | if ((noaLen > 0) && (noaLen<(SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN))) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1032 | { |
| 1033 | // Add 2 bytes for length and Arribute field |
| 1034 | v_U32_t nBytesToCopy = ((pP2PIe + origLen + 2 ) - |
| 1035 | (v_U8_t *)pMbMsg->data); |
| 1036 | palCopyMemory( pMac->hHdd, pFrame, pMbMsg->data, nBytesToCopy); |
| 1037 | palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy), noaStream, noaLen); |
| 1038 | palCopyMemory( pMac->hHdd, (pFrame + nBytesToCopy + noaLen), |
| 1039 | pMbMsg->data + nBytesToCopy, nBytes - nBytesToCopy - noaLen); |
| 1040 | |
| 1041 | } |
| 1042 | else |
| 1043 | { |
| 1044 | palCopyMemory(pMac->hHdd, pFrame, pMbMsg->data, nBytes); |
| 1045 | } |
| 1046 | |
| 1047 | /* Use BD rate 2 for all P2P related frames. As these frames need to go |
| 1048 | * at OFDM rates. And BD rate2 we configured at 6Mbps. |
| 1049 | */ |
| 1050 | txFlag |= HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME; |
| 1051 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1052 | if ( (SIR_MAC_MGMT_PROBE_RSP == pFc->subType) || |
| 1053 | (pMbMsg->noack) |
| 1054 | ) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1055 | { |
| 1056 | halstatus = halTxFrame( pMac, pPacket, (tANI_U16)nBytes, |
| 1057 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 1058 | 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame, |
| 1059 | txFlag ); |
| 1060 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1061 | if (!pMbMsg->noack) |
| 1062 | { |
| 1063 | limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1064 | halstatus, pMbMsg->sessionId, 0); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1065 | } |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1066 | pMac->lim.mgmtFrameSessionId = 0xff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1067 | } |
| 1068 | else |
| 1069 | { |
Gopichand Nakkala | 6265d6f | 2013-03-20 23:32:50 +0530 | [diff] [blame] | 1070 | pMac->lim.mgmtFrameSessionId = 0xff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1071 | halstatus = halTxFrameWithTxComplete( pMac, pPacket, (tANI_U16)nBytes, |
| 1072 | HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, |
| 1073 | 7,/*SMAC_SWBD_TX_TID_MGMT_HIGH */ limTxComplete, pFrame, |
| 1074 | limP2PActionCnf, txFlag ); |
| 1075 | |
| 1076 | if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) |
| 1077 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1078 | limLog( pMac, LOGE, FL("could not send action frame!" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1079 | limSendSmeRsp(pMac, eWNI_SME_ACTION_FRAME_SEND_CNF, halstatus, |
| 1080 | pMbMsg->sessionId, 0); |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1081 | pMac->lim.mgmtFrameSessionId = 0xff; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1082 | } |
| 1083 | else |
| 1084 | { |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1085 | pMac->lim.mgmtFrameSessionId = pMbMsg->sessionId; |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1086 | limLog( pMac, LOG2, FL("lim.actionFrameSessionId = %lu" ), |
Gopichand Nakkala | b977a97 | 2013-02-18 19:15:09 -0800 | [diff] [blame] | 1087 | pMac->lim.mgmtFrameSessionId); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 1088 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | return; |
| 1093 | } |
| 1094 | |
| 1095 | |
| 1096 | void limAbortRemainOnChan(tpAniSirGlobal pMac) |
| 1097 | { |
| 1098 | if(VOS_TRUE == tx_timer_running( |
| 1099 | &pMac->lim.limTimers.gLimRemainOnChannelTimer)) |
| 1100 | { |
| 1101 | //TODO check for state and take appropriate actions |
| 1102 | limDeactivateAndChangeTimer(pMac, eLIM_REMAIN_CHN_TIMER); |
| 1103 | limProcessRemainOnChnTimeout(pMac); |
| 1104 | } |
| 1105 | return; |
| 1106 | } |
| 1107 | |
| 1108 | /* Power Save Related Functions */ |
| 1109 | tSirRetStatus __limProcessSmeNoAUpdate(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) |
| 1110 | { |
| 1111 | tpP2pPsConfig pNoA; |
| 1112 | tpP2pPsParams pMsgNoA; |
| 1113 | tSirMsgQ msg; |
| 1114 | |
| 1115 | pNoA = (tpP2pPsConfig) pMsgBuf; |
| 1116 | |
| 1117 | if( eHAL_STATUS_SUCCESS != palAllocateMemory( |
| 1118 | pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig ))) |
| 1119 | { |
| 1120 | limLog( pMac, LOGE, |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1121 | FL( "Unable to allocate memory during NoA Update" )); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1122 | return eSIR_MEM_ALLOC_FAILED; |
| 1123 | } |
| 1124 | |
| 1125 | palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig)); |
| 1126 | pMsgNoA->opp_ps = pNoA->opp_ps; |
| 1127 | pMsgNoA->ctWindow = pNoA->ctWindow; |
| 1128 | pMsgNoA->duration = pNoA->duration; |
| 1129 | pMsgNoA->interval = pNoA->interval; |
| 1130 | pMsgNoA->count = pNoA->count; |
| 1131 | pMsgNoA->single_noa_duration = pNoA->single_noa_duration; |
| 1132 | pMsgNoA->psSelection = pNoA->psSelection; |
| 1133 | |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 1134 | msg.type = WDA_SET_P2P_GO_NOA_REQ; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1135 | msg.reserved = 0; |
| 1136 | msg.bodyptr = pMsgNoA; |
| 1137 | msg.bodyval = 0; |
| 1138 | |
| 1139 | if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg)) |
| 1140 | { |
Kiran Kumar Lokere | 8000726 | 2013-03-18 19:45:50 -0700 | [diff] [blame] | 1141 | limLog(pMac, LOGE, FL("halPostMsgApi failed")); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1142 | return eSIR_FAILURE; |
| 1143 | } |
| 1144 | |
| 1145 | return eSIR_SUCCESS; |
| 1146 | } /*** end __limProcessSmeGoNegReq() ***/ |
| 1147 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1148 | |