blob: f1bee68f9e673154fb94d4ab88bf9295153fb31f [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
5 */
Jeff Johnson295189b2012-06-20 16:38:30 -07006#ifdef WLAN_FEATURE_VOWIFI_11R
7/**=========================================================================
8
9 \brief implementation for PE 11r VoWiFi FT Protocol
10
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053011 Copyright 2008 (c) Qualcomm Technologies, Inc. All Rights Reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070012
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053013 Qualcomm Technologies Confidential and Proprietary.
Jeff Johnson295189b2012-06-20 16:38:30 -070014
15 ========================================================================*/
16
17/* $Header$ */
18
19
20/*--------------------------------------------------------------------------
21 Include Files
22 ------------------------------------------------------------------------*/
23#include <limSendMessages.h>
24#include <limTypes.h>
25#include <limFT.h>
26#include <limFTDefs.h>
27#include <limUtils.h>
28#include <limPropExtsUtils.h>
29#include <limAssocUtils.h>
30#include <limSession.h>
31#include <limAdmitControl.h>
32#include "wmmApsd.h"
33
34#define LIM_FT_RIC_BA_SSN 1
35#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
36#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053037#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070038
39/*--------------------------------------------------------------------------
40 Initialize the FT variables.
41 ------------------------------------------------------------------------*/
42void limFTOpen(tpAniSirGlobal pMac)
43{
44 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
45 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
46}
47
48/*--------------------------------------------------------------------------
49 Cleanup FT variables.
50 ------------------------------------------------------------------------*/
51void limFTCleanup(tpAniSirGlobal pMac)
52{
53 if (pMac->ft.ftPEContext.pFTPreAuthReq)
54 {
55#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070056 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070057 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070058#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080059 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
60 {
61 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
62 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
63 }
Jeff Johnson295189b2012-06-20 16:38:30 -070064 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
65 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
66 }
67
68 // This is the old session, should be deleted else where.
69 // We should not be cleaning it here, just set it to NULL.
70 if (pMac->ft.ftPEContext.psavedsessionEntry)
71 {
72#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070073 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070074 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070075#endif
76 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
77 }
78
79 // This is the extra session we added as part of Auth resp
80 // clean it up.
81 if (pMac->ft.ftPEContext.pftSessionEntry)
82 {
83 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
84 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
85 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070086 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -070087 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
88 }
89 pMac->ft.ftPEContext.pftSessionEntry = NULL;
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070091 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
94 }
95
96 if (pMac->ft.ftPEContext.pAddBssReq)
97 {
98 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
99 pMac->ft.ftPEContext.pAddBssReq = NULL;
100 }
101
102 if (pMac->ft.ftPEContext.pAddStaReq)
103 {
104 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
105 pMac->ft.ftPEContext.pAddStaReq = NULL;
106 }
107
108 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
109
110}
111
112/*--------------------------------------------------------------------------
113 Init FT variables.
114 ------------------------------------------------------------------------*/
115void limFTInit(tpAniSirGlobal pMac)
116{
117 if (pMac->ft.ftPEContext.pFTPreAuthReq)
118 {
119#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700120 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700121 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700122#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800123 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
124 {
125 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
126 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
127 }
128
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
130 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
131 }
132
133 // This is the old session, should be deleted else where.
134 // We should not be cleaning it here, just set it to NULL.
135 if (pMac->ft.ftPEContext.psavedsessionEntry)
136 {
137#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700138 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700139 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700140#endif
141 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
142 }
143
144 // This is the extra session we added as part of Auth resp
145 // clean it up.
146 if (pMac->ft.ftPEContext.pftSessionEntry)
147 {
148 /* Cannot delete sessions across associations */
149#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700150 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700151 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700152#endif
153 pMac->ft.ftPEContext.pftSessionEntry = NULL;
154 }
155
156 if (pMac->ft.ftPEContext.pAddBssReq)
157 {
158#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700159 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700160 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700161#endif
162 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
163 pMac->ft.ftPEContext.pAddBssReq = NULL;
164 }
165
166
167 if (pMac->ft.ftPEContext.pAddStaReq)
168 {
169#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700170 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700171 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#endif
173 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
174 pMac->ft.ftPEContext.pAddStaReq = NULL;
175 }
176
177 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
178
179}
180
181/*------------------------------------------------------------------
182 *
183 * This is the handler after suspending the link.
184 * We suspend the link and then now proceed to switch channel.
185 *
186 *------------------------------------------------------------------*/
187void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
188{
189 tpPESession psessionEntry;
190
191 // The link is suspended of not ?
192 if (status != eHAL_STATUS_SUCCESS)
193 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700194 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700195 // Post the FT Pre Auth Response to SME
196 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
197
198 return;
199 }
200
201 psessionEntry = (tpPESession)data;
202 // Suspended, now move to a different channel.
203 // Perform some sanity check before proceeding.
204 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
205 {
206 limChangeChannelWithCallback(pMac,
207 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
208 limPerformFTPreAuth, NULL, psessionEntry);
209 return;
210 }
211
212 // Else return error.
213 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
214}
215
216
217/*--------------------------------------------------------------------------
218 In this function, we process the FT Pre Auth Req.
219 We receive Pre-Auth
220 Suspend link
221 Register a call back
222 In the call back, we will need to accept frames from the new bssid
223 Send out the auth req to new AP.
224 Start timer and when the timer is done or if we receive the Auth response
225 We change channel
226 Resume link
227 ------------------------------------------------------------------------*/
228int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
229{
230 int bufConsumed = FALSE;
231 tpPESession psessionEntry;
232 tANI_U8 sessionId;
233
234 // Now we are starting fresh make sure all's cleanup.
235 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530236 // Can set it only after sending auth
237 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
238
239 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
240 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
241 {
242 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
243 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
244 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700245
246 // We need information from the Pre-Auth Req. Lets save that
247 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
248
249#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800250 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
252 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
253 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
254#endif
255
256 // Get the current session entry
257 psessionEntry = peFindSessionByBssid(pMac,
258 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
259 if (psessionEntry == NULL)
260 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700261 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700262 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700263 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
264 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800265 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530266 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
267 {
268 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
269 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
270 }
271 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700272 return TRUE;
273 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700274#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
275 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
276#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700277
278 // Dont need to suspend if APs are in same channel
279 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
280 {
281 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700282 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700283 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700284 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 (tANI_U32 *)psessionEntry);
286 }
287 else
288 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700289 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700290 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 // We are in the same channel. Perform pre-auth
292 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
293 }
294
295 return bufConsumed;
296}
297
298/*------------------------------------------------------------------
299 * Send the Auth1
300 * Receive back Auth2
301 *------------------------------------------------------------------*/
302void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
303 tpPESession psessionEntry)
304{
305 tSirMacAuthFrameBody authFrame;
306
307 if (psessionEntry->is11Rconnection)
308 {
309 // Only 11r assoc has FT IEs.
310 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
311 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800312 PELOGE(limLog( pMac, LOGE,
313 "%s: FTIEs for Auth Req Seq 1 is absent",
314 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 return;
316 }
317 }
318 if (status != eHAL_STATUS_SUCCESS)
319 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800320 PELOGE(limLog( pMac, LOGE,
321 "%s: Change channel not successful for FT pre-auth",
322 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 return;
324 }
325 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
326
327#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700328 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700329 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700330 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331#endif
332
333
334 if (psessionEntry->is11Rconnection)
335 {
336 // Now we are on the right channel and need to send out Auth1 and
337 // receive Auth2.
338 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
339 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700340#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 else
342 {
343 // Will need to make isCCXconnection a enum may be for further
344 // improvements to this to match this algorithm number
345 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
346 }
347#endif
348 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
349 authFrame.authStatusCode = 0;
350
351 // Start timer here to come back to operating channel.
352 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
353 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
354 {
355#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700356 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700357#endif
358 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800359MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700360
361#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800362 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700363#endif
364
365 limSendAuthMgmtFrame(pMac, &authFrame,
366 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
367 LIM_NO_WEP_IN_FC, psessionEntry);
368
369 return;
370}
371
372
373/*------------------------------------------------------------------
374 *
375 * Create the new Add Bss Req to the new AP.
376 * This will be used when we are ready to FT to the new AP.
377 * The newly created ft Session entry is passed to this function
378 *
379 *------------------------------------------------------------------*/
380tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
381 tANI_U8 updateEntry, tpPESession pftSessionEntry,
382 tpSirBssDescription bssDescription )
383{
384 tpAddBssParams pAddBssParams = NULL;
385 tANI_U8 i;
386 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700387 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700388
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530389 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
390 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700391 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530392 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700393 return eSIR_MEM_ALLOC_FAILED;
394 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700395
396 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530397 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
398 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530400 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530402 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 return (eSIR_MEM_ALLOC_FAILED);
404 }
405
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530406 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700407
408
409 limExtractApCapabilities( pMac,
410 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700411 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700412
413 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700414 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700415
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530416 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
417 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700418
419 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530420 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
421 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
423 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
424 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
425
426 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
427
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700428 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 pAddBssParams->updateBss = updateEntry;
430
431
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700432 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
433 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
434 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
435 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700436
437
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700438 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530439 vos_mem_copy(pAddBssParams->rateSet.rate,
440 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
442 pAddBssParams->nwType = bssDescription->nwType;
443
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700444 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
446 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
447 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
448 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
449
450 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700451 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700453 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700455 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700457 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
458 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700459
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700461 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700462 (chanWidthSupp) )
463 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700464 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
465 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 }
467 else
468 {
469 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700470 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700472 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
473 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
474 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 }
476 }
477
478 pAddBssParams->currentOperChannel = bssDescription->channelId;
479
480#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700481 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 pAddBssParams->currentOperChannel);
483#endif
484
485
486 // Populate the STA-related parameters here
487 // Note that the STA here refers to the AP
488 {
489 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
490
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530491 vos_mem_copy(pAddBssParams->staContext.bssId,
492 bssDescription->bssId,
493 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
495
496 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
497 pAddBssParams->staContext.uAPSD = 0;
498 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700499 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 pAddBssParams->staContext.updateSta = updateEntry;
501 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
502
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700503 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 {
505 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
506 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700507 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
508 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
509 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 (chanWidthSupp) )
511 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700512 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 }
514 else
515 {
516 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
517 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700518 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
519 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
520 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
521 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
522 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
523 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
524 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
525 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700526
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700527 if( pBeaconStruct->HTInfo.present )
528 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700529 }
530
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700531 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
532 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 pAddBssParams->staContext.wmmEnabled = 1;
534 else
535 pAddBssParams->staContext.wmmEnabled = 0;
536
537 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700538#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700539 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
540 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700541 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700542#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700543 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700545#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
547
548 }
549
550
551 //Disable BA. It will be set as part of ADDBA negotiation.
552 for( i = 0; i < STACFG_MAX_TC; i++ )
553 {
554 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
555 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
556 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
557 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
558 }
559
560#if defined WLAN_FEATURE_VOWIFI
561 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
562#endif
563
564 pAddBssParams->status = eHAL_STATUS_SUCCESS;
565 pAddBssParams->respReqd = true;
566
567 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
568 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
569
570 // Set a new state for MLME
571
572 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800573 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 -0700574 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
575
576 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
577
578#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800579 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580#endif
581
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530582 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 return 0;
584}
585
586/*------------------------------------------------------------------
587 *
588 * Setup the new session for the pre-auth AP.
589 * Return the newly created session entry.
590 *
591 *------------------------------------------------------------------*/
592tpPESession limFillFTSession(tpAniSirGlobal pMac,
593 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
594{
595 tpPESession pftSessionEntry;
596 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 tPowerdBm localPowerConstraint;
598 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700599 tSchBeaconStruct *pBeaconStruct;
600
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530601 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
602 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700603 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530604 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700605 return NULL;
606 }
607
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800609
610 /* Retrieve the session that has already been created and update the entry */
611 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700612#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700613 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700614#endif
615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700617 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700618
619 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
620 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
621 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
622 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
623
624 // Fields to be filled later
625 pftSessionEntry->pLimJoinReq = NULL;
626 pftSessionEntry->smeSessionId = 0;
627 pftSessionEntry->transactionId = 0;
628
629 limExtractApCapabilities( pMac,
630 (tANI_U8 *) pbssDescription->ieFields,
631 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700632 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700633
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700634 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530635 vos_mem_copy(pftSessionEntry->rateSet.rate,
636 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700637
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700638 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530639 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700640 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700641
642
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700643 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530644 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 pftSessionEntry->ssId.length);
646
647
648 // Self Mac
649 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
650 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700651#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700652 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700653#endif
654
655 /* Store beaconInterval */
656 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
657 pftSessionEntry->bssType = psessionEntry->bssType;
658
659 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
660 pftSessionEntry->nwType = pbssDescription->nwType;
661
662 /* Copy The channel Id to the session Table */
663 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
664 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
665
666
667 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
668 {
669 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
670 }
671 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
672 {
673 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
674 }
675 else
676 {
677 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700678 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700679 }
680
681 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
682 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800683 if( pMac->roam.configParam.shortSlotTime &&
684 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
685 {
686 pftSessionEntry->shortSlotTimeSupported = TRUE;
687 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700688
689 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
690 localPowerConstraint = regMax;
691 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
692 limGetIElenFromBssDescription(pbssDescription),
693 &pftSessionEntry->limCurrentBssQosCaps,
694 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700695 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700696
697 pftSessionEntry->limReassocBssQosCaps =
698 pftSessionEntry->limCurrentBssQosCaps;
699 pftSessionEntry->limReassocBssPropCap =
700 pftSessionEntry->limCurrentBssPropCap;
701
702
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800703#ifdef FEATURE_WLAN_CCX
704 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
705#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800707#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700708
709#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800710 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 -0800711 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700712#endif
713
714 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
715
716 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
717 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800718 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700719
720 pftSessionEntry->encryptType = psessionEntry->encryptType;
721
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800722#ifdef WLAN_FEATURE_11AC
723 pftSessionEntry->vhtCapability = psessionEntry->vhtCapability;
724 pftSessionEntry->vhtCapabilityPresentInBeacon = psessionEntry->vhtCapabilityPresentInBeacon;
725#endif
726
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530727 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 return pftSessionEntry;
729}
730
731/*------------------------------------------------------------------
732 *
733 * Setup the session and the add bss req for the pre-auth AP.
734 *
735 *------------------------------------------------------------------*/
736void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
737{
738 tpPESession pftSessionEntry;
739
740 // Prepare the session right now with as much as possible.
741 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
742
743 if (pftSessionEntry)
744 {
745 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
746#ifdef FEATURE_WLAN_CCX
747 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
748#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700749#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
751#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700752
753#ifdef FEATURE_WLAN_LFR
754 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
755#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
757 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
758 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
759 }
760}
761
762/*------------------------------------------------------------------
763 * Resume Link Call Back
764 *------------------------------------------------------------------*/
765void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
766{
767 tpPESession psessionEntry;
768
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700769 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
770 return;
771
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 psessionEntry = (tpPESession)data;
773
774 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
775 {
776 limFTSetupAuthSession(pMac, psessionEntry);
777 }
778
779 // Post the FT Pre Auth Response to SME
780 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
781 pMac->ft.ftPEContext.saved_auth_rsp,
782 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
783
784}
785
786/*------------------------------------------------------------------
787 * Resume Link Call Back
788 *------------------------------------------------------------------*/
789void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
790 tpPESession psessionEntry)
791{
792 //Set the resume channel to Any valid channel (invalid).
793 //This will instruct HAL to set it to any previous valid channel.
794 peSetResumeChannel(pMac, 0, 0);
795 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
796}
797
798tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
799 tANI_U8 *ric_ies, tANI_U32 *ieLength)
800{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530801 /* BlockACK + RIC is not supported now, TODO later to support this */
802#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 tDot11fIERICDataDesc ricIe;
804 tDot11fFfBAStartingSequenceControl baSsnControl;
805 tDot11fFfAddBAParameterSet baParamSet;
806 tDot11fFfBATimeout baTimeout;
807
808 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
809 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
810 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
811 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
812
813 ricIe.present = 1;
814 ricIe.RICData.present = 1;
815 ricIe.RICData.resourceDescCount = 1;
816 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
817 ricIe.RICDescriptor.present = 1;
818 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
819 baParamSet.tid = tid;
820 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
821 baParamSet.bufferSize = pTrafficClass->txBufSize;
822 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
823 baSsnControl.fragNumber = 0;
824 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
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 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
827 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
828 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
829 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530830 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700831 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
832 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
833 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
834 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530835 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700836 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
837 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
838 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
839 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530841#endif
842
843 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700844}
845
846tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
847{
848 tANI_U8 tid = 0;
849 tpDphHashNode pSta;
850 tANI_U16 numBA = 0, aid = 0;
851 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
852 tANI_U32 offset = 0, ieLength = 0;
853 tSirRetStatus status = eSIR_SUCCESS;
854
855 // First, extract the DPH entry
856 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
857 if( NULL == pSta )
858 {
859 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800860 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
861 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 return eSIR_FAILURE;
863 }
864
865 for (tid = 0; tid < STACFG_MAX_TC; tid++)
866 {
867 if (pSta->tcCfg[tid].fUseBATx)
868 {
869 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
870 if (eSIR_SUCCESS == status)
871 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700872 // TODO RIC
873 if ( ieLength > MAX_FTIE_SIZE )
874 {
875 ieLength = 0;
876 return status;
877 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 offset += ieLength;
879 *ric_ies_length += ieLength;
880 numBA++;
881 }
882 else
883 {
884 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
885 }
886 }
887 }
888
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700889 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 -0700890 return status;
891}
892
893/*------------------------------------------------------------------
894 *
895 * Will post pre auth response to SME.
896 *
897 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800898void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
900 tpPESession psessionEntry)
901{
902 tpSirFTPreAuthRsp pFTPreAuthRsp;
903 tSirMsgQ mmhMsg;
904 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700905 // TODO: RIC Support
906 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700907
908 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530909 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700911 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 VOS_ASSERT(pFTPreAuthRsp != NULL);
913 return;
914 }
915 vos_mem_zero( pFTPreAuthRsp, rspLen);
916#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800917 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700918#endif
919
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530920 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
922 pFTPreAuthRsp->length = (tANI_U16) rspLen;
923 pFTPreAuthRsp->status = status;
924 if (psessionEntry)
925 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
926
927 // The bssid of the AP we are sending Auth1 to.
928 if (pMac->ft.ftPEContext.pFTPreAuthReq)
929 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
930 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
931
932 // Attach the auth response now back to SME
933 pFTPreAuthRsp->ft_ies_length = 0;
934 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
935 {
936 // Only 11r assoc has FT IEs.
937 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
938 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
939 }
940
941#ifdef WLAN_FEATURE_VOWIFI_11R
942 if ((psessionEntry) && (psessionEntry->is11Rconnection))
943 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700944 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
945 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700946 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
947 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
948 if (eSIR_SUCCESS != sirStatus)
949 {
950 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
951 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700952 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 }
954#endif
955
956 mmhMsg.type = pFTPreAuthRsp->messageType;
957 mmhMsg.bodyptr = pFTPreAuthRsp;
958 mmhMsg.bodyval = 0;
959
960#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700961 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800962#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700963#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -0700964 if (status == eSIR_SUCCESS)
965 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
966 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700967#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
969}
970
971/*------------------------------------------------------------------
972 *
973 * Send the FT Pre Auth Response to SME when ever we have a status
974 * ready to be sent to SME
975 *
976 * SME will be the one to send it up to the supplicant to receive
977 * FTIEs which will be required for Reassoc Req.
978 *
979 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800980void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
982 tpPESession psessionEntry)
983{
984
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800985 tpPESession pftSessionEntry;
986 tANI_U8 sessionId;
987 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700988#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
989 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
990#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800991
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 // Save the status of pre-auth
993 pMac->ft.ftPEContext.ftPreAuthStatus = status;
994
995 // Save the auth rsp, so we can send it to
996 // SME once we resume link.
997 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
998 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
999 {
1000 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1001 auth_rsp, auth_rsp_length);
1002 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1003 }
1004
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001005 /* Create FT session for the re-association at this point */
1006 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1007 {
1008 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1009 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1010 &sessionId, pMac->lim.maxStation)) == NULL)
1011 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001012 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001013 return;
1014 }
1015 pftSessionEntry->peSessionId = sessionId;
1016 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1017 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1018 pftSessionEntry->bssType = psessionEntry->bssType;
1019
1020 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1021 {
1022 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1023 }
1024 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1025 {
1026 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1027 }
1028 else
1029 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001030 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001031 }
1032 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1033 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1034 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001035 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001036 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1037
1038 /* Update the ReAssoc BSSID of the current session */
1039 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001040 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001041 }
1042
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 if (psessionEntry->currentOperChannel !=
1044 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1045 {
1046 // Need to move to the original AP channel
1047 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1048 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1049 }
1050 else
1051 {
1052#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001053 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1055#endif
1056 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1057 }
1058}
1059
1060/*------------------------------------------------------------------
1061 *
1062 * This function handles the 11R Reassoc Req from SME
1063 *
1064 *------------------------------------------------------------------*/
1065void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1066 tpPESession psessionEntry)
1067{
1068 tANI_U8 smeSessionId = 0;
1069 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001070 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001071 tLimMlmReassocReq *pMlmReassocReq;
1072 tANI_U16 caps;
1073 tANI_U32 val;
1074 tSirMsgQ msgQ;
1075 tSirRetStatus retCode;
1076 tANI_U32 teleBcnEn = 0;
1077
Jeff Johnson278b0492013-04-03 14:10:08 -07001078 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1080 psessionEntry->smeSessionId = smeSessionId;
1081 psessionEntry->transactionId = transactionId;
1082
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001083#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1084 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1085#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001086
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301087 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1088 {
1089 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1090 return;
1091 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301092 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1093 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 {
1095 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301096 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 return;
1098 }
1099
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301100 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1101 psessionEntry->bssId,
1102 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001103
1104 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1105 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1106 != eSIR_SUCCESS)
1107 {
1108 /**
1109 * Could not get ReassocFailureTimeout value
1110 * from CFG. Log error.
1111 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001112 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301113 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 return;
1115 }
1116
1117 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1118 {
1119 /**
1120 * Could not get Capabilities value
1121 * from CFG. Log error.
1122 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001123 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301124 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 return;
1126 }
1127 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001128
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 /* Update PE sessionId*/
1130 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1131
1132 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001133 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1134 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001136 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301137 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001138 return;
1139 }
1140
1141 if (teleBcnEn)
1142 {
1143 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001144 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 /**
1146 * Could not get ListenInterval value
1147 * from CFG. Log error.
1148 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001149 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301150 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001151 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001152 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 }
1154 else
1155 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001156 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 {
1158 /**
1159 * Could not get ListenInterval value
1160 * from CFG. Log error.
1161 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001162 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301163 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 return;
1165 }
1166 }
1167 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001168 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001169 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301170 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001171 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 }
1173
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 pMlmReassocReq->listenInterval = (tANI_U16) val;
1175
1176 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1177
1178
1179 //we need to defer the message until we get the response back from HAL.
1180 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001181
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1183 msgQ.reserved = 0;
1184 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1185 msgQ.bodyval = 0;
1186
1187
1188#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001189 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001190#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001191 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001192
1193 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001194 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001195 {
1196 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001197 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 retCode );
1199 }
1200 // Dont need this anymore
1201 pMac->ft.ftPEContext.pAddBssReq = NULL;
1202 return;
1203}
1204
1205/*------------------------------------------------------------------
1206 *
1207 * This function is called if preauth response is not received from the AP
1208 * within this timeout while FT in progress
1209 *
1210 *------------------------------------------------------------------*/
1211void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1212{
1213 tpPESession psessionEntry;
1214
1215 // We have failed pre auth. We need to resume link and get back on
1216 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301217 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001218
1219 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1220 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001221 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 return;
1223 }
1224
1225 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1226 // to get back.
1227 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1228}
1229
1230
1231/*------------------------------------------------------------------
1232 *
1233 * This function is called to process the update key request from SME
1234 *
1235 *------------------------------------------------------------------*/
1236tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1237{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301238 tAddBssParams * pAddBssParams;
1239 tSirFTUpdateKeyInfo * pKeyInfo;
1240 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001241
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301242 /* Sanity Check */
1243 if( pMac == NULL || pMsgBuf == NULL )
1244 {
1245 return TRUE;
1246 }
1247 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1248 {
1249 limLog( pMac, LOGE,
1250 FL( "pAddBssReq is NULL" ));
1251 return TRUE;
1252 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001253
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301254 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1255 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001256
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301257 /* Store the key information in the ADD BSS parameters */
1258 pAddBssParams->extSetStaKeyParamValid = 1;
1259 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301260 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1261 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301262 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1263 {
1264 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1265 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001266
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301267 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1268 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1269 pAddBssParams->extSetStaKeyParamValid,
1270 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001271
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301272 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1273
1274 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001275 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301276
1277 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1278 {
1279 PELOG1(limLog(pMac, LOG1,
1280 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1281 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1282 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1283 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1284 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1285 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1286 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1287 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1288 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1289 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1290 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1291 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1292 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1293 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1294 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1295 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1296 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1297 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1298 }
1299
1300 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001301}
1302
1303tSirRetStatus
1304limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1305{
1306 tSirMsgQ msg;
1307 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1308 tpAggrAddTsParams pAggrAddTsParam;
1309 tpPESession psessionEntry = NULL;
1310 tpLimTspecInfo tspecInfo;
1311 tANI_U8 ac;
1312 tpDphHashNode pSta;
1313 tANI_U16 aid;
1314 tANI_U8 sessionId;
1315 int i;
1316
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301317 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1318 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301320 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() 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);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301328 vos_mem_free(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"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301336 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 return eSIR_FAILURE;
1338 }
1339
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301340 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1341 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 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;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301403 vos_mem_free(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);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301426 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001427 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
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301445 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1446 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301448 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 return;
1450 }
1451
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301452 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 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 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301504 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 }
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 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301542 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001543 }
1544 return;
1545}
1546
Jeff Johnson295189b2012-06-20 16:38:30 -07001547#endif /* WLAN_FEATURE_VOWIFI_11R */