blob: 3af32ea0d3651c46004efe7e15b2497f7b53ecc1 [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"
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053051#include "vos_utils.h"
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053052
Jeff Johnson295189b2012-06-20 16:38:30 -070053#define LIM_FT_RIC_BA_SSN 1
54#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
55#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053056#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070057
58/*--------------------------------------------------------------------------
59 Initialize the FT variables.
60 ------------------------------------------------------------------------*/
61void limFTOpen(tpAniSirGlobal pMac)
62{
63 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
64 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
65}
66
67/*--------------------------------------------------------------------------
68 Cleanup FT variables.
69 ------------------------------------------------------------------------*/
70void limFTCleanup(tpAniSirGlobal pMac)
71{
72 if (pMac->ft.ftPEContext.pFTPreAuthReq)
73 {
74#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070075 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070076 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070077#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080078 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
79 {
80 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
81 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
82 }
Jeff Johnson295189b2012-06-20 16:38:30 -070083 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
84 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
85 }
86
87 // This is the old session, should be deleted else where.
88 // We should not be cleaning it here, just set it to NULL.
89 if (pMac->ft.ftPEContext.psavedsessionEntry)
90 {
91#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070092 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070093 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070094#endif
95 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
96 }
97
98 // This is the extra session we added as part of Auth resp
99 // clean it up.
100 if (pMac->ft.ftPEContext.pftSessionEntry)
101 {
102 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
103 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
104 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700105 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700106 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
107 }
108 pMac->ft.ftPEContext.pftSessionEntry = NULL;
109#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700110 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700111 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700112#endif
113 }
114
115 if (pMac->ft.ftPEContext.pAddBssReq)
116 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +0530117 vos_mem_zero(pMac->ft.ftPEContext.pAddBssReq, sizeof(tAddBssParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700118 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
119 pMac->ft.ftPEContext.pAddBssReq = NULL;
120 }
121
122 if (pMac->ft.ftPEContext.pAddStaReq)
123 {
124 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
125 pMac->ft.ftPEContext.pAddStaReq = NULL;
126 }
127
128 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
129
130}
131
132/*--------------------------------------------------------------------------
133 Init FT variables.
134 ------------------------------------------------------------------------*/
135void limFTInit(tpAniSirGlobal pMac)
136{
137 if (pMac->ft.ftPEContext.pFTPreAuthReq)
138 {
139#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700140 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700141 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700142#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800143 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
144 {
145 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
146 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
147 }
148
Jeff Johnson295189b2012-06-20 16:38:30 -0700149 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
150 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
151 }
152
153 // This is the old session, should be deleted else where.
154 // We should not be cleaning it here, just set it to NULL.
155 if (pMac->ft.ftPEContext.psavedsessionEntry)
156 {
157#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700158 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700159 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700160#endif
161 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
162 }
163
164 // This is the extra session we added as part of Auth resp
165 // clean it up.
166 if (pMac->ft.ftPEContext.pftSessionEntry)
167 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530168
Jeff Johnson295189b2012-06-20 16:38:30 -0700169#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700170 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700171 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530173 /* Delete the previous valid preauth pesession if it is still in
174 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
175 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
176 * preauth didnt went through and its Session was not deleted.
177 */
178 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
179 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
180 == eLIM_SME_WT_REASSOC_STATE) &&
181 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
182 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
183 {
184 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
185 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
186 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
187 }
188
Jeff Johnson295189b2012-06-20 16:38:30 -0700189 pMac->ft.ftPEContext.pftSessionEntry = NULL;
190 }
191
192 if (pMac->ft.ftPEContext.pAddBssReq)
193 {
194#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700195 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700196 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700197#endif
198 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
199 pMac->ft.ftPEContext.pAddBssReq = NULL;
200 }
201
202
203 if (pMac->ft.ftPEContext.pAddStaReq)
204 {
205#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700206 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700207 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700208#endif
209 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
210 pMac->ft.ftPEContext.pAddStaReq = NULL;
211 }
212
213 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
214
215}
216
217/*------------------------------------------------------------------
218 *
219 * This is the handler after suspending the link.
220 * We suspend the link and then now proceed to switch channel.
221 *
222 *------------------------------------------------------------------*/
223void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
224{
225 tpPESession psessionEntry;
226
227 // The link is suspended of not ?
228 if (status != eHAL_STATUS_SUCCESS)
229 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700230 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 // Post the FT Pre Auth Response to SME
232 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
233
234 return;
235 }
236
237 psessionEntry = (tpPESession)data;
238 // Suspended, now move to a different channel.
239 // Perform some sanity check before proceeding.
240 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
241 {
242 limChangeChannelWithCallback(pMac,
243 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
244 limPerformFTPreAuth, NULL, psessionEntry);
245 return;
246 }
247
248 // Else return error.
249 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
250}
251
252
253/*--------------------------------------------------------------------------
254 In this function, we process the FT Pre Auth Req.
255 We receive Pre-Auth
256 Suspend link
257 Register a call back
258 In the call back, we will need to accept frames from the new bssid
259 Send out the auth req to new AP.
260 Start timer and when the timer is done or if we receive the Auth response
261 We change channel
262 Resume link
263 ------------------------------------------------------------------------*/
264int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
265{
266 int bufConsumed = FALSE;
267 tpPESession psessionEntry;
268 tANI_U8 sessionId;
269
270 // Now we are starting fresh make sure all's cleanup.
271 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530272 // Can set it only after sending auth
273 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
274
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 // We need information from the Pre-Auth Req. Lets save that
276 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
277
278#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +0530279 PELOGE(limLog( pMac, LOG1, "%s: PRE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700280 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
281 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
282 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
283#endif
284
285 // Get the current session entry
286 psessionEntry = peFindSessionByBssid(pMac,
287 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
288 if (psessionEntry == NULL)
289 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700290 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700291 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700292 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
293 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800294 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530295 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
296 {
297 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
298 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
299 }
300 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 return TRUE;
302 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700303#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
304 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
305#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700306
307 // Dont need to suspend if APs are in same channel
308 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
309 {
310 // Need to suspend link only if the channels are different
Abhishek Singh525045c2014-12-15 17:18:45 +0530311 limLog(pMac, LOG1, FL(" Performing pre-auth on different"
312 " channel (session %p)"), psessionEntry);
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700313 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 (tANI_U32 *)psessionEntry);
315 }
316 else
317 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530318 limLog(pMac, LOG1, FL(" Performing pre-auth on same"
319 " channel (session %p)"), psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 // We are in the same channel. Perform pre-auth
321 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
322 }
323
324 return bufConsumed;
325}
326
327/*------------------------------------------------------------------
328 * Send the Auth1
329 * Receive back Auth2
330 *------------------------------------------------------------------*/
331void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
332 tpPESession psessionEntry)
333{
334 tSirMacAuthFrameBody authFrame;
335
336 if (psessionEntry->is11Rconnection)
337 {
338 // Only 11r assoc has FT IEs.
339 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
340 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800341 PELOGE(limLog( pMac, LOGE,
342 "%s: FTIEs for Auth Req Seq 1 is absent",
343 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530344 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700345 }
346 }
347 if (status != eHAL_STATUS_SUCCESS)
348 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800349 PELOGE(limLog( pMac, LOGE,
350 "%s: Change channel not successful for FT pre-auth",
351 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530352 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 }
354 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
355
356#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Abhishek Singh525045c2014-12-15 17:18:45 +0530357 limLog(pMac, LOG1, FL("Entered wait auth2 state for FT"
358 " (old session %p)"),
359 pMac->ft.ftPEContext.psavedsessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700360#endif
361
362
363 if (psessionEntry->is11Rconnection)
364 {
365 // Now we are on the right channel and need to send out Auth1 and
366 // receive Auth2.
367 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
368 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800369#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 else
371 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800372 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800374 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 }
376#endif
377 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
378 authFrame.authStatusCode = 0;
379
380 // Start timer here to come back to operating channel.
381 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
382 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
383 {
384#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700385 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700386#endif
387 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800388MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
390#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800391 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700392#endif
393
394 limSendAuthMgmtFrame(pMac, &authFrame,
395 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
396 LIM_NO_WEP_IN_FC, psessionEntry);
397
398 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530399preauth_fail:
400 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
401 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700402}
403
404
405/*------------------------------------------------------------------
406 *
407 * Create the new Add Bss Req to the new AP.
408 * This will be used when we are ready to FT to the new AP.
409 * The newly created ft Session entry is passed to this function
410 *
411 *------------------------------------------------------------------*/
412tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
413 tANI_U8 updateEntry, tpPESession pftSessionEntry,
414 tpSirBssDescription bssDescription )
415{
416 tpAddBssParams pAddBssParams = NULL;
417 tANI_U8 i;
418 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700419 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700420
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530421 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
422 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700423 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530424 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 return eSIR_MEM_ALLOC_FAILED;
426 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700427
428 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530429 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
430 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700431 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530432 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 return (eSIR_MEM_ALLOC_FAILED);
436 }
437
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530438 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440
441 limExtractApCapabilities( pMac,
442 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700444
445 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700446 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700447
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530448 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
449 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
451 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530452 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
453 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
455 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
456 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
457
458 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
459
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700460 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 pAddBssParams->updateBss = updateEntry;
462
463
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700464 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
465 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
466 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
467 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700468
469
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530471 vos_mem_copy(pAddBssParams->rateSet.rate,
472 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
474 pAddBssParams->nwType = bssDescription->nwType;
475
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700476 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
478 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
479 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
480 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
481
482 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700483 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700485 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700487 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
490 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700491
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700493 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 (chanWidthSupp) )
495 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700496 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
497 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 }
499 else
500 {
501 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700502 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700504 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
505 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
506 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 }
508 }
509
510 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800511 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
512
513#ifdef WLAN_FEATURE_11AC
514 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
515 {
516 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
517 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
518 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
519 pAddBssParams->currentOperChannel,
520 pAddBssParams->currentExtChannel,
521 pftSessionEntry->apCenterChan,
522 pftSessionEntry);
523 }
524 else
525 {
526 pAddBssParams->vhtCapable = 0;
527 }
528#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700529
530#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700531 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 pAddBssParams->currentOperChannel);
533#endif
534
535
536 // Populate the STA-related parameters here
537 // Note that the STA here refers to the AP
538 {
539 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
540
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530541 vos_mem_copy(pAddBssParams->staContext.bssId,
542 bssDescription->bssId,
543 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
545
546 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
547 pAddBssParams->staContext.uAPSD = 0;
548 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700549 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pAddBssParams->staContext.updateSta = updateEntry;
551 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
552
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700553 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 {
555 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
556 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700557 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
558 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
559 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 (chanWidthSupp) )
561 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700562 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 }
564 else
565 {
566 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
567 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800568#ifdef WLAN_FEATURE_11AC
569 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
570 {
571 pAddBssParams->staContext.vhtCapable = 1;
572 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
573 pBeaconStruct->VHTCaps.muBeamformerCap) &&
574 pftSessionEntry->txBFIniFeatureEnabled)
575 {
576 pAddBssParams->staContext.vhtTxBFCapable = 1;
577 }
578 }
579#endif
580 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
581 (chanWidthSupp) )
582 {
583 pAddBssParams->staContext.txChannelWidthSet =
584 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
585#ifdef WLAN_FEATURE_11AC
586 if (pAddBssParams->staContext.vhtCapable)
587 {
588 pAddBssParams->staContext.vhtTxChannelWidthSet =
589 pBeaconStruct->VHTOperation.chanWidth;
590 }
591#endif
592 }
593 else
594 {
595 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
596 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700597 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
598 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
599 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
600 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
601 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
602 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
603 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
604 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700605
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700606 if( pBeaconStruct->HTInfo.present )
607 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 }
609
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700610 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
611 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700612 pAddBssParams->staContext.wmmEnabled = 1;
613 else
614 pAddBssParams->staContext.wmmEnabled = 0;
615
616 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700617#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700618 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
619 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700620 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700621#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700622 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700624#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800625 if (pftSessionEntry->htCapability)
626 {
627 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
628 if (pftSessionEntry->vhtCapability)
629 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
630 }
631 else
632 {
633 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
634 {
635 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
636 }
637 else
638 {
639 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
640 }
641 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 }
643
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 //Disable BA. It will be set as part of ADDBA negotiation.
645 for( i = 0; i < STACFG_MAX_TC; i++ )
646 {
647 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
648 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
649 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
650 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
651 }
652
653#if defined WLAN_FEATURE_VOWIFI
654 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
655#endif
656
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800657#ifdef WLAN_FEATURE_11W
658 if (pftSessionEntry->limRmfEnabled)
659 {
660 pAddBssParams->rmfEnabled = 1;
661 pAddBssParams->staContext.rmfEnabled = 1;
662 }
663#endif
664
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 pAddBssParams->status = eHAL_STATUS_SUCCESS;
666 pAddBssParams->respReqd = true;
667
668 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
669 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
670
671 // Set a new state for MLME
672
673 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800674 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 -0700675 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
676
677 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
678
679#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800680 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700681#endif
682
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530683 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 return 0;
685}
686
687/*------------------------------------------------------------------
688 *
689 * Setup the new session for the pre-auth AP.
690 * Return the newly created session entry.
691 *
692 *------------------------------------------------------------------*/
693tpPESession limFillFTSession(tpAniSirGlobal pMac,
694 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
695{
696 tpPESession pftSessionEntry;
697 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700698 tPowerdBm localPowerConstraint;
699 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700700 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800701 uint32 selfDot11Mode;
702 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700703
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530704 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
705 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700706 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530707 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700708 return NULL;
709 }
710
Jeff Johnson295189b2012-06-20 16:38:30 -0700711
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800712
713 /* Retrieve the session that has already been created and update the entry */
714 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800715#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700716 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700717#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
719 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
720 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
721 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
722
723 // Fields to be filled later
724 pftSessionEntry->pLimJoinReq = NULL;
725 pftSessionEntry->smeSessionId = 0;
726 pftSessionEntry->transactionId = 0;
727
728 limExtractApCapabilities( pMac,
729 (tANI_U8 *) pbssDescription->ieFields,
730 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700731 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700732
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700733 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530734 vos_mem_copy(pftSessionEntry->rateSet.rate,
735 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700736
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700737 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530738 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700739 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
741
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700742 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530743 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700744 pftSessionEntry->ssId.length);
745
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800746 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
Mukul Sharma45063942015-04-01 20:07:59 +0530747 limLog(pMac, LOG1, FL("selfDot11Mode %d"),selfDot11Mode );
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800748 pftSessionEntry->dot11mode = selfDot11Mode;
749 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
750 && pBeaconStruct->VHTCaps.present);
751 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
752 && pBeaconStruct->HTCaps.present);
753#ifdef WLAN_FEATURE_11AC
754 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
755 {
756 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
757 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
758 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
759 }
760 else
761 {
762 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
763 }
764#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 // Self Mac
766 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
767 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800768#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700769 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700770#endif
771
772 /* Store beaconInterval */
773 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
774 pftSessionEntry->bssType = psessionEntry->bssType;
775
776 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
777 pftSessionEntry->nwType = pbssDescription->nwType;
778
779 /* Copy The channel Id to the session Table */
780 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
781 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
782
783
784 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
785 {
786 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
787 }
788 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
789 {
790 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
791 }
792 else
793 {
794 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700795 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700796 }
797
798 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
799 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800800 if( pMac->roam.configParam.shortSlotTime &&
801 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
802 {
803 pftSessionEntry->shortSlotTimeSupported = TRUE;
804 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700805
806 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
807 localPowerConstraint = regMax;
808 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
809 limGetIElenFromBssDescription(pbssDescription),
810 &pftSessionEntry->limCurrentBssQosCaps,
811 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700812 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700813
814 pftSessionEntry->limReassocBssQosCaps =
815 pftSessionEntry->limCurrentBssQosCaps;
816 pftSessionEntry->limReassocBssPropCap =
817 pftSessionEntry->limCurrentBssPropCap;
818
819
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800820#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800821 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
822#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800824#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700825
826#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800827 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 -0800828 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700829#endif
830
831 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
832
833 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
834 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800835 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700836
837 pftSessionEntry->encryptType = psessionEntry->encryptType;
838
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800839 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
840 {
841 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
842 }
843 else
844 {
845 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
846 }
847 pftSessionEntry->htSupportedChannelWidthSet =
848 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
849 pftSessionEntry->htRecommendedTxWidthSet =
850 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530851 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
852 (pftSessionEntry->htSupportedChannelWidthSet == 1))
853 {
854 limInitOBSSScanParams(pMac, pftSessionEntry);
855 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530856 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 return pftSessionEntry;
858}
859
860/*------------------------------------------------------------------
861 *
862 * Setup the session and the add bss req for the pre-auth AP.
863 *
864 *------------------------------------------------------------------*/
865void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
866{
867 tpPESession pftSessionEntry;
868
869 // Prepare the session right now with as much as possible.
870 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
871
872 if (pftSessionEntry)
873 {
874 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800875#ifdef FEATURE_WLAN_ESE
876 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700877#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800878#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
880#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700881
882#ifdef FEATURE_WLAN_LFR
883 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
884#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800885#ifdef WLAN_FEATURE_11W
886 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
887#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
889 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
890 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
891 }
892}
893
894/*------------------------------------------------------------------
895 * Resume Link Call Back
896 *------------------------------------------------------------------*/
897void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
898{
899 tpPESession psessionEntry;
900
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700901 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
902 return;
903
Jeff Johnson295189b2012-06-20 16:38:30 -0700904 psessionEntry = (tpPESession)data;
905
906 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
907 {
908 limFTSetupAuthSession(pMac, psessionEntry);
909 }
910
911 // Post the FT Pre Auth Response to SME
912 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
913 pMac->ft.ftPEContext.saved_auth_rsp,
914 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
915
916}
917
918/*------------------------------------------------------------------
919 * Resume Link Call Back
920 *------------------------------------------------------------------*/
921void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
922 tpPESession psessionEntry)
923{
924 //Set the resume channel to Any valid channel (invalid).
925 //This will instruct HAL to set it to any previous valid channel.
926 peSetResumeChannel(pMac, 0, 0);
927 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
928}
929
930tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
931 tANI_U8 *ric_ies, tANI_U32 *ieLength)
932{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530933 /* BlockACK + RIC is not supported now, TODO later to support this */
934#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 tDot11fIERICDataDesc ricIe;
936 tDot11fFfBAStartingSequenceControl baSsnControl;
937 tDot11fFfAddBAParameterSet baParamSet;
938 tDot11fFfBATimeout baTimeout;
939
940 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
941 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
942 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
943 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
944
945 ricIe.present = 1;
946 ricIe.RICData.present = 1;
947 ricIe.RICData.resourceDescCount = 1;
948 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
949 ricIe.RICDescriptor.present = 1;
950 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
951 baParamSet.tid = tid;
952 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
953 baParamSet.bufferSize = pTrafficClass->txBufSize;
954 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
955 baSsnControl.fragNumber = 0;
956 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530957 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700958 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
959 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
960 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
961 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530962 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700963 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
964 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
965 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
966 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530967 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700968 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
969 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
970 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
971 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530973#endif
974
975 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700976}
977
978tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
979{
980 tANI_U8 tid = 0;
981 tpDphHashNode pSta;
982 tANI_U16 numBA = 0, aid = 0;
983 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
984 tANI_U32 offset = 0, ieLength = 0;
985 tSirRetStatus status = eSIR_SUCCESS;
986
987 // First, extract the DPH entry
988 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
989 if( NULL == pSta )
990 {
991 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800992 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
993 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 return eSIR_FAILURE;
995 }
996
997 for (tid = 0; tid < STACFG_MAX_TC; tid++)
998 {
999 if (pSta->tcCfg[tid].fUseBATx)
1000 {
1001 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1002 if (eSIR_SUCCESS == status)
1003 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001004 // TODO RIC
1005 if ( ieLength > MAX_FTIE_SIZE )
1006 {
1007 ieLength = 0;
1008 return status;
1009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 offset += ieLength;
1011 *ric_ies_length += ieLength;
1012 numBA++;
1013 }
1014 else
1015 {
1016 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1017 }
1018 }
1019 }
1020
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001021 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 -07001022 return status;
1023}
1024
1025/*------------------------------------------------------------------
1026 *
1027 * Will post pre auth response to SME.
1028 *
1029 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001030void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1032 tpPESession psessionEntry)
1033{
1034 tpSirFTPreAuthRsp pFTPreAuthRsp;
1035 tSirMsgQ mmhMsg;
1036 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001037 // TODO: RIC Support
1038 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001039
1040 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301041 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001042 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001043 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 VOS_ASSERT(pFTPreAuthRsp != NULL);
1045 return;
1046 }
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301047
Jeff Johnson295189b2012-06-20 16:38:30 -07001048#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001049 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001050#endif
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301051
1052 vos_mem_zero(pFTPreAuthRsp, rspLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1054 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1055 pFTPreAuthRsp->status = status;
1056 if (psessionEntry)
1057 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1058
1059 // The bssid of the AP we are sending Auth1 to.
1060 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1061 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1062 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1063
1064 // Attach the auth response now back to SME
1065 pFTPreAuthRsp->ft_ies_length = 0;
1066 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1067 {
1068 // Only 11r assoc has FT IEs.
1069 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1070 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1071 }
1072
1073#ifdef WLAN_FEATURE_VOWIFI_11R
1074 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1075 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001076 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1077 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001078 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1079 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1080 if (eSIR_SUCCESS != sirStatus)
1081 {
1082 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1083 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001084 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001085 }
1086#endif
1087
1088 mmhMsg.type = pFTPreAuthRsp->messageType;
1089 mmhMsg.bodyptr = pFTPreAuthRsp;
1090 mmhMsg.bodyval = 0;
1091
1092#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001093 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001094#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001095#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001096 if (status == eSIR_SUCCESS)
1097 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1098 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001099#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1101}
1102
1103/*------------------------------------------------------------------
1104 *
1105 * Send the FT Pre Auth Response to SME when ever we have a status
1106 * ready to be sent to SME
1107 *
1108 * SME will be the one to send it up to the supplicant to receive
1109 * FTIEs which will be required for Reassoc Req.
1110 *
1111 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001112void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001113 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1114 tpPESession psessionEntry)
1115{
1116
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001117 tpPESession pftSessionEntry;
1118 tANI_U8 sessionId;
1119 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001120#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1121 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1122#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001123
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 // Save the status of pre-auth
1125 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1126
1127 // Save the auth rsp, so we can send it to
1128 // SME once we resume link.
1129 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1130 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1131 {
1132 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1133 auth_rsp, auth_rsp_length);
1134 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1135 }
1136
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001137 /* Create FT session for the re-association at this point */
1138 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1139 {
1140 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1141 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1142 &sessionId, pMac->lim.maxStation)) == NULL)
1143 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001144 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301145 status = eSIR_FAILURE;
1146 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1147 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001148 }
1149 pftSessionEntry->peSessionId = sessionId;
1150 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1151 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1152 pftSessionEntry->bssType = psessionEntry->bssType;
1153
1154 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1155 {
1156 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1157 }
1158 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1159 {
1160 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1161 }
1162 else
1163 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001164 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001165 }
1166 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1167 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1168 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001169 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001170 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1171
1172 /* Update the ReAssoc BSSID of the current session */
1173 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001174 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001175 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301176out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 if (psessionEntry->currentOperChannel !=
1178 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1179 {
1180 // Need to move to the original AP channel
1181 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1182 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1183 }
1184 else
1185 {
1186#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001187 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1189#endif
1190 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1191 }
1192}
1193
1194/*------------------------------------------------------------------
1195 *
1196 * This function handles the 11R Reassoc Req from SME
1197 *
1198 *------------------------------------------------------------------*/
1199void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1200 tpPESession psessionEntry)
1201{
1202 tANI_U8 smeSessionId = 0;
1203 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001204 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001205 tLimMlmReassocReq *pMlmReassocReq;
1206 tANI_U16 caps;
1207 tANI_U32 val;
1208 tSirMsgQ msgQ;
1209 tSirRetStatus retCode;
1210 tANI_U32 teleBcnEn = 0;
1211
Jeff Johnson278b0492013-04-03 14:10:08 -07001212 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1214 psessionEntry->smeSessionId = smeSessionId;
1215 psessionEntry->transactionId = transactionId;
1216
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001217#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1218 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1219#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001220
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301221 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1222 {
1223 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1224 return;
1225 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301226 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1227 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 {
1229 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301230 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 return;
1232 }
1233
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301234 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1235 psessionEntry->bssId,
1236 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001237
1238 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1239 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1240 != eSIR_SUCCESS)
1241 {
1242 /**
1243 * Could not get ReassocFailureTimeout value
1244 * from CFG. Log error.
1245 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001246 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301247 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 return;
1249 }
1250
1251 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1252 {
1253 /**
1254 * Could not get Capabilities value
1255 * from CFG. Log error.
1256 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001257 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301258 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001259 return;
1260 }
1261 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001262
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 /* Update PE sessionId*/
1264 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1265
1266 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001267 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1268 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001270 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301271 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001272 return;
1273 }
1274
1275 if (teleBcnEn)
1276 {
1277 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001278 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 /**
1280 * Could not get ListenInterval value
1281 * from CFG. Log error.
1282 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001283 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301284 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001286 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 }
1288 else
1289 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001290 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001291 {
1292 /**
1293 * Could not get ListenInterval value
1294 * from CFG. Log error.
1295 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001296 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301297 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001298 return;
1299 }
1300 }
1301 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001302 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301304 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001305 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 }
1307
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 pMlmReassocReq->listenInterval = (tANI_U16) val;
1309
1310 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1311
1312
1313 //we need to defer the message until we get the response back from HAL.
1314 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001315
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1317 msgQ.reserved = 0;
1318 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1319 msgQ.bodyval = 0;
1320
1321
1322#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001323 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001324#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001325 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
1327 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001328 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 {
1330 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001331 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 retCode );
1333 }
1334 // Dont need this anymore
1335 pMac->ft.ftPEContext.pAddBssReq = NULL;
Girish Gowli1c2fc802015-01-19 16:18:07 +05301336 if (pMac->roam.configParam.roamDelayStatsEnabled)
1337 {
1338 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1339 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 return;
1341}
1342
1343/*------------------------------------------------------------------
1344 *
1345 * This function is called if preauth response is not received from the AP
1346 * within this timeout while FT in progress
1347 *
1348 *------------------------------------------------------------------*/
1349void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1350{
1351 tpPESession psessionEntry;
1352
1353 // We have failed pre auth. We need to resume link and get back on
1354 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301355 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
1357 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1358 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001359 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 return;
1361 }
1362
Abhishek Singh8a226222014-03-13 14:49:16 +05301363 /* To handle the race condition where we recieve preauth rsp after
1364 * timer has expired.
1365 */
1366 if (eANI_BOOLEAN_TRUE ==
1367 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1368 {
1369 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1370 " (session %p)"), psessionEntry);
1371 return;
1372 }
1373 else
1374 {
1375 /* Here we are sending preauth rsp with failure state
1376 * and which is forwarded to SME. Now, if we receive an preauth
1377 * resp from AP with success it would create a FT pesession, but
1378 * will be dropped in SME leaving behind the pesession.
1379 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1380 * limProcessAuthFrameNoSession.
1381 */
1382 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1383 " (session %p)"), psessionEntry);
1384 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1385 eANI_BOOLEAN_TRUE;
1386 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1388 // to get back.
1389 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1390}
1391
1392
1393/*------------------------------------------------------------------
1394 *
1395 * This function is called to process the update key request from SME
1396 *
1397 *------------------------------------------------------------------*/
1398tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1399{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301400 tAddBssParams * pAddBssParams;
1401 tSirFTUpdateKeyInfo * pKeyInfo;
1402 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301404 /* Sanity Check */
1405 if( pMac == NULL || pMsgBuf == NULL )
1406 {
1407 return TRUE;
1408 }
1409 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1410 {
1411 limLog( pMac, LOGE,
1412 FL( "pAddBssReq is NULL" ));
1413 return TRUE;
1414 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301416 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1417 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001418
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301419 /* Store the key information in the ADD BSS parameters */
1420 pAddBssParams->extSetStaKeyParamValid = 1;
1421 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301422 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1423 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301424 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1425 {
1426 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1427 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301429 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301430 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301431 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301432 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001433
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301434 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1435
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301436 limLog(pMac, LOG1,
1437 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301438
1439 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1440 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301441 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301442 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1443 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1444 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1445 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1446 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1451 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1452 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1455 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1456 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1457 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1458 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301459 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301460 }
1461
1462 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001463}
1464
1465tSirRetStatus
1466limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1467{
1468 tSirMsgQ msg;
1469 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1470 tpAggrAddTsParams pAggrAddTsParam;
1471 tpPESession psessionEntry = NULL;
1472 tpLimTspecInfo tspecInfo;
1473 tANI_U8 ac;
1474 tpDphHashNode pSta;
1475 tANI_U16 aid;
1476 tANI_U8 sessionId;
1477 int i;
1478
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301479 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1480 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301482 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 return eSIR_MEM_ALLOC_FAILED;
1484 }
1485
1486 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1487
1488 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001489 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301490 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 return eSIR_FAILURE;
1492 }
1493
1494 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1495 if (pSta == NULL)
1496 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001497 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301498 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 return eSIR_FAILURE;
1500 }
1501
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301502 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1503 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001504 pAggrAddTsParam->staIdx = psessionEntry->staId;
1505 // Fill in the sessionId specific to PE
1506 pAggrAddTsParam->sessionId = sessionId;
1507 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1508
1509 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1510 {
1511 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1512 {
1513 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1514 /* Since AddTS response was successful, check for the PSB flag
1515 * and directional flag inside the TS Info field.
1516 * An AC is trigger enabled AC if the PSB subfield is set to 1
1517 * in the uplink direction.
1518 * An AC is delivery enabled AC if the PSB subfield is set to 1
1519 * in the downlink direction.
1520 * An AC is trigger and delivery enabled AC if the PSB subfield
1521 * is set to 1 in the bi-direction field.
1522 */
1523 if (pTspec->tsinfo.traffic.psb == 1)
1524 {
1525 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1526 }
1527 else
1528 {
1529 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1530 }
1531 /* ADDTS success, so AC is now admitted. We shall now use the default
1532 * EDCA parameters as advertised by AP and send the updated EDCA params
1533 * to HAL.
1534 */
1535 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1536 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1537 {
1538 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1539 }
1540 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1541 {
1542 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1543 }
1544 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1545 {
1546 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1547 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1548 }
1549
1550 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1551
1552 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1553 {
1554 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1555 }
1556 else
1557 {
1558 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1559 }
1560
1561 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1562 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001563 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301565 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1567 }
1568
1569 // Copy the TSPEC paramters
1570 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1571 }
1572 }
1573
1574 msg.type = WDA_AGGR_QOS_REQ;
1575 msg.bodyptr = pAggrAddTsParam;
1576 msg.bodyval = 0;
1577
1578 /* We need to defer any incoming messages until we get a
1579 * WDA_AGGR_QOS_RSP from HAL.
1580 */
1581 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001582 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001583
1584 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1585 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001586 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001587 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301588 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 return eSIR_FAILURE;
1590 }
1591
1592 return eSIR_SUCCESS;
1593}
1594
1595void
1596limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1597 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1598{
1599 tpSirAggrQosRsp rsp;
1600 int i = 0;
1601
1602 if (! rspReqd)
1603 {
1604 return;
1605 }
1606
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301607 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1608 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301610 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 return;
1612 }
1613
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301614 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1616 rsp->sessionId = smesessionId;
1617 rsp->length = sizeof(*rsp);
1618 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1619
1620 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1621 {
1622 if( (1 << i) & aggrQosRsp->tspecIdx )
1623 {
1624 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1625 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1626 }
1627 }
1628
1629 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1630 return;
1631}
1632
1633
1634void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1635{
1636 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1637 //tpAggrQosParams pAggrQosRspMsg = NULL;
1638 tAddTsParams addTsParam = {0};
1639 tpDphHashNode pSta = NULL;
1640 tANI_U16 assocId =0;
1641 tSirMacAddr peerMacAddr;
1642 tANI_U8 rspReqd = 1;
1643 tpPESession psessionEntry = NULL;
1644 int i = 0;
1645
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301646 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001647
1648 /* Need to process all the deferred messages enqueued since sending the
1649 SIR_HAL_AGGR_ADD_TS_REQ */
1650 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1651
1652 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1653 if (NULL == pAggrQosRspMsg)
1654 {
1655 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1656 return;
1657 }
1658
1659 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1660 if (NULL == psessionEntry)
1661 {
1662 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001663 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 if( pAggrQosRspMsg != NULL )
1665 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301666 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001667 }
1668 return;
1669 }
1670
1671 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1672 {
1673 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1674 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1675 {
1676 /* send DELTS to the station */
1677 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1678
1679 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1680 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1681 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1682 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1683
1684 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1685 &addTsParam.tspec.tsinfo,
1686 &addTsParam.tspec, psessionEntry);
1687
1688 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1689 &psessionEntry->dph.dphHashTable);
1690 if (pSta != NULL)
1691 {
1692 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1693 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1694 }
1695 }
1696 }
1697
1698 /* Send the Aggr QoS response to SME */
1699
1700 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1701 psessionEntry->smeSessionId);
1702 if( pAggrQosRspMsg != NULL )
1703 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301704 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 }
1706 return;
1707}
1708
Jeff Johnson295189b2012-06-20 16:38:30 -07001709#endif /* WLAN_FEATURE_VOWIFI_11R */