blob: b5f9cc28a2c477242462abd849e2f56fa26e0c68 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22#ifdef WLAN_FEATURE_VOWIFI_11R
23/**=========================================================================
24
25 \brief implementation for PE 11r VoWiFi FT Protocol
26
27 Copyright 2008 (c) Qualcomm, Incorporated. All Rights Reserved.
28
29 Qualcomm Confidential and Proprietary.
30
31 ========================================================================*/
32
33/* $Header$ */
34
35
36/*--------------------------------------------------------------------------
37 Include Files
38 ------------------------------------------------------------------------*/
39#include <limSendMessages.h>
40#include <limTypes.h>
41#include <limFT.h>
42#include <limFTDefs.h>
43#include <limUtils.h>
44#include <limPropExtsUtils.h>
45#include <limAssocUtils.h>
46#include <limSession.h>
47#include <limAdmitControl.h>
48#include "wmmApsd.h"
49
50#define LIM_FT_RIC_BA_SSN 1
51#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
52#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
53
54/*--------------------------------------------------------------------------
55 Initialize the FT variables.
56 ------------------------------------------------------------------------*/
57void limFTOpen(tpAniSirGlobal pMac)
58{
59 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
60 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
61}
62
63/*--------------------------------------------------------------------------
64 Cleanup FT variables.
65 ------------------------------------------------------------------------*/
66void limFTCleanup(tpAniSirGlobal pMac)
67{
68 if (pMac->ft.ftPEContext.pFTPreAuthReq)
69 {
70#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
71 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070072 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070073#endif
74 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
75 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
76 }
77
78 // This is the old session, should be deleted else where.
79 // We should not be cleaning it here, just set it to NULL.
80 if (pMac->ft.ftPEContext.psavedsessionEntry)
81 {
82#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
83 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070084 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070085#endif
86 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
87 }
88
89 // This is the extra session we added as part of Auth resp
90 // clean it up.
91 if (pMac->ft.ftPEContext.pftSessionEntry)
92 {
93 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
94 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
95 {
96 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d\n", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
97 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
98 }
99 pMac->ft.ftPEContext.pftSessionEntry = NULL;
100#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
101 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700102 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700103#endif
104 }
105
106 if (pMac->ft.ftPEContext.pAddBssReq)
107 {
108 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
109 pMac->ft.ftPEContext.pAddBssReq = NULL;
110 }
111
112 if (pMac->ft.ftPEContext.pAddStaReq)
113 {
114 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
115 pMac->ft.ftPEContext.pAddStaReq = NULL;
116 }
117
118 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
119
120}
121
122/*--------------------------------------------------------------------------
123 Init FT variables.
124 ------------------------------------------------------------------------*/
125void limFTInit(tpAniSirGlobal pMac)
126{
127 if (pMac->ft.ftPEContext.pFTPreAuthReq)
128 {
129#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
130 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700131 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700132#endif
133 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
134 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
135 }
136
137 // This is the old session, should be deleted else where.
138 // We should not be cleaning it here, just set it to NULL.
139 if (pMac->ft.ftPEContext.psavedsessionEntry)
140 {
141#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
142 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700143 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700144#endif
145 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
146 }
147
148 // This is the extra session we added as part of Auth resp
149 // clean it up.
150 if (pMac->ft.ftPEContext.pftSessionEntry)
151 {
152 /* Cannot delete sessions across associations */
153#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
154 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700155 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700156#endif
157 pMac->ft.ftPEContext.pftSessionEntry = NULL;
158 }
159
160 if (pMac->ft.ftPEContext.pAddBssReq)
161 {
162#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
163 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700164 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700165#endif
166 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
167 pMac->ft.ftPEContext.pAddBssReq = NULL;
168 }
169
170
171 if (pMac->ft.ftPEContext.pAddStaReq)
172 {
173#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
174 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p \n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176#endif
177 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
178 pMac->ft.ftPEContext.pAddStaReq = NULL;
179 }
180
181 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
182
183}
184
185/*------------------------------------------------------------------
186 *
187 * This is the handler after suspending the link.
188 * We suspend the link and then now proceed to switch channel.
189 *
190 *------------------------------------------------------------------*/
191void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
192{
193 tpPESession psessionEntry;
194
195 // The link is suspended of not ?
196 if (status != eHAL_STATUS_SUCCESS)
197 {
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700198 PELOGE(limLog( pMac, LOGE, "%s: Returning \n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700199 // Post the FT Pre Auth Response to SME
200 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
201
202 return;
203 }
204
205 psessionEntry = (tpPESession)data;
206 // Suspended, now move to a different channel.
207 // Perform some sanity check before proceeding.
208 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
209 {
210 limChangeChannelWithCallback(pMac,
211 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
212 limPerformFTPreAuth, NULL, psessionEntry);
213 return;
214 }
215
216 // Else return error.
217 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
218}
219
220
221/*--------------------------------------------------------------------------
222 In this function, we process the FT Pre Auth Req.
223 We receive Pre-Auth
224 Suspend link
225 Register a call back
226 In the call back, we will need to accept frames from the new bssid
227 Send out the auth req to new AP.
228 Start timer and when the timer is done or if we receive the Auth response
229 We change channel
230 Resume link
231 ------------------------------------------------------------------------*/
232int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
233{
234 int bufConsumed = FALSE;
235 tpPESession psessionEntry;
236 tANI_U8 sessionId;
237
238 // Now we are starting fresh make sure all's cleanup.
239 limFTInit(pMac);
240 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
241
242 // We need information from the Pre-Auth Req. Lets save that
243 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
244
245#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700246 PELOGE(limLog( pMac, LOGE, "%s: PE Auth ft_ies_length=%02x%02x%02x\n", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
248 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
249 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
250#endif
251
252 // Get the current session entry
253 psessionEntry = peFindSessionByBssid(pMac,
254 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
255 if (psessionEntry == NULL)
256 {
257 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700258 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
260 // Post the FT Pre Auth Response to SME
261 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
262 return TRUE;
263 }
264
265 // Dont need to suspend if APs are in same channel
266 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
267 {
268 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700269 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700270 " channel (session %p)\n", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700271 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 (tANI_U32 *)psessionEntry);
273 }
274 else
275 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700276 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700277 " channel (session %p)\n", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 // We are in the same channel. Perform pre-auth
279 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
280 }
281
282 return bufConsumed;
283}
284
285/*------------------------------------------------------------------
286 * Send the Auth1
287 * Receive back Auth2
288 *------------------------------------------------------------------*/
289void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
290 tpPESession psessionEntry)
291{
292 tSirMacAuthFrameBody authFrame;
293
294 if (psessionEntry->is11Rconnection)
295 {
296 // Only 11r assoc has FT IEs.
297 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
298 {
299 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent\n");)
300 return;
301 }
302 }
303 if (status != eHAL_STATUS_SUCCESS)
304 {
305 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth\n");)
306 return;
307 }
308 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
309
310#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700311 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
312 " (old session %p)\n",
313 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700314#endif
315
316
317 if (psessionEntry->is11Rconnection)
318 {
319 // Now we are on the right channel and need to send out Auth1 and
320 // receive Auth2.
321 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
322 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700323#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 else
325 {
326 // Will need to make isCCXconnection a enum may be for further
327 // improvements to this to match this algorithm number
328 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
329 }
330#endif
331 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
332 authFrame.authStatusCode = 0;
333
334 // Start timer here to come back to operating channel.
335 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
336 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
337 {
338#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700339 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700340#endif
341 }
342
343#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700344 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Started\n", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700345#endif
346
347 limSendAuthMgmtFrame(pMac, &authFrame,
348 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
349 LIM_NO_WEP_IN_FC, psessionEntry);
350
351 return;
352}
353
354
355/*------------------------------------------------------------------
356 *
357 * Create the new Add Bss Req to the new AP.
358 * This will be used when we are ready to FT to the new AP.
359 * The newly created ft Session entry is passed to this function
360 *
361 *------------------------------------------------------------------*/
362tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
363 tANI_U8 updateEntry, tpPESession pftSessionEntry,
364 tpSirBssDescription bssDescription )
365{
366 tpAddBssParams pAddBssParams = NULL;
367 tANI_U8 i;
368 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700369 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700370
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700371 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
372 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
373 {
374 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS\n") );
375 return eSIR_MEM_ALLOC_FAILED;
376 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
378 // Package SIR_HAL_ADD_BSS_REQ message parameters
379 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
380 (void **) &pAddBssParams, sizeof( tAddBssParams )))
381 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700382 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 limLog( pMac, LOGP,
384 FL( "Unable to PAL allocate memory for creating ADD_BSS\n" ));
385 return (eSIR_MEM_ALLOC_FAILED);
386 }
387
388 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
389
390
391 limExtractApCapabilities( pMac,
392 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700393 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700394
395 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700396 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700397
398 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
399 sizeof( tSirMacAddr ));
400
401 // Fill in tAddBssParams selfMacAddr
402 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
403 sizeof( tSirMacAddr ));
404
405 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
406 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
407
408 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
409
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700410 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 pAddBssParams->updateBss = updateEntry;
412
413
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700414 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
415 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
416 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
417 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700418
419
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700420 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700422 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
424 pAddBssParams->nwType = bssDescription->nwType;
425
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700426 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
428 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
429 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
430 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
431
432 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700433 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700435 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700437 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700439 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
440 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
442#ifdef WLAN_SOFTAP_FEATURE
443 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
444#else
445 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET);
446#endif
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700447 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 (chanWidthSupp) )
449 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700450 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
451 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 }
453 else
454 {
455 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700456 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700458 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
459 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
460 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 }
462 }
463
464 pAddBssParams->currentOperChannel = bssDescription->channelId;
465
466#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
467 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
468 pAddBssParams->currentOperChannel);
469#endif
470
471
472 // Populate the STA-related parameters here
473 // Note that the STA here refers to the AP
474 {
475 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
476
477 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
478 bssDescription->bssId,
479 sizeof( tSirMacAddr ));
480 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
481
482 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
483 pAddBssParams->staContext.uAPSD = 0;
484 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700485 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 pAddBssParams->staContext.updateSta = updateEntry;
487 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
488
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 {
491 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
492 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700493 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
494 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
495 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 (chanWidthSupp) )
497 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700498 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 }
500 else
501 {
502 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
503 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700504 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
505 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
506 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
507 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
508 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
509 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
510 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
511 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700512
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700513 if( pBeaconStruct->HTInfo.present )
514 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 }
516
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700517 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
518 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700519 pAddBssParams->staContext.wmmEnabled = 1;
520 else
521 pAddBssParams->staContext.wmmEnabled = 0;
522
523 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700524#ifdef WLAN_FEATURE_11AC
525 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700526 pBeaconStruct->HTCaps.supportedMCSSet,
527 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700528#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
530 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700531#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
533
534 }
535
536
537 //Disable BA. It will be set as part of ADDBA negotiation.
538 for( i = 0; i < STACFG_MAX_TC; i++ )
539 {
540 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
541 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
542 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
543 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
544 }
545
546#if defined WLAN_FEATURE_VOWIFI
547 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
548#endif
549
550 pAddBssParams->status = eHAL_STATUS_SUCCESS;
551 pAddBssParams->respReqd = true;
552
553 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
554 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
555
556 // Set a new state for MLME
557
558 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
559
560 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
561
562 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
563
564#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
565 limLog( pMac, LOGE, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
566#endif
567
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700568 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 return 0;
570}
571
572/*------------------------------------------------------------------
573 *
574 * Setup the new session for the pre-auth AP.
575 * Return the newly created session entry.
576 *
577 *------------------------------------------------------------------*/
578tpPESession limFillFTSession(tpAniSirGlobal pMac,
579 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
580{
581 tpPESession pftSessionEntry;
582 tANI_U8 currentBssUapsd;
583 tANI_U8 sessionId;
584 tPowerdBm localPowerConstraint;
585 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700586 tSchBeaconStruct *pBeaconStruct;
587
588 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
589 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
590 {
591 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession\n") );
592 return NULL;
593 }
594
Jeff Johnson295189b2012-06-20 16:38:30 -0700595
596 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
597 &sessionId, pMac->lim.maxStation)) == NULL)
598 {
599 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP\n"));
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700600 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 return NULL;
602 }
603
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700604#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
606#endif
607
608 /* Store PE session Id in session Table */
609 pftSessionEntry->peSessionId = sessionId;
610
611 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700612 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700613
614 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
615 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
616 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
617 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
618
619 // Fields to be filled later
620 pftSessionEntry->pLimJoinReq = NULL;
621 pftSessionEntry->smeSessionId = 0;
622 pftSessionEntry->transactionId = 0;
623
624 limExtractApCapabilities( pMac,
625 (tANI_U8 *) pbssDescription->ieFields,
626 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700627 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700628
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700629 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700631 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700632
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700633 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700635 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700636
637
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700638 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
639 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 pftSessionEntry->ssId.length);
641
642
643 // Self Mac
644 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
645 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700646#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
648#endif
649
650 /* Store beaconInterval */
651 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
652 pftSessionEntry->bssType = psessionEntry->bssType;
653
654 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
655 pftSessionEntry->nwType = pbssDescription->nwType;
656
657 /* Copy The channel Id to the session Table */
658 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
659 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
660
661
662 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
663 {
664 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
665 }
666 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
667 {
668 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
669 }
670 else
671 {
672 /* Throw an error and return and make sure to delete the session.*/
673 limLog(pMac, LOGE, FL("Invalid bss type\n"));
674 }
675
676 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
677 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -0700678
679 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
680 localPowerConstraint = regMax;
681 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
682 limGetIElenFromBssDescription(pbssDescription),
683 &pftSessionEntry->limCurrentBssQosCaps,
684 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700685 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700686
687 pftSessionEntry->limReassocBssQosCaps =
688 pftSessionEntry->limCurrentBssQosCaps;
689 pftSessionEntry->limReassocBssPropCap =
690 pftSessionEntry->limCurrentBssPropCap;
691
692
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800693#ifdef FEATURE_WLAN_CCX
694 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
695#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800697#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700698
699#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800700 limLog( pMac, LOGE, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
701 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700702#endif
703
704 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
705
706 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
707 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
708
709 pftSessionEntry->encryptType = psessionEntry->encryptType;
710
711#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700712 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d\n",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700713 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700714#endif
715
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700716 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 return pftSessionEntry;
718}
719
720/*------------------------------------------------------------------
721 *
722 * Setup the session and the add bss req for the pre-auth AP.
723 *
724 *------------------------------------------------------------------*/
725void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
726{
727 tpPESession pftSessionEntry;
728
729 // Prepare the session right now with as much as possible.
730 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
731
732 if (pftSessionEntry)
733 {
734 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
735#ifdef FEATURE_WLAN_CCX
736 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
737#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700738#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
740#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700741
742#ifdef FEATURE_WLAN_LFR
743 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
744#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
746 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
747 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
748 }
749}
750
751/*------------------------------------------------------------------
752 * Resume Link Call Back
753 *------------------------------------------------------------------*/
754void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
755{
756 tpPESession psessionEntry;
757
758 psessionEntry = (tpPESession)data;
759
760 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
761 {
762 limFTSetupAuthSession(pMac, psessionEntry);
763 }
764
765 // Post the FT Pre Auth Response to SME
766 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
767 pMac->ft.ftPEContext.saved_auth_rsp,
768 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
769
770}
771
772/*------------------------------------------------------------------
773 * Resume Link Call Back
774 *------------------------------------------------------------------*/
775void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
776 tpPESession psessionEntry)
777{
778 //Set the resume channel to Any valid channel (invalid).
779 //This will instruct HAL to set it to any previous valid channel.
780 peSetResumeChannel(pMac, 0, 0);
781 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
782}
783
784tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
785 tANI_U8 *ric_ies, tANI_U32 *ieLength)
786{
787 tDot11fIERICDataDesc ricIe;
788 tDot11fFfBAStartingSequenceControl baSsnControl;
789 tDot11fFfAddBAParameterSet baParamSet;
790 tDot11fFfBATimeout baTimeout;
791
792 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
793 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
794 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
795 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
796
797 ricIe.present = 1;
798 ricIe.RICData.present = 1;
799 ricIe.RICData.resourceDescCount = 1;
800 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
801 ricIe.RICDescriptor.present = 1;
802 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
803 baParamSet.tid = tid;
804 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
805 baParamSet.bufferSize = pTrafficClass->txBufSize;
806 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
807 baSsnControl.fragNumber = 0;
808 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
809
810 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
811 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
812 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
813
814 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
815 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
816 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
817
818 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
819 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
820 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
821
822 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
823}
824
825tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
826{
827 tANI_U8 tid = 0;
828 tpDphHashNode pSta;
829 tANI_U16 numBA = 0, aid = 0;
830 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
831 tANI_U32 offset = 0, ieLength = 0;
832 tSirRetStatus status = eSIR_SUCCESS;
833
834 // First, extract the DPH entry
835 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
836 if( NULL == pSta )
837 {
838 PELOGE(limLog( pMac, LOGE,
839 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x\n" ),
840 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
841 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
842 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
843 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
844 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
845 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
846 return eSIR_FAILURE;
847 }
848
849 for (tid = 0; tid < STACFG_MAX_TC; tid++)
850 {
851 if (pSta->tcCfg[tid].fUseBATx)
852 {
853 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
854 if (eSIR_SUCCESS == status)
855 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700856 // TODO RIC
857 if ( ieLength > MAX_FTIE_SIZE )
858 {
859 ieLength = 0;
860 return status;
861 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 offset += ieLength;
863 *ric_ies_length += ieLength;
864 numBA++;
865 }
866 else
867 {
868 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
869 }
870 }
871 }
872
873 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d\n"), numBA, *ric_ies_length);)
874 return status;
875}
876
877/*------------------------------------------------------------------
878 *
879 * Will post pre auth response to SME.
880 *
881 *------------------------------------------------------------------*/
882void limPostFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
883 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
884 tpPESession psessionEntry)
885{
886 tpSirFTPreAuthRsp pFTPreAuthRsp;
887 tSirMsgQ mmhMsg;
888 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700889 // TODO: RIC Support
890 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700891
892 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
893 if(NULL == pFTPreAuthRsp)
894 {
895 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory\n");)
896 VOS_ASSERT(pFTPreAuthRsp != NULL);
897 return;
898 }
899 vos_mem_zero( pFTPreAuthRsp, rspLen);
900#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
901 PELOGE(limLog( pMac, LOGE, "%s: Auth Rsp = %p\n", pFTPreAuthRsp);)
902#endif
903
904 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
905 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
906 pFTPreAuthRsp->length = (tANI_U16) rspLen;
907 pFTPreAuthRsp->status = status;
908 if (psessionEntry)
909 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
910
911 // The bssid of the AP we are sending Auth1 to.
912 if (pMac->ft.ftPEContext.pFTPreAuthReq)
913 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
914 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
915
916 // Attach the auth response now back to SME
917 pFTPreAuthRsp->ft_ies_length = 0;
918 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
919 {
920 // Only 11r assoc has FT IEs.
921 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
922 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
923 }
924
925#ifdef WLAN_FEATURE_VOWIFI_11R
926 if ((psessionEntry) && (psessionEntry->is11Rconnection))
927 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700928 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
929 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
931 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
932 if (eSIR_SUCCESS != sirStatus)
933 {
934 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
935 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700936 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 }
938#endif
939
940 mmhMsg.type = pFTPreAuthRsp->messageType;
941 mmhMsg.bodyptr = pFTPreAuthRsp;
942 mmhMsg.bodyval = 0;
943
944#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
945 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME\n");)
946#endif
947 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of %d\n", status);)
948 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
949}
950
951/*------------------------------------------------------------------
952 *
953 * Send the FT Pre Auth Response to SME when ever we have a status
954 * ready to be sent to SME
955 *
956 * SME will be the one to send it up to the supplicant to receive
957 * FTIEs which will be required for Reassoc Req.
958 *
959 *------------------------------------------------------------------*/
960void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, eHalStatus status,
961 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
962 tpPESession psessionEntry)
963{
964
965 // Save the status of pre-auth
966 pMac->ft.ftPEContext.ftPreAuthStatus = status;
967
968 // Save the auth rsp, so we can send it to
969 // SME once we resume link.
970 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
971 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
972 {
973 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
974 auth_rsp, auth_rsp_length);
975 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
976 }
977
978 if (psessionEntry->currentOperChannel !=
979 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
980 {
981 // Need to move to the original AP channel
982 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
983 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
984 }
985 else
986 {
987#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
988 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d\n",
989 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
990#endif
991 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
992 }
993}
994
995/*------------------------------------------------------------------
996 *
997 * This function handles the 11R Reassoc Req from SME
998 *
999 *------------------------------------------------------------------*/
1000void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1001 tpPESession psessionEntry)
1002{
1003 tANI_U8 smeSessionId = 0;
1004 tANI_U16 transactionId = 0;
1005 tANI_U8 chanNum = 0;
1006 tLimMlmReassocReq *pMlmReassocReq;
1007 tANI_U16 caps;
1008 tANI_U32 val;
1009 tSirMsgQ msgQ;
1010 tSirRetStatus retCode;
1011 tANI_U32 teleBcnEn = 0;
1012
1013 chanNum = psessionEntry->currentOperChannel;
1014 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1015 psessionEntry->smeSessionId = smeSessionId;
1016 psessionEntry->transactionId = transactionId;
1017
1018
1019
1020 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
1021 sizeof(tLimMlmReassocReq)))
1022 {
1023 // Log error
1024 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq\n"));
1025 return;
1026 }
1027
1028 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1029 psessionEntry->bssId,
1030 sizeof(tSirMacAddr));
1031
1032 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1033 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1034 != eSIR_SUCCESS)
1035 {
1036 /**
1037 * Could not get ReassocFailureTimeout value
1038 * from CFG. Log error.
1039 */
1040 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value\n"));
1041 return;
1042 }
1043
1044 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1045 {
1046 /**
1047 * Could not get Capabilities value
1048 * from CFG. Log error.
1049 */
1050 limLog(pMac, LOGE, FL("could not retrieve Capabilities value\n"));
1051 return;
1052 }
1053 pMlmReassocReq->capabilityInfo = caps;
1054
1055 /* Update PE sessionId*/
1056 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1057
1058 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
1059 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1060 eSIR_SUCCESS)
1061 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
1062
1063 if(teleBcnEn)
1064 {
1065 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
1066 /**
1067 * Could not get ListenInterval value
1068 * from CFG. Log error.
1069 */
1070 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1071 return;
1072 }
1073 else
1074 {
1075 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
1076 {
1077 /**
1078 * Could not get ListenInterval value
1079 * from CFG. Log error.
1080 */
1081 limLog(pMac, LOGE, FL("could not retrieve ListenInterval\n"));
1082 return;
1083 }
1084 }
1085 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1086 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1087 {
1088 return;
1089 }
1090
1091 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1092 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1093 {
1094 return;
1095 }
1096
1097 if (limSetLinkState(pMac, eSIR_LINK_POSTASSOC_STATE, psessionEntry->bssId,
1098 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1099 {
1100 return;
1101 }
1102
1103 pMlmReassocReq->listenInterval = (tANI_U16) val;
1104
1105 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1106
1107
1108 //we need to defer the message until we get the response back from HAL.
1109 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
1110
1111 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1112 msgQ.reserved = 0;
1113 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1114 msgQ.bodyval = 0;
1115
1116
1117#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1118 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1119#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001120 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001121
1122 retCode = wdaPostCtrlMsg( pMac, &msgQ );
1123 if( eSIR_SUCCESS != retCode)
1124 {
1125 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
1126 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X\n"),
1127 retCode );
1128 }
1129 // Dont need this anymore
1130 pMac->ft.ftPEContext.pAddBssReq = NULL;
1131 return;
1132}
1133
1134/*------------------------------------------------------------------
1135 *
1136 * This function is called if preauth response is not received from the AP
1137 * within this timeout while FT in progress
1138 *
1139 *------------------------------------------------------------------*/
1140void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1141{
1142 tpPESession psessionEntry;
1143
1144 // We have failed pre auth. We need to resume link and get back on
1145 // home channel.
1146
1147 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1148 {
1149 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID\n"));
1150 return;
1151 }
1152
1153 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1154 // to get back.
1155 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1156}
1157
1158
1159/*------------------------------------------------------------------
1160 *
1161 * This function is called to process the update key request from SME
1162 *
1163 *------------------------------------------------------------------*/
1164tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1165{
1166 tAddBssParams * pAddBssParams;
1167 tSirFTUpdateKeyInfo * pKeyInfo;
1168 tANI_U32 val = 0;
1169
1170 /* Sanity Check */
1171 if( pMac == NULL || pMsgBuf == NULL )
1172 {
1173 return TRUE;
1174 }
1175
1176 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1177 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
1178
1179 /* Store the key information in the ADD BSS parameters */
1180 pAddBssParams->extSetStaKeyParamValid = 1;
1181 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1182 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1183 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
1184 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1185 {
1186 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC\n" ));
1187 }
1188
1189 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1190
1191 return TRUE;
1192}
1193
1194tSirRetStatus
1195limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1196{
1197 tSirMsgQ msg;
1198 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1199 tpAggrAddTsParams pAggrAddTsParam;
1200 tpPESession psessionEntry = NULL;
1201 tpLimTspecInfo tspecInfo;
1202 tANI_U8 ac;
1203 tpDphHashNode pSta;
1204 tANI_U16 aid;
1205 tANI_U8 sessionId;
1206 int i;
1207
1208 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1209 (void **)&pAggrAddTsParam,
1210 sizeof(tAggrAddTsParams)))
1211 {
1212 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed\n"));)
1213 return eSIR_MEM_ALLOC_FAILED;
1214 }
1215
1216 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1217
1218 if (psessionEntry == NULL) {
1219 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d\n"), aggrQosReq->sessionId);)
1220 return eSIR_FAILURE;
1221 }
1222
1223 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1224 if (pSta == NULL)
1225 {
1226 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp\n"));)
1227 return eSIR_FAILURE;
1228 }
1229
1230 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1231 sizeof(tAggrAddTsParams));
1232 pAggrAddTsParam->staIdx = psessionEntry->staId;
1233 // Fill in the sessionId specific to PE
1234 pAggrAddTsParam->sessionId = sessionId;
1235 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1236
1237 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1238 {
1239 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1240 {
1241 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1242 /* Since AddTS response was successful, check for the PSB flag
1243 * and directional flag inside the TS Info field.
1244 * An AC is trigger enabled AC if the PSB subfield is set to 1
1245 * in the uplink direction.
1246 * An AC is delivery enabled AC if the PSB subfield is set to 1
1247 * in the downlink direction.
1248 * An AC is trigger and delivery enabled AC if the PSB subfield
1249 * is set to 1 in the bi-direction field.
1250 */
1251 if (pTspec->tsinfo.traffic.psb == 1)
1252 {
1253 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1254 }
1255 else
1256 {
1257 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1258 }
1259 /* ADDTS success, so AC is now admitted. We shall now use the default
1260 * EDCA parameters as advertised by AP and send the updated EDCA params
1261 * to HAL.
1262 */
1263 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1264 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1265 {
1266 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1267 }
1268 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1269 {
1270 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1271 }
1272 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1273 {
1274 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1275 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1276 }
1277
1278 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1279
1280 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1281 {
1282 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1283 }
1284 else
1285 {
1286 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1287 }
1288
1289 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1290 {
1291 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed \n"));)
1292 pMac->lim.gLimAddtsSent = false;
1293 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1294 }
1295
1296 // Copy the TSPEC paramters
1297 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1298 }
1299 }
1300
1301 msg.type = WDA_AGGR_QOS_REQ;
1302 msg.bodyptr = pAggrAddTsParam;
1303 msg.bodyval = 0;
1304
1305 /* We need to defer any incoming messages until we get a
1306 * WDA_AGGR_QOS_RSP from HAL.
1307 */
1308 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001309 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001310
1311 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1312 {
1313 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
1314 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1315 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1316 return eSIR_FAILURE;
1317 }
1318
1319 return eSIR_SUCCESS;
1320}
1321
1322void
1323limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1324 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1325{
1326 tpSirAggrQosRsp rsp;
1327 int i = 0;
1328
1329 if (! rspReqd)
1330 {
1331 return;
1332 }
1333
1334 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1335 sizeof(tSirAggrQosRsp)))
1336 {
1337 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1338 return;
1339 }
1340
1341 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1342 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1343 rsp->sessionId = smesessionId;
1344 rsp->length = sizeof(*rsp);
1345 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1346
1347 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1348 {
1349 if( (1 << i) & aggrQosRsp->tspecIdx )
1350 {
1351 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1352 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1353 }
1354 }
1355
1356 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1357 return;
1358}
1359
1360
1361void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1362{
1363 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1364 //tpAggrQosParams pAggrQosRspMsg = NULL;
1365 tAddTsParams addTsParam = {0};
1366 tpDphHashNode pSta = NULL;
1367 tANI_U16 assocId =0;
1368 tSirMacAddr peerMacAddr;
1369 tANI_U8 rspReqd = 1;
1370 tpPESession psessionEntry = NULL;
1371 int i = 0;
1372
1373 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL\n"));)
1374
1375 /* Need to process all the deferred messages enqueued since sending the
1376 SIR_HAL_AGGR_ADD_TS_REQ */
1377 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1378
1379 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1380 if (NULL == pAggrQosRspMsg)
1381 {
1382 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1383 return;
1384 }
1385
1386 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1387 if (NULL == psessionEntry)
1388 {
1389 // Cant find session entry
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -07001390 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s\n"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 if( pAggrQosRspMsg != NULL )
1392 {
1393 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1394 }
1395 return;
1396 }
1397
1398 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1399 {
1400 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1401 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1402 {
1403 /* send DELTS to the station */
1404 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1405
1406 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1407 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1408 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1409 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1410
1411 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1412 &addTsParam.tspec.tsinfo,
1413 &addTsParam.tspec, psessionEntry);
1414
1415 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1416 &psessionEntry->dph.dphHashTable);
1417 if (pSta != NULL)
1418 {
1419 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1420 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1421 }
1422 }
1423 }
1424
1425 /* Send the Aggr QoS response to SME */
1426
1427 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1428 psessionEntry->smeSessionId);
1429 if( pAggrQosRspMsg != NULL )
1430 {
1431 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1432 }
1433 return;
1434}
1435
1436
1437/*--------------------------------------------------------------------------
1438 Determines if a session with ccx or 11r assoc is present.
1439 If present it will return TRUE else FALSE
1440 ------------------------------------------------------------------------*/
1441int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1442{
1443 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1444 {
1445 // If ccx or 11r connection is found we need to return TRUE
1446 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1447 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1448#ifdef FEATURE_WLAN_CCX
1449 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1450#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001451#ifdef FEATURE_WLAN_LFR
1452 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1453#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 )&&
1455 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1456 {
1457 // Make sure we have 11r/CCX and FT enabled only then we need
1458 // the values to be altered from cfg for FW RSSI Period alteration.
1459 return TRUE;
1460 }
1461 }
1462
1463 return FALSE;
1464}
1465
1466#endif /* WLAN_FEATURE_VOWIFI_11R */