blob: 014d5e1e51e6b0a89cf52db462ed9b0beaeefe7a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +05302 * 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*/
Jeff Johnson295189b2012-06-20 16:38:30 -070021#ifdef WLAN_FEATURE_VOWIFI_11R
22/**=========================================================================
23
24 \brief implementation for PE 11r VoWiFi FT Protocol
25
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053026 Copyright 2008 (c) Qualcomm Technologies, Inc. All Rights Reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070027
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053028 Qualcomm Technologies Confidential and Proprietary.
Jeff Johnson295189b2012-06-20 16:38:30 -070029
30 ========================================================================*/
31
32/* $Header$ */
33
34
35/*--------------------------------------------------------------------------
36 Include Files
37 ------------------------------------------------------------------------*/
38#include <limSendMessages.h>
39#include <limTypes.h>
40#include <limFT.h>
41#include <limFTDefs.h>
42#include <limUtils.h>
43#include <limPropExtsUtils.h>
44#include <limAssocUtils.h>
45#include <limSession.h>
46#include <limAdmitControl.h>
47#include "wmmApsd.h"
48
49#define LIM_FT_RIC_BA_SSN 1
50#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
51#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053052#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070053
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
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070071 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070072 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070073#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080074 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
75 {
76 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
77 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
78 }
Jeff Johnson295189b2012-06-20 16:38:30 -070079 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
80 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
81 }
82
83 // This is the old session, should be deleted else where.
84 // We should not be cleaning it here, just set it to NULL.
85 if (pMac->ft.ftPEContext.psavedsessionEntry)
86 {
87#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070088 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070089 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070090#endif
91 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
92 }
93
94 // This is the extra session we added as part of Auth resp
95 // clean it up.
96 if (pMac->ft.ftPEContext.pftSessionEntry)
97 {
98 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
99 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
100 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700101 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700102 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
103 }
104 pMac->ft.ftPEContext.pftSessionEntry = NULL;
105#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700106 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700107 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108#endif
109 }
110
111 if (pMac->ft.ftPEContext.pAddBssReq)
112 {
113 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
114 pMac->ft.ftPEContext.pAddBssReq = NULL;
115 }
116
117 if (pMac->ft.ftPEContext.pAddStaReq)
118 {
119 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
120 pMac->ft.ftPEContext.pAddStaReq = NULL;
121 }
122
123 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
124
125}
126
127/*--------------------------------------------------------------------------
128 Init FT variables.
129 ------------------------------------------------------------------------*/
130void limFTInit(tpAniSirGlobal pMac)
131{
132 if (pMac->ft.ftPEContext.pFTPreAuthReq)
133 {
134#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700135 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700136 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700137#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800138 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
139 {
140 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
141 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
142 }
143
Jeff Johnson295189b2012-06-20 16:38:30 -0700144 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
145 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
146 }
147
148 // This is the old session, should be deleted else where.
149 // We should not be cleaning it here, just set it to NULL.
150 if (pMac->ft.ftPEContext.psavedsessionEntry)
151 {
152#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700153 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700154 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700155#endif
156 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
157 }
158
159 // This is the extra session we added as part of Auth resp
160 // clean it up.
161 if (pMac->ft.ftPEContext.pftSessionEntry)
162 {
163 /* Cannot delete sessions across associations */
164#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700165 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700166 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700167#endif
168 pMac->ft.ftPEContext.pftSessionEntry = NULL;
169 }
170
171 if (pMac->ft.ftPEContext.pAddBssReq)
172 {
173#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700174 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176#endif
177 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
178 pMac->ft.ftPEContext.pAddBssReq = NULL;
179 }
180
181
182 if (pMac->ft.ftPEContext.pAddStaReq)
183 {
184#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700185 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700186 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700187#endif
188 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
189 pMac->ft.ftPEContext.pAddStaReq = NULL;
190 }
191
192 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
193
194}
195
196/*------------------------------------------------------------------
197 *
198 * This is the handler after suspending the link.
199 * We suspend the link and then now proceed to switch channel.
200 *
201 *------------------------------------------------------------------*/
202void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
203{
204 tpPESession psessionEntry;
205
206 // The link is suspended of not ?
207 if (status != eHAL_STATUS_SUCCESS)
208 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700209 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 // Post the FT Pre Auth Response to SME
211 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
212
213 return;
214 }
215
216 psessionEntry = (tpPESession)data;
217 // Suspended, now move to a different channel.
218 // Perform some sanity check before proceeding.
219 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
220 {
221 limChangeChannelWithCallback(pMac,
222 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
223 limPerformFTPreAuth, NULL, psessionEntry);
224 return;
225 }
226
227 // Else return error.
228 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
229}
230
231
232/*--------------------------------------------------------------------------
233 In this function, we process the FT Pre Auth Req.
234 We receive Pre-Auth
235 Suspend link
236 Register a call back
237 In the call back, we will need to accept frames from the new bssid
238 Send out the auth req to new AP.
239 Start timer and when the timer is done or if we receive the Auth response
240 We change channel
241 Resume link
242 ------------------------------------------------------------------------*/
243int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
244{
245 int bufConsumed = FALSE;
246 tpPESession psessionEntry;
247 tANI_U8 sessionId;
248
249 // Now we are starting fresh make sure all's cleanup.
250 limFTInit(pMac);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700251 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
Jeff Johnson295189b2012-06-20 16:38:30 -0700252
253 // We need information from the Pre-Auth Req. Lets save that
254 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
255
256#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800257 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
259 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
260 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
261#endif
262
263 // Get the current session entry
264 psessionEntry = peFindSessionByBssid(pMac,
265 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
266 if (psessionEntry == NULL)
267 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700268 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700269 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
271 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800272 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700273 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 return TRUE;
275 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700276#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
277 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
278#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
280 // Dont need to suspend if APs are in same channel
281 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
282 {
283 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700284 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700285 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700286 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 (tANI_U32 *)psessionEntry);
288 }
289 else
290 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700291 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700292 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 // We are in the same channel. Perform pre-auth
294 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
295 }
296
297 return bufConsumed;
298}
299
300/*------------------------------------------------------------------
301 * Send the Auth1
302 * Receive back Auth2
303 *------------------------------------------------------------------*/
304void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
305 tpPESession psessionEntry)
306{
307 tSirMacAuthFrameBody authFrame;
308
309 if (psessionEntry->is11Rconnection)
310 {
311 // Only 11r assoc has FT IEs.
312 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
313 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700314 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 return;
316 }
317 }
318 if (status != eHAL_STATUS_SUCCESS)
319 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700320 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 return;
322 }
323 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
324
325#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700326 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700327 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700328 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700329#endif
330
331
332 if (psessionEntry->is11Rconnection)
333 {
334 // Now we are on the right channel and need to send out Auth1 and
335 // receive Auth2.
336 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
337 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700338#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 else
340 {
341 // Will need to make isCCXconnection a enum may be for further
342 // improvements to this to match this algorithm number
343 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
344 }
345#endif
346 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
347 authFrame.authStatusCode = 0;
348
349 // Start timer here to come back to operating channel.
350 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
351 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
352 {
353#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700354 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700355#endif
356 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800357MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800360 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361#endif
362
363 limSendAuthMgmtFrame(pMac, &authFrame,
364 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
365 LIM_NO_WEP_IN_FC, psessionEntry);
366
367 return;
368}
369
370
371/*------------------------------------------------------------------
372 *
373 * Create the new Add Bss Req to the new AP.
374 * This will be used when we are ready to FT to the new AP.
375 * The newly created ft Session entry is passed to this function
376 *
377 *------------------------------------------------------------------*/
378tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
379 tANI_U8 updateEntry, tpPESession pftSessionEntry,
380 tpSirBssDescription bssDescription )
381{
382 tpAddBssParams pAddBssParams = NULL;
383 tANI_U8 i;
384 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700385 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700386
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700387 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
388 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
389 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700390 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700391 return eSIR_MEM_ALLOC_FAILED;
392 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700393
394 // Package SIR_HAL_ADD_BSS_REQ message parameters
395 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
396 (void **) &pAddBssParams, sizeof( tAddBssParams )))
397 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700398 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 limLog( pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700400 FL( "Unable to PAL allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 return (eSIR_MEM_ALLOC_FAILED);
402 }
403
404 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
405
406
407 limExtractApCapabilities( pMac,
408 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700409 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
411 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700412 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
414 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
415 sizeof( tSirMacAddr ));
416
417 // Fill in tAddBssParams selfMacAddr
418 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
419 sizeof( tSirMacAddr ));
420
421 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
422 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
423
424 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
425
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700426 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 pAddBssParams->updateBss = updateEntry;
428
429
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700430 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
431 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
432 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
433 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700434
435
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700436 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700438 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440 pAddBssParams->nwType = bssDescription->nwType;
441
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700442 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
444 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
445 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
446 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
447
448 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700449 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700451 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700453 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700455 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
456 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700459 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 (chanWidthSupp) )
461 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
463 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 }
465 else
466 {
467 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700468 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
471 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
472 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 }
474 }
475
476 pAddBssParams->currentOperChannel = bssDescription->channelId;
477
478#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 pAddBssParams->currentOperChannel);
481#endif
482
483
484 // Populate the STA-related parameters here
485 // Note that the STA here refers to the AP
486 {
487 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
488
489 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
490 bssDescription->bssId,
491 sizeof( tSirMacAddr ));
492 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
493
494 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
495 pAddBssParams->staContext.uAPSD = 0;
496 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700497 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 pAddBssParams->staContext.updateSta = updateEntry;
499 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
500
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700501 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 {
503 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
504 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700505 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
506 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
507 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 (chanWidthSupp) )
509 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 }
512 else
513 {
514 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
515 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700516 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
517 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
518 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
519 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
520 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
521 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
522 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
523 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700524
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700525 if( pBeaconStruct->HTInfo.present )
526 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 }
528
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700529 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
530 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 pAddBssParams->staContext.wmmEnabled = 1;
532 else
533 pAddBssParams->staContext.wmmEnabled = 0;
534
535 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700536#ifdef WLAN_FEATURE_11AC
537 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700538 pBeaconStruct->HTCaps.supportedMCSSet,
539 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700540#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
542 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700543#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
545
546 }
547
548
549 //Disable BA. It will be set as part of ADDBA negotiation.
550 for( i = 0; i < STACFG_MAX_TC; i++ )
551 {
552 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
553 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
554 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
555 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
556 }
557
558#if defined WLAN_FEATURE_VOWIFI
559 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
560#endif
561
562 pAddBssParams->status = eHAL_STATUS_SUCCESS;
563 pAddBssParams->respReqd = true;
564
565 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
566 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
567
568 // Set a new state for MLME
569
570 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800571 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, pftSessionEntry->peSessionId, eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
573
574 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
575
576#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800577 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700578#endif
579
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700580 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 return 0;
582}
583
584/*------------------------------------------------------------------
585 *
586 * Setup the new session for the pre-auth AP.
587 * Return the newly created session entry.
588 *
589 *------------------------------------------------------------------*/
590tpPESession limFillFTSession(tpAniSirGlobal pMac,
591 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
592{
593 tpPESession pftSessionEntry;
594 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 tPowerdBm localPowerConstraint;
596 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700597 tSchBeaconStruct *pBeaconStruct;
598
599 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
600 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
601 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700602 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700603 return NULL;
604 }
605
Jeff Johnson295189b2012-06-20 16:38:30 -0700606
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800607
608 /* Retrieve the session that has already been created and update the entry */
609 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700610#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
612#endif
613
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
617 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
618 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
619 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
620 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
621
622 // Fields to be filled later
623 pftSessionEntry->pLimJoinReq = NULL;
624 pftSessionEntry->smeSessionId = 0;
625 pftSessionEntry->transactionId = 0;
626
627 limExtractApCapabilities( pMac,
628 (tANI_U8 *) pbssDescription->ieFields,
629 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700630 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700631
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700632 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700634 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700635
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700636 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700638 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700639
640
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700641 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
642 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 pftSessionEntry->ssId.length);
644
645
646 // Self Mac
647 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
648 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700649#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
651#endif
652
653 /* Store beaconInterval */
654 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
655 pftSessionEntry->bssType = psessionEntry->bssType;
656
657 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
658 pftSessionEntry->nwType = pbssDescription->nwType;
659
660 /* Copy The channel Id to the session Table */
661 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
662 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
663
664
665 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
666 {
667 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
668 }
669 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
670 {
671 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
672 }
673 else
674 {
675 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700676 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 }
678
679 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
680 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800681 if( pMac->roam.configParam.shortSlotTime &&
682 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
683 {
684 pftSessionEntry->shortSlotTimeSupported = TRUE;
685 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700686
687 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
688 localPowerConstraint = regMax;
689 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
690 limGetIElenFromBssDescription(pbssDescription),
691 &pftSessionEntry->limCurrentBssQosCaps,
692 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700693 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700694
695 pftSessionEntry->limReassocBssQosCaps =
696 pftSessionEntry->limCurrentBssQosCaps;
697 pftSessionEntry->limReassocBssPropCap =
698 pftSessionEntry->limCurrentBssPropCap;
699
700
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800701#ifdef FEATURE_WLAN_CCX
702 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
703#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800705#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700706
707#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800708 limLog( pMac, LOG1, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800709 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700710#endif
711
712 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
713
714 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
715 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800716 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700717
718 pftSessionEntry->encryptType = psessionEntry->encryptType;
719
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700720 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 return pftSessionEntry;
722}
723
724/*------------------------------------------------------------------
725 *
726 * Setup the session and the add bss req for the pre-auth AP.
727 *
728 *------------------------------------------------------------------*/
729void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
730{
731 tpPESession pftSessionEntry;
732
733 // Prepare the session right now with as much as possible.
734 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
735
736 if (pftSessionEntry)
737 {
738 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
739#ifdef FEATURE_WLAN_CCX
740 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
741#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700742#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
744#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700745
746#ifdef FEATURE_WLAN_LFR
747 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
748#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
750 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
751 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
752 }
753}
754
755/*------------------------------------------------------------------
756 * Resume Link Call Back
757 *------------------------------------------------------------------*/
758void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
759{
760 tpPESession psessionEntry;
761
762 psessionEntry = (tpPESession)data;
763
764 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
765 {
766 limFTSetupAuthSession(pMac, psessionEntry);
767 }
768
769 // Post the FT Pre Auth Response to SME
770 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
771 pMac->ft.ftPEContext.saved_auth_rsp,
772 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
773
774}
775
776/*------------------------------------------------------------------
777 * Resume Link Call Back
778 *------------------------------------------------------------------*/
779void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
780 tpPESession psessionEntry)
781{
782 //Set the resume channel to Any valid channel (invalid).
783 //This will instruct HAL to set it to any previous valid channel.
784 peSetResumeChannel(pMac, 0, 0);
785 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
786}
787
788tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
789 tANI_U8 *ric_ies, tANI_U32 *ieLength)
790{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530791 /* BlockACK + RIC is not supported now, TODO later to support this */
792#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 tDot11fIERICDataDesc ricIe;
794 tDot11fFfBAStartingSequenceControl baSsnControl;
795 tDot11fFfAddBAParameterSet baParamSet;
796 tDot11fFfBATimeout baTimeout;
797
798 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
799 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
800 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
801 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
802
803 ricIe.present = 1;
804 ricIe.RICData.present = 1;
805 ricIe.RICData.resourceDescCount = 1;
806 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
807 ricIe.RICDescriptor.present = 1;
808 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
809 baParamSet.tid = tid;
810 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
811 baParamSet.bufferSize = pTrafficClass->txBufSize;
812 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
813 baSsnControl.fragNumber = 0;
814 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530815 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700816 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
817 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
818 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
819 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530820 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700821 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
822 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
823 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
824 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530825 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700826 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
827 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
828 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
829 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530831#endif
832
833 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700834}
835
836tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
837{
838 tANI_U8 tid = 0;
839 tpDphHashNode pSta;
840 tANI_U16 numBA = 0, aid = 0;
841 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
842 tANI_U32 offset = 0, ieLength = 0;
843 tSirRetStatus status = eSIR_SUCCESS;
844
845 // First, extract the DPH entry
846 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
847 if( NULL == pSta )
848 {
849 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700850 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x" ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
852 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
853 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
854 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
855 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
856 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
857 return eSIR_FAILURE;
858 }
859
860 for (tid = 0; tid < STACFG_MAX_TC; tid++)
861 {
862 if (pSta->tcCfg[tid].fUseBATx)
863 {
864 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
865 if (eSIR_SUCCESS == status)
866 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700867 // TODO RIC
868 if ( ieLength > MAX_FTIE_SIZE )
869 {
870 ieLength = 0;
871 return status;
872 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 offset += ieLength;
874 *ric_ies_length += ieLength;
875 numBA++;
876 }
877 else
878 {
879 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
880 }
881 }
882 }
883
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700884 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d"), numBA, *ric_ies_length);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 return status;
886}
887
888/*------------------------------------------------------------------
889 *
890 * Will post pre auth response to SME.
891 *
892 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800893void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
895 tpPESession psessionEntry)
896{
897 tpSirFTPreAuthRsp pFTPreAuthRsp;
898 tSirMsgQ mmhMsg;
899 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700900 // TODO: RIC Support
901 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
904 if(NULL == pFTPreAuthRsp)
905 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700906 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 VOS_ASSERT(pFTPreAuthRsp != NULL);
908 return;
909 }
910 vos_mem_zero( pFTPreAuthRsp, rspLen);
911#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800912 PELOGE(limLog( pMac, LOG1, "%s: Auth Rsp = %p", pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700913#endif
914
915 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
916 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
917 pFTPreAuthRsp->length = (tANI_U16) rspLen;
918 pFTPreAuthRsp->status = status;
919 if (psessionEntry)
920 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
921
922 // The bssid of the AP we are sending Auth1 to.
923 if (pMac->ft.ftPEContext.pFTPreAuthReq)
924 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
925 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
926
927 // Attach the auth response now back to SME
928 pFTPreAuthRsp->ft_ies_length = 0;
929 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
930 {
931 // Only 11r assoc has FT IEs.
932 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
933 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
934 }
935
936#ifdef WLAN_FEATURE_VOWIFI_11R
937 if ((psessionEntry) && (psessionEntry->is11Rconnection))
938 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700939 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
940 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
942 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
943 if (eSIR_SUCCESS != sirStatus)
944 {
945 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
946 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700947 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 }
949#endif
950
951 mmhMsg.type = pFTPreAuthRsp->messageType;
952 mmhMsg.bodyptr = pFTPreAuthRsp;
953 mmhMsg.bodyval = 0;
954
955#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800956 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800957#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700958#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
959 if( status == eHAL_STATUS_SUCCESS )
960 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry, status, 0);
961#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
963}
964
965/*------------------------------------------------------------------
966 *
967 * Send the FT Pre Auth Response to SME when ever we have a status
968 * ready to be sent to SME
969 *
970 * SME will be the one to send it up to the supplicant to receive
971 * FTIEs which will be required for Reassoc Req.
972 *
973 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800974void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
976 tpPESession psessionEntry)
977{
978
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800979 tpPESession pftSessionEntry;
980 tANI_U8 sessionId;
981 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700982#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
983 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
984#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800985
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 // 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
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800999 /* Create FT session for the re-association at this point */
1000 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1001 {
1002 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1003 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1004 &sessionId, pMac->lim.maxStation)) == NULL)
1005 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001006 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001007 return;
1008 }
1009 pftSessionEntry->peSessionId = sessionId;
1010 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1011 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1012 pftSessionEntry->bssType = psessionEntry->bssType;
1013
1014 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1015 {
1016 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1017 }
1018 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1019 {
1020 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1021 }
1022 else
1023 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001024 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001025 }
1026 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1027 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1028 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001029 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001030 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1031
1032 /* Update the ReAssoc BSSID of the current session */
1033 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1034 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1035 }
1036
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 if (psessionEntry->currentOperChannel !=
1038 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1039 {
1040 // Need to move to the original AP channel
1041 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1042 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1043 }
1044 else
1045 {
1046#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001047 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001048 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1049#endif
1050 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1051 }
1052}
1053
1054/*------------------------------------------------------------------
1055 *
1056 * This function handles the 11R Reassoc Req from SME
1057 *
1058 *------------------------------------------------------------------*/
1059void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1060 tpPESession psessionEntry)
1061{
1062 tANI_U8 smeSessionId = 0;
1063 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001064 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 tLimMlmReassocReq *pMlmReassocReq;
1066 tANI_U16 caps;
1067 tANI_U32 val;
1068 tSirMsgQ msgQ;
1069 tSirRetStatus retCode;
1070 tANI_U32 teleBcnEn = 0;
1071
Jeff Johnson278b0492013-04-03 14:10:08 -07001072 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001073 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1074 psessionEntry->smeSessionId = smeSessionId;
1075 psessionEntry->transactionId = transactionId;
1076
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001077#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1078 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1079#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001080
1081
Jeff Johnson278b0492013-04-03 14:10:08 -07001082 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 sizeof(tLimMlmReassocReq)))
1084 {
1085 // Log error
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001086 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 return;
1088 }
1089
1090 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1091 psessionEntry->bssId,
1092 sizeof(tSirMacAddr));
1093
1094 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1095 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1096 != eSIR_SUCCESS)
1097 {
1098 /**
1099 * Could not get ReassocFailureTimeout value
1100 * from CFG. Log error.
1101 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001102 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001103 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 return;
1105 }
1106
1107 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1108 {
1109 /**
1110 * Could not get Capabilities value
1111 * from CFG. Log error.
1112 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001113 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001114 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 return;
1116 }
1117 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001118
Jeff Johnson295189b2012-06-20 16:38:30 -07001119 /* Update PE sessionId*/
1120 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1121
1122 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001123 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1124 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001126 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
1127 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1128 return;
1129 }
1130
1131 if (teleBcnEn)
1132 {
1133 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001134 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 /**
1136 * Could not get ListenInterval value
1137 * from CFG. Log error.
1138 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001139 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001140 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001141 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001142 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 }
1144 else
1145 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001146 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 {
1148 /**
1149 * Could not get ListenInterval value
1150 * from CFG. Log error.
1151 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001152 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001153 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 return;
1155 }
1156 }
1157 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001158 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001160 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1161 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 }
1163
1164 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1165 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1166 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001167 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1168 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 }
1170
Jeff Johnson295189b2012-06-20 16:38:30 -07001171 pMlmReassocReq->listenInterval = (tANI_U16) val;
1172
1173 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1174
1175
1176 //we need to defer the message until we get the response back from HAL.
1177 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001178
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1180 msgQ.reserved = 0;
1181 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1182 msgQ.bodyval = 0;
1183
1184
1185#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1186 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1187#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001188 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001189
1190 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001191 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 {
1193 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001194 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 retCode );
1196 }
1197 // Dont need this anymore
1198 pMac->ft.ftPEContext.pAddBssReq = NULL;
1199 return;
1200}
1201
1202/*------------------------------------------------------------------
1203 *
1204 * This function is called if preauth response is not received from the AP
1205 * within this timeout while FT in progress
1206 *
1207 *------------------------------------------------------------------*/
1208void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1209{
1210 tpPESession psessionEntry;
1211
1212 // We have failed pre auth. We need to resume link and get back on
1213 // home channel.
1214
1215 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1216 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001217 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 return;
1219 }
1220
1221 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1222 // to get back.
1223 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1224}
1225
1226
1227/*------------------------------------------------------------------
1228 *
1229 * This function is called to process the update key request from SME
1230 *
1231 *------------------------------------------------------------------*/
1232tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1233{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301234 tAddBssParams * pAddBssParams;
1235 tSirFTUpdateKeyInfo * pKeyInfo;
1236 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001237
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301238 /* Sanity Check */
1239 if( pMac == NULL || pMsgBuf == NULL )
1240 {
1241 return TRUE;
1242 }
1243 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1244 {
1245 limLog( pMac, LOGE,
1246 FL( "pAddBssReq is NULL" ));
1247 return TRUE;
1248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001249
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301250 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1251 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301253 /* Store the key information in the ADD BSS parameters */
1254 pAddBssParams->extSetStaKeyParamValid = 1;
1255 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1256 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301258 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1259 {
1260 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1261 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301263 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1264 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1265 pAddBssParams->extSetStaKeyParamValid,
1266 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001267
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301268 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1269
1270 PELOG1(limLog(pMac, LOG1,
1271 FL("BSSID = %02X-%02X-%02X-%02X-%02X-%02X"),
1272 pKeyInfo->bssId[0], pKeyInfo->bssId[1],
1273 pKeyInfo->bssId[2], pKeyInfo->bssId[3],
1274 pKeyInfo->bssId[4], pKeyInfo->bssId[5]);)
1275
1276 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1277 {
1278 PELOG1(limLog(pMac, LOG1,
1279 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1280 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1281 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1282 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1283 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1284 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1285 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1286 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1287 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1288 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1289 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1290 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1291 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1292 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1293 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1294 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1295 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1296 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1297 }
1298
1299 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001300}
1301
1302tSirRetStatus
1303limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1304{
1305 tSirMsgQ msg;
1306 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1307 tpAggrAddTsParams pAggrAddTsParam;
1308 tpPESession psessionEntry = NULL;
1309 tpLimTspecInfo tspecInfo;
1310 tANI_U8 ac;
1311 tpDphHashNode pSta;
1312 tANI_U16 aid;
1313 tANI_U8 sessionId;
1314 int i;
1315
1316 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1317 (void **)&pAggrAddTsParam,
1318 sizeof(tAggrAddTsParams)))
1319 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001320 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 return eSIR_MEM_ALLOC_FAILED;
1322 }
1323
1324 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1325
1326 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001327 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301328 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 return eSIR_FAILURE;
1330 }
1331
1332 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1333 if (pSta == NULL)
1334 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001335 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301336 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 return eSIR_FAILURE;
1338 }
1339
1340 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1341 sizeof(tAggrAddTsParams));
1342 pAggrAddTsParam->staIdx = psessionEntry->staId;
1343 // Fill in the sessionId specific to PE
1344 pAggrAddTsParam->sessionId = sessionId;
1345 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1346
1347 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1348 {
1349 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1350 {
1351 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1352 /* Since AddTS response was successful, check for the PSB flag
1353 * and directional flag inside the TS Info field.
1354 * An AC is trigger enabled AC if the PSB subfield is set to 1
1355 * in the uplink direction.
1356 * An AC is delivery enabled AC if the PSB subfield is set to 1
1357 * in the downlink direction.
1358 * An AC is trigger and delivery enabled AC if the PSB subfield
1359 * is set to 1 in the bi-direction field.
1360 */
1361 if (pTspec->tsinfo.traffic.psb == 1)
1362 {
1363 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1364 }
1365 else
1366 {
1367 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1368 }
1369 /* ADDTS success, so AC is now admitted. We shall now use the default
1370 * EDCA parameters as advertised by AP and send the updated EDCA params
1371 * to HAL.
1372 */
1373 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1374 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1375 {
1376 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1377 }
1378 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1379 {
1380 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1381 }
1382 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1383 {
1384 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1385 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1386 }
1387
1388 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1389
1390 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1391 {
1392 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1393 }
1394 else
1395 {
1396 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1397 }
1398
1399 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1400 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001401 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 pMac->lim.gLimAddtsSent = false;
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301403 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001404 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1405 }
1406
1407 // Copy the TSPEC paramters
1408 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1409 }
1410 }
1411
1412 msg.type = WDA_AGGR_QOS_REQ;
1413 msg.bodyptr = pAggrAddTsParam;
1414 msg.bodyval = 0;
1415
1416 /* We need to defer any incoming messages until we get a
1417 * WDA_AGGR_QOS_RSP from HAL.
1418 */
1419 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001420 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001421
1422 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1423 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001424 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001425 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1426 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1427 return eSIR_FAILURE;
1428 }
1429
1430 return eSIR_SUCCESS;
1431}
1432
1433void
1434limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1435 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1436{
1437 tpSirAggrQosRsp rsp;
1438 int i = 0;
1439
1440 if (! rspReqd)
1441 {
1442 return;
1443 }
1444
1445 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1446 sizeof(tSirAggrQosRsp)))
1447 {
1448 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1449 return;
1450 }
1451
1452 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1453 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1454 rsp->sessionId = smesessionId;
1455 rsp->length = sizeof(*rsp);
1456 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1457
1458 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1459 {
1460 if( (1 << i) & aggrQosRsp->tspecIdx )
1461 {
1462 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1463 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1464 }
1465 }
1466
1467 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1468 return;
1469}
1470
1471
1472void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1473{
1474 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1475 //tpAggrQosParams pAggrQosRspMsg = NULL;
1476 tAddTsParams addTsParam = {0};
1477 tpDphHashNode pSta = NULL;
1478 tANI_U16 assocId =0;
1479 tSirMacAddr peerMacAddr;
1480 tANI_U8 rspReqd = 1;
1481 tpPESession psessionEntry = NULL;
1482 int i = 0;
1483
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001484 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001485
1486 /* Need to process all the deferred messages enqueued since sending the
1487 SIR_HAL_AGGR_ADD_TS_REQ */
1488 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1489
1490 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1491 if (NULL == pAggrQosRspMsg)
1492 {
1493 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1494 return;
1495 }
1496
1497 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1498 if (NULL == psessionEntry)
1499 {
1500 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001501 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 if( pAggrQosRspMsg != NULL )
1503 {
1504 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1505 }
1506 return;
1507 }
1508
1509 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1510 {
1511 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1512 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1513 {
1514 /* send DELTS to the station */
1515 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1516
1517 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1518 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1519 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1520 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1521
1522 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1523 &addTsParam.tspec.tsinfo,
1524 &addTsParam.tspec, psessionEntry);
1525
1526 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1527 &psessionEntry->dph.dphHashTable);
1528 if (pSta != NULL)
1529 {
1530 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1531 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1532 }
1533 }
1534 }
1535
1536 /* Send the Aggr QoS response to SME */
1537
1538 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1539 psessionEntry->smeSessionId);
1540 if( pAggrQosRspMsg != NULL )
1541 {
1542 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1543 }
1544 return;
1545}
1546
1547
1548/*--------------------------------------------------------------------------
1549 Determines if a session with ccx or 11r assoc is present.
1550 If present it will return TRUE else FALSE
1551 ------------------------------------------------------------------------*/
1552int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1553{
1554 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1555 {
1556 // If ccx or 11r connection is found we need to return TRUE
1557 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1558 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1559#ifdef FEATURE_WLAN_CCX
1560 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1561#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001562#ifdef FEATURE_WLAN_LFR
1563 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1564#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 )&&
1566 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1567 {
1568 // Make sure we have 11r/CCX and FT enabled only then we need
1569 // the values to be altered from cfg for FW RSSI Period alteration.
1570 return TRUE;
1571 }
1572 }
1573
1574 return FALSE;
1575}
1576
1577#endif /* WLAN_FEATURE_VOWIFI_11R */