blob: 2372007a2fcfe66bf7d72e6874300c351ac378fd [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
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800564#ifdef WLAN_FEATURE_11W
565 if (pftSessionEntry->limRmfEnabled)
566 {
567 pAddBssParams->rmfEnabled = 1;
568 pAddBssParams->staContext.rmfEnabled = 1;
569 }
570#endif
571
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 pAddBssParams->status = eHAL_STATUS_SUCCESS;
573 pAddBssParams->respReqd = true;
574
575 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
576 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
577
578 // Set a new state for MLME
579
580 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800581 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 -0700582 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
583
584 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
585
586#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800587 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700588#endif
589
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530590 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 return 0;
592}
593
594/*------------------------------------------------------------------
595 *
596 * Setup the new session for the pre-auth AP.
597 * Return the newly created session entry.
598 *
599 *------------------------------------------------------------------*/
600tpPESession limFillFTSession(tpAniSirGlobal pMac,
601 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
602{
603 tpPESession pftSessionEntry;
604 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 tPowerdBm localPowerConstraint;
606 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700607 tSchBeaconStruct *pBeaconStruct;
608
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530609 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
610 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700611 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530612 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700613 return NULL;
614 }
615
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800617
618 /* Retrieve the session that has already been created and update the entry */
619 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700620#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700621 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700622#endif
623
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700625 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700626
627 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
628 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
629 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
630 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
631
632 // Fields to be filled later
633 pftSessionEntry->pLimJoinReq = NULL;
634 pftSessionEntry->smeSessionId = 0;
635 pftSessionEntry->transactionId = 0;
636
637 limExtractApCapabilities( pMac,
638 (tANI_U8 *) pbssDescription->ieFields,
639 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700640 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700641
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700642 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530643 vos_mem_copy(pftSessionEntry->rateSet.rate,
644 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700645
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700646 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530647 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700648 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700649
650
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700651 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530652 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 pftSessionEntry->ssId.length);
654
655
656 // Self Mac
657 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
658 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700659#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700660 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700661#endif
662
663 /* Store beaconInterval */
664 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
665 pftSessionEntry->bssType = psessionEntry->bssType;
666
667 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
668 pftSessionEntry->nwType = pbssDescription->nwType;
669
670 /* Copy The channel Id to the session Table */
671 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
672 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
673
674
675 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
676 {
677 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
678 }
679 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
680 {
681 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
682 }
683 else
684 {
685 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700686 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 }
688
689 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
690 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800691 if( pMac->roam.configParam.shortSlotTime &&
692 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
693 {
694 pftSessionEntry->shortSlotTimeSupported = TRUE;
695 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700696
697 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
698 localPowerConstraint = regMax;
699 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
700 limGetIElenFromBssDescription(pbssDescription),
701 &pftSessionEntry->limCurrentBssQosCaps,
702 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700703 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700704
705 pftSessionEntry->limReassocBssQosCaps =
706 pftSessionEntry->limCurrentBssQosCaps;
707 pftSessionEntry->limReassocBssPropCap =
708 pftSessionEntry->limCurrentBssPropCap;
709
710
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800711#ifdef FEATURE_WLAN_CCX
712 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
713#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800715#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700716
717#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800718 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 -0800719 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700720#endif
721
722 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
723
724 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
725 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800726 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700727
728 pftSessionEntry->encryptType = psessionEntry->encryptType;
729
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800730#ifdef WLAN_FEATURE_11AC
731 pftSessionEntry->vhtCapability = psessionEntry->vhtCapability;
732 pftSessionEntry->vhtCapabilityPresentInBeacon = psessionEntry->vhtCapabilityPresentInBeacon;
733#endif
734
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530735 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 return pftSessionEntry;
737}
738
739/*------------------------------------------------------------------
740 *
741 * Setup the session and the add bss req for the pre-auth AP.
742 *
743 *------------------------------------------------------------------*/
744void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
745{
746 tpPESession pftSessionEntry;
747
748 // Prepare the session right now with as much as possible.
749 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
750
751 if (pftSessionEntry)
752 {
753 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
754#ifdef FEATURE_WLAN_CCX
755 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
756#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700757#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
759#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700760
761#ifdef FEATURE_WLAN_LFR
762 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
763#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800764#ifdef WLAN_FEATURE_11W
765 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
766#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
768 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
769 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
770 }
771}
772
773/*------------------------------------------------------------------
774 * Resume Link Call Back
775 *------------------------------------------------------------------*/
776void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
777{
778 tpPESession psessionEntry;
779
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700780 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
781 return;
782
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 psessionEntry = (tpPESession)data;
784
785 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
786 {
787 limFTSetupAuthSession(pMac, psessionEntry);
788 }
789
790 // Post the FT Pre Auth Response to SME
791 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
792 pMac->ft.ftPEContext.saved_auth_rsp,
793 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
794
795}
796
797/*------------------------------------------------------------------
798 * Resume Link Call Back
799 *------------------------------------------------------------------*/
800void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
801 tpPESession psessionEntry)
802{
803 //Set the resume channel to Any valid channel (invalid).
804 //This will instruct HAL to set it to any previous valid channel.
805 peSetResumeChannel(pMac, 0, 0);
806 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
807}
808
809tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
810 tANI_U8 *ric_ies, tANI_U32 *ieLength)
811{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530812 /* BlockACK + RIC is not supported now, TODO later to support this */
813#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 tDot11fIERICDataDesc ricIe;
815 tDot11fFfBAStartingSequenceControl baSsnControl;
816 tDot11fFfAddBAParameterSet baParamSet;
817 tDot11fFfBATimeout baTimeout;
818
819 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
820 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
821 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
822 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
823
824 ricIe.present = 1;
825 ricIe.RICData.present = 1;
826 ricIe.RICData.resourceDescCount = 1;
827 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
828 ricIe.RICDescriptor.present = 1;
829 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
830 baParamSet.tid = tid;
831 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
832 baParamSet.bufferSize = pTrafficClass->txBufSize;
833 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
834 baSsnControl.fragNumber = 0;
835 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530836 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700837 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
838 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
839 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
840 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530841 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700842 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
843 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
844 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
845 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530846 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700847 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
848 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
849 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
850 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530852#endif
853
854 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700855}
856
857tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
858{
859 tANI_U8 tid = 0;
860 tpDphHashNode pSta;
861 tANI_U16 numBA = 0, aid = 0;
862 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
863 tANI_U32 offset = 0, ieLength = 0;
864 tSirRetStatus status = eSIR_SUCCESS;
865
866 // First, extract the DPH entry
867 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
868 if( NULL == pSta )
869 {
870 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800871 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
872 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 return eSIR_FAILURE;
874 }
875
876 for (tid = 0; tid < STACFG_MAX_TC; tid++)
877 {
878 if (pSta->tcCfg[tid].fUseBATx)
879 {
880 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
881 if (eSIR_SUCCESS == status)
882 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700883 // TODO RIC
884 if ( ieLength > MAX_FTIE_SIZE )
885 {
886 ieLength = 0;
887 return status;
888 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 offset += ieLength;
890 *ric_ies_length += ieLength;
891 numBA++;
892 }
893 else
894 {
895 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
896 }
897 }
898 }
899
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700900 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 -0700901 return status;
902}
903
904/*------------------------------------------------------------------
905 *
906 * Will post pre auth response to SME.
907 *
908 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800909void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
911 tpPESession psessionEntry)
912{
913 tpSirFTPreAuthRsp pFTPreAuthRsp;
914 tSirMsgQ mmhMsg;
915 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700916 // TODO: RIC Support
917 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700918
919 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530920 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700922 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 VOS_ASSERT(pFTPreAuthRsp != NULL);
924 return;
925 }
926 vos_mem_zero( pFTPreAuthRsp, rspLen);
927#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800928 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700929#endif
930
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530931 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
933 pFTPreAuthRsp->length = (tANI_U16) rspLen;
934 pFTPreAuthRsp->status = status;
935 if (psessionEntry)
936 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
937
938 // The bssid of the AP we are sending Auth1 to.
939 if (pMac->ft.ftPEContext.pFTPreAuthReq)
940 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
941 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
942
943 // Attach the auth response now back to SME
944 pFTPreAuthRsp->ft_ies_length = 0;
945 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
946 {
947 // Only 11r assoc has FT IEs.
948 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
949 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
950 }
951
952#ifdef WLAN_FEATURE_VOWIFI_11R
953 if ((psessionEntry) && (psessionEntry->is11Rconnection))
954 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700955 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
956 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
958 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
959 if (eSIR_SUCCESS != sirStatus)
960 {
961 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
962 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700963 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 }
965#endif
966
967 mmhMsg.type = pFTPreAuthRsp->messageType;
968 mmhMsg.bodyptr = pFTPreAuthRsp;
969 mmhMsg.bodyval = 0;
970
971#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700972 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800973#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700974#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -0700975 if (status == eSIR_SUCCESS)
976 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
977 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700978#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
980}
981
982/*------------------------------------------------------------------
983 *
984 * Send the FT Pre Auth Response to SME when ever we have a status
985 * ready to be sent to SME
986 *
987 * SME will be the one to send it up to the supplicant to receive
988 * FTIEs which will be required for Reassoc Req.
989 *
990 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800991void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
993 tpPESession psessionEntry)
994{
995
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800996 tpPESession pftSessionEntry;
997 tANI_U8 sessionId;
998 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700999#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1000 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1001#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001002
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 // Save the status of pre-auth
1004 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1005
1006 // Save the auth rsp, so we can send it to
1007 // SME once we resume link.
1008 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1009 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1010 {
1011 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1012 auth_rsp, auth_rsp_length);
1013 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1014 }
1015
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001016 /* Create FT session for the re-association at this point */
1017 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1018 {
1019 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1020 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1021 &sessionId, pMac->lim.maxStation)) == NULL)
1022 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001023 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001024 return;
1025 }
1026 pftSessionEntry->peSessionId = sessionId;
1027 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1028 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1029 pftSessionEntry->bssType = psessionEntry->bssType;
1030
1031 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1032 {
1033 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1034 }
1035 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1036 {
1037 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1038 }
1039 else
1040 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001041 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001042 }
1043 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1044 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1045 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001046 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001047 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1048
1049 /* Update the ReAssoc BSSID of the current session */
1050 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001051 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001052 }
1053
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 if (psessionEntry->currentOperChannel !=
1055 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1056 {
1057 // Need to move to the original AP channel
1058 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1059 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1060 }
1061 else
1062 {
1063#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001064 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1066#endif
1067 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1068 }
1069}
1070
1071/*------------------------------------------------------------------
1072 *
1073 * This function handles the 11R Reassoc Req from SME
1074 *
1075 *------------------------------------------------------------------*/
1076void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1077 tpPESession psessionEntry)
1078{
1079 tANI_U8 smeSessionId = 0;
1080 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001081 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 tLimMlmReassocReq *pMlmReassocReq;
1083 tANI_U16 caps;
1084 tANI_U32 val;
1085 tSirMsgQ msgQ;
1086 tSirRetStatus retCode;
1087 tANI_U32 teleBcnEn = 0;
1088
Jeff Johnson278b0492013-04-03 14:10:08 -07001089 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1091 psessionEntry->smeSessionId = smeSessionId;
1092 psessionEntry->transactionId = transactionId;
1093
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001094#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1095 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1096#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001097
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301098 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1099 {
1100 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1101 return;
1102 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301103 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1104 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 {
1106 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301107 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 return;
1109 }
1110
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301111 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1112 psessionEntry->bssId,
1113 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001114
1115 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1116 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1117 != eSIR_SUCCESS)
1118 {
1119 /**
1120 * Could not get ReassocFailureTimeout value
1121 * from CFG. Log error.
1122 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001123 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301124 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 return;
1126 }
1127
1128 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1129 {
1130 /**
1131 * Could not get Capabilities value
1132 * from CFG. Log error.
1133 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001134 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301135 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 return;
1137 }
1138 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001139
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 /* Update PE sessionId*/
1141 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1142
1143 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001144 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1145 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001147 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301148 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001149 return;
1150 }
1151
1152 if (teleBcnEn)
1153 {
1154 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001155 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 /**
1157 * Could not get ListenInterval value
1158 * from CFG. Log error.
1159 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001160 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301161 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001162 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001163 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 }
1165 else
1166 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001167 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001168 {
1169 /**
1170 * Could not get ListenInterval value
1171 * from CFG. Log error.
1172 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001173 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301174 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001175 return;
1176 }
1177 }
1178 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001179 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301181 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001182 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 }
1184
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 pMlmReassocReq->listenInterval = (tANI_U16) val;
1186
1187 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1188
1189
1190 //we need to defer the message until we get the response back from HAL.
1191 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001192
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1194 msgQ.reserved = 0;
1195 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1196 msgQ.bodyval = 0;
1197
1198
1199#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001200 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001201#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001202 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001203
1204 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001205 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 {
1207 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001208 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001209 retCode );
1210 }
1211 // Dont need this anymore
1212 pMac->ft.ftPEContext.pAddBssReq = NULL;
1213 return;
1214}
1215
1216/*------------------------------------------------------------------
1217 *
1218 * This function is called if preauth response is not received from the AP
1219 * within this timeout while FT in progress
1220 *
1221 *------------------------------------------------------------------*/
1222void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1223{
1224 tpPESession psessionEntry;
1225
1226 // We have failed pre auth. We need to resume link and get back on
1227 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301228 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1231 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001232 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 return;
1234 }
1235
1236 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1237 // to get back.
1238 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1239}
1240
1241
1242/*------------------------------------------------------------------
1243 *
1244 * This function is called to process the update key request from SME
1245 *
1246 *------------------------------------------------------------------*/
1247tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1248{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301249 tAddBssParams * pAddBssParams;
1250 tSirFTUpdateKeyInfo * pKeyInfo;
1251 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001252
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301253 /* Sanity Check */
1254 if( pMac == NULL || pMsgBuf == NULL )
1255 {
1256 return TRUE;
1257 }
1258 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1259 {
1260 limLog( pMac, LOGE,
1261 FL( "pAddBssReq is NULL" ));
1262 return TRUE;
1263 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001264
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301265 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1266 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001267
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301268 /* Store the key information in the ADD BSS parameters */
1269 pAddBssParams->extSetStaKeyParamValid = 1;
1270 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301271 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1272 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301273 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1274 {
1275 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1276 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001277
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301278 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1279 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1280 pAddBssParams->extSetStaKeyParamValid,
1281 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001282
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301283 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1284
1285 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001286 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301287
1288 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1289 {
1290 PELOG1(limLog(pMac, LOG1,
1291 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1292 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1293 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1294 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1295 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1296 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1297 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1298 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1299 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1300 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1301 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1302 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1303 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1304 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1305 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1306 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1307 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1308 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1309 }
1310
1311 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001312}
1313
1314tSirRetStatus
1315limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1316{
1317 tSirMsgQ msg;
1318 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1319 tpAggrAddTsParams pAggrAddTsParam;
1320 tpPESession psessionEntry = NULL;
1321 tpLimTspecInfo tspecInfo;
1322 tANI_U8 ac;
1323 tpDphHashNode pSta;
1324 tANI_U16 aid;
1325 tANI_U8 sessionId;
1326 int i;
1327
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301328 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1329 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301331 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 return eSIR_MEM_ALLOC_FAILED;
1333 }
1334
1335 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1336
1337 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001338 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301339 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 return eSIR_FAILURE;
1341 }
1342
1343 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1344 if (pSta == NULL)
1345 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001346 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301347 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 return eSIR_FAILURE;
1349 }
1350
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301351 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1352 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pAggrAddTsParam->staIdx = psessionEntry->staId;
1354 // Fill in the sessionId specific to PE
1355 pAggrAddTsParam->sessionId = sessionId;
1356 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1357
1358 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1359 {
1360 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1361 {
1362 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1363 /* Since AddTS response was successful, check for the PSB flag
1364 * and directional flag inside the TS Info field.
1365 * An AC is trigger enabled AC if the PSB subfield is set to 1
1366 * in the uplink direction.
1367 * An AC is delivery enabled AC if the PSB subfield is set to 1
1368 * in the downlink direction.
1369 * An AC is trigger and delivery enabled AC if the PSB subfield
1370 * is set to 1 in the bi-direction field.
1371 */
1372 if (pTspec->tsinfo.traffic.psb == 1)
1373 {
1374 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1375 }
1376 else
1377 {
1378 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1379 }
1380 /* ADDTS success, so AC is now admitted. We shall now use the default
1381 * EDCA parameters as advertised by AP and send the updated EDCA params
1382 * to HAL.
1383 */
1384 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1385 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1386 {
1387 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1388 }
1389 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1390 {
1391 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1392 }
1393 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1394 {
1395 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1396 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1397 }
1398
1399 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1400
1401 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1402 {
1403 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1404 }
1405 else
1406 {
1407 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1408 }
1409
1410 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1411 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001412 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301414 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1416 }
1417
1418 // Copy the TSPEC paramters
1419 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1420 }
1421 }
1422
1423 msg.type = WDA_AGGR_QOS_REQ;
1424 msg.bodyptr = pAggrAddTsParam;
1425 msg.bodyval = 0;
1426
1427 /* We need to defer any incoming messages until we get a
1428 * WDA_AGGR_QOS_RSP from HAL.
1429 */
1430 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001432
1433 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1434 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001435 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301437 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 return eSIR_FAILURE;
1439 }
1440
1441 return eSIR_SUCCESS;
1442}
1443
1444void
1445limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1446 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1447{
1448 tpSirAggrQosRsp rsp;
1449 int i = 0;
1450
1451 if (! rspReqd)
1452 {
1453 return;
1454 }
1455
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301456 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1457 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301459 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 return;
1461 }
1462
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301463 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1465 rsp->sessionId = smesessionId;
1466 rsp->length = sizeof(*rsp);
1467 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1468
1469 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1470 {
1471 if( (1 << i) & aggrQosRsp->tspecIdx )
1472 {
1473 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1474 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1475 }
1476 }
1477
1478 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1479 return;
1480}
1481
1482
1483void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1484{
1485 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1486 //tpAggrQosParams pAggrQosRspMsg = NULL;
1487 tAddTsParams addTsParam = {0};
1488 tpDphHashNode pSta = NULL;
1489 tANI_U16 assocId =0;
1490 tSirMacAddr peerMacAddr;
1491 tANI_U8 rspReqd = 1;
1492 tpPESession psessionEntry = NULL;
1493 int i = 0;
1494
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001495 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
1497 /* Need to process all the deferred messages enqueued since sending the
1498 SIR_HAL_AGGR_ADD_TS_REQ */
1499 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1500
1501 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1502 if (NULL == pAggrQosRspMsg)
1503 {
1504 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1505 return;
1506 }
1507
1508 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1509 if (NULL == psessionEntry)
1510 {
1511 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001512 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 if( pAggrQosRspMsg != NULL )
1514 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301515 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 }
1517 return;
1518 }
1519
1520 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1521 {
1522 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1523 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1524 {
1525 /* send DELTS to the station */
1526 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1527
1528 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1529 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1530 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1531 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1532
1533 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1534 &addTsParam.tspec.tsinfo,
1535 &addTsParam.tspec, psessionEntry);
1536
1537 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1538 &psessionEntry->dph.dphHashTable);
1539 if (pSta != NULL)
1540 {
1541 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1542 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1543 }
1544 }
1545 }
1546
1547 /* Send the Aggr QoS response to SME */
1548
1549 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1550 psessionEntry->smeSessionId);
1551 if( pAggrQosRspMsg != NULL )
1552 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301553 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 }
1555 return;
1556}
1557
Jeff Johnson295189b2012-06-20 16:38:30 -07001558#endif /* WLAN_FEATURE_VOWIFI_11R */