blob: 0c449d27e32b5057d32a57784cb6a7b181670d0e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifdef WLAN_FEATURE_VOWIFI_11R
29/**=========================================================================
30
Kiet Lam842dad02014-02-18 18:44:02 -080031 \brief implementation for PE 11r VoWiFi FT Protocol
Jeff Johnson295189b2012-06-20 16:38:30 -070032
33 ========================================================================*/
34
35/* $Header$ */
36
37
38/*--------------------------------------------------------------------------
39 Include Files
40 ------------------------------------------------------------------------*/
41#include <limSendMessages.h>
42#include <limTypes.h>
43#include <limFT.h>
44#include <limFTDefs.h>
45#include <limUtils.h>
46#include <limPropExtsUtils.h>
47#include <limAssocUtils.h>
48#include <limSession.h>
49#include <limAdmitControl.h>
50#include "wmmApsd.h"
51
52#define LIM_FT_RIC_BA_SSN 1
53#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
54#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053055#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57/*--------------------------------------------------------------------------
58 Initialize the FT variables.
59 ------------------------------------------------------------------------*/
60void limFTOpen(tpAniSirGlobal pMac)
61{
62 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
63 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
64}
65
66/*--------------------------------------------------------------------------
67 Cleanup FT variables.
68 ------------------------------------------------------------------------*/
69void limFTCleanup(tpAniSirGlobal pMac)
70{
71 if (pMac->ft.ftPEContext.pFTPreAuthReq)
72 {
73#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070074 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070075 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070076#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080077 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
78 {
79 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
80 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
81 }
Jeff Johnson295189b2012-06-20 16:38:30 -070082 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
83 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
84 }
85
86 // This is the old session, should be deleted else where.
87 // We should not be cleaning it here, just set it to NULL.
88 if (pMac->ft.ftPEContext.psavedsessionEntry)
89 {
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 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
95 }
96
97 // This is the extra session we added as part of Auth resp
98 // clean it up.
99 if (pMac->ft.ftPEContext.pftSessionEntry)
100 {
101 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
102 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
106 }
107 pMac->ft.ftPEContext.pftSessionEntry = NULL;
108#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700109 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700110 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111#endif
112 }
113
114 if (pMac->ft.ftPEContext.pAddBssReq)
115 {
116 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
117 pMac->ft.ftPEContext.pAddBssReq = NULL;
118 }
119
120 if (pMac->ft.ftPEContext.pAddStaReq)
121 {
122 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
123 pMac->ft.ftPEContext.pAddStaReq = NULL;
124 }
125
126 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
127
128}
129
130/*--------------------------------------------------------------------------
131 Init FT variables.
132 ------------------------------------------------------------------------*/
133void limFTInit(tpAniSirGlobal pMac)
134{
135 if (pMac->ft.ftPEContext.pFTPreAuthReq)
136 {
137#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700138 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700139 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700140#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800141 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
142 {
143 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
144 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
145 }
146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
148 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
149 }
150
151 // This is the old session, should be deleted else where.
152 // We should not be cleaning it here, just set it to NULL.
153 if (pMac->ft.ftPEContext.psavedsessionEntry)
154 {
155#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700156 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700157 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#endif
159 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
160 }
161
162 // This is the extra session we added as part of Auth resp
163 // clean it up.
164 if (pMac->ft.ftPEContext.pftSessionEntry)
165 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530166
Jeff Johnson295189b2012-06-20 16:38:30 -0700167#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700168 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700169 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700170#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530171 /* Delete the previous valid preauth pesession if it is still in
172 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
173 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
174 * preauth didnt went through and its Session was not deleted.
175 */
176 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
177 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
178 == eLIM_SME_WT_REASSOC_STATE) &&
179 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
180 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
181 {
182 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
183 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
184 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
185 }
186
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 pMac->ft.ftPEContext.pftSessionEntry = NULL;
188 }
189
190 if (pMac->ft.ftPEContext.pAddBssReq)
191 {
192#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700193 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700194 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700195#endif
196 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
197 pMac->ft.ftPEContext.pAddBssReq = NULL;
198 }
199
200
201 if (pMac->ft.ftPEContext.pAddStaReq)
202 {
203#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700204 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700205 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700206#endif
207 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
208 pMac->ft.ftPEContext.pAddStaReq = NULL;
209 }
210
211 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
212
213}
214
215/*------------------------------------------------------------------
216 *
217 * This is the handler after suspending the link.
218 * We suspend the link and then now proceed to switch channel.
219 *
220 *------------------------------------------------------------------*/
221void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
222{
223 tpPESession psessionEntry;
224
225 // The link is suspended of not ?
226 if (status != eHAL_STATUS_SUCCESS)
227 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700228 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 // Post the FT Pre Auth Response to SME
230 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
231
232 return;
233 }
234
235 psessionEntry = (tpPESession)data;
236 // Suspended, now move to a different channel.
237 // Perform some sanity check before proceeding.
238 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
239 {
240 limChangeChannelWithCallback(pMac,
241 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
242 limPerformFTPreAuth, NULL, psessionEntry);
243 return;
244 }
245
246 // Else return error.
247 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
248}
249
250
251/*--------------------------------------------------------------------------
252 In this function, we process the FT Pre Auth Req.
253 We receive Pre-Auth
254 Suspend link
255 Register a call back
256 In the call back, we will need to accept frames from the new bssid
257 Send out the auth req to new AP.
258 Start timer and when the timer is done or if we receive the Auth response
259 We change channel
260 Resume link
261 ------------------------------------------------------------------------*/
262int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
263{
264 int bufConsumed = FALSE;
265 tpPESession psessionEntry;
266 tANI_U8 sessionId;
267
268 // Now we are starting fresh make sure all's cleanup.
269 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530270 // Can set it only after sending auth
271 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
272
273 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
274 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
275 {
276 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
277 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
278 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
280 // We need information from the Pre-Auth Req. Lets save that
281 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
282
283#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800284 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
286 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
287 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
288#endif
289
290 // Get the current session entry
291 psessionEntry = peFindSessionByBssid(pMac,
292 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
293 if (psessionEntry == NULL)
294 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700295 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700296 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
298 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800299 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530300 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
301 {
302 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
303 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
304 }
305 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 return TRUE;
307 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700308#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
309 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
310#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700311
312 // Dont need to suspend if APs are in same channel
313 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
314 {
315 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700316 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700317 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700318 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 (tANI_U32 *)psessionEntry);
320 }
321 else
322 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700323 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700324 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 // We are in the same channel. Perform pre-auth
326 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
327 }
328
329 return bufConsumed;
330}
331
332/*------------------------------------------------------------------
333 * Send the Auth1
334 * Receive back Auth2
335 *------------------------------------------------------------------*/
336void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
337 tpPESession psessionEntry)
338{
339 tSirMacAuthFrameBody authFrame;
340
341 if (psessionEntry->is11Rconnection)
342 {
343 // Only 11r assoc has FT IEs.
344 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
345 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800346 PELOGE(limLog( pMac, LOGE,
347 "%s: FTIEs for Auth Req Seq 1 is absent",
348 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 return;
350 }
351 }
352 if (status != eHAL_STATUS_SUCCESS)
353 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800354 PELOGE(limLog( pMac, LOGE,
355 "%s: Change channel not successful for FT pre-auth",
356 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 return;
358 }
359 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
360
361#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700362 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700363 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700364 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700365#endif
366
367
368 if (psessionEntry->is11Rconnection)
369 {
370 // Now we are on the right channel and need to send out Auth1 and
371 // receive Auth2.
372 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
373 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800374#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 else
376 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800377 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800379 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 }
381#endif
382 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
383 authFrame.authStatusCode = 0;
384
385 // Start timer here to come back to operating channel.
386 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
387 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
388 {
389#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700390 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700391#endif
392 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800393MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700394
395#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800396 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700397#endif
398
399 limSendAuthMgmtFrame(pMac, &authFrame,
400 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
401 LIM_NO_WEP_IN_FC, psessionEntry);
402
403 return;
404}
405
406
407/*------------------------------------------------------------------
408 *
409 * Create the new Add Bss Req to the new AP.
410 * This will be used when we are ready to FT to the new AP.
411 * The newly created ft Session entry is passed to this function
412 *
413 *------------------------------------------------------------------*/
414tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
415 tANI_U8 updateEntry, tpPESession pftSessionEntry,
416 tpSirBssDescription bssDescription )
417{
418 tpAddBssParams pAddBssParams = NULL;
419 tANI_U8 i;
420 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700421 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530423 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
424 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530426 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700427 return eSIR_MEM_ALLOC_FAILED;
428 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700429
430 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530431 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
432 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530436 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 return (eSIR_MEM_ALLOC_FAILED);
438 }
439
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530440 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
442
443 limExtractApCapabilities( pMac,
444 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700445 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700446
447 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700448 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530450 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
451 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
453 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530454 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
455 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
458 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
459
460 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
461
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 pAddBssParams->updateBss = updateEntry;
464
465
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700466 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
467 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
468 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
469 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
471
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700472 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530473 vos_mem_copy(pAddBssParams->rateSet.rate,
474 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700475
476 pAddBssParams->nwType = bssDescription->nwType;
477
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700478 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
480 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
481 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
482 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
483
484 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700485 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700487 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700488
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700491 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
492 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700495 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 (chanWidthSupp) )
497 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700498 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
499 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 }
501 else
502 {
503 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700504 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700506 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
507 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
508 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 }
510 }
511
512 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800513 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
514
515#ifdef WLAN_FEATURE_11AC
516 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
517 {
518 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
519 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
520 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
521 pAddBssParams->currentOperChannel,
522 pAddBssParams->currentExtChannel,
523 pftSessionEntry->apCenterChan,
524 pftSessionEntry);
525 }
526 else
527 {
528 pAddBssParams->vhtCapable = 0;
529 }
530#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700531
532#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700533 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 pAddBssParams->currentOperChannel);
535#endif
536
537
538 // Populate the STA-related parameters here
539 // Note that the STA here refers to the AP
540 {
541 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
542
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530543 vos_mem_copy(pAddBssParams->staContext.bssId,
544 bssDescription->bssId,
545 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
547
548 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
549 pAddBssParams->staContext.uAPSD = 0;
550 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700551 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 pAddBssParams->staContext.updateSta = updateEntry;
553 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
554
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700555 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 {
557 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
558 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700559 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
560 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
561 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 (chanWidthSupp) )
563 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700564 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 }
566 else
567 {
568 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
569 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800570#ifdef WLAN_FEATURE_11AC
571 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
572 {
573 pAddBssParams->staContext.vhtCapable = 1;
574 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
575 pBeaconStruct->VHTCaps.muBeamformerCap) &&
576 pftSessionEntry->txBFIniFeatureEnabled)
577 {
578 pAddBssParams->staContext.vhtTxBFCapable = 1;
579 }
580 }
581#endif
582 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
583 (chanWidthSupp) )
584 {
585 pAddBssParams->staContext.txChannelWidthSet =
586 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
587#ifdef WLAN_FEATURE_11AC
588 if (pAddBssParams->staContext.vhtCapable)
589 {
590 pAddBssParams->staContext.vhtTxChannelWidthSet =
591 pBeaconStruct->VHTOperation.chanWidth;
592 }
593#endif
594 }
595 else
596 {
597 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
598 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700599 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
600 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
601 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
602 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
603 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
604 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
605 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
606 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700607
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700608 if( pBeaconStruct->HTInfo.present )
609 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 }
611
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700612 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
613 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pAddBssParams->staContext.wmmEnabled = 1;
615 else
616 pAddBssParams->staContext.wmmEnabled = 0;
617
618 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700619#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700620 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
621 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700622 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700623#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700624 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700626#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800627 if (pftSessionEntry->htCapability)
628 {
629 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
630 if (pftSessionEntry->vhtCapability)
631 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
632 }
633 else
634 {
635 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
636 {
637 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
638 }
639 else
640 {
641 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
642 }
643 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 }
645
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 //Disable BA. It will be set as part of ADDBA negotiation.
647 for( i = 0; i < STACFG_MAX_TC; i++ )
648 {
649 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
650 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
651 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
652 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
653 }
654
655#if defined WLAN_FEATURE_VOWIFI
656 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
657#endif
658
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800659#ifdef WLAN_FEATURE_11W
660 if (pftSessionEntry->limRmfEnabled)
661 {
662 pAddBssParams->rmfEnabled = 1;
663 pAddBssParams->staContext.rmfEnabled = 1;
664 }
665#endif
666
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 pAddBssParams->status = eHAL_STATUS_SUCCESS;
668 pAddBssParams->respReqd = true;
669
670 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
671 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
672
673 // Set a new state for MLME
674
675 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800676 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 -0700677 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
678
679 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
680
681#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800682 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700683#endif
684
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530685 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 return 0;
687}
688
689/*------------------------------------------------------------------
690 *
691 * Setup the new session for the pre-auth AP.
692 * Return the newly created session entry.
693 *
694 *------------------------------------------------------------------*/
695tpPESession limFillFTSession(tpAniSirGlobal pMac,
696 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
697{
698 tpPESession pftSessionEntry;
699 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 tPowerdBm localPowerConstraint;
701 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700702 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800703 uint32 selfDot11Mode;
704 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700705
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530706 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
707 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700708 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530709 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700710 return NULL;
711 }
712
Jeff Johnson295189b2012-06-20 16:38:30 -0700713
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800714
715 /* Retrieve the session that has already been created and update the entry */
716 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800717#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700718 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700719#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
721 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
722 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
723 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
724
725 // Fields to be filled later
726 pftSessionEntry->pLimJoinReq = NULL;
727 pftSessionEntry->smeSessionId = 0;
728 pftSessionEntry->transactionId = 0;
729
730 limExtractApCapabilities( pMac,
731 (tANI_U8 *) pbssDescription->ieFields,
732 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700733 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700735 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530736 vos_mem_copy(pftSessionEntry->rateSet.rate,
737 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700739 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530740 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700741 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700742
743
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700744 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530745 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 pftSessionEntry->ssId.length);
747
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800748 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
749 pftSessionEntry->dot11mode = selfDot11Mode;
750 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
751 && pBeaconStruct->VHTCaps.present);
752 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
753 && pBeaconStruct->HTCaps.present);
754#ifdef WLAN_FEATURE_11AC
755 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
756 {
757 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
758 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
759 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
760 }
761 else
762 {
763 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
764 }
765#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 // Self Mac
767 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
768 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800769#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700770 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700771#endif
772
773 /* Store beaconInterval */
774 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
775 pftSessionEntry->bssType = psessionEntry->bssType;
776
777 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
778 pftSessionEntry->nwType = pbssDescription->nwType;
779
780 /* Copy The channel Id to the session Table */
781 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
782 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
783
784
785 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
786 {
787 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
788 }
789 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
790 {
791 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
792 }
793 else
794 {
795 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700796 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 }
798
799 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
800 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800801 if( pMac->roam.configParam.shortSlotTime &&
802 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
803 {
804 pftSessionEntry->shortSlotTimeSupported = TRUE;
805 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700806
807 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
808 localPowerConstraint = regMax;
809 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
810 limGetIElenFromBssDescription(pbssDescription),
811 &pftSessionEntry->limCurrentBssQosCaps,
812 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700813 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700814
815 pftSessionEntry->limReassocBssQosCaps =
816 pftSessionEntry->limCurrentBssQosCaps;
817 pftSessionEntry->limReassocBssPropCap =
818 pftSessionEntry->limCurrentBssPropCap;
819
820
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800821#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800822 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
823#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800825#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700826
827#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800828 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 -0800829 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700830#endif
831
832 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
833
834 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
835 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800836 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700837
838 pftSessionEntry->encryptType = psessionEntry->encryptType;
839
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800840 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
841 {
842 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
843 }
844 else
845 {
846 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
847 }
848 pftSessionEntry->htSupportedChannelWidthSet =
849 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
850 pftSessionEntry->htRecommendedTxWidthSet =
851 pftSessionEntry->htSupportedChannelWidthSet;
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800852
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530853 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 return pftSessionEntry;
855}
856
857/*------------------------------------------------------------------
858 *
859 * Setup the session and the add bss req for the pre-auth AP.
860 *
861 *------------------------------------------------------------------*/
862void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
863{
864 tpPESession pftSessionEntry;
865
866 // Prepare the session right now with as much as possible.
867 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
868
869 if (pftSessionEntry)
870 {
871 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800872#ifdef FEATURE_WLAN_ESE
873 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700874#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800875#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
877#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700878
879#ifdef FEATURE_WLAN_LFR
880 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
881#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800882#ifdef WLAN_FEATURE_11W
883 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
884#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
886 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
887 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
888 }
889}
890
891/*------------------------------------------------------------------
892 * Resume Link Call Back
893 *------------------------------------------------------------------*/
894void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
895{
896 tpPESession psessionEntry;
897
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700898 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
899 return;
900
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 psessionEntry = (tpPESession)data;
902
903 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
904 {
905 limFTSetupAuthSession(pMac, psessionEntry);
906 }
907
908 // Post the FT Pre Auth Response to SME
909 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
910 pMac->ft.ftPEContext.saved_auth_rsp,
911 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
912
913}
914
915/*------------------------------------------------------------------
916 * Resume Link Call Back
917 *------------------------------------------------------------------*/
918void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
919 tpPESession psessionEntry)
920{
921 //Set the resume channel to Any valid channel (invalid).
922 //This will instruct HAL to set it to any previous valid channel.
923 peSetResumeChannel(pMac, 0, 0);
924 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
925}
926
927tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
928 tANI_U8 *ric_ies, tANI_U32 *ieLength)
929{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530930 /* BlockACK + RIC is not supported now, TODO later to support this */
931#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 tDot11fIERICDataDesc ricIe;
933 tDot11fFfBAStartingSequenceControl baSsnControl;
934 tDot11fFfAddBAParameterSet baParamSet;
935 tDot11fFfBATimeout baTimeout;
936
937 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
938 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
939 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
940 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
941
942 ricIe.present = 1;
943 ricIe.RICData.present = 1;
944 ricIe.RICData.resourceDescCount = 1;
945 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
946 ricIe.RICDescriptor.present = 1;
947 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
948 baParamSet.tid = tid;
949 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
950 baParamSet.bufferSize = pTrafficClass->txBufSize;
951 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
952 baSsnControl.fragNumber = 0;
953 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530954 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700955 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
956 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
957 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
958 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530959 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700960 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
961 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
962 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
963 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530964 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700965 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
966 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
967 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
968 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530970#endif
971
972 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700973}
974
975tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
976{
977 tANI_U8 tid = 0;
978 tpDphHashNode pSta;
979 tANI_U16 numBA = 0, aid = 0;
980 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
981 tANI_U32 offset = 0, ieLength = 0;
982 tSirRetStatus status = eSIR_SUCCESS;
983
984 // First, extract the DPH entry
985 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
986 if( NULL == pSta )
987 {
988 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800989 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
990 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 return eSIR_FAILURE;
992 }
993
994 for (tid = 0; tid < STACFG_MAX_TC; tid++)
995 {
996 if (pSta->tcCfg[tid].fUseBATx)
997 {
998 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
999 if (eSIR_SUCCESS == status)
1000 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001001 // TODO RIC
1002 if ( ieLength > MAX_FTIE_SIZE )
1003 {
1004 ieLength = 0;
1005 return status;
1006 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 offset += ieLength;
1008 *ric_ies_length += ieLength;
1009 numBA++;
1010 }
1011 else
1012 {
1013 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1014 }
1015 }
1016 }
1017
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001018 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 -07001019 return status;
1020}
1021
1022/*------------------------------------------------------------------
1023 *
1024 * Will post pre auth response to SME.
1025 *
1026 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001027void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001028 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1029 tpPESession psessionEntry)
1030{
1031 tpSirFTPreAuthRsp pFTPreAuthRsp;
1032 tSirMsgQ mmhMsg;
1033 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001034 // TODO: RIC Support
1035 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001036
1037 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301038 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001039 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001040 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001041 VOS_ASSERT(pFTPreAuthRsp != NULL);
1042 return;
1043 }
1044 vos_mem_zero( pFTPreAuthRsp, rspLen);
1045#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001046 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001047#endif
1048
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301049 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001050 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1051 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1052 pFTPreAuthRsp->status = status;
1053 if (psessionEntry)
1054 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1055
1056 // The bssid of the AP we are sending Auth1 to.
1057 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1058 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1059 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1060
1061 // Attach the auth response now back to SME
1062 pFTPreAuthRsp->ft_ies_length = 0;
1063 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1064 {
1065 // Only 11r assoc has FT IEs.
1066 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1067 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1068 }
1069
1070#ifdef WLAN_FEATURE_VOWIFI_11R
1071 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1072 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001073 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1074 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1076 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1077 if (eSIR_SUCCESS != sirStatus)
1078 {
1079 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1080 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001081 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 }
1083#endif
1084
1085 mmhMsg.type = pFTPreAuthRsp->messageType;
1086 mmhMsg.bodyptr = pFTPreAuthRsp;
1087 mmhMsg.bodyval = 0;
1088
1089#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001090 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001091#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001092#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001093 if (status == eSIR_SUCCESS)
1094 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1095 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001096#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001097 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1098}
1099
1100/*------------------------------------------------------------------
1101 *
1102 * Send the FT Pre Auth Response to SME when ever we have a status
1103 * ready to be sent to SME
1104 *
1105 * SME will be the one to send it up to the supplicant to receive
1106 * FTIEs which will be required for Reassoc Req.
1107 *
1108 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001109void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1111 tpPESession psessionEntry)
1112{
1113
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001114 tpPESession pftSessionEntry;
1115 tANI_U8 sessionId;
1116 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001117#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1118 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1119#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001120
Jeff Johnson295189b2012-06-20 16:38:30 -07001121 // Save the status of pre-auth
1122 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1123
1124 // Save the auth rsp, so we can send it to
1125 // SME once we resume link.
1126 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1127 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1128 {
1129 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1130 auth_rsp, auth_rsp_length);
1131 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1132 }
1133
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001134 /* Create FT session for the re-association at this point */
1135 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1136 {
1137 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1138 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1139 &sessionId, pMac->lim.maxStation)) == NULL)
1140 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001141 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001142 return;
1143 }
1144 pftSessionEntry->peSessionId = sessionId;
1145 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1146 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1147 pftSessionEntry->bssType = psessionEntry->bssType;
1148
1149 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1150 {
1151 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1152 }
1153 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1154 {
1155 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1156 }
1157 else
1158 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001159 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001160 }
1161 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1162 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1163 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001164 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001165 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1166
1167 /* Update the ReAssoc BSSID of the current session */
1168 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001169 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001170 }
1171
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 if (psessionEntry->currentOperChannel !=
1173 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1174 {
1175 // Need to move to the original AP channel
1176 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1177 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1178 }
1179 else
1180 {
1181#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001182 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1184#endif
1185 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1186 }
1187}
1188
1189/*------------------------------------------------------------------
1190 *
1191 * This function handles the 11R Reassoc Req from SME
1192 *
1193 *------------------------------------------------------------------*/
1194void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1195 tpPESession psessionEntry)
1196{
1197 tANI_U8 smeSessionId = 0;
1198 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001199 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 tLimMlmReassocReq *pMlmReassocReq;
1201 tANI_U16 caps;
1202 tANI_U32 val;
1203 tSirMsgQ msgQ;
1204 tSirRetStatus retCode;
1205 tANI_U32 teleBcnEn = 0;
1206
Jeff Johnson278b0492013-04-03 14:10:08 -07001207 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1209 psessionEntry->smeSessionId = smeSessionId;
1210 psessionEntry->transactionId = transactionId;
1211
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001212#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1213 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1214#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001215
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301216 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1217 {
1218 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1219 return;
1220 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301221 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1222 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 {
1224 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301225 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 return;
1227 }
1228
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301229 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1230 psessionEntry->bssId,
1231 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001232
1233 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1234 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1235 != eSIR_SUCCESS)
1236 {
1237 /**
1238 * Could not get ReassocFailureTimeout value
1239 * from CFG. Log error.
1240 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001241 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301242 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 return;
1244 }
1245
1246 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1247 {
1248 /**
1249 * Could not get Capabilities value
1250 * from CFG. Log error.
1251 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001252 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301253 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001254 return;
1255 }
1256 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001257
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 /* Update PE sessionId*/
1259 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1260
1261 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001262 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1263 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001265 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301266 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001267 return;
1268 }
1269
1270 if (teleBcnEn)
1271 {
1272 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001273 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001274 /**
1275 * Could not get ListenInterval value
1276 * from CFG. Log error.
1277 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001278 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301279 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001281 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 }
1283 else
1284 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001285 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 {
1287 /**
1288 * Could not get ListenInterval value
1289 * from CFG. Log error.
1290 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001291 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301292 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 return;
1294 }
1295 }
1296 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001297 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001298 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301299 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001300 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 }
1302
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 pMlmReassocReq->listenInterval = (tANI_U16) val;
1304
1305 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1306
1307
1308 //we need to defer the message until we get the response back from HAL.
1309 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001310
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1312 msgQ.reserved = 0;
1313 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1314 msgQ.bodyval = 0;
1315
1316
1317#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001318 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001319#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001320 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001321
1322 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001323 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001324 {
1325 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001326 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 retCode );
1328 }
1329 // Dont need this anymore
1330 pMac->ft.ftPEContext.pAddBssReq = NULL;
1331 return;
1332}
1333
1334/*------------------------------------------------------------------
1335 *
1336 * This function is called if preauth response is not received from the AP
1337 * within this timeout while FT in progress
1338 *
1339 *------------------------------------------------------------------*/
1340void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1341{
1342 tpPESession psessionEntry;
1343
1344 // We have failed pre auth. We need to resume link and get back on
1345 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301346 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001347
1348 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1349 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001350 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 return;
1352 }
1353
Abhishek Singh8a226222014-03-13 14:49:16 +05301354 /* To handle the race condition where we recieve preauth rsp after
1355 * timer has expired.
1356 */
1357 if (eANI_BOOLEAN_TRUE ==
1358 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1359 {
1360 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1361 " (session %p)"), psessionEntry);
1362 return;
1363 }
1364 else
1365 {
1366 /* Here we are sending preauth rsp with failure state
1367 * and which is forwarded to SME. Now, if we receive an preauth
1368 * resp from AP with success it would create a FT pesession, but
1369 * will be dropped in SME leaving behind the pesession.
1370 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1371 * limProcessAuthFrameNoSession.
1372 */
1373 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1374 " (session %p)"), psessionEntry);
1375 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1376 eANI_BOOLEAN_TRUE;
1377 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1379 // to get back.
1380 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1381}
1382
1383
1384/*------------------------------------------------------------------
1385 *
1386 * This function is called to process the update key request from SME
1387 *
1388 *------------------------------------------------------------------*/
1389tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1390{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301391 tAddBssParams * pAddBssParams;
1392 tSirFTUpdateKeyInfo * pKeyInfo;
1393 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001394
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301395 /* Sanity Check */
1396 if( pMac == NULL || pMsgBuf == NULL )
1397 {
1398 return TRUE;
1399 }
1400 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1401 {
1402 limLog( pMac, LOGE,
1403 FL( "pAddBssReq is NULL" ));
1404 return TRUE;
1405 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001406
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301407 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1408 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001409
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301410 /* Store the key information in the ADD BSS parameters */
1411 pAddBssParams->extSetStaKeyParamValid = 1;
1412 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301413 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1414 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301415 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1416 {
1417 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1418 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301420 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1421 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1422 pAddBssParams->extSetStaKeyParamValid,
1423 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001424
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301425 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1426
1427 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001428 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301429
1430 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1431 {
1432 PELOG1(limLog(pMac, LOG1,
1433 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1434 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1435 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1436 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1437 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1438 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1439 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1440 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1441 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1442 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1443 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1444 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1445 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1446 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1451 }
1452
1453 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001454}
1455
1456tSirRetStatus
1457limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1458{
1459 tSirMsgQ msg;
1460 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1461 tpAggrAddTsParams pAggrAddTsParam;
1462 tpPESession psessionEntry = NULL;
1463 tpLimTspecInfo tspecInfo;
1464 tANI_U8 ac;
1465 tpDphHashNode pSta;
1466 tANI_U16 aid;
1467 tANI_U8 sessionId;
1468 int i;
1469
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301470 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1471 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301473 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001474 return eSIR_MEM_ALLOC_FAILED;
1475 }
1476
1477 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1478
1479 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001480 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301481 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 return eSIR_FAILURE;
1483 }
1484
1485 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1486 if (pSta == NULL)
1487 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001488 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301489 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 return eSIR_FAILURE;
1491 }
1492
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301493 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1494 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 pAggrAddTsParam->staIdx = psessionEntry->staId;
1496 // Fill in the sessionId specific to PE
1497 pAggrAddTsParam->sessionId = sessionId;
1498 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1499
1500 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1501 {
1502 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1503 {
1504 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1505 /* Since AddTS response was successful, check for the PSB flag
1506 * and directional flag inside the TS Info field.
1507 * An AC is trigger enabled AC if the PSB subfield is set to 1
1508 * in the uplink direction.
1509 * An AC is delivery enabled AC if the PSB subfield is set to 1
1510 * in the downlink direction.
1511 * An AC is trigger and delivery enabled AC if the PSB subfield
1512 * is set to 1 in the bi-direction field.
1513 */
1514 if (pTspec->tsinfo.traffic.psb == 1)
1515 {
1516 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1517 }
1518 else
1519 {
1520 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1521 }
1522 /* ADDTS success, so AC is now admitted. We shall now use the default
1523 * EDCA parameters as advertised by AP and send the updated EDCA params
1524 * to HAL.
1525 */
1526 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1527 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1528 {
1529 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1530 }
1531 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1532 {
1533 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1534 }
1535 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1536 {
1537 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1538 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1539 }
1540
1541 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1542
1543 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1544 {
1545 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1546 }
1547 else
1548 {
1549 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1550 }
1551
1552 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1553 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001554 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301556 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001557 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1558 }
1559
1560 // Copy the TSPEC paramters
1561 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1562 }
1563 }
1564
1565 msg.type = WDA_AGGR_QOS_REQ;
1566 msg.bodyptr = pAggrAddTsParam;
1567 msg.bodyval = 0;
1568
1569 /* We need to defer any incoming messages until we get a
1570 * WDA_AGGR_QOS_RSP from HAL.
1571 */
1572 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001573 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001574
1575 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1576 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001577 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001578 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301579 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 return eSIR_FAILURE;
1581 }
1582
1583 return eSIR_SUCCESS;
1584}
1585
1586void
1587limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1588 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1589{
1590 tpSirAggrQosRsp rsp;
1591 int i = 0;
1592
1593 if (! rspReqd)
1594 {
1595 return;
1596 }
1597
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301598 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1599 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301601 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 return;
1603 }
1604
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301605 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1607 rsp->sessionId = smesessionId;
1608 rsp->length = sizeof(*rsp);
1609 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1610
1611 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1612 {
1613 if( (1 << i) & aggrQosRsp->tspecIdx )
1614 {
1615 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1616 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1617 }
1618 }
1619
1620 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1621 return;
1622}
1623
1624
1625void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1626{
1627 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1628 //tpAggrQosParams pAggrQosRspMsg = NULL;
1629 tAddTsParams addTsParam = {0};
1630 tpDphHashNode pSta = NULL;
1631 tANI_U16 assocId =0;
1632 tSirMacAddr peerMacAddr;
1633 tANI_U8 rspReqd = 1;
1634 tpPESession psessionEntry = NULL;
1635 int i = 0;
1636
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001637 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001638
1639 /* Need to process all the deferred messages enqueued since sending the
1640 SIR_HAL_AGGR_ADD_TS_REQ */
1641 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1642
1643 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1644 if (NULL == pAggrQosRspMsg)
1645 {
1646 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1647 return;
1648 }
1649
1650 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1651 if (NULL == psessionEntry)
1652 {
1653 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001654 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 if( pAggrQosRspMsg != NULL )
1656 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301657 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 }
1659 return;
1660 }
1661
1662 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1663 {
1664 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1665 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1666 {
1667 /* send DELTS to the station */
1668 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1669
1670 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1671 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1672 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1673 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1674
1675 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1676 &addTsParam.tspec.tsinfo,
1677 &addTsParam.tspec, psessionEntry);
1678
1679 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1680 &psessionEntry->dph.dphHashTable);
1681 if (pSta != NULL)
1682 {
1683 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1684 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1685 }
1686 }
1687 }
1688
1689 /* Send the Aggr QoS response to SME */
1690
1691 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1692 psessionEntry->smeSessionId);
1693 if( pAggrQosRspMsg != NULL )
1694 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301695 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001696 }
1697 return;
1698}
1699
Jeff Johnson295189b2012-06-20 16:38:30 -07001700#endif /* WLAN_FEATURE_VOWIFI_11R */