blob: 0498efb602b5659fa68cefa67098ca937bd8ebe6 [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;
604 tANI_U8 sessionId;
605 tPowerdBm localPowerConstraint;
606 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700607 tSchBeaconStruct *pBeaconStruct;
608
609 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
610 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
611 {
612 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
613 return NULL;
614 }
615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
617 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
618 &sessionId, pMac->lim.maxStation)) == NULL)
619 {
620 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700621 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 return NULL;
623 }
624
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700625#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
627#endif
628
629 /* Store PE session Id in session Table */
630 pftSessionEntry->peSessionId = sessionId;
631
632 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700633 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700634
635 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
636 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
637 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
638 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
639
640 // Fields to be filled later
641 pftSessionEntry->pLimJoinReq = NULL;
642 pftSessionEntry->smeSessionId = 0;
643 pftSessionEntry->transactionId = 0;
644
645 limExtractApCapabilities( pMac,
646 (tANI_U8 *) pbssDescription->ieFields,
647 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700648 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700649
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700650 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700652 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700653
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700654 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700656 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700657
658
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700659 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
660 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700661 pftSessionEntry->ssId.length);
662
663
664 // Self Mac
665 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
666 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700667#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
669#endif
670
671 /* Store beaconInterval */
672 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
673 pftSessionEntry->bssType = psessionEntry->bssType;
674
675 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
676 pftSessionEntry->nwType = pbssDescription->nwType;
677
678 /* Copy The channel Id to the session Table */
679 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
680 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
681
682
683 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
684 {
685 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
686 }
687 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
688 {
689 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
690 }
691 else
692 {
693 /* Throw an error and return and make sure to delete the session.*/
694 limLog(pMac, LOGE, FL("Invalid bss type\n"));
695 }
696
697 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
698 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700699
700 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
701 localPowerConstraint = regMax;
702 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
703 limGetIElenFromBssDescription(pbssDescription),
704 &pftSessionEntry->limCurrentBssQosCaps,
705 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700706 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700707
708 pftSessionEntry->limReassocBssQosCaps =
709 pftSessionEntry->limCurrentBssQosCaps;
710 pftSessionEntry->limReassocBssPropCap =
711 pftSessionEntry->limCurrentBssPropCap;
712
713
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800714#ifdef FEATURE_WLAN_CCX
715 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
716#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800718#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700719
720#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800721 limLog( pMac, LOGE, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
722 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700723#endif
724
725 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
726
727 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
728 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
729
730 pftSessionEntry->encryptType = psessionEntry->encryptType;
731
732#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700733 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700734 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700735#endif
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 *------------------------------------------------------------------*/
903void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
904 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
922 PELOGE(limLog( pMac, LOGE, "%s: Auth Rsp = %p\n", pFTPreAuthRsp);)
923#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
966 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME\n");)
967#endif
968 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of %d\n", status);)
969 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
970}
971
972/*------------------------------------------------------------------
973 *
974 * Send the FT Pre Auth Response to SME when ever we have a status
975 * ready to be sent to SME
976 *
977 * SME will be the one to send it up to the supplicant to receive
978 * FTIEs which will be required for Reassoc Req.
979 *
980 *------------------------------------------------------------------*/
981void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
982 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
983 tpPESession psessionEntry)
984{
985
986 // Save the status of pre-auth
987 pMac->ft.ftPEContext.ftPreAuthStatus = status;
988
989 // Save the auth rsp, so we can send it to
990 // SME once we resume link.
991 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
992 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
993 {
994 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
995 auth_rsp, auth_rsp_length);
996 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
997 }
998
999 if (psessionEntry->currentOperChannel !=
1000 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1001 {
1002 // Need to move to the original AP channel
1003 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1004 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1005 }
1006 else
1007 {
1008#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
1009 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
1010 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1011#endif
1012 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1013 }
1014}
1015
1016/*------------------------------------------------------------------
1017 *
1018 * This function handles the 11R Reassoc Req from SME
1019 *
1020 *------------------------------------------------------------------*/
1021void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1022 tpPESession psessionEntry)
1023{
1024 tANI_U8 smeSessionId = 0;
1025 tANI_U16 transactionId = 0;
1026 tANI_U8 chanNum = 0;
1027 tLimMlmReassocReq *pMlmReassocReq;
1028 tANI_U16 caps;
1029 tANI_U32 val;
1030 tSirMsgQ msgQ;
1031 tSirRetStatus retCode;
1032 tANI_U32 teleBcnEn = 0;
1033
1034 chanNum = psessionEntry->currentOperChannel;
1035 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1036 psessionEntry->smeSessionId = smeSessionId;
1037 psessionEntry->transactionId = transactionId;
1038
1039
1040
1041 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
1042 sizeof(tLimMlmReassocReq)))
1043 {
1044 // Log error
1045 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
1046 return;
1047 }
1048
1049 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1050 psessionEntry->bssId,
1051 sizeof(tSirMacAddr));
1052
1053 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1054 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1055 != eSIR_SUCCESS)
1056 {
1057 /**
1058 * Could not get ReassocFailureTimeout value
1059 * from CFG. Log error.
1060 */
1061 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
1062 return;
1063 }
1064
1065 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1066 {
1067 /**
1068 * Could not get Capabilities value
1069 * from CFG. Log error.
1070 */
1071 limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
1072 return;
1073 }
1074 pMlmReassocReq->capabilityInfo = caps;
1075
1076 /* Update PE sessionId*/
1077 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1078
1079 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
1080 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1081 eSIR_SUCCESS)
1082 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
1083
1084 if(teleBcnEn)
1085 {
1086 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
1087 /**
1088 * Could not get ListenInterval value
1089 * from CFG. Log error.
1090 */
1091 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1092 return;
1093 }
1094 else
1095 {
1096 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
1097 {
1098 /**
1099 * Could not get ListenInterval value
1100 * from CFG. Log error.
1101 */
1102 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1103 return;
1104 }
1105 }
1106 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1107 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1108 {
1109 return;
1110 }
1111
1112 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1113 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1114 {
1115 return;
1116 }
1117
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 pMlmReassocReq->listenInterval = (tANI_U16) val;
1119
1120 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1121
1122
1123 //we need to defer the message until we get the response back from HAL.
1124 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1125
1126 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1127 msgQ.reserved = 0;
1128 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1129 msgQ.bodyval = 0;
1130
1131
1132#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1133 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1134#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001135 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001136
1137 retCode = wdaPostCtrlMsg( pMac, &msgQ );
1138 if( eSIR_SUCCESS != retCode)
1139 {
1140 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
1141 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
1142 retCode );
1143 }
1144 // Dont need this anymore
1145 pMac->ft.ftPEContext.pAddBssReq = NULL;
1146 return;
1147}
1148
1149/*------------------------------------------------------------------
1150 *
1151 * This function is called if preauth response is not received from the AP
1152 * within this timeout while FT in progress
1153 *
1154 *------------------------------------------------------------------*/
1155void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1156{
1157 tpPESession psessionEntry;
1158
1159 // We have failed pre auth. We need to resume link and get back on
1160 // home channel.
1161
1162 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1163 {
1164 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
1165 return;
1166 }
1167
1168 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1169 // to get back.
1170 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1171}
1172
1173
1174/*------------------------------------------------------------------
1175 *
1176 * This function is called to process the update key request from SME
1177 *
1178 *------------------------------------------------------------------*/
1179tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1180{
1181 tAddBssParams * pAddBssParams;
1182 tSirFTUpdateKeyInfo * pKeyInfo;
1183 tANI_U32 val = 0;
1184
1185 /* Sanity Check */
1186 if( pMac == NULL || pMsgBuf == NULL )
1187 {
1188 return TRUE;
1189 }
1190
1191 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1192 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
1193
1194 /* Store the key information in the ADD BSS parameters */
1195 pAddBssParams->extSetStaKeyParamValid = 1;
1196 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1197 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1198 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
1199 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1200 {
1201 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
1202 }
1203
1204 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1205
1206 return TRUE;
1207}
1208
1209tSirRetStatus
1210limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1211{
1212 tSirMsgQ msg;
1213 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1214 tpAggrAddTsParams pAggrAddTsParam;
1215 tpPESession psessionEntry = NULL;
1216 tpLimTspecInfo tspecInfo;
1217 tANI_U8 ac;
1218 tpDphHashNode pSta;
1219 tANI_U16 aid;
1220 tANI_U8 sessionId;
1221 int i;
1222
1223 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1224 (void **)&pAggrAddTsParam,
1225 sizeof(tAggrAddTsParams)))
1226 {
1227 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
1228 return eSIR_MEM_ALLOC_FAILED;
1229 }
1230
1231 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1232
1233 if (psessionEntry == NULL) {
1234 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
1235 return eSIR_FAILURE;
1236 }
1237
1238 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1239 if (pSta == NULL)
1240 {
1241 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
1242 return eSIR_FAILURE;
1243 }
1244
1245 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1246 sizeof(tAggrAddTsParams));
1247 pAggrAddTsParam->staIdx = psessionEntry->staId;
1248 // Fill in the sessionId specific to PE
1249 pAggrAddTsParam->sessionId = sessionId;
1250 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1251
1252 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1253 {
1254 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1255 {
1256 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1257 /* Since AddTS response was successful, check for the PSB flag
1258 * and directional flag inside the TS Info field.
1259 * An AC is trigger enabled AC if the PSB subfield is set to 1
1260 * in the uplink direction.
1261 * An AC is delivery enabled AC if the PSB subfield is set to 1
1262 * in the downlink direction.
1263 * An AC is trigger and delivery enabled AC if the PSB subfield
1264 * is set to 1 in the bi-direction field.
1265 */
1266 if (pTspec->tsinfo.traffic.psb == 1)
1267 {
1268 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1269 }
1270 else
1271 {
1272 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1273 }
1274 /* ADDTS success, so AC is now admitted. We shall now use the default
1275 * EDCA parameters as advertised by AP and send the updated EDCA params
1276 * to HAL.
1277 */
1278 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1279 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1280 {
1281 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1282 }
1283 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1284 {
1285 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1286 }
1287 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1288 {
1289 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1290 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1291 }
1292
1293 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1294
1295 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1296 {
1297 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1298 }
1299 else
1300 {
1301 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1302 }
1303
1304 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1305 {
1306 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
1307 pMac->lim.gLimAddtsSent = false;
1308 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1309 }
1310
1311 // Copy the TSPEC paramters
1312 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1313 }
1314 }
1315
1316 msg.type = WDA_AGGR_QOS_REQ;
1317 msg.bodyptr = pAggrAddTsParam;
1318 msg.bodyval = 0;
1319
1320 /* We need to defer any incoming messages until we get a
1321 * WDA_AGGR_QOS_RSP from HAL.
1322 */
1323 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001324 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
1326 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1327 {
1328 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
1329 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1330 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1331 return eSIR_FAILURE;
1332 }
1333
1334 return eSIR_SUCCESS;
1335}
1336
1337void
1338limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1339 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1340{
1341 tpSirAggrQosRsp rsp;
1342 int i = 0;
1343
1344 if (! rspReqd)
1345 {
1346 return;
1347 }
1348
1349 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1350 sizeof(tSirAggrQosRsp)))
1351 {
1352 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1353 return;
1354 }
1355
1356 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1357 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1358 rsp->sessionId = smesessionId;
1359 rsp->length = sizeof(*rsp);
1360 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1361
1362 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1363 {
1364 if( (1 << i) & aggrQosRsp->tspecIdx )
1365 {
1366 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1367 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1368 }
1369 }
1370
1371 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1372 return;
1373}
1374
1375
1376void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1377{
1378 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1379 //tpAggrQosParams pAggrQosRspMsg = NULL;
1380 tAddTsParams addTsParam = {0};
1381 tpDphHashNode pSta = NULL;
1382 tANI_U16 assocId =0;
1383 tSirMacAddr peerMacAddr;
1384 tANI_U8 rspReqd = 1;
1385 tpPESession psessionEntry = NULL;
1386 int i = 0;
1387
1388 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
1389
1390 /* Need to process all the deferred messages enqueued since sending the
1391 SIR_HAL_AGGR_ADD_TS_REQ */
1392 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1393
1394 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1395 if (NULL == pAggrQosRspMsg)
1396 {
1397 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1398 return;
1399 }
1400
1401 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1402 if (NULL == psessionEntry)
1403 {
1404 // Cant find session entry
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001405 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 if( pAggrQosRspMsg != NULL )
1407 {
1408 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1409 }
1410 return;
1411 }
1412
1413 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1414 {
1415 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1416 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1417 {
1418 /* send DELTS to the station */
1419 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1420
1421 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1422 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1423 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1424 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1425
1426 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1427 &addTsParam.tspec.tsinfo,
1428 &addTsParam.tspec, psessionEntry);
1429
1430 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1431 &psessionEntry->dph.dphHashTable);
1432 if (pSta != NULL)
1433 {
1434 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1435 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1436 }
1437 }
1438 }
1439
1440 /* Send the Aggr QoS response to SME */
1441
1442 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1443 psessionEntry->smeSessionId);
1444 if( pAggrQosRspMsg != NULL )
1445 {
1446 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1447 }
1448 return;
1449}
1450
1451
1452/*--------------------------------------------------------------------------
1453 Determines if a session with ccx or 11r assoc is present.
1454 If present it will return TRUE else FALSE
1455 ------------------------------------------------------------------------*/
1456int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1457{
1458 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1459 {
1460 // If ccx or 11r connection is found we need to return TRUE
1461 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1462 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1463#ifdef FEATURE_WLAN_CCX
1464 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1465#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001466#ifdef FEATURE_WLAN_LFR
1467 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1468#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001469 )&&
1470 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1471 {
1472 // Make sure we have 11r/CCX and FT enabled only then we need
1473 // the values to be altered from cfg for FW RSSI Period alteration.
1474 return TRUE;
1475 }
1476 }
1477
1478 return FALSE;
1479}
1480
1481#endif /* WLAN_FEATURE_VOWIFI_11R */