blob: 0df792be87f9a24eaaa0c32199df588e40ea4728 [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
94 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
95 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
96 }
97
98 // This is the old session, should be deleted else where.
99 // We should not be cleaning it here, just set it to NULL.
100 if (pMac->ft.ftPEContext.psavedsessionEntry)
101 {
102#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
103 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700104 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105#endif
106 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
107 }
108
109 // This is the extra session we added as part of Auth resp
110 // clean it up.
111 if (pMac->ft.ftPEContext.pftSessionEntry)
112 {
113 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
114 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
115 {
116 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d\n", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
117 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
118 }
119 pMac->ft.ftPEContext.pftSessionEntry = NULL;
120#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
121 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700122 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700123#endif
124 }
125
126 if (pMac->ft.ftPEContext.pAddBssReq)
127 {
128 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
129 pMac->ft.ftPEContext.pAddBssReq = NULL;
130 }
131
132 if (pMac->ft.ftPEContext.pAddStaReq)
133 {
134 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
135 pMac->ft.ftPEContext.pAddStaReq = NULL;
136 }
137
138 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
139
140}
141
142/*--------------------------------------------------------------------------
143 Init FT variables.
144 ------------------------------------------------------------------------*/
145void limFTInit(tpAniSirGlobal pMac)
146{
147 if (pMac->ft.ftPEContext.pFTPreAuthReq)
148 {
149#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
150 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700151 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700152#endif
153 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
154 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
155 }
156
157 // This is the old session, should be deleted else where.
158 // We should not be cleaning it here, just set it to NULL.
159 if (pMac->ft.ftPEContext.psavedsessionEntry)
160 {
161#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
162 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700163 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700164#endif
165 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
166 }
167
168 // This is the extra session we added as part of Auth resp
169 // clean it up.
170 if (pMac->ft.ftPEContext.pftSessionEntry)
171 {
172 /* Cannot delete sessions across associations */
173#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
174 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176#endif
177 pMac->ft.ftPEContext.pftSessionEntry = NULL;
178 }
179
180 if (pMac->ft.ftPEContext.pAddBssReq)
181 {
182#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
183 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700184 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700185#endif
186 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
187 pMac->ft.ftPEContext.pAddBssReq = NULL;
188 }
189
190
191 if (pMac->ft.ftPEContext.pAddStaReq)
192 {
193#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
194 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700195 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196#endif
197 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
198 pMac->ft.ftPEContext.pAddStaReq = NULL;
199 }
200
201 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
202
203}
204
205/*------------------------------------------------------------------
206 *
207 * This is the handler after suspending the link.
208 * We suspend the link and then now proceed to switch channel.
209 *
210 *------------------------------------------------------------------*/
211void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
212{
213 tpPESession psessionEntry;
214
215 // The link is suspended of not ?
216 if (status != eHAL_STATUS_SUCCESS)
217 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700218 PELOGE(limLog( pMac, LOGE, "%s: Returning \n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700219 // Post the FT Pre Auth Response to SME
220 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
221
222 return;
223 }
224
225 psessionEntry = (tpPESession)data;
226 // Suspended, now move to a different channel.
227 // Perform some sanity check before proceeding.
228 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
229 {
230 limChangeChannelWithCallback(pMac,
231 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
232 limPerformFTPreAuth, NULL, psessionEntry);
233 return;
234 }
235
236 // Else return error.
237 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
238}
239
240
241/*--------------------------------------------------------------------------
242 In this function, we process the FT Pre Auth Req.
243 We receive Pre-Auth
244 Suspend link
245 Register a call back
246 In the call back, we will need to accept frames from the new bssid
247 Send out the auth req to new AP.
248 Start timer and when the timer is done or if we receive the Auth response
249 We change channel
250 Resume link
251 ------------------------------------------------------------------------*/
252int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
253{
254 int bufConsumed = FALSE;
255 tpPESession psessionEntry;
256 tANI_U8 sessionId;
257
258 // Now we are starting fresh make sure all's cleanup.
259 limFTInit(pMac);
260 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
261
262 // We need information from the Pre-Auth Req. Lets save that
263 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
264
265#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700266 PELOGE(limLog( pMac, LOGE, "%s: PE Auth ft_ies_length=%02x%02x%02x\n", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
268 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
269 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
270#endif
271
272 // Get the current session entry
273 psessionEntry = peFindSessionByBssid(pMac,
274 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
275 if (psessionEntry == NULL)
276 {
277 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700278 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
280 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800281 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
282 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 return TRUE;
284 }
285
286 // Dont need to suspend if APs are in same channel
287 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
288 {
289 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700290 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700291 " channel (session %p)\n", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700292 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 (tANI_U32 *)psessionEntry);
294 }
295 else
296 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700297 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700298 " channel (session %p)\n", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 // We are in the same channel. Perform pre-auth
300 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
301 }
302
303 return bufConsumed;
304}
305
306/*------------------------------------------------------------------
307 * Send the Auth1
308 * Receive back Auth2
309 *------------------------------------------------------------------*/
310void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
311 tpPESession psessionEntry)
312{
313 tSirMacAuthFrameBody authFrame;
314
315 if (psessionEntry->is11Rconnection)
316 {
317 // Only 11r assoc has FT IEs.
318 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
319 {
320 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent\n");)
321 return;
322 }
323 }
324 if (status != eHAL_STATUS_SUCCESS)
325 {
326 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth\n");)
327 return;
328 }
329 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
330
331#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700332 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
333 " (old session %p)\n",
334 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700335#endif
336
337
338 if (psessionEntry->is11Rconnection)
339 {
340 // Now we are on the right channel and need to send out Auth1 and
341 // receive Auth2.
342 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
343 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700344#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 else
346 {
347 // Will need to make isCCXconnection a enum may be for further
348 // improvements to this to match this algorithm number
349 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
350 }
351#endif
352 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
353 authFrame.authStatusCode = 0;
354
355 // Start timer here to come back to operating channel.
356 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
357 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
358 {
359#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700360 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361#endif
362 }
363
364#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700365 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Started\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700366#endif
367
368 limSendAuthMgmtFrame(pMac, &authFrame,
369 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
370 LIM_NO_WEP_IN_FC, psessionEntry);
371
372 return;
373}
374
375
376/*------------------------------------------------------------------
377 *
378 * Create the new Add Bss Req to the new AP.
379 * This will be used when we are ready to FT to the new AP.
380 * The newly created ft Session entry is passed to this function
381 *
382 *------------------------------------------------------------------*/
383tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
384 tANI_U8 updateEntry, tpPESession pftSessionEntry,
385 tpSirBssDescription bssDescription )
386{
387 tpAddBssParams pAddBssParams = NULL;
388 tANI_U8 i;
389 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700390 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700391
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700392 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
393 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
394 {
395 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS\n") );
396 return eSIR_MEM_ALLOC_FAILED;
397 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
399 // Package SIR_HAL_ADD_BSS_REQ message parameters
400 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
401 (void **) &pAddBssParams, sizeof( tAddBssParams )))
402 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700403 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 limLog( pMac, LOGP,
405 FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
406 return (eSIR_MEM_ALLOC_FAILED);
407 }
408
409 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
410
411
412 limExtractApCapabilities( pMac,
413 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700414 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700415
416 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700417 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700418
419 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
420 sizeof( tSirMacAddr ));
421
422 // Fill in tAddBssParams selfMacAddr
423 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
424 sizeof( tSirMacAddr ));
425
426 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
427 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
428
429 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
430
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700431 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 pAddBssParams->updateBss = updateEntry;
433
434
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700435 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
436 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
437 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
438 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700441 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700442 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700444
445 pAddBssParams->nwType = bssDescription->nwType;
446
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700447 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
449 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
450 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
451 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
452
453 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700454 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700455 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700456 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700458 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700460 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
461 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700462
463#ifdef WLAN_SOFTAP_FEATURE
464 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
465#else
466 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
467#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700468 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 (chanWidthSupp) )
470 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700471 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
472 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 }
474 else
475 {
476 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700477 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700479 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
480 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
481 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 }
483 }
484
485 pAddBssParams->currentOperChannel = bssDescription->channelId;
486
487#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
488 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
489 pAddBssParams->currentOperChannel);
490#endif
491
492
493 // Populate the STA-related parameters here
494 // Note that the STA here refers to the AP
495 {
496 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
497
498 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
499 bssDescription->bssId,
500 sizeof( tSirMacAddr ));
501 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
502
503 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
504 pAddBssParams->staContext.uAPSD = 0;
505 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700506 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 pAddBssParams->staContext.updateSta = updateEntry;
508 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
509
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 {
512 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
513 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
515 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
516 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 (chanWidthSupp) )
518 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700519 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700520 }
521 else
522 {
523 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
524 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700525 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
526 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
527 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
528 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
529 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
530 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
531 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
532 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700533
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700534 if( pBeaconStruct->HTInfo.present )
535 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 }
537
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700538 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
539 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 pAddBssParams->staContext.wmmEnabled = 1;
541 else
542 pAddBssParams->staContext.wmmEnabled = 0;
543
544 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700545#ifdef WLAN_FEATURE_11AC
546 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700547 pBeaconStruct->HTCaps.supportedMCSSet,
548 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700549#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
551 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700552#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
554
555 }
556
557
558 //Disable BA. It will be set as part of ADDBA negotiation.
559 for( i = 0; i < STACFG_MAX_TC; i++ )
560 {
561 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
562 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
563 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
564 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
565 }
566
567#if defined WLAN_FEATURE_VOWIFI
568 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
569#endif
570
571 pAddBssParams->status = eHAL_STATUS_SUCCESS;
572 pAddBssParams->respReqd = true;
573
574 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
575 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
576
577 // Set a new state for MLME
578
579 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
580
581 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
582
583 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
584
585#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
586 limLog( pMac, LOGE, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
587#endif
588
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700589 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 return 0;
591}
592
593/*------------------------------------------------------------------
594 *
595 * Setup the new session for the pre-auth AP.
596 * Return the newly created session entry.
597 *
598 *------------------------------------------------------------------*/
599tpPESession limFillFTSession(tpAniSirGlobal pMac,
600 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
601{
602 tpPESession pftSessionEntry;
603 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 tPowerdBm localPowerConstraint;
605 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700606 tSchBeaconStruct *pBeaconStruct;
607
608 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
609 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
610 {
611 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
612 return NULL;
613 }
614
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800616
617 /* Retrieve the session that has already been created and update the entry */
618 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700619#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700620 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
621#endif
622
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700624 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700625
626 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
627 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
628 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
629 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
630
631 // Fields to be filled later
632 pftSessionEntry->pLimJoinReq = NULL;
633 pftSessionEntry->smeSessionId = 0;
634 pftSessionEntry->transactionId = 0;
635
636 limExtractApCapabilities( pMac,
637 (tANI_U8 *) pbssDescription->ieFields,
638 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700639 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700640
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700641 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700643 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700645 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700647 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
649
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700650 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
651 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 pftSessionEntry->ssId.length);
653
654
655 // Self Mac
656 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
657 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700658#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
660#endif
661
662 /* Store beaconInterval */
663 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
664 pftSessionEntry->bssType = psessionEntry->bssType;
665
666 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
667 pftSessionEntry->nwType = pbssDescription->nwType;
668
669 /* Copy The channel Id to the session Table */
670 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
671 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
672
673
674 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
675 {
676 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
677 }
678 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
679 {
680 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
681 }
682 else
683 {
684 /* Throw an error and return and make sure to delete the session.*/
685 limLog(pMac, LOGE, FL("Invalid bss type\n"));
686 }
687
688 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
689 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800690 if( pMac->roam.configParam.shortSlotTime &&
691 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
692 {
693 pftSessionEntry->shortSlotTimeSupported = TRUE;
694 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700695
696 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
697 localPowerConstraint = regMax;
698 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
699 limGetIElenFromBssDescription(pbssDescription),
700 &pftSessionEntry->limCurrentBssQosCaps,
701 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700702 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700703
704 pftSessionEntry->limReassocBssQosCaps =
705 pftSessionEntry->limCurrentBssQosCaps;
706 pftSessionEntry->limReassocBssPropCap =
707 pftSessionEntry->limCurrentBssPropCap;
708
709
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800710#ifdef FEATURE_WLAN_CCX
711 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
712#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800714#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700715
716#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800717 limLog( pMac, LOGE, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
718 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700719#endif
720
721 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
722
723 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
724 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
725
726 pftSessionEntry->encryptType = psessionEntry->encryptType;
727
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700728 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 return pftSessionEntry;
730}
731
732/*------------------------------------------------------------------
733 *
734 * Setup the session and the add bss req for the pre-auth AP.
735 *
736 *------------------------------------------------------------------*/
737void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
738{
739 tpPESession pftSessionEntry;
740
741 // Prepare the session right now with as much as possible.
742 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
743
744 if (pftSessionEntry)
745 {
746 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
747#ifdef FEATURE_WLAN_CCX
748 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
749#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700750#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
752#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700753
754#ifdef FEATURE_WLAN_LFR
755 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
756#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
758 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
759 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
760 }
761}
762
763/*------------------------------------------------------------------
764 * Resume Link Call Back
765 *------------------------------------------------------------------*/
766void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
767{
768 tpPESession psessionEntry;
769
770 psessionEntry = (tpPESession)data;
771
772 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
773 {
774 limFTSetupAuthSession(pMac, psessionEntry);
775 }
776
777 // Post the FT Pre Auth Response to SME
778 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
779 pMac->ft.ftPEContext.saved_auth_rsp,
780 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
781
782}
783
784/*------------------------------------------------------------------
785 * Resume Link Call Back
786 *------------------------------------------------------------------*/
787void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
788 tpPESession psessionEntry)
789{
790 //Set the resume channel to Any valid channel (invalid).
791 //This will instruct HAL to set it to any previous valid channel.
792 peSetResumeChannel(pMac, 0, 0);
793 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
794}
795
796tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
797 tANI_U8 *ric_ies, tANI_U32 *ieLength)
798{
799 tDot11fIERICDataDesc ricIe;
800 tDot11fFfBAStartingSequenceControl baSsnControl;
801 tDot11fFfAddBAParameterSet baParamSet;
802 tDot11fFfBATimeout baTimeout;
803
804 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
805 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
806 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
807 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
808
809 ricIe.present = 1;
810 ricIe.RICData.present = 1;
811 ricIe.RICData.resourceDescCount = 1;
812 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
813 ricIe.RICDescriptor.present = 1;
814 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
815 baParamSet.tid = tid;
816 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
817 baParamSet.bufferSize = pTrafficClass->txBufSize;
818 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
819 baSsnControl.fragNumber = 0;
820 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
821
822 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
823 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
824 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
825
826 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
827 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
828 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
829
830 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
831 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
832 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
833
834 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
835}
836
837tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
838{
839 tANI_U8 tid = 0;
840 tpDphHashNode pSta;
841 tANI_U16 numBA = 0, aid = 0;
842 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
843 tANI_U32 offset = 0, ieLength = 0;
844 tSirRetStatus status = eSIR_SUCCESS;
845
846 // First, extract the DPH entry
847 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
848 if( NULL == pSta )
849 {
850 PELOGE(limLog( pMac, LOGE,
851 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x\n" ),
852 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
853 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
854 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
855 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
856 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
857 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
858 return eSIR_FAILURE;
859 }
860
861 for (tid = 0; tid < STACFG_MAX_TC; tid++)
862 {
863 if (pSta->tcCfg[tid].fUseBATx)
864 {
865 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
866 if (eSIR_SUCCESS == status)
867 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700868 // TODO RIC
869 if ( ieLength > MAX_FTIE_SIZE )
870 {
871 ieLength = 0;
872 return status;
873 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 offset += ieLength;
875 *ric_ies_length += ieLength;
876 numBA++;
877 }
878 else
879 {
880 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
881 }
882 }
883 }
884
885 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d\n"), numBA, *ric_ies_length);)
886 return status;
887}
888
889/*------------------------------------------------------------------
890 *
891 * Will post pre auth response to SME.
892 *
893 *------------------------------------------------------------------*/
894void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
895 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
896 tpPESession psessionEntry)
897{
898 tpSirFTPreAuthRsp pFTPreAuthRsp;
899 tSirMsgQ mmhMsg;
900 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700901 // TODO: RIC Support
902 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700903
904 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
905 if(NULL == pFTPreAuthRsp)
906 {
907 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory\n");)
908 VOS_ASSERT(pFTPreAuthRsp != NULL);
909 return;
910 }
911 vos_mem_zero( pFTPreAuthRsp, rspLen);
912#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
913 PELOGE(limLog( pMac, LOGE, "%s: Auth Rsp = %p\n", pFTPreAuthRsp);)
914#endif
915
916 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
917 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
918 pFTPreAuthRsp->length = (tANI_U16) rspLen;
919 pFTPreAuthRsp->status = status;
920 if (psessionEntry)
921 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
922
923 // The bssid of the AP we are sending Auth1 to.
924 if (pMac->ft.ftPEContext.pFTPreAuthReq)
925 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
926 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
927
928 // Attach the auth response now back to SME
929 pFTPreAuthRsp->ft_ies_length = 0;
930 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
931 {
932 // Only 11r assoc has FT IEs.
933 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
934 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
935 }
936
937#ifdef WLAN_FEATURE_VOWIFI_11R
938 if ((psessionEntry) && (psessionEntry->is11Rconnection))
939 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700940 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
941 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
943 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
944 if (eSIR_SUCCESS != sirStatus)
945 {
946 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
947 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700948 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 }
950#endif
951
952 mmhMsg.type = pFTPreAuthRsp->messageType;
953 mmhMsg.bodyptr = pFTPreAuthRsp;
954 mmhMsg.bodyval = 0;
955
956#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
957 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME\n");)
958#endif
959 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of %d\n", status);)
960 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
961}
962
963/*------------------------------------------------------------------
964 *
965 * Send the FT Pre Auth Response to SME when ever we have a status
966 * ready to be sent to SME
967 *
968 * SME will be the one to send it up to the supplicant to receive
969 * FTIEs which will be required for Reassoc Req.
970 *
971 *------------------------------------------------------------------*/
972void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
973 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
974 tpPESession psessionEntry)
975{
976
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800977 tpPESession pftSessionEntry;
978 tANI_U8 sessionId;
979 tpSirBssDescription pbssDescription;
980
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 // Save the status of pre-auth
982 pMac->ft.ftPEContext.ftPreAuthStatus = status;
983
984 // Save the auth rsp, so we can send it to
985 // SME once we resume link.
986 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
987 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
988 {
989 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
990 auth_rsp, auth_rsp_length);
991 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
992 }
993
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800994 /* Create FT session for the re-association at this point */
995 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
996 {
997 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
998 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
999 &sessionId, pMac->lim.maxStation)) == NULL)
1000 {
1001 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
1002 return;
1003 }
1004 pftSessionEntry->peSessionId = sessionId;
1005 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1006 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1007 pftSessionEntry->bssType = psessionEntry->bssType;
1008
1009 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1010 {
1011 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1012 }
1013 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1014 {
1015 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1016 }
1017 else
1018 {
1019 limLog(pMac, LOGE, FL("Invalid bss type\n"));
1020 }
1021 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1022 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1023 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
1024 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n",
1025 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1026
1027 /* Update the ReAssoc BSSID of the current session */
1028 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1029 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1030 }
1031
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 if (psessionEntry->currentOperChannel !=
1033 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1034 {
1035 // Need to move to the original AP channel
1036 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1037 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1038 }
1039 else
1040 {
1041#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
1042 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
1043 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1044#endif
1045 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1046 }
1047}
1048
1049/*------------------------------------------------------------------
1050 *
1051 * This function handles the 11R Reassoc Req from SME
1052 *
1053 *------------------------------------------------------------------*/
1054void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1055 tpPESession psessionEntry)
1056{
1057 tANI_U8 smeSessionId = 0;
1058 tANI_U16 transactionId = 0;
1059 tANI_U8 chanNum = 0;
1060 tLimMlmReassocReq *pMlmReassocReq;
1061 tANI_U16 caps;
1062 tANI_U32 val;
1063 tSirMsgQ msgQ;
1064 tSirRetStatus retCode;
1065 tANI_U32 teleBcnEn = 0;
1066
1067 chanNum = psessionEntry->currentOperChannel;
1068 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1069 psessionEntry->smeSessionId = smeSessionId;
1070 psessionEntry->transactionId = transactionId;
1071
1072
1073
1074 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
1075 sizeof(tLimMlmReassocReq)))
1076 {
1077 // Log error
1078 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
1079 return;
1080 }
1081
1082 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1083 psessionEntry->bssId,
1084 sizeof(tSirMacAddr));
1085
1086 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1087 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1088 != eSIR_SUCCESS)
1089 {
1090 /**
1091 * Could not get ReassocFailureTimeout value
1092 * from CFG. Log error.
1093 */
1094 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
1095 return;
1096 }
1097
1098 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1099 {
1100 /**
1101 * Could not get Capabilities value
1102 * from CFG. Log error.
1103 */
1104 limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
1105 return;
1106 }
1107 pMlmReassocReq->capabilityInfo = caps;
1108
1109 /* Update PE sessionId*/
1110 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1111
1112 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
1113 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1114 eSIR_SUCCESS)
1115 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
1116
1117 if(teleBcnEn)
1118 {
1119 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001120 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 /**
1122 * Could not get ListenInterval value
1123 * from CFG. Log error.
1124 */
1125 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1126 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001128 }
1129 else
1130 {
1131 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
1132 {
1133 /**
1134 * Could not get ListenInterval value
1135 * from CFG. Log error.
1136 */
1137 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1138 return;
1139 }
1140 }
1141 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1142 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1143 {
1144 return;
1145 }
1146
1147 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1148 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1149 {
1150 return;
1151 }
1152
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 pMlmReassocReq->listenInterval = (tANI_U16) val;
1154
1155 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1156
1157
1158 //we need to defer the message until we get the response back from HAL.
1159 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1160
1161 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1162 msgQ.reserved = 0;
1163 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1164 msgQ.bodyval = 0;
1165
1166
1167#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1168 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1169#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001170 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001171
1172 retCode = wdaPostCtrlMsg( pMac, &msgQ );
1173 if( eSIR_SUCCESS != retCode)
1174 {
1175 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
1176 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
1177 retCode );
1178 }
1179 // Dont need this anymore
1180 pMac->ft.ftPEContext.pAddBssReq = NULL;
1181 return;
1182}
1183
1184/*------------------------------------------------------------------
1185 *
1186 * This function is called if preauth response is not received from the AP
1187 * within this timeout while FT in progress
1188 *
1189 *------------------------------------------------------------------*/
1190void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1191{
1192 tpPESession psessionEntry;
1193
1194 // We have failed pre auth. We need to resume link and get back on
1195 // home channel.
1196
1197 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1198 {
1199 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
1200 return;
1201 }
1202
1203 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1204 // to get back.
1205 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1206}
1207
1208
1209/*------------------------------------------------------------------
1210 *
1211 * This function is called to process the update key request from SME
1212 *
1213 *------------------------------------------------------------------*/
1214tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1215{
1216 tAddBssParams * pAddBssParams;
1217 tSirFTUpdateKeyInfo * pKeyInfo;
1218 tANI_U32 val = 0;
1219
1220 /* Sanity Check */
1221 if( pMac == NULL || pMsgBuf == NULL )
1222 {
1223 return TRUE;
1224 }
1225
1226 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1227 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
1228
1229 /* Store the key information in the ADD BSS parameters */
1230 pAddBssParams->extSetStaKeyParamValid = 1;
1231 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1232 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1233 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
1234 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1235 {
1236 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
1237 }
1238
1239 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1240
1241 return TRUE;
1242}
1243
1244tSirRetStatus
1245limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1246{
1247 tSirMsgQ msg;
1248 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1249 tpAggrAddTsParams pAggrAddTsParam;
1250 tpPESession psessionEntry = NULL;
1251 tpLimTspecInfo tspecInfo;
1252 tANI_U8 ac;
1253 tpDphHashNode pSta;
1254 tANI_U16 aid;
1255 tANI_U8 sessionId;
1256 int i;
1257
1258 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1259 (void **)&pAggrAddTsParam,
1260 sizeof(tAggrAddTsParams)))
1261 {
1262 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
1263 return eSIR_MEM_ALLOC_FAILED;
1264 }
1265
1266 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1267
1268 if (psessionEntry == NULL) {
1269 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
1270 return eSIR_FAILURE;
1271 }
1272
1273 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1274 if (pSta == NULL)
1275 {
1276 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
1277 return eSIR_FAILURE;
1278 }
1279
1280 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1281 sizeof(tAggrAddTsParams));
1282 pAggrAddTsParam->staIdx = psessionEntry->staId;
1283 // Fill in the sessionId specific to PE
1284 pAggrAddTsParam->sessionId = sessionId;
1285 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1286
1287 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1288 {
1289 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1290 {
1291 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1292 /* Since AddTS response was successful, check for the PSB flag
1293 * and directional flag inside the TS Info field.
1294 * An AC is trigger enabled AC if the PSB subfield is set to 1
1295 * in the uplink direction.
1296 * An AC is delivery enabled AC if the PSB subfield is set to 1
1297 * in the downlink direction.
1298 * An AC is trigger and delivery enabled AC if the PSB subfield
1299 * is set to 1 in the bi-direction field.
1300 */
1301 if (pTspec->tsinfo.traffic.psb == 1)
1302 {
1303 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1304 }
1305 else
1306 {
1307 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1308 }
1309 /* ADDTS success, so AC is now admitted. We shall now use the default
1310 * EDCA parameters as advertised by AP and send the updated EDCA params
1311 * to HAL.
1312 */
1313 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1314 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1315 {
1316 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1317 }
1318 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1319 {
1320 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1321 }
1322 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1323 {
1324 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1325 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1326 }
1327
1328 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1329
1330 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1331 {
1332 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1333 }
1334 else
1335 {
1336 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1337 }
1338
1339 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1340 {
1341 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
1342 pMac->lim.gLimAddtsSent = false;
1343 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1344 }
1345
1346 // Copy the TSPEC paramters
1347 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1348 }
1349 }
1350
1351 msg.type = WDA_AGGR_QOS_REQ;
1352 msg.bodyptr = pAggrAddTsParam;
1353 msg.bodyval = 0;
1354
1355 /* We need to defer any incoming messages until we get a
1356 * WDA_AGGR_QOS_RSP from HAL.
1357 */
1358 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001359 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
1361 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1362 {
1363 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
1364 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1365 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1366 return eSIR_FAILURE;
1367 }
1368
1369 return eSIR_SUCCESS;
1370}
1371
1372void
1373limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1374 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1375{
1376 tpSirAggrQosRsp rsp;
1377 int i = 0;
1378
1379 if (! rspReqd)
1380 {
1381 return;
1382 }
1383
1384 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1385 sizeof(tSirAggrQosRsp)))
1386 {
1387 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1388 return;
1389 }
1390
1391 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1392 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1393 rsp->sessionId = smesessionId;
1394 rsp->length = sizeof(*rsp);
1395 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1396
1397 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1398 {
1399 if( (1 << i) & aggrQosRsp->tspecIdx )
1400 {
1401 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1402 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1403 }
1404 }
1405
1406 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1407 return;
1408}
1409
1410
1411void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1412{
1413 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1414 //tpAggrQosParams pAggrQosRspMsg = NULL;
1415 tAddTsParams addTsParam = {0};
1416 tpDphHashNode pSta = NULL;
1417 tANI_U16 assocId =0;
1418 tSirMacAddr peerMacAddr;
1419 tANI_U8 rspReqd = 1;
1420 tpPESession psessionEntry = NULL;
1421 int i = 0;
1422
1423 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
1424
1425 /* Need to process all the deferred messages enqueued since sending the
1426 SIR_HAL_AGGR_ADD_TS_REQ */
1427 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1428
1429 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1430 if (NULL == pAggrQosRspMsg)
1431 {
1432 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1433 return;
1434 }
1435
1436 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1437 if (NULL == psessionEntry)
1438 {
1439 // Cant find session entry
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001440 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 if( pAggrQosRspMsg != NULL )
1442 {
1443 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1444 }
1445 return;
1446 }
1447
1448 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1449 {
1450 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1451 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1452 {
1453 /* send DELTS to the station */
1454 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1455
1456 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1457 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1458 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1459 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1460
1461 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1462 &addTsParam.tspec.tsinfo,
1463 &addTsParam.tspec, psessionEntry);
1464
1465 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1466 &psessionEntry->dph.dphHashTable);
1467 if (pSta != NULL)
1468 {
1469 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1470 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1471 }
1472 }
1473 }
1474
1475 /* Send the Aggr QoS response to SME */
1476
1477 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1478 psessionEntry->smeSessionId);
1479 if( pAggrQosRspMsg != NULL )
1480 {
1481 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1482 }
1483 return;
1484}
1485
1486
1487/*--------------------------------------------------------------------------
1488 Determines if a session with ccx or 11r assoc is present.
1489 If present it will return TRUE else FALSE
1490 ------------------------------------------------------------------------*/
1491int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1492{
1493 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1494 {
1495 // If ccx or 11r connection is found we need to return TRUE
1496 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1497 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1498#ifdef FEATURE_WLAN_CCX
1499 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1500#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001501#ifdef FEATURE_WLAN_LFR
1502 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1503#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 )&&
1505 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1506 {
1507 // Make sure we have 11r/CCX and FT enabled only then we need
1508 // the values to be altered from cfg for FW RSSI Period alteration.
1509 return TRUE;
1510 }
1511 }
1512
1513 return FALSE;
1514}
1515
1516#endif /* WLAN_FEATURE_VOWIFI_11R */