blob: 99bea6ca13681d7fdbfb9e2a4cf2f10bdb3c4bbf [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
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530387 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
388 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800390MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700391
392#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800393 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700394#endif
395
396 limSendAuthMgmtFrame(pMac, &authFrame,
397 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
Sushant Kaushik9e923872015-04-02 17:09:31 +0530398 LIM_NO_WEP_IN_FC, psessionEntry, eSIR_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700399
400 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530401preauth_fail:
402 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
403 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700404}
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);
Mukul Sharma45063942015-04-01 20:07:59 +0530749 limLog(pMac, LOG1, FL("selfDot11Mode %d"),selfDot11Mode );
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800750 pftSessionEntry->dot11mode = selfDot11Mode;
751 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
752 && pBeaconStruct->VHTCaps.present);
753 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
754 && pBeaconStruct->HTCaps.present);
755#ifdef WLAN_FEATURE_11AC
756 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
757 {
758 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
759 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
760 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
761 }
762 else
763 {
764 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
765 }
766#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 // Self Mac
768 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
769 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800770#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700771 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700772#endif
773
774 /* Store beaconInterval */
775 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
776 pftSessionEntry->bssType = psessionEntry->bssType;
777
778 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
779 pftSessionEntry->nwType = pbssDescription->nwType;
780
781 /* Copy The channel Id to the session Table */
782 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
783 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
784
785
786 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
787 {
788 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
789 }
790 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
791 {
792 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
793 }
794 else
795 {
796 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700797 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 }
799
800 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
801 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800802 if( pMac->roam.configParam.shortSlotTime &&
803 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
804 {
805 pftSessionEntry->shortSlotTimeSupported = TRUE;
806 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700807
808 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
809 localPowerConstraint = regMax;
810 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
811 limGetIElenFromBssDescription(pbssDescription),
812 &pftSessionEntry->limCurrentBssQosCaps,
813 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700814 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815
816 pftSessionEntry->limReassocBssQosCaps =
817 pftSessionEntry->limCurrentBssQosCaps;
818 pftSessionEntry->limReassocBssPropCap =
819 pftSessionEntry->limCurrentBssPropCap;
820
821
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800822#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800823 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
824#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800826#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700827
828#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800829 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 -0800830 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700831#endif
832
833 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
834
835 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
836 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800837 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700838
839 pftSessionEntry->encryptType = psessionEntry->encryptType;
840
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800841 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
842 {
843 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
844 }
845 else
846 {
847 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
848 }
849 pftSessionEntry->htSupportedChannelWidthSet =
850 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
851 pftSessionEntry->htRecommendedTxWidthSet =
852 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530853 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
854 (pftSessionEntry->htSupportedChannelWidthSet == 1))
855 {
856 limInitOBSSScanParams(pMac, pftSessionEntry);
857 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530858 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 return pftSessionEntry;
860}
861
862/*------------------------------------------------------------------
863 *
864 * Setup the session and the add bss req for the pre-auth AP.
865 *
866 *------------------------------------------------------------------*/
867void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
868{
869 tpPESession pftSessionEntry;
870
871 // Prepare the session right now with as much as possible.
872 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
873
874 if (pftSessionEntry)
875 {
876 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800877#ifdef FEATURE_WLAN_ESE
878 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700879#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800880#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
882#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700883
884#ifdef FEATURE_WLAN_LFR
885 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
886#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800887#ifdef WLAN_FEATURE_11W
888 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
889#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
891 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
892 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
893 }
894}
895
896/*------------------------------------------------------------------
897 * Resume Link Call Back
898 *------------------------------------------------------------------*/
899void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
900{
901 tpPESession psessionEntry;
902
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700903 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
904 return;
905
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 psessionEntry = (tpPESession)data;
907
908 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
909 {
910 limFTSetupAuthSession(pMac, psessionEntry);
911 }
912
913 // Post the FT Pre Auth Response to SME
914 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
915 pMac->ft.ftPEContext.saved_auth_rsp,
916 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
917
918}
919
920/*------------------------------------------------------------------
921 * Resume Link Call Back
922 *------------------------------------------------------------------*/
923void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
924 tpPESession psessionEntry)
925{
926 //Set the resume channel to Any valid channel (invalid).
927 //This will instruct HAL to set it to any previous valid channel.
928 peSetResumeChannel(pMac, 0, 0);
929 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
930}
931
932tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
933 tANI_U8 *ric_ies, tANI_U32 *ieLength)
934{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530935 /* BlockACK + RIC is not supported now, TODO later to support this */
936#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 tDot11fIERICDataDesc ricIe;
938 tDot11fFfBAStartingSequenceControl baSsnControl;
939 tDot11fFfAddBAParameterSet baParamSet;
940 tDot11fFfBATimeout baTimeout;
941
942 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
943 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
944 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
945 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
946
947 ricIe.present = 1;
948 ricIe.RICData.present = 1;
949 ricIe.RICData.resourceDescCount = 1;
950 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
951 ricIe.RICDescriptor.present = 1;
952 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
953 baParamSet.tid = tid;
954 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
955 baParamSet.bufferSize = pTrafficClass->txBufSize;
956 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
957 baSsnControl.fragNumber = 0;
958 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
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 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
961 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
962 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
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 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
966 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
967 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
968 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530969 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700970 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
971 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
972 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
973 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530975#endif
976
977 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700978}
979
980tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
981{
982 tANI_U8 tid = 0;
983 tpDphHashNode pSta;
984 tANI_U16 numBA = 0, aid = 0;
985 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
986 tANI_U32 offset = 0, ieLength = 0;
987 tSirRetStatus status = eSIR_SUCCESS;
988
989 // First, extract the DPH entry
990 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
991 if( NULL == pSta )
992 {
993 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800994 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
995 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 return eSIR_FAILURE;
997 }
998
999 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1000 {
1001 if (pSta->tcCfg[tid].fUseBATx)
1002 {
1003 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1004 if (eSIR_SUCCESS == status)
1005 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001006 // TODO RIC
1007 if ( ieLength > MAX_FTIE_SIZE )
1008 {
1009 ieLength = 0;
1010 return status;
1011 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 offset += ieLength;
1013 *ric_ies_length += ieLength;
1014 numBA++;
1015 }
1016 else
1017 {
1018 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1019 }
1020 }
1021 }
1022
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001023 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 -07001024 return status;
1025}
1026
1027/*------------------------------------------------------------------
1028 *
1029 * Will post pre auth response to SME.
1030 *
1031 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001032void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1034 tpPESession psessionEntry)
1035{
1036 tpSirFTPreAuthRsp pFTPreAuthRsp;
1037 tSirMsgQ mmhMsg;
1038 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001039 // TODO: RIC Support
1040 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
1042 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301043 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001045 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 VOS_ASSERT(pFTPreAuthRsp != NULL);
1047 return;
1048 }
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301049
Jeff Johnson295189b2012-06-20 16:38:30 -07001050#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001051 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001052#endif
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301053
1054 vos_mem_zero(pFTPreAuthRsp, rspLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1056 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1057 pFTPreAuthRsp->status = status;
1058 if (psessionEntry)
1059 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1060
1061 // The bssid of the AP we are sending Auth1 to.
1062 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1063 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1064 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1065
1066 // Attach the auth response now back to SME
1067 pFTPreAuthRsp->ft_ies_length = 0;
1068 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1069 {
1070 // Only 11r assoc has FT IEs.
1071 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1072 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1073 }
1074
1075#ifdef WLAN_FEATURE_VOWIFI_11R
1076 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1077 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001078 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1079 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1081 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1082 if (eSIR_SUCCESS != sirStatus)
1083 {
1084 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1085 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001086 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 }
1088#endif
1089
1090 mmhMsg.type = pFTPreAuthRsp->messageType;
1091 mmhMsg.bodyptr = pFTPreAuthRsp;
1092 mmhMsg.bodyval = 0;
1093
1094#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001095 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001096#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001097#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001098 if (status == eSIR_SUCCESS)
1099 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1100 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001101#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1103}
1104
1105/*------------------------------------------------------------------
1106 *
1107 * Send the FT Pre Auth Response to SME when ever we have a status
1108 * ready to be sent to SME
1109 *
1110 * SME will be the one to send it up to the supplicant to receive
1111 * FTIEs which will be required for Reassoc Req.
1112 *
1113 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001114void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1116 tpPESession psessionEntry)
1117{
1118
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001119 tpPESession pftSessionEntry;
1120 tANI_U8 sessionId;
1121 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001122#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1123 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1124#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001125
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 // Save the status of pre-auth
1127 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1128
1129 // Save the auth rsp, so we can send it to
1130 // SME once we resume link.
1131 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1132 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1133 {
1134 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1135 auth_rsp, auth_rsp_length);
1136 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1137 }
1138
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001139 /* Create FT session for the re-association at this point */
1140 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1141 {
1142 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1143 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1144 &sessionId, pMac->lim.maxStation)) == NULL)
1145 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001146 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301147 status = eSIR_FAILURE;
1148 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1149 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001150 }
1151 pftSessionEntry->peSessionId = sessionId;
1152 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1153 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1154 pftSessionEntry->bssType = psessionEntry->bssType;
1155
1156 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1157 {
1158 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1159 }
1160 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1161 {
1162 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1163 }
1164 else
1165 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001166 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001167 }
1168 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1169 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1170 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001171 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001172 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1173
1174 /* Update the ReAssoc BSSID of the current session */
1175 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001176 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001177 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301178out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 if (psessionEntry->currentOperChannel !=
1180 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1181 {
1182 // Need to move to the original AP channel
1183 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1184 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1185 }
1186 else
1187 {
1188#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001189 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1191#endif
1192 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1193 }
1194}
1195
1196/*------------------------------------------------------------------
1197 *
1198 * This function handles the 11R Reassoc Req from SME
1199 *
1200 *------------------------------------------------------------------*/
1201void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1202 tpPESession psessionEntry)
1203{
1204 tANI_U8 smeSessionId = 0;
1205 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001206 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 tLimMlmReassocReq *pMlmReassocReq;
1208 tANI_U16 caps;
1209 tANI_U32 val;
1210 tSirMsgQ msgQ;
1211 tSirRetStatus retCode;
1212 tANI_U32 teleBcnEn = 0;
1213
Jeff Johnson278b0492013-04-03 14:10:08 -07001214 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1216 psessionEntry->smeSessionId = smeSessionId;
1217 psessionEntry->transactionId = transactionId;
1218
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001219#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1220 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1221#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001222
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301223 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1224 {
1225 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1226 return;
1227 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301228 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1229 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 {
1231 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301232 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 return;
1234 }
1235
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301236 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1237 psessionEntry->bssId,
1238 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001239
1240 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1241 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1242 != eSIR_SUCCESS)
1243 {
1244 /**
1245 * Could not get ReassocFailureTimeout value
1246 * from CFG. Log error.
1247 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001248 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301249 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 return;
1251 }
1252
1253 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1254 {
1255 /**
1256 * Could not get Capabilities value
1257 * from CFG. Log error.
1258 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001259 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301260 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 return;
1262 }
1263 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001264
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 /* Update PE sessionId*/
1266 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1267
1268 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001269 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1270 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001272 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301273 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001274 return;
1275 }
1276
1277 if (teleBcnEn)
1278 {
1279 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001280 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 /**
1282 * Could not get ListenInterval value
1283 * from CFG. Log error.
1284 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001285 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301286 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001288 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 }
1290 else
1291 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001292 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 {
1294 /**
1295 * Could not get ListenInterval value
1296 * from CFG. Log error.
1297 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001298 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301299 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 return;
1301 }
1302 }
1303 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001304 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301306 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001307 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 }
1309
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 pMlmReassocReq->listenInterval = (tANI_U16) val;
1311
1312 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1313
1314
1315 //we need to defer the message until we get the response back from HAL.
1316 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001317
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1319 msgQ.reserved = 0;
1320 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1321 msgQ.bodyval = 0;
1322
1323
1324#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001325 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001326#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001327 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328
1329 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001330 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 {
1332 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001333 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 retCode );
1335 }
1336 // Dont need this anymore
1337 pMac->ft.ftPEContext.pAddBssReq = NULL;
Girish Gowli1c2fc802015-01-19 16:18:07 +05301338 if (pMac->roam.configParam.roamDelayStatsEnabled)
1339 {
1340 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1341 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 return;
1343}
1344
1345/*------------------------------------------------------------------
1346 *
1347 * This function is called if preauth response is not received from the AP
1348 * within this timeout while FT in progress
1349 *
1350 *------------------------------------------------------------------*/
1351void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1352{
1353 tpPESession psessionEntry;
1354
1355 // We have failed pre auth. We need to resume link and get back on
1356 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301357 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1360 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001361 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 return;
1363 }
1364
Abhishek Singh8a226222014-03-13 14:49:16 +05301365 /* To handle the race condition where we recieve preauth rsp after
1366 * timer has expired.
1367 */
1368 if (eANI_BOOLEAN_TRUE ==
1369 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1370 {
1371 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1372 " (session %p)"), psessionEntry);
1373 return;
1374 }
1375 else
1376 {
1377 /* Here we are sending preauth rsp with failure state
1378 * and which is forwarded to SME. Now, if we receive an preauth
1379 * resp from AP with success it would create a FT pesession, but
1380 * will be dropped in SME leaving behind the pesession.
1381 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1382 * limProcessAuthFrameNoSession.
1383 */
1384 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1385 " (session %p)"), psessionEntry);
1386 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1387 eANI_BOOLEAN_TRUE;
1388 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1390 // to get back.
1391 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1392}
1393
1394
1395/*------------------------------------------------------------------
1396 *
1397 * This function is called to process the update key request from SME
1398 *
1399 *------------------------------------------------------------------*/
1400tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1401{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301402 tAddBssParams * pAddBssParams;
1403 tSirFTUpdateKeyInfo * pKeyInfo;
1404 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001405
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301406 /* Sanity Check */
1407 if( pMac == NULL || pMsgBuf == NULL )
1408 {
1409 return TRUE;
1410 }
1411 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1412 {
1413 limLog( pMac, LOGE,
1414 FL( "pAddBssReq is NULL" ));
1415 return TRUE;
1416 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001417
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301418 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1419 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301421 /* Store the key information in the ADD BSS parameters */
1422 pAddBssParams->extSetStaKeyParamValid = 1;
1423 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301424 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1425 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301426 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1427 {
1428 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1429 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001430
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301431 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301432 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301433 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301434 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001435
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301436 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1437
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301438 limLog(pMac, LOG1,
1439 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301440
1441 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1442 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301443 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301444 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1445 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1446 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1451 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1452 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1455 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1456 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1457 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1458 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1459 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1460 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301461 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301462 }
1463
1464 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001465}
1466
1467tSirRetStatus
1468limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1469{
1470 tSirMsgQ msg;
1471 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1472 tpAggrAddTsParams pAggrAddTsParam;
1473 tpPESession psessionEntry = NULL;
1474 tpLimTspecInfo tspecInfo;
1475 tANI_U8 ac;
1476 tpDphHashNode pSta;
1477 tANI_U16 aid;
1478 tANI_U8 sessionId;
1479 int i;
1480
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301481 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1482 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301484 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 return eSIR_MEM_ALLOC_FAILED;
1486 }
1487
1488 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1489
1490 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001491 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301492 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 return eSIR_FAILURE;
1494 }
1495
1496 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1497 if (pSta == NULL)
1498 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001499 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301500 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 return eSIR_FAILURE;
1502 }
1503
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301504 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1505 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 pAggrAddTsParam->staIdx = psessionEntry->staId;
1507 // Fill in the sessionId specific to PE
1508 pAggrAddTsParam->sessionId = sessionId;
1509 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1510
1511 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1512 {
1513 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1514 {
1515 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1516 /* Since AddTS response was successful, check for the PSB flag
1517 * and directional flag inside the TS Info field.
1518 * An AC is trigger enabled AC if the PSB subfield is set to 1
1519 * in the uplink direction.
1520 * An AC is delivery enabled AC if the PSB subfield is set to 1
1521 * in the downlink direction.
1522 * An AC is trigger and delivery enabled AC if the PSB subfield
1523 * is set to 1 in the bi-direction field.
1524 */
1525 if (pTspec->tsinfo.traffic.psb == 1)
1526 {
1527 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1528 }
1529 else
1530 {
1531 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1532 }
1533 /* ADDTS success, so AC is now admitted. We shall now use the default
1534 * EDCA parameters as advertised by AP and send the updated EDCA params
1535 * to HAL.
1536 */
1537 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1538 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1539 {
1540 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1541 }
1542 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1543 {
1544 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1545 }
1546 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1547 {
1548 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1549 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1550 }
1551
1552 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1553
1554 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1555 {
1556 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1557 }
1558 else
1559 {
1560 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1561 }
1562
1563 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001565 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301567 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1569 }
1570
1571 // Copy the TSPEC paramters
1572 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1573 }
1574 }
1575
1576 msg.type = WDA_AGGR_QOS_REQ;
1577 msg.bodyptr = pAggrAddTsParam;
1578 msg.bodyval = 0;
1579
1580 /* We need to defer any incoming messages until we get a
1581 * WDA_AGGR_QOS_RSP from HAL.
1582 */
1583 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001584 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001585
1586 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1587 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001588 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301590 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 return eSIR_FAILURE;
1592 }
1593
1594 return eSIR_SUCCESS;
1595}
1596
1597void
1598limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1599 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1600{
1601 tpSirAggrQosRsp rsp;
1602 int i = 0;
1603
1604 if (! rspReqd)
1605 {
1606 return;
1607 }
1608
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301609 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1610 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301612 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 return;
1614 }
1615
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301616 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1618 rsp->sessionId = smesessionId;
1619 rsp->length = sizeof(*rsp);
1620 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1621
1622 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1623 {
1624 if( (1 << i) & aggrQosRsp->tspecIdx )
1625 {
1626 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1627 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1628 }
1629 }
1630
1631 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1632 return;
1633}
1634
1635
1636void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1637{
1638 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1639 //tpAggrQosParams pAggrQosRspMsg = NULL;
1640 tAddTsParams addTsParam = {0};
1641 tpDphHashNode pSta = NULL;
1642 tANI_U16 assocId =0;
1643 tSirMacAddr peerMacAddr;
1644 tANI_U8 rspReqd = 1;
1645 tpPESession psessionEntry = NULL;
1646 int i = 0;
1647
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301648 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001649
1650 /* Need to process all the deferred messages enqueued since sending the
1651 SIR_HAL_AGGR_ADD_TS_REQ */
1652 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1653
1654 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1655 if (NULL == pAggrQosRspMsg)
1656 {
1657 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1658 return;
1659 }
1660
1661 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1662 if (NULL == psessionEntry)
1663 {
1664 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001665 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 if( pAggrQosRspMsg != NULL )
1667 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301668 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 }
1670 return;
1671 }
1672
1673 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1674 {
1675 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1676 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1677 {
1678 /* send DELTS to the station */
1679 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1680
1681 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1682 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1683 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1684 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1685
1686 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1687 &addTsParam.tspec.tsinfo,
1688 &addTsParam.tspec, psessionEntry);
1689
1690 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1691 &psessionEntry->dph.dphHashTable);
1692 if (pSta != NULL)
1693 {
1694 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1695 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1696 }
1697 }
1698 }
1699
1700 /* Send the Aggr QoS response to SME */
1701
1702 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1703 psessionEntry->smeSessionId);
1704 if( pAggrQosRspMsg != NULL )
1705 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301706 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 }
1708 return;
1709}
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711#endif /* WLAN_FEATURE_VOWIFI_11R */