blob: 8cbe6b81ebf5e51df73519979da18be6b8b0ba22 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +05302 * Copyright (c) 2012-2015 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 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700108#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530109 PELOGE(limLog( pMac, LOGE, "%s: Setting pftSessionEntry= %p to NULL",
110 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111#endif
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530112 pMac->ft.ftPEContext.pftSessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700113 }
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
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530128 vos_mem_zero(&pMac->ft.ftPEContext, sizeof(tftPEContext));
Jeff Johnson295189b2012-06-20 16:38:30 -0700129}
130
131/*--------------------------------------------------------------------------
132 Init FT variables.
133 ------------------------------------------------------------------------*/
134void limFTInit(tpAniSirGlobal pMac)
135{
136 if (pMac->ft.ftPEContext.pFTPreAuthReq)
137 {
138#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700139 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700140 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700141#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800142 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
143 {
144 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
145 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
146 }
147
Jeff Johnson295189b2012-06-20 16:38:30 -0700148 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
149 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
150 }
151
152 // This is the old session, should be deleted else where.
153 // We should not be cleaning it here, just set it to NULL.
154 if (pMac->ft.ftPEContext.psavedsessionEntry)
155 {
156#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700157 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700158 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700159#endif
160 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
161 }
162
163 // This is the extra session we added as part of Auth resp
164 // clean it up.
165 if (pMac->ft.ftPEContext.pftSessionEntry)
166 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530167
Jeff Johnson295189b2012-06-20 16:38:30 -0700168#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700169 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700170 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700171#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530172 /* Delete the previous valid preauth pesession if it is still in
173 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
174 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
175 * preauth didnt went through and its Session was not deleted.
176 */
177 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
178 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
179 == eLIM_SME_WT_REASSOC_STATE) &&
180 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
181 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
182 {
183 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
184 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
185 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
186 }
187
Jeff Johnson295189b2012-06-20 16:38:30 -0700188 pMac->ft.ftPEContext.pftSessionEntry = NULL;
189 }
190
191 if (pMac->ft.ftPEContext.pAddBssReq)
192 {
193#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700194 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700195 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700196#endif
197 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
198 pMac->ft.ftPEContext.pAddBssReq = NULL;
199 }
200
201
202 if (pMac->ft.ftPEContext.pAddStaReq)
203 {
204#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700205 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700206 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700207#endif
208 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
209 pMac->ft.ftPEContext.pAddStaReq = NULL;
210 }
211
212 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
213
214}
215
216/*------------------------------------------------------------------
217 *
218 * This is the handler after suspending the link.
219 * We suspend the link and then now proceed to switch channel.
220 *
221 *------------------------------------------------------------------*/
222void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
223{
224 tpPESession psessionEntry;
225
226 // The link is suspended of not ?
227 if (status != eHAL_STATUS_SUCCESS)
228 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700229 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700230 // Post the FT Pre Auth Response to SME
231 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
232
233 return;
234 }
235
236 psessionEntry = (tpPESession)data;
237 // Suspended, now move to a different channel.
238 // Perform some sanity check before proceeding.
239 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
240 {
241 limChangeChannelWithCallback(pMac,
242 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
243 limPerformFTPreAuth, NULL, psessionEntry);
244 return;
245 }
246
247 // Else return error.
248 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
249}
250
251
252/*--------------------------------------------------------------------------
253 In this function, we process the FT Pre Auth Req.
254 We receive Pre-Auth
255 Suspend link
256 Register a call back
257 In the call back, we will need to accept frames from the new bssid
258 Send out the auth req to new AP.
259 Start timer and when the timer is done or if we receive the Auth response
260 We change channel
261 Resume link
262 ------------------------------------------------------------------------*/
263int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
264{
265 int bufConsumed = FALSE;
266 tpPESession psessionEntry;
267 tANI_U8 sessionId;
268
269 // Now we are starting fresh make sure all's cleanup.
270 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530271 // Can set it only after sending auth
272 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
273
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 // We need information from the Pre-Auth Req. Lets save that
275 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
276
277#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +0530278 PELOGE(limLog( pMac, LOG1, "%s: PRE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
280 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
281 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
282#endif
283
284 // Get the current session entry
285 psessionEntry = peFindSessionByBssid(pMac,
286 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
287 if (psessionEntry == NULL)
288 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700289 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700290 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
292 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800293 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +0530294
295 /* return FALSE, since the Pre-Auth Req will be freed in
296 * limPostFTPreAuthRsp on failure
297 */
298 return bufConsumed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700300#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
301 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
302#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700303
304 // Dont need to suspend if APs are in same channel
305 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
306 {
307 // Need to suspend link only if the channels are different
Abhishek Singh525045c2014-12-15 17:18:45 +0530308 limLog(pMac, LOG1, FL(" Performing pre-auth on different"
309 " channel (session %p)"), psessionEntry);
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700310 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 (tANI_U32 *)psessionEntry);
312 }
313 else
314 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530315 limLog(pMac, LOG1, FL(" Performing pre-auth on same"
316 " channel (session %p)"), psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 // We are in the same channel. Perform pre-auth
318 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
319 }
320
321 return bufConsumed;
322}
323
324/*------------------------------------------------------------------
325 * Send the Auth1
326 * Receive back Auth2
327 *------------------------------------------------------------------*/
328void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
329 tpPESession psessionEntry)
330{
331 tSirMacAuthFrameBody authFrame;
332
333 if (psessionEntry->is11Rconnection)
334 {
335 // Only 11r assoc has FT IEs.
336 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
337 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800338 PELOGE(limLog( pMac, LOGE,
339 "%s: FTIEs for Auth Req Seq 1 is absent",
340 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530341 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 }
343 }
344 if (status != eHAL_STATUS_SUCCESS)
345 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800346 PELOGE(limLog( pMac, LOGE,
347 "%s: Change channel not successful for FT pre-auth",
348 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530349 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 }
351 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
352
353#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Abhishek Singh525045c2014-12-15 17:18:45 +0530354 limLog(pMac, LOG1, FL("Entered wait auth2 state for FT"
355 " (old session %p)"),
356 pMac->ft.ftPEContext.psavedsessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700357#endif
358
359
360 if (psessionEntry->is11Rconnection)
361 {
362 // Now we are on the right channel and need to send out Auth1 and
363 // receive Auth2.
364 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
365 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800366#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 else
368 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800369 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700370 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800371 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700372 }
373#endif
374 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
375 authFrame.authStatusCode = 0;
376
377 // Start timer here to come back to operating channel.
378 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
379 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
380 {
381#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700382 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700383#endif
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530384 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
385 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700386 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800387MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700388
389#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800390 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700391#endif
392
393 limSendAuthMgmtFrame(pMac, &authFrame,
394 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
Sushant Kaushik9e923872015-04-02 17:09:31 +0530395 LIM_NO_WEP_IN_FC, psessionEntry, eSIR_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700396
397 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530398preauth_fail:
399 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
400 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700401}
402
403
404/*------------------------------------------------------------------
405 *
406 * Create the new Add Bss Req to the new AP.
407 * This will be used when we are ready to FT to the new AP.
408 * The newly created ft Session entry is passed to this function
409 *
410 *------------------------------------------------------------------*/
411tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
412 tANI_U8 updateEntry, tpPESession pftSessionEntry,
413 tpSirBssDescription bssDescription )
414{
415 tpAddBssParams pAddBssParams = NULL;
416 tANI_U8 i;
417 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700418 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700419
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530420 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
421 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700422 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530423 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700424 return eSIR_MEM_ALLOC_FAILED;
425 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700426
427 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530428 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
429 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530431 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530433 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 return (eSIR_MEM_ALLOC_FAILED);
435 }
436
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530437 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438
439
440 limExtractApCapabilities( pMac,
441 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700442 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
444 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700445 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700446
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530447 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
448 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
450 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530451 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
452 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
454 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
455 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
456
457 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
458
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700459 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 pAddBssParams->updateBss = updateEntry;
461
462
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700463 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
464 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
465 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
466 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700467
468
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700469 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530470 vos_mem_copy(pAddBssParams->rateSet.rate,
471 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700472
473 pAddBssParams->nwType = bssDescription->nwType;
474
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700475 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
477 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
478 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
479 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
480
481 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700482 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700484 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700485
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700486 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700488 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
489 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700490
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700492 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 (chanWidthSupp) )
494 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700495 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
496 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 }
498 else
499 {
500 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700501 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700503 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
504 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
505 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 }
507 }
508
509 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800510 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
511
512#ifdef WLAN_FEATURE_11AC
513 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
514 {
515 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
516 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
517 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
518 pAddBssParams->currentOperChannel,
519 pAddBssParams->currentExtChannel,
520 pftSessionEntry->apCenterChan,
521 pftSessionEntry);
522 }
523 else
524 {
525 pAddBssParams->vhtCapable = 0;
526 }
527#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700528
529#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700530 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 pAddBssParams->currentOperChannel);
532#endif
533
534
535 // Populate the STA-related parameters here
536 // Note that the STA here refers to the AP
537 {
538 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
539
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530540 vos_mem_copy(pAddBssParams->staContext.bssId,
541 bssDescription->bssId,
542 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700543 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
544
545 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
546 pAddBssParams->staContext.uAPSD = 0;
547 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700548 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 pAddBssParams->staContext.updateSta = updateEntry;
550 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
551
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700552 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 {
554 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
555 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700556 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
557 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
558 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 (chanWidthSupp) )
560 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700561 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 }
563 else
564 {
565 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
566 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800567#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530568 if (pftSessionEntry->vhtCapability &&
569 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800570 {
571 pAddBssParams->staContext.vhtCapable = 1;
572 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
573 pBeaconStruct->VHTCaps.muBeamformerCap) &&
574 pftSessionEntry->txBFIniFeatureEnabled)
575 {
576 pAddBssParams->staContext.vhtTxBFCapable = 1;
577 }
Abhishek Singhcfcc2b42015-08-08 09:22:58 +0530578 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
579 pftSessionEntry->txMuBformee )
580 {
581 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
582 limLog(pMac, LOG1, FL("Enabling MUBformee for peer"));
583 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800584 }
585#endif
586 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
587 (chanWidthSupp) )
588 {
589 pAddBssParams->staContext.txChannelWidthSet =
590 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
591#ifdef WLAN_FEATURE_11AC
592 if (pAddBssParams->staContext.vhtCapable)
593 {
594 pAddBssParams->staContext.vhtTxChannelWidthSet =
595 pBeaconStruct->VHTOperation.chanWidth;
596 }
597#endif
598 }
599 else
600 {
601 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
602 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700603 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
604 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
605 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
606 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
607 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
608 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
609 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
610 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700611
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700612 if( pBeaconStruct->HTInfo.present )
613 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 }
615
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700616 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
617 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 pAddBssParams->staContext.wmmEnabled = 1;
619 else
620 pAddBssParams->staContext.wmmEnabled = 0;
621
622 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700623#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700624 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
625 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700626 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700627#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700628 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700630#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800631 if (pftSessionEntry->htCapability)
632 {
633 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
634 if (pftSessionEntry->vhtCapability)
635 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
636 }
637 else
638 {
639 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
640 {
641 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
642 }
643 else
644 {
645 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
646 }
647 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 }
649
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 //Disable BA. It will be set as part of ADDBA negotiation.
651 for( i = 0; i < STACFG_MAX_TC; i++ )
652 {
653 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
654 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
655 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
656 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
657 }
658
659#if defined WLAN_FEATURE_VOWIFI
660 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
661#endif
662
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800663#ifdef WLAN_FEATURE_11W
664 if (pftSessionEntry->limRmfEnabled)
665 {
666 pAddBssParams->rmfEnabled = 1;
667 pAddBssParams->staContext.rmfEnabled = 1;
668 }
669#endif
670
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 pAddBssParams->status = eHAL_STATUS_SUCCESS;
672 pAddBssParams->respReqd = true;
673
674 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
675 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
676
677 // Set a new state for MLME
678
679 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800680 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 -0700681 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
682
683 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
684
685#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800686 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700687#endif
688
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530689 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 return 0;
691}
692
693/*------------------------------------------------------------------
694 *
695 * Setup the new session for the pre-auth AP.
696 * Return the newly created session entry.
697 *
698 *------------------------------------------------------------------*/
699tpPESession limFillFTSession(tpAniSirGlobal pMac,
700 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
701{
702 tpPESession pftSessionEntry;
703 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 tPowerdBm localPowerConstraint;
705 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700706 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800707 uint32 selfDot11Mode;
708 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700709
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530710 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
711 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700712 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530713 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700714 return NULL;
715 }
716
Jeff Johnson295189b2012-06-20 16:38:30 -0700717
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800718
719 /* Retrieve the session that has already been created and update the entry */
720 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800721#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700722 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700723#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
725 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
726 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
727 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
728
729 // Fields to be filled later
730 pftSessionEntry->pLimJoinReq = NULL;
731 pftSessionEntry->smeSessionId = 0;
732 pftSessionEntry->transactionId = 0;
733
734 limExtractApCapabilities( pMac,
735 (tANI_U8 *) pbssDescription->ieFields,
736 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700737 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700739 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530740 vos_mem_copy(pftSessionEntry->rateSet.rate,
741 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700742
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700743 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530744 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700745 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700746
747
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700748 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530749 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 pftSessionEntry->ssId.length);
751
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800752 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
Mukul Sharma45063942015-04-01 20:07:59 +0530753 limLog(pMac, LOG1, FL("selfDot11Mode %d"),selfDot11Mode );
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800754 pftSessionEntry->dot11mode = selfDot11Mode;
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530755 pftSessionEntry->vhtCapability =
756 (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
757 && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps));
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800758 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
759 && pBeaconStruct->HTCaps.present);
760#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530761 if (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)
762 && pBeaconStruct->VHTOperation.present)
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800763 {
764 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
765 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
766 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
Abhishek Singhcfcc2b42015-08-08 09:22:58 +0530767
768 pftSessionEntry->txBFIniFeatureEnabled =
769 pMac->roam.configParam.txBFEnable;
770
771 limLog(pMac, LOG1, FL("txBFIniFeatureEnabled=%d"),
772 pftSessionEntry->txBFIniFeatureEnabled);
773
774 if (pftSessionEntry->txBFIniFeatureEnabled)
775 {
776 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
777 pftSessionEntry->txBFIniFeatureEnabled)
778 != eSIR_SUCCESS)
779 {
780 limLog(pMac, LOGE, FL("could not set "
781 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
782 }
783 limLog(pMac, LOG1, FL("txBFCsnValue=%d"),
784 pMac->roam.configParam.txBFCsnValue);
785
786 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
787 pMac->roam.configParam.txBFCsnValue)
788 != eSIR_SUCCESS)
789 {
790 limLog(pMac, LOGE, FL("could not set "
791 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
792 }
793
794 if (IS_MUMIMO_BFORMEE_CAPABLE)
795 pftSessionEntry->txMuBformee =
796 pMac->roam.configParam.txMuBformee;
797 }
798
799 limLog(pMac, LOG1, FL("txMuBformee = %d"),
800 pftSessionEntry->txMuBformee);
801
802 if (cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
803 pftSessionEntry->txMuBformee)
804 != eSIR_SUCCESS)
805 {
806 limLog(pMac, LOGE, FL("could not set "
807 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
808 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800809 }
810 else
811 {
812 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
813 }
814#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700815 // Self Mac
816 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
817 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800818#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700819 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700820#endif
821
822 /* Store beaconInterval */
823 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
824 pftSessionEntry->bssType = psessionEntry->bssType;
825
826 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
827 pftSessionEntry->nwType = pbssDescription->nwType;
828
829 /* Copy The channel Id to the session Table */
830 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
831 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
832
833
834 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
835 {
836 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
837 }
838 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
839 {
840 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
841 }
842 else
843 {
844 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700845 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 }
847
848 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
849 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800850 if( pMac->roam.configParam.shortSlotTime &&
851 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
852 {
853 pftSessionEntry->shortSlotTimeSupported = TRUE;
854 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700855
856 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
857 localPowerConstraint = regMax;
858 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
859 limGetIElenFromBssDescription(pbssDescription),
860 &pftSessionEntry->limCurrentBssQosCaps,
861 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700862 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700863
864 pftSessionEntry->limReassocBssQosCaps =
865 pftSessionEntry->limCurrentBssQosCaps;
866 pftSessionEntry->limReassocBssPropCap =
867 pftSessionEntry->limCurrentBssPropCap;
868
869
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800870#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800871 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
872#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800874#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700875
876#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800877 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 -0800878 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700879#endif
880
881 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
882
883 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
884 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800885 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700886
887 pftSessionEntry->encryptType = psessionEntry->encryptType;
888
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800889 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
890 {
891 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
892 }
893 else
894 {
895 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
896 }
897 pftSessionEntry->htSupportedChannelWidthSet =
898 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
899 pftSessionEntry->htRecommendedTxWidthSet =
900 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530901 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
902 (pftSessionEntry->htSupportedChannelWidthSet == 1))
903 {
904 limInitOBSSScanParams(pMac, pftSessionEntry);
905 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530906 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 return pftSessionEntry;
908}
909
910/*------------------------------------------------------------------
911 *
912 * Setup the session and the add bss req for the pre-auth AP.
913 *
914 *------------------------------------------------------------------*/
915void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
916{
917 tpPESession pftSessionEntry;
918
919 // Prepare the session right now with as much as possible.
920 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
921
922 if (pftSessionEntry)
923 {
924 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800925#ifdef FEATURE_WLAN_ESE
926 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700927#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800928#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
930#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700931
932#ifdef FEATURE_WLAN_LFR
933 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
934#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800935#ifdef WLAN_FEATURE_11W
936 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
937#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
939 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
940 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
941 }
942}
943
944/*------------------------------------------------------------------
945 * Resume Link Call Back
946 *------------------------------------------------------------------*/
947void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
948{
949 tpPESession psessionEntry;
950
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700951 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
952 return;
953
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 psessionEntry = (tpPESession)data;
955
956 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
957 {
958 limFTSetupAuthSession(pMac, psessionEntry);
959 }
960
961 // Post the FT Pre Auth Response to SME
962 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
963 pMac->ft.ftPEContext.saved_auth_rsp,
964 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
965
966}
967
968/*------------------------------------------------------------------
969 * Resume Link Call Back
970 *------------------------------------------------------------------*/
971void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
972 tpPESession psessionEntry)
973{
974 //Set the resume channel to Any valid channel (invalid).
975 //This will instruct HAL to set it to any previous valid channel.
976 peSetResumeChannel(pMac, 0, 0);
977 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
978}
979
980tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
981 tANI_U8 *ric_ies, tANI_U32 *ieLength)
982{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530983 /* BlockACK + RIC is not supported now, TODO later to support this */
984#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 tDot11fIERICDataDesc ricIe;
986 tDot11fFfBAStartingSequenceControl baSsnControl;
987 tDot11fFfAddBAParameterSet baParamSet;
988 tDot11fFfBATimeout baTimeout;
989
990 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
991 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
992 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
993 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
994
995 ricIe.present = 1;
996 ricIe.RICData.present = 1;
997 ricIe.RICData.resourceDescCount = 1;
998 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
999 ricIe.RICDescriptor.present = 1;
1000 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
1001 baParamSet.tid = tid;
1002 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
1003 baParamSet.bufferSize = pTrafficClass->txBufSize;
1004 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
1005 baSsnControl.fragNumber = 0;
1006 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301007 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001008 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1009 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
1010 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
1011 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301012 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001013 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1014 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
1015 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
1016 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301017 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001018 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1019 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
1020 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
1021 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301023#endif
1024
1025 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001026}
1027
1028tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
1029{
1030 tANI_U8 tid = 0;
1031 tpDphHashNode pSta;
1032 tANI_U16 numBA = 0, aid = 0;
1033 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
1034 tANI_U32 offset = 0, ieLength = 0;
1035 tSirRetStatus status = eSIR_SUCCESS;
1036
1037 // First, extract the DPH entry
1038 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
1039 if( NULL == pSta )
1040 {
1041 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -08001042 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
1043 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 return eSIR_FAILURE;
1045 }
1046
1047 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1048 {
1049 if (pSta->tcCfg[tid].fUseBATx)
1050 {
1051 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1052 if (eSIR_SUCCESS == status)
1053 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001054 // TODO RIC
1055 if ( ieLength > MAX_FTIE_SIZE )
1056 {
1057 ieLength = 0;
1058 return status;
1059 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001060 offset += ieLength;
1061 *ric_ies_length += ieLength;
1062 numBA++;
1063 }
1064 else
1065 {
1066 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1067 }
1068 }
1069 }
1070
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001071 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 -07001072 return status;
1073}
1074
1075/*------------------------------------------------------------------
1076 *
1077 * Will post pre auth response to SME.
1078 *
1079 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001080void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1082 tpPESession psessionEntry)
1083{
1084 tpSirFTPreAuthRsp pFTPreAuthRsp;
1085 tSirMsgQ mmhMsg;
1086 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001087 // TODO: RIC Support
1088 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001089
1090 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301091 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001093 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 VOS_ASSERT(pFTPreAuthRsp != NULL);
1095 return;
1096 }
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301097
Jeff Johnson295189b2012-06-20 16:38:30 -07001098#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001099 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001100#endif
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301101
1102 vos_mem_zero(pFTPreAuthRsp, rspLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1104 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1105 pFTPreAuthRsp->status = status;
1106 if (psessionEntry)
1107 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1108
1109 // The bssid of the AP we are sending Auth1 to.
1110 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1111 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1112 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1113
1114 // Attach the auth response now back to SME
1115 pFTPreAuthRsp->ft_ies_length = 0;
1116 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1117 {
1118 // Only 11r assoc has FT IEs.
1119 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1120 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1121 }
1122
1123#ifdef WLAN_FEATURE_VOWIFI_11R
1124 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1125 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001126 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1127 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001128 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1129 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1130 if (eSIR_SUCCESS != sirStatus)
1131 {
1132 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1133 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001134 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 }
1136#endif
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +05301137
1138 if (status != eSIR_SUCCESS)
1139 {
1140 /* Ensure that on Pre-Auth failure the cached Pre-Auth Req and
1141 * other allocated memory is freed up before returning.
1142 */
1143 limLog(pMac, LOG1, "Pre-Auth Failed, Cleanup!");
1144 limFTCleanup(pMac);
1145 }
1146
Jeff Johnson295189b2012-06-20 16:38:30 -07001147 mmhMsg.type = pFTPreAuthRsp->messageType;
1148 mmhMsg.bodyptr = pFTPreAuthRsp;
1149 mmhMsg.bodyval = 0;
1150
1151#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001152 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001153#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001154#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001155 if (status == eSIR_SUCCESS)
1156 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1157 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1160}
1161
1162/*------------------------------------------------------------------
1163 *
1164 * Send the FT Pre Auth Response to SME when ever we have a status
1165 * ready to be sent to SME
1166 *
1167 * SME will be the one to send it up to the supplicant to receive
1168 * FTIEs which will be required for Reassoc Req.
1169 *
1170 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001171void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1173 tpPESession psessionEntry)
1174{
1175
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001176 tpPESession pftSessionEntry;
1177 tANI_U8 sessionId;
1178 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001179#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1180 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1181#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001182
Jeff Johnson295189b2012-06-20 16:38:30 -07001183 // Save the status of pre-auth
1184 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1185
1186 // Save the auth rsp, so we can send it to
1187 // SME once we resume link.
1188 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1189 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1190 {
1191 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1192 auth_rsp, auth_rsp_length);
1193 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1194 }
1195
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001196 /* Create FT session for the re-association at this point */
1197 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1198 {
1199 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1200 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1201 &sessionId, pMac->lim.maxStation)) == NULL)
1202 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001203 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301204 status = eSIR_FAILURE;
1205 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1206 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001207 }
1208 pftSessionEntry->peSessionId = sessionId;
1209 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1210 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1211 pftSessionEntry->bssType = psessionEntry->bssType;
1212
1213 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1214 {
1215 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1216 }
1217 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1218 {
1219 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1220 }
1221 else
1222 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001223 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001224 }
1225 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1226 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1227 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001228 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001229 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1230
1231 /* Update the ReAssoc BSSID of the current session */
1232 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001233 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001234 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301235out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 if (psessionEntry->currentOperChannel !=
1237 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1238 {
1239 // Need to move to the original AP channel
1240 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1241 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1242 }
1243 else
1244 {
1245#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001246 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1248#endif
1249 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1250 }
1251}
1252
1253/*------------------------------------------------------------------
1254 *
1255 * This function handles the 11R Reassoc Req from SME
1256 *
1257 *------------------------------------------------------------------*/
1258void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1259 tpPESession psessionEntry)
1260{
1261 tANI_U8 smeSessionId = 0;
1262 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001263 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 tLimMlmReassocReq *pMlmReassocReq;
1265 tANI_U16 caps;
1266 tANI_U32 val;
1267 tSirMsgQ msgQ;
1268 tSirRetStatus retCode;
1269 tANI_U32 teleBcnEn = 0;
1270
Jeff Johnson278b0492013-04-03 14:10:08 -07001271 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001272 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1273 psessionEntry->smeSessionId = smeSessionId;
1274 psessionEntry->transactionId = transactionId;
1275
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001276#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1277 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1278#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001279
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301280 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1281 {
1282 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1283 return;
1284 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301285 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1286 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 {
1288 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301289 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 return;
1291 }
1292
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301293 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1294 psessionEntry->bssId,
1295 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001296
1297 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1298 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1299 != eSIR_SUCCESS)
1300 {
1301 /**
1302 * Could not get ReassocFailureTimeout value
1303 * from CFG. Log error.
1304 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001305 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301306 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 return;
1308 }
1309
1310 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1311 {
1312 /**
1313 * Could not get Capabilities value
1314 * from CFG. Log error.
1315 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001316 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301317 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 return;
1319 }
1320 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001321
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 /* Update PE sessionId*/
1323 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1324
1325 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001326 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1327 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001329 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301330 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001331 return;
1332 }
1333
1334 if (teleBcnEn)
1335 {
1336 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001337 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 /**
1339 * Could not get ListenInterval value
1340 * from CFG. Log error.
1341 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001342 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301343 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001345 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 }
1347 else
1348 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001349 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 {
1351 /**
1352 * Could not get ListenInterval value
1353 * from CFG. Log error.
1354 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001355 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301356 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 return;
1358 }
1359 }
1360 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001361 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301363 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001364 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 }
1366
Jeff Johnson295189b2012-06-20 16:38:30 -07001367 pMlmReassocReq->listenInterval = (tANI_U16) val;
1368
1369 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1370
1371
1372 //we need to defer the message until we get the response back from HAL.
1373 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001374
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1376 msgQ.reserved = 0;
1377 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1378 msgQ.bodyval = 0;
1379
1380
1381#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001382 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001383#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001384 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
1386 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001387 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 {
1389 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001390 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 retCode );
1392 }
1393 // Dont need this anymore
1394 pMac->ft.ftPEContext.pAddBssReq = NULL;
Girish Gowli1c2fc802015-01-19 16:18:07 +05301395 if (pMac->roam.configParam.roamDelayStatsEnabled)
1396 {
1397 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1398 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001399 return;
1400}
1401
1402/*------------------------------------------------------------------
1403 *
1404 * This function is called if preauth response is not received from the AP
1405 * within this timeout while FT in progress
1406 *
1407 *------------------------------------------------------------------*/
1408void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1409{
1410 tpPESession psessionEntry;
1411
1412 // We have failed pre auth. We need to resume link and get back on
1413 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301414 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
1416 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1417 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001418 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001419 return;
1420 }
1421
Abhishek Singh8a226222014-03-13 14:49:16 +05301422 /* To handle the race condition where we recieve preauth rsp after
1423 * timer has expired.
1424 */
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +05301425
1426 if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL)
1427 {
1428 limLog(pMac, LOGE, FL("Auth Rsp might already be posted to SME"
1429 " and ftcleanup done! sessionId:%d"),
1430 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId);
1431 return;
1432 }
1433
Abhishek Singh8a226222014-03-13 14:49:16 +05301434 if (eANI_BOOLEAN_TRUE ==
1435 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1436 {
1437 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1438 " (session %p)"), psessionEntry);
1439 return;
1440 }
1441 else
1442 {
1443 /* Here we are sending preauth rsp with failure state
1444 * and which is forwarded to SME. Now, if we receive an preauth
1445 * resp from AP with success it would create a FT pesession, but
1446 * will be dropped in SME leaving behind the pesession.
1447 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1448 * limProcessAuthFrameNoSession.
1449 */
1450 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1451 " (session %p)"), psessionEntry);
1452 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1453 eANI_BOOLEAN_TRUE;
1454 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1456 // to get back.
1457 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1458}
1459
1460
1461/*------------------------------------------------------------------
1462 *
1463 * This function is called to process the update key request from SME
1464 *
1465 *------------------------------------------------------------------*/
1466tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1467{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301468 tAddBssParams * pAddBssParams;
1469 tSirFTUpdateKeyInfo * pKeyInfo;
1470 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001471
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301472 /* Sanity Check */
1473 if( pMac == NULL || pMsgBuf == NULL )
1474 {
1475 return TRUE;
1476 }
1477 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1478 {
1479 limLog( pMac, LOGE,
1480 FL( "pAddBssReq is NULL" ));
1481 return TRUE;
1482 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001483
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301484 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1485 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001486
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301487 /* Store the key information in the ADD BSS parameters */
1488 pAddBssParams->extSetStaKeyParamValid = 1;
1489 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301490 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1491 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301492 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1493 {
1494 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1495 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301497 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301498 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301499 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301500 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001501
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301502 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1503
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301504 limLog(pMac, LOG1,
1505 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301506
1507 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1508 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301509 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301510 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1511 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1512 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1513 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1514 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1515 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1516 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1517 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1518 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1519 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1520 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1521 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1522 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1523 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1524 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1525 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1526 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301527 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301528 }
1529
1530 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001531}
1532
1533tSirRetStatus
1534limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1535{
1536 tSirMsgQ msg;
1537 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1538 tpAggrAddTsParams pAggrAddTsParam;
1539 tpPESession psessionEntry = NULL;
1540 tpLimTspecInfo tspecInfo;
1541 tANI_U8 ac;
1542 tpDphHashNode pSta;
1543 tANI_U16 aid;
1544 tANI_U8 sessionId;
1545 int i;
1546
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301547 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1548 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001549 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301550 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001551 return eSIR_MEM_ALLOC_FAILED;
1552 }
1553
1554 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1555
1556 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001557 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301558 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 return eSIR_FAILURE;
1560 }
1561
1562 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1563 if (pSta == NULL)
1564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001565 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301566 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 return eSIR_FAILURE;
1568 }
1569
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301570 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1571 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 pAggrAddTsParam->staIdx = psessionEntry->staId;
1573 // Fill in the sessionId specific to PE
1574 pAggrAddTsParam->sessionId = sessionId;
1575 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1576
1577 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1578 {
1579 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1580 {
1581 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1582 /* Since AddTS response was successful, check for the PSB flag
1583 * and directional flag inside the TS Info field.
1584 * An AC is trigger enabled AC if the PSB subfield is set to 1
1585 * in the uplink direction.
1586 * An AC is delivery enabled AC if the PSB subfield is set to 1
1587 * in the downlink direction.
1588 * An AC is trigger and delivery enabled AC if the PSB subfield
1589 * is set to 1 in the bi-direction field.
1590 */
1591 if (pTspec->tsinfo.traffic.psb == 1)
1592 {
1593 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1594 }
1595 else
1596 {
1597 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1598 }
1599 /* ADDTS success, so AC is now admitted. We shall now use the default
1600 * EDCA parameters as advertised by AP and send the updated EDCA params
1601 * to HAL.
1602 */
1603 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1604 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1605 {
1606 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1607 }
1608 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1609 {
1610 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1611 }
1612 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1613 {
1614 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1615 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1616 }
1617
1618 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1619
1620 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1621 {
1622 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1623 }
1624 else
1625 {
1626 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1627 }
1628
1629 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1630 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001631 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301633 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1635 }
1636
1637 // Copy the TSPEC paramters
1638 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1639 }
1640 }
1641
1642 msg.type = WDA_AGGR_QOS_REQ;
1643 msg.bodyptr = pAggrAddTsParam;
1644 msg.bodyval = 0;
1645
1646 /* We need to defer any incoming messages until we get a
1647 * WDA_AGGR_QOS_RSP from HAL.
1648 */
1649 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001650 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001651
1652 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1653 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001654 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301656 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001657 return eSIR_FAILURE;
1658 }
1659
1660 return eSIR_SUCCESS;
1661}
1662
1663void
1664limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1665 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1666{
1667 tpSirAggrQosRsp rsp;
1668 int i = 0;
1669
1670 if (! rspReqd)
1671 {
1672 return;
1673 }
1674
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301675 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1676 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301678 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 return;
1680 }
1681
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301682 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001683 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1684 rsp->sessionId = smesessionId;
1685 rsp->length = sizeof(*rsp);
1686 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1687
1688 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1689 {
1690 if( (1 << i) & aggrQosRsp->tspecIdx )
1691 {
1692 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1693 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1694 }
1695 }
1696
1697 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1698 return;
1699}
1700
1701
1702void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1703{
1704 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1705 //tpAggrQosParams pAggrQosRspMsg = NULL;
1706 tAddTsParams addTsParam = {0};
1707 tpDphHashNode pSta = NULL;
1708 tANI_U16 assocId =0;
1709 tSirMacAddr peerMacAddr;
1710 tANI_U8 rspReqd = 1;
1711 tpPESession psessionEntry = NULL;
1712 int i = 0;
1713
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301714 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001715
1716 /* Need to process all the deferred messages enqueued since sending the
1717 SIR_HAL_AGGR_ADD_TS_REQ */
1718 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1719
1720 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1721 if (NULL == pAggrQosRspMsg)
1722 {
1723 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1724 return;
1725 }
1726
1727 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1728 if (NULL == psessionEntry)
1729 {
1730 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001731 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001732 if( pAggrQosRspMsg != NULL )
1733 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301734 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 }
1736 return;
1737 }
1738
1739 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1740 {
1741 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1742 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1743 {
1744 /* send DELTS to the station */
1745 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1746
1747 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1748 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1749 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1750 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1751
1752 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1753 &addTsParam.tspec.tsinfo,
1754 &addTsParam.tspec, psessionEntry);
1755
1756 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1757 &psessionEntry->dph.dphHashTable);
1758 if (pSta != NULL)
1759 {
1760 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1761 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1762 }
1763 }
1764 }
1765
1766 /* Send the Aggr QoS response to SME */
1767
1768 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1769 psessionEntry->smeSessionId);
1770 if( pAggrQosRspMsg != NULL )
1771 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301772 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 }
1774 return;
1775}
1776
Jeff Johnson295189b2012-06-20 16:38:30 -07001777#endif /* WLAN_FEATURE_VOWIFI_11R */