blob: 84a4aaa28f20fca3f0d608c65ecfa6178c02b6b6 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * 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 Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42#ifdef WLAN_FEATURE_VOWIFI_11R
43/**=========================================================================
44
45 \brief implementation for PE 11r VoWiFi FT Protocol
46
47 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
48
49 Qualcomm Confidential and Proprietary.
50
51 ========================================================================*/
52
53/* $Header$ */
54
55
56/*--------------------------------------------------------------------------
57 Include Files
58 ------------------------------------------------------------------------*/
59#include <limSendMessages.h>
60#include <limTypes.h>
61#include <limFT.h>
62#include <limFTDefs.h>
63#include <limUtils.h>
64#include <limPropExtsUtils.h>
65#include <limAssocUtils.h>
66#include <limSession.h>
67#include <limAdmitControl.h>
68#include "wmmApsd.h"
69
70#define LIM_FT_RIC_BA_SSN 1
71#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
72#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
73
74/*--------------------------------------------------------------------------
75 Initialize the FT variables.
76 ------------------------------------------------------------------------*/
77void limFTOpen(tpAniSirGlobal pMac)
78{
79 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
80 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
81}
82
83/*--------------------------------------------------------------------------
84 Cleanup FT variables.
85 ------------------------------------------------------------------------*/
86void limFTCleanup(tpAniSirGlobal pMac)
87{
88 if (pMac->ft.ftPEContext.pFTPreAuthReq)
89 {
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
91 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080094 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
95 {
96 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
97 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
98 }
Jeff Johnson295189b2012-06-20 16:38:30 -070099 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
100 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
101 }
102
103 // This is the old session, should be deleted else where.
104 // We should not be cleaning it here, just set it to NULL.
105 if (pMac->ft.ftPEContext.psavedsessionEntry)
106 {
107#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
108 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700109 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700110#endif
111 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
112 }
113
114 // This is the extra session we added as part of Auth resp
115 // clean it up.
116 if (pMac->ft.ftPEContext.pftSessionEntry)
117 {
118 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
119 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
120 {
121 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d\n", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
122 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
123 }
124 pMac->ft.ftPEContext.pftSessionEntry = NULL;
125#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
126 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700127 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700128#endif
129 }
130
131 if (pMac->ft.ftPEContext.pAddBssReq)
132 {
133 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
134 pMac->ft.ftPEContext.pAddBssReq = NULL;
135 }
136
137 if (pMac->ft.ftPEContext.pAddStaReq)
138 {
139 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
140 pMac->ft.ftPEContext.pAddStaReq = NULL;
141 }
142
143 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
144
145}
146
147/*--------------------------------------------------------------------------
148 Init FT variables.
149 ------------------------------------------------------------------------*/
150void limFTInit(tpAniSirGlobal pMac)
151{
152 if (pMac->ft.ftPEContext.pFTPreAuthReq)
153 {
154#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
155 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700156 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700157#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800158 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
159 {
160 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
161 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
162 }
163
Jeff Johnson295189b2012-06-20 16:38:30 -0700164 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
165 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
166 }
167
168 // This is the old session, should be deleted else where.
169 // We should not be cleaning it here, just set it to NULL.
170 if (pMac->ft.ftPEContext.psavedsessionEntry)
171 {
172#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
173 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700174 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175#endif
176 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
177 }
178
179 // This is the extra session we added as part of Auth resp
180 // clean it up.
181 if (pMac->ft.ftPEContext.pftSessionEntry)
182 {
183 /* Cannot delete sessions across associations */
184#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
185 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700186 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700187#endif
188 pMac->ft.ftPEContext.pftSessionEntry = NULL;
189 }
190
191 if (pMac->ft.ftPEContext.pAddBssReq)
192 {
193#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
194 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700195 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196#endif
197 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
198 pMac->ft.ftPEContext.pAddBssReq = NULL;
199 }
200
201
202 if (pMac->ft.ftPEContext.pAddStaReq)
203 {
204#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
205 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700206 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700207#endif
208 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
209 pMac->ft.ftPEContext.pAddStaReq = NULL;
210 }
211
212 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
213
214}
215
216/*------------------------------------------------------------------
217 *
218 * This is the handler after suspending the link.
219 * We suspend the link and then now proceed to switch channel.
220 *
221 *------------------------------------------------------------------*/
222void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
223{
224 tpPESession psessionEntry;
225
226 // The link is suspended of not ?
227 if (status != eHAL_STATUS_SUCCESS)
228 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700229 PELOGE(limLog( pMac, LOGE, "%s: Returning \n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 // Post the FT Pre Auth Response to SME
231 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
232
233 return;
234 }
235
236 psessionEntry = (tpPESession)data;
237 // Suspended, now move to a different channel.
238 // Perform some sanity check before proceeding.
239 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
240 {
241 limChangeChannelWithCallback(pMac,
242 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
243 limPerformFTPreAuth, NULL, psessionEntry);
244 return;
245 }
246
247 // Else return error.
248 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
249}
250
251
252/*--------------------------------------------------------------------------
253 In this function, we process the FT Pre Auth Req.
254 We receive Pre-Auth
255 Suspend link
256 Register a call back
257 In the call back, we will need to accept frames from the new bssid
258 Send out the auth req to new AP.
259 Start timer and when the timer is done or if we receive the Auth response
260 We change channel
261 Resume link
262 ------------------------------------------------------------------------*/
263int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
264{
265 int bufConsumed = FALSE;
266 tpPESession psessionEntry;
267 tANI_U8 sessionId;
268
269 // Now we are starting fresh make sure all's cleanup.
270 limFTInit(pMac);
271 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
272
273 // We need information from the Pre-Auth Req. Lets save that
274 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
275
276#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800277 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
279 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
280 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
281#endif
282
283 // Get the current session entry
284 psessionEntry = peFindSessionByBssid(pMac,
285 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
286 if (psessionEntry == NULL)
287 {
288 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700289 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
291 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800292 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
293 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 return TRUE;
295 }
296
297 // Dont need to suspend if APs are in same channel
298 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
299 {
300 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700301 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700302 " channel (session %p)\n", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700303 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 (tANI_U32 *)psessionEntry);
305 }
306 else
307 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700308 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700309 " channel (session %p)\n", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 // We are in the same channel. Perform pre-auth
311 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
312 }
313
314 return bufConsumed;
315}
316
317/*------------------------------------------------------------------
318 * Send the Auth1
319 * Receive back Auth2
320 *------------------------------------------------------------------*/
321void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
322 tpPESession psessionEntry)
323{
324 tSirMacAuthFrameBody authFrame;
325
326 if (psessionEntry->is11Rconnection)
327 {
328 // Only 11r assoc has FT IEs.
329 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
330 {
331 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent\n");)
332 return;
333 }
334 }
335 if (status != eHAL_STATUS_SUCCESS)
336 {
337 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth\n");)
338 return;
339 }
340 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
341
342#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700343 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
344 " (old session %p)\n",
345 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700346#endif
347
348
349 if (psessionEntry->is11Rconnection)
350 {
351 // Now we are on the right channel and need to send out Auth1 and
352 // receive Auth2.
353 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
354 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700355#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 else
357 {
358 // Will need to make isCCXconnection a enum may be for further
359 // improvements to this to match this algorithm number
360 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
361 }
362#endif
363 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
364 authFrame.authStatusCode = 0;
365
366 // Start timer here to come back to operating channel.
367 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
368 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
369 {
370#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700371 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700372#endif
373 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800374MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700375
376#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800377 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700378#endif
379
380 limSendAuthMgmtFrame(pMac, &authFrame,
381 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
382 LIM_NO_WEP_IN_FC, psessionEntry);
383
384 return;
385}
386
387
388/*------------------------------------------------------------------
389 *
390 * Create the new Add Bss Req to the new AP.
391 * This will be used when we are ready to FT to the new AP.
392 * The newly created ft Session entry is passed to this function
393 *
394 *------------------------------------------------------------------*/
395tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
396 tANI_U8 updateEntry, tpPESession pftSessionEntry,
397 tpSirBssDescription bssDescription )
398{
399 tpAddBssParams pAddBssParams = NULL;
400 tANI_U8 i;
401 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700402 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700403
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700404 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
405 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
406 {
407 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS\n") );
408 return eSIR_MEM_ALLOC_FAILED;
409 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
411 // Package SIR_HAL_ADD_BSS_REQ message parameters
412 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
413 (void **) &pAddBssParams, sizeof( tAddBssParams )))
414 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700415 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700416 limLog( pMac, LOGP,
417 FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
418 return (eSIR_MEM_ALLOC_FAILED);
419 }
420
421 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
422
423
424 limExtractApCapabilities( pMac,
425 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700426 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700427
428 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700429 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
431 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
432 sizeof( tSirMacAddr ));
433
434 // Fill in tAddBssParams selfMacAddr
435 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
436 sizeof( tSirMacAddr ));
437
438 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
439 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
440
441 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
442
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700444 pAddBssParams->updateBss = updateEntry;
445
446
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700447 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
448 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
449 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
450 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700451
452
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700453 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700455 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 pAddBssParams->nwType = bssDescription->nwType;
458
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700459 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
461 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
462 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
463 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
464
465 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700466 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700468 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700469
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700472 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
473 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700474
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700476 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 (chanWidthSupp) )
478 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700479 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
480 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 }
482 else
483 {
484 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700485 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700487 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
488 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
489 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 }
491 }
492
493 pAddBssParams->currentOperChannel = bssDescription->channelId;
494
495#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
496 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
497 pAddBssParams->currentOperChannel);
498#endif
499
500
501 // Populate the STA-related parameters here
502 // Note that the STA here refers to the AP
503 {
504 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
505
506 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
507 bssDescription->bssId,
508 sizeof( tSirMacAddr ));
509 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
510
511 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
512 pAddBssParams->staContext.uAPSD = 0;
513 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 pAddBssParams->staContext.updateSta = updateEntry;
516 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
517
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700518 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 {
520 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
521 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700522 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
523 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
524 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 (chanWidthSupp) )
526 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700527 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 }
529 else
530 {
531 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
532 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700533 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
534 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
535 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
536 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
537 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
538 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
539 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
540 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700541
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700542 if( pBeaconStruct->HTInfo.present )
543 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 }
545
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700546 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
547 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 pAddBssParams->staContext.wmmEnabled = 1;
549 else
550 pAddBssParams->staContext.wmmEnabled = 0;
551
552 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700553#ifdef WLAN_FEATURE_11AC
554 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700555 pBeaconStruct->HTCaps.supportedMCSSet,
556 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700557#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
559 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700560#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700561 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
562
563 }
564
565
566 //Disable BA. It will be set as part of ADDBA negotiation.
567 for( i = 0; i < STACFG_MAX_TC; i++ )
568 {
569 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
570 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
571 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
572 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
573 }
574
575#if defined WLAN_FEATURE_VOWIFI
576 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
577#endif
578
579 pAddBssParams->status = eHAL_STATUS_SUCCESS;
580 pAddBssParams->respReqd = true;
581
582 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
583 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
584
585 // Set a new state for MLME
586
587 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800588 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, pftSessionEntry->peSessionId, eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700589 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
590
591 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
592
593#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800594 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700595#endif
596
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700597 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 return 0;
599}
600
601/*------------------------------------------------------------------
602 *
603 * Setup the new session for the pre-auth AP.
604 * Return the newly created session entry.
605 *
606 *------------------------------------------------------------------*/
607tpPESession limFillFTSession(tpAniSirGlobal pMac,
608 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
609{
610 tpPESession pftSessionEntry;
611 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 tPowerdBm localPowerConstraint;
613 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700614 tSchBeaconStruct *pBeaconStruct;
615
616 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
617 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
618 {
619 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
620 return NULL;
621 }
622
Jeff Johnson295189b2012-06-20 16:38:30 -0700623
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800624
625 /* Retrieve the session that has already been created and update the entry */
626 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700627#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
629#endif
630
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700632 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700633
634 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
635 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
636 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
637 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
638
639 // Fields to be filled later
640 pftSessionEntry->pLimJoinReq = NULL;
641 pftSessionEntry->smeSessionId = 0;
642 pftSessionEntry->transactionId = 0;
643
644 limExtractApCapabilities( pMac,
645 (tANI_U8 *) pbssDescription->ieFields,
646 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700647 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700649 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700651 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700652
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700653 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700655 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700658 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
659 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 pftSessionEntry->ssId.length);
661
662
663 // Self Mac
664 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
665 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700666#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
668#endif
669
670 /* Store beaconInterval */
671 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
672 pftSessionEntry->bssType = psessionEntry->bssType;
673
674 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
675 pftSessionEntry->nwType = pbssDescription->nwType;
676
677 /* Copy The channel Id to the session Table */
678 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
679 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
680
681
682 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
683 {
684 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
685 }
686 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
687 {
688 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
689 }
690 else
691 {
692 /* Throw an error and return and make sure to delete the session.*/
693 limLog(pMac, LOGE, FL("Invalid bss type\n"));
694 }
695
696 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
697 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800698 if( pMac->roam.configParam.shortSlotTime &&
699 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
700 {
701 pftSessionEntry->shortSlotTimeSupported = TRUE;
702 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700703
704 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
705 localPowerConstraint = regMax;
706 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
707 limGetIElenFromBssDescription(pbssDescription),
708 &pftSessionEntry->limCurrentBssQosCaps,
709 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700710 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700711
712 pftSessionEntry->limReassocBssQosCaps =
713 pftSessionEntry->limCurrentBssQosCaps;
714 pftSessionEntry->limReassocBssPropCap =
715 pftSessionEntry->limCurrentBssPropCap;
716
717
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800718#ifdef FEATURE_WLAN_CCX
719 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
720#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800722#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700723
724#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800725 limLog( pMac, LOG1, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800726 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700727#endif
728
729 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
730
731 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
732 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800733 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
735 pftSessionEntry->encryptType = psessionEntry->encryptType;
736
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700737 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 return pftSessionEntry;
739}
740
741/*------------------------------------------------------------------
742 *
743 * Setup the session and the add bss req for the pre-auth AP.
744 *
745 *------------------------------------------------------------------*/
746void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
747{
748 tpPESession pftSessionEntry;
749
750 // Prepare the session right now with as much as possible.
751 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
752
753 if (pftSessionEntry)
754 {
755 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
756#ifdef FEATURE_WLAN_CCX
757 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
758#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700759#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
761#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700762
763#ifdef FEATURE_WLAN_LFR
764 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
765#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
767 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
768 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
769 }
770}
771
772/*------------------------------------------------------------------
773 * Resume Link Call Back
774 *------------------------------------------------------------------*/
775void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
776{
777 tpPESession psessionEntry;
778
779 psessionEntry = (tpPESession)data;
780
781 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
782 {
783 limFTSetupAuthSession(pMac, psessionEntry);
784 }
785
786 // Post the FT Pre Auth Response to SME
787 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
788 pMac->ft.ftPEContext.saved_auth_rsp,
789 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
790
791}
792
793/*------------------------------------------------------------------
794 * Resume Link Call Back
795 *------------------------------------------------------------------*/
796void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
797 tpPESession psessionEntry)
798{
799 //Set the resume channel to Any valid channel (invalid).
800 //This will instruct HAL to set it to any previous valid channel.
801 peSetResumeChannel(pMac, 0, 0);
802 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
803}
804
805tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
806 tANI_U8 *ric_ies, tANI_U32 *ieLength)
807{
808 tDot11fIERICDataDesc ricIe;
809 tDot11fFfBAStartingSequenceControl baSsnControl;
810 tDot11fFfAddBAParameterSet baParamSet;
811 tDot11fFfBATimeout baTimeout;
812
813 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
814 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
815 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
816 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
817
818 ricIe.present = 1;
819 ricIe.RICData.present = 1;
820 ricIe.RICData.resourceDescCount = 1;
821 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
822 ricIe.RICDescriptor.present = 1;
823 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
824 baParamSet.tid = tid;
825 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
826 baParamSet.bufferSize = pTrafficClass->txBufSize;
827 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
828 baSsnControl.fragNumber = 0;
829 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
830
831 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
832 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
833 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
834
835 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
836 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
837 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
838
839 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
840 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
841 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
842
843 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
844}
845
846tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
847{
848 tANI_U8 tid = 0;
849 tpDphHashNode pSta;
850 tANI_U16 numBA = 0, aid = 0;
851 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
852 tANI_U32 offset = 0, ieLength = 0;
853 tSirRetStatus status = eSIR_SUCCESS;
854
855 // First, extract the DPH entry
856 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
857 if( NULL == pSta )
858 {
859 PELOGE(limLog( pMac, LOGE,
860 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x\n" ),
861 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
862 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
863 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
864 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
865 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
866 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
867 return eSIR_FAILURE;
868 }
869
870 for (tid = 0; tid < STACFG_MAX_TC; tid++)
871 {
872 if (pSta->tcCfg[tid].fUseBATx)
873 {
874 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
875 if (eSIR_SUCCESS == status)
876 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700877 // TODO RIC
878 if ( ieLength > MAX_FTIE_SIZE )
879 {
880 ieLength = 0;
881 return status;
882 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 offset += ieLength;
884 *ric_ies_length += ieLength;
885 numBA++;
886 }
887 else
888 {
889 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
890 }
891 }
892 }
893
894 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d\n"), numBA, *ric_ies_length);)
895 return status;
896}
897
898/*------------------------------------------------------------------
899 *
900 * Will post pre auth response to SME.
901 *
902 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800903void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
905 tpPESession psessionEntry)
906{
907 tpSirFTPreAuthRsp pFTPreAuthRsp;
908 tSirMsgQ mmhMsg;
909 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700910 // TODO: RIC Support
911 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700912
913 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
914 if(NULL == pFTPreAuthRsp)
915 {
916 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory\n");)
917 VOS_ASSERT(pFTPreAuthRsp != NULL);
918 return;
919 }
920 vos_mem_zero( pFTPreAuthRsp, rspLen);
921#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800922 PELOGE(limLog( pMac, LOG1, "%s: Auth Rsp = %p", pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700923#endif
924
925 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
926 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
927 pFTPreAuthRsp->length = (tANI_U16) rspLen;
928 pFTPreAuthRsp->status = status;
929 if (psessionEntry)
930 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
931
932 // The bssid of the AP we are sending Auth1 to.
933 if (pMac->ft.ftPEContext.pFTPreAuthReq)
934 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
935 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
936
937 // Attach the auth response now back to SME
938 pFTPreAuthRsp->ft_ies_length = 0;
939 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
940 {
941 // Only 11r assoc has FT IEs.
942 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
943 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
944 }
945
946#ifdef WLAN_FEATURE_VOWIFI_11R
947 if ((psessionEntry) && (psessionEntry->is11Rconnection))
948 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700949 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
950 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700951 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
952 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
953 if (eSIR_SUCCESS != sirStatus)
954 {
955 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
956 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700957 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 }
959#endif
960
961 mmhMsg.type = pFTPreAuthRsp->messageType;
962 mmhMsg.bodyptr = pFTPreAuthRsp;
963 mmhMsg.bodyval = 0;
964
965#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800966 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800967#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
969}
970
971/*------------------------------------------------------------------
972 *
973 * Send the FT Pre Auth Response to SME when ever we have a status
974 * ready to be sent to SME
975 *
976 * SME will be the one to send it up to the supplicant to receive
977 * FTIEs which will be required for Reassoc Req.
978 *
979 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800980void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
982 tpPESession psessionEntry)
983{
984
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800985 tpPESession pftSessionEntry;
986 tANI_U8 sessionId;
987 tpSirBssDescription pbssDescription;
988
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 // Save the status of pre-auth
990 pMac->ft.ftPEContext.ftPreAuthStatus = status;
991
992 // Save the auth rsp, so we can send it to
993 // SME once we resume link.
994 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
995 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
996 {
997 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
998 auth_rsp, auth_rsp_length);
999 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1000 }
1001
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001002 /* Create FT session for the re-association at this point */
1003 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1004 {
1005 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1006 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1007 &sessionId, pMac->lim.maxStation)) == NULL)
1008 {
1009 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
1010 return;
1011 }
1012 pftSessionEntry->peSessionId = sessionId;
1013 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1014 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1015 pftSessionEntry->bssType = psessionEntry->bssType;
1016
1017 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1018 {
1019 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1020 }
1021 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1022 {
1023 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1024 }
1025 else
1026 {
1027 limLog(pMac, LOGE, FL("Invalid bss type\n"));
1028 }
1029 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1030 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1031 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
1032 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n",
1033 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1034
1035 /* Update the ReAssoc BSSID of the current session */
1036 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1037 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1038 }
1039
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 if (psessionEntry->currentOperChannel !=
1041 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1042 {
1043 // Need to move to the original AP channel
1044 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1045 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1046 }
1047 else
1048 {
1049#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
1050 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
1051 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1052#endif
1053 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1054 }
1055}
1056
1057/*------------------------------------------------------------------
1058 *
1059 * This function handles the 11R Reassoc Req from SME
1060 *
1061 *------------------------------------------------------------------*/
1062void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1063 tpPESession psessionEntry)
1064{
1065 tANI_U8 smeSessionId = 0;
1066 tANI_U16 transactionId = 0;
1067 tANI_U8 chanNum = 0;
1068 tLimMlmReassocReq *pMlmReassocReq;
1069 tANI_U16 caps;
1070 tANI_U32 val;
1071 tSirMsgQ msgQ;
1072 tSirRetStatus retCode;
1073 tANI_U32 teleBcnEn = 0;
1074
1075 chanNum = psessionEntry->currentOperChannel;
1076 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1077 psessionEntry->smeSessionId = smeSessionId;
1078 psessionEntry->transactionId = transactionId;
1079
1080
1081
1082 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
1083 sizeof(tLimMlmReassocReq)))
1084 {
1085 // Log error
1086 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
1087 return;
1088 }
1089
1090 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1091 psessionEntry->bssId,
1092 sizeof(tSirMacAddr));
1093
1094 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1095 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1096 != eSIR_SUCCESS)
1097 {
1098 /**
1099 * Could not get ReassocFailureTimeout value
1100 * from CFG. Log error.
1101 */
1102 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
1103 return;
1104 }
1105
1106 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1107 {
1108 /**
1109 * Could not get Capabilities value
1110 * from CFG. Log error.
1111 */
1112 limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
1113 return;
1114 }
1115 pMlmReassocReq->capabilityInfo = caps;
1116
1117 /* Update PE sessionId*/
1118 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1119
1120 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
1121 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1122 eSIR_SUCCESS)
1123 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
1124
1125 if(teleBcnEn)
1126 {
1127 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001128 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 /**
1130 * Could not get ListenInterval value
1131 * from CFG. Log error.
1132 */
1133 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1134 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001135 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 }
1137 else
1138 {
1139 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
1140 {
1141 /**
1142 * Could not get ListenInterval value
1143 * from CFG. Log error.
1144 */
1145 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1146 return;
1147 }
1148 }
1149 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1150 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1151 {
1152 return;
1153 }
1154
1155 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1156 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1157 {
1158 return;
1159 }
1160
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 pMlmReassocReq->listenInterval = (tANI_U16) val;
1162
1163 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1164
1165
1166 //we need to defer the message until we get the response back from HAL.
1167 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1168
1169 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1170 msgQ.reserved = 0;
1171 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1172 msgQ.bodyval = 0;
1173
1174
1175#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1176 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1177#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001178 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001179
1180 retCode = wdaPostCtrlMsg( pMac, &msgQ );
1181 if( eSIR_SUCCESS != retCode)
1182 {
1183 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
1184 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
1185 retCode );
1186 }
1187 // Dont need this anymore
1188 pMac->ft.ftPEContext.pAddBssReq = NULL;
1189 return;
1190}
1191
1192/*------------------------------------------------------------------
1193 *
1194 * This function is called if preauth response is not received from the AP
1195 * within this timeout while FT in progress
1196 *
1197 *------------------------------------------------------------------*/
1198void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1199{
1200 tpPESession psessionEntry;
1201
1202 // We have failed pre auth. We need to resume link and get back on
1203 // home channel.
1204
1205 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1206 {
1207 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
1208 return;
1209 }
1210
1211 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1212 // to get back.
1213 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1214}
1215
1216
1217/*------------------------------------------------------------------
1218 *
1219 * This function is called to process the update key request from SME
1220 *
1221 *------------------------------------------------------------------*/
1222tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1223{
1224 tAddBssParams * pAddBssParams;
1225 tSirFTUpdateKeyInfo * pKeyInfo;
1226 tANI_U32 val = 0;
1227
1228 /* Sanity Check */
1229 if( pMac == NULL || pMsgBuf == NULL )
1230 {
1231 return TRUE;
1232 }
1233
1234 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1235 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
1236
1237 /* Store the key information in the ADD BSS parameters */
1238 pAddBssParams->extSetStaKeyParamValid = 1;
1239 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1240 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1241 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
1242 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1243 {
1244 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
1245 }
1246
1247 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1248
1249 return TRUE;
1250}
1251
1252tSirRetStatus
1253limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1254{
1255 tSirMsgQ msg;
1256 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1257 tpAggrAddTsParams pAggrAddTsParam;
1258 tpPESession psessionEntry = NULL;
1259 tpLimTspecInfo tspecInfo;
1260 tANI_U8 ac;
1261 tpDphHashNode pSta;
1262 tANI_U16 aid;
1263 tANI_U8 sessionId;
1264 int i;
1265
1266 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1267 (void **)&pAggrAddTsParam,
1268 sizeof(tAggrAddTsParams)))
1269 {
1270 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
1271 return eSIR_MEM_ALLOC_FAILED;
1272 }
1273
1274 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1275
1276 if (psessionEntry == NULL) {
1277 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
1278 return eSIR_FAILURE;
1279 }
1280
1281 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1282 if (pSta == NULL)
1283 {
1284 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
1285 return eSIR_FAILURE;
1286 }
1287
1288 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1289 sizeof(tAggrAddTsParams));
1290 pAggrAddTsParam->staIdx = psessionEntry->staId;
1291 // Fill in the sessionId specific to PE
1292 pAggrAddTsParam->sessionId = sessionId;
1293 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1294
1295 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1296 {
1297 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1298 {
1299 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1300 /* Since AddTS response was successful, check for the PSB flag
1301 * and directional flag inside the TS Info field.
1302 * An AC is trigger enabled AC if the PSB subfield is set to 1
1303 * in the uplink direction.
1304 * An AC is delivery enabled AC if the PSB subfield is set to 1
1305 * in the downlink direction.
1306 * An AC is trigger and delivery enabled AC if the PSB subfield
1307 * is set to 1 in the bi-direction field.
1308 */
1309 if (pTspec->tsinfo.traffic.psb == 1)
1310 {
1311 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1312 }
1313 else
1314 {
1315 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1316 }
1317 /* ADDTS success, so AC is now admitted. We shall now use the default
1318 * EDCA parameters as advertised by AP and send the updated EDCA params
1319 * to HAL.
1320 */
1321 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1322 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1323 {
1324 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1325 }
1326 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1327 {
1328 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1329 }
1330 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1331 {
1332 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1333 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1334 }
1335
1336 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1337
1338 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1339 {
1340 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1341 }
1342 else
1343 {
1344 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1345 }
1346
1347 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1348 {
1349 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
1350 pMac->lim.gLimAddtsSent = false;
1351 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1352 }
1353
1354 // Copy the TSPEC paramters
1355 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1356 }
1357 }
1358
1359 msg.type = WDA_AGGR_QOS_REQ;
1360 msg.bodyptr = pAggrAddTsParam;
1361 msg.bodyval = 0;
1362
1363 /* We need to defer any incoming messages until we get a
1364 * WDA_AGGR_QOS_RSP from HAL.
1365 */
1366 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001367 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001368
1369 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1370 {
1371 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
1372 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1373 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1374 return eSIR_FAILURE;
1375 }
1376
1377 return eSIR_SUCCESS;
1378}
1379
1380void
1381limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1382 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1383{
1384 tpSirAggrQosRsp rsp;
1385 int i = 0;
1386
1387 if (! rspReqd)
1388 {
1389 return;
1390 }
1391
1392 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1393 sizeof(tSirAggrQosRsp)))
1394 {
1395 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1396 return;
1397 }
1398
1399 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1400 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1401 rsp->sessionId = smesessionId;
1402 rsp->length = sizeof(*rsp);
1403 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1404
1405 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1406 {
1407 if( (1 << i) & aggrQosRsp->tspecIdx )
1408 {
1409 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1410 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1411 }
1412 }
1413
1414 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1415 return;
1416}
1417
1418
1419void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1420{
1421 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1422 //tpAggrQosParams pAggrQosRspMsg = NULL;
1423 tAddTsParams addTsParam = {0};
1424 tpDphHashNode pSta = NULL;
1425 tANI_U16 assocId =0;
1426 tSirMacAddr peerMacAddr;
1427 tANI_U8 rspReqd = 1;
1428 tpPESession psessionEntry = NULL;
1429 int i = 0;
1430
1431 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
1432
1433 /* Need to process all the deferred messages enqueued since sending the
1434 SIR_HAL_AGGR_ADD_TS_REQ */
1435 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1436
1437 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1438 if (NULL == pAggrQosRspMsg)
1439 {
1440 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1441 return;
1442 }
1443
1444 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1445 if (NULL == psessionEntry)
1446 {
1447 // Cant find session entry
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001448 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 if( pAggrQosRspMsg != NULL )
1450 {
1451 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1452 }
1453 return;
1454 }
1455
1456 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1457 {
1458 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1459 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1460 {
1461 /* send DELTS to the station */
1462 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1463
1464 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1465 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1466 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1467 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1468
1469 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1470 &addTsParam.tspec.tsinfo,
1471 &addTsParam.tspec, psessionEntry);
1472
1473 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1474 &psessionEntry->dph.dphHashTable);
1475 if (pSta != NULL)
1476 {
1477 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1478 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1479 }
1480 }
1481 }
1482
1483 /* Send the Aggr QoS response to SME */
1484
1485 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1486 psessionEntry->smeSessionId);
1487 if( pAggrQosRspMsg != NULL )
1488 {
1489 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1490 }
1491 return;
1492}
1493
1494
1495/*--------------------------------------------------------------------------
1496 Determines if a session with ccx or 11r assoc is present.
1497 If present it will return TRUE else FALSE
1498 ------------------------------------------------------------------------*/
1499int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1500{
1501 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1502 {
1503 // If ccx or 11r connection is found we need to return TRUE
1504 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1505 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1506#ifdef FEATURE_WLAN_CCX
1507 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1508#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001509#ifdef FEATURE_WLAN_LFR
1510 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1511#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 )&&
1513 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1514 {
1515 // Make sure we have 11r/CCX and FT enabled only then we need
1516 // the values to be altered from cfg for FW RSSI Period alteration.
1517 return TRUE;
1518 }
1519 }
1520
1521 return FALSE;
1522}
1523
1524#endif /* WLAN_FEATURE_VOWIFI_11R */