blob: 8058e13799d30d43908d90b02a95955f59410ad4 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05302 * Copyright (c) 2012-2016 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 }
300
301 // Dont need to suspend if APs are in same channel
302 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
303 {
304 // Need to suspend link only if the channels are different
Abhishek Singh525045c2014-12-15 17:18:45 +0530305 limLog(pMac, LOG1, FL(" Performing pre-auth on different"
306 " channel (session %p)"), psessionEntry);
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700307 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700308 (tANI_U32 *)psessionEntry);
309 }
310 else
311 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530312 limLog(pMac, LOG1, FL(" Performing pre-auth on same"
313 " channel (session %p)"), psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 // We are in the same channel. Perform pre-auth
315 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
316 }
317
318 return bufConsumed;
319}
320
321/*------------------------------------------------------------------
322 * Send the Auth1
323 * Receive back Auth2
324 *------------------------------------------------------------------*/
325void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
326 tpPESession psessionEntry)
327{
328 tSirMacAuthFrameBody authFrame;
329
330 if (psessionEntry->is11Rconnection)
331 {
332 // Only 11r assoc has FT IEs.
333 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
334 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800335 PELOGE(limLog( pMac, LOGE,
336 "%s: FTIEs for Auth Req Seq 1 is absent",
337 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530338 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 }
340 }
341 if (status != eHAL_STATUS_SUCCESS)
342 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800343 PELOGE(limLog( pMac, LOGE,
344 "%s: Change channel not successful for FT pre-auth",
345 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530346 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 }
348 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
349
350#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Abhishek Singh525045c2014-12-15 17:18:45 +0530351 limLog(pMac, LOG1, FL("Entered wait auth2 state for FT"
352 " (old session %p)"),
353 pMac->ft.ftPEContext.psavedsessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700354#endif
355
356
357 if (psessionEntry->is11Rconnection)
358 {
359 // Now we are on the right channel and need to send out Auth1 and
360 // receive Auth2.
361 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
362 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800363#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 else
365 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800366 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800368 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 }
370#endif
371 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
372 authFrame.authStatusCode = 0;
373
374 // Start timer here to come back to operating channel.
375 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
376 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
377 {
378#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700379 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700380#endif
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530381 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
382 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800384MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700385
386#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800387 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700388#endif
Deepthi Gowri639d5042015-11-16 20:23:39 +0530389#ifdef FEATURE_WLAN_DIAG_SUPPORT
390 limDiagEventReport(pMac, WLAN_PE_DIAG_ROAM_AUTH_START_EVENT,
391 pMac->lim.pSessionEntry, eSIR_SUCCESS, eSIR_SUCCESS);
392#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700393
394 limSendAuthMgmtFrame(pMac, &authFrame,
395 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
Sushant Kaushik9e923872015-04-02 17:09:31 +0530396 LIM_NO_WEP_IN_FC, psessionEntry, eSIR_FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700397
398 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530399preauth_fail:
400 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
401 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700402}
403
404
405/*------------------------------------------------------------------
406 *
407 * Create the new Add Bss Req to the new AP.
408 * This will be used when we are ready to FT to the new AP.
409 * The newly created ft Session entry is passed to this function
410 *
411 *------------------------------------------------------------------*/
412tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
413 tANI_U8 updateEntry, tpPESession pftSessionEntry,
414 tpSirBssDescription bssDescription )
415{
416 tpAddBssParams pAddBssParams = NULL;
417 tANI_U8 i;
418 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700419 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700420
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530421 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
422 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700423 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530424 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 return eSIR_MEM_ALLOC_FAILED;
426 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700427
428 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530429 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
430 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700431 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530432 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 return (eSIR_MEM_ALLOC_FAILED);
436 }
437
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530438 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440
441 limExtractApCapabilities( pMac,
442 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700444
445 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700446 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700447
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530448 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
449 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
451 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530452 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
453 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
455 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
456 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
457
458 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
459
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700460 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700461 pAddBssParams->updateBss = updateEntry;
462
463
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700464 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
465 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
466 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
467 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700468
469
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530471 vos_mem_copy(pAddBssParams->rateSet.rate,
472 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700473
474 pAddBssParams->nwType = bssDescription->nwType;
475
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700476 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
478 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
479 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
480 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
481
482 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700483 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700485 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700487 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
490 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700491
Jeff Johnson295189b2012-06-20 16:38:30 -0700492 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700493 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 (chanWidthSupp) )
495 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700496 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
497 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 }
499 else
500 {
501 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700502 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700503 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700504 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
505 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
506 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 }
508 }
509
510 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800511 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
512
513#ifdef WLAN_FEATURE_11AC
514 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
515 {
516 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
517 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
518 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
519 pAddBssParams->currentOperChannel,
520 pAddBssParams->currentExtChannel,
521 pftSessionEntry->apCenterChan,
522 pftSessionEntry);
523 }
524 else
525 {
526 pAddBssParams->vhtCapable = 0;
527 }
528#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700529
530#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700531 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700532 pAddBssParams->currentOperChannel);
533#endif
534
535
536 // Populate the STA-related parameters here
537 // Note that the STA here refers to the AP
538 {
539 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
540
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530541 vos_mem_copy(pAddBssParams->staContext.bssId,
542 bssDescription->bssId,
543 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
545
546 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
547 pAddBssParams->staContext.uAPSD = 0;
548 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700549 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pAddBssParams->staContext.updateSta = updateEntry;
551 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
552
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700553 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 {
555 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
556 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700557 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
558 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
559 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 (chanWidthSupp) )
561 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700562 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 }
564 else
565 {
566 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
567 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800568#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530569 if (pftSessionEntry->vhtCapability &&
570 IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps))
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800571 {
572 pAddBssParams->staContext.vhtCapable = 1;
573 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
574 pBeaconStruct->VHTCaps.muBeamformerCap) &&
575 pftSessionEntry->txBFIniFeatureEnabled)
576 {
577 pAddBssParams->staContext.vhtTxBFCapable = 1;
578 }
Abhishek Singhcfcc2b42015-08-08 09:22:58 +0530579 if (pBeaconStruct->VHTCaps.muBeamformerCap &&
580 pftSessionEntry->txMuBformee )
581 {
582 pAddBssParams->staContext.vhtTxMUBformeeCapable = 1;
583 limLog(pMac, LOG1, FL("Enabling MUBformee for peer"));
584 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800585 }
586#endif
587 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
588 (chanWidthSupp) )
589 {
590 pAddBssParams->staContext.txChannelWidthSet =
591 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
592#ifdef WLAN_FEATURE_11AC
593 if (pAddBssParams->staContext.vhtCapable)
594 {
595 pAddBssParams->staContext.vhtTxChannelWidthSet =
596 pBeaconStruct->VHTOperation.chanWidth;
597 }
598#endif
599 }
600 else
601 {
602 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
603 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700604 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
605 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
606 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
607 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
608 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
609 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
610 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
611 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700612
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700613 if( pBeaconStruct->HTInfo.present )
614 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 }
616
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700617 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
618 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 pAddBssParams->staContext.wmmEnabled = 1;
620 else
621 pAddBssParams->staContext.wmmEnabled = 0;
622
623 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700624#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700625 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
626 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700627 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700628#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700629 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700631#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800632 if (pftSessionEntry->htCapability)
633 {
634 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
635 if (pftSessionEntry->vhtCapability)
636 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
637 }
638 else
639 {
640 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
641 {
642 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
643 }
644 else
645 {
646 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
647 }
648 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 }
650
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 //Disable BA. It will be set as part of ADDBA negotiation.
652 for( i = 0; i < STACFG_MAX_TC; i++ )
653 {
654 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
655 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
656 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
657 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
658 }
659
660#if defined WLAN_FEATURE_VOWIFI
661 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
662#endif
663
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800664#ifdef WLAN_FEATURE_11W
665 if (pftSessionEntry->limRmfEnabled)
666 {
667 pAddBssParams->rmfEnabled = 1;
668 pAddBssParams->staContext.rmfEnabled = 1;
669 }
670#endif
671
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 pAddBssParams->status = eHAL_STATUS_SUCCESS;
673 pAddBssParams->respReqd = true;
674
675 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
676 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
677
678 // Set a new state for MLME
679
680 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800681 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 -0700682 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
683
684 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
685
686#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800687 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700688#endif
689
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530690 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 return 0;
692}
693
694/*------------------------------------------------------------------
695 *
696 * Setup the new session for the pre-auth AP.
697 * Return the newly created session entry.
698 *
699 *------------------------------------------------------------------*/
700tpPESession limFillFTSession(tpAniSirGlobal pMac,
701 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
702{
703 tpPESession pftSessionEntry;
704 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 tPowerdBm localPowerConstraint;
706 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700707 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800708 uint32 selfDot11Mode;
709 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700710
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530711 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
712 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700713 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530714 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700715 return NULL;
716 }
717
Jeff Johnson295189b2012-06-20 16:38:30 -0700718
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800719
720 /* Retrieve the session that has already been created and update the entry */
721 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800722#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700723 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700724#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
726 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
727 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
728 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
729
730 // Fields to be filled later
731 pftSessionEntry->pLimJoinReq = NULL;
732 pftSessionEntry->smeSessionId = 0;
733 pftSessionEntry->transactionId = 0;
734
735 limExtractApCapabilities( pMac,
736 (tANI_U8 *) pbssDescription->ieFields,
737 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700738 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700739
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700740 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530741 vos_mem_copy(pftSessionEntry->rateSet.rate,
742 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700744 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530745 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700746 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700747
748
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700749 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530750 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 pftSessionEntry->ssId.length);
752
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800753 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
Mukul Sharma45063942015-04-01 20:07:59 +0530754 limLog(pMac, LOG1, FL("selfDot11Mode %d"),selfDot11Mode );
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800755 pftSessionEntry->dot11mode = selfDot11Mode;
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530756 pftSessionEntry->vhtCapability =
757 (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
758 && IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps));
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800759 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
760 && pBeaconStruct->HTCaps.present);
761#ifdef WLAN_FEATURE_11AC
Kanchanapally, Vidyullatha3f3b6542015-08-21 14:38:49 +0530762 if (IS_BSS_VHT_CAPABLE(pBeaconStruct->VHTCaps)
763 && pBeaconStruct->VHTOperation.present)
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800764 {
765 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
766 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
767 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
Abhishek Singhcfcc2b42015-08-08 09:22:58 +0530768
769 pftSessionEntry->txBFIniFeatureEnabled =
770 pMac->roam.configParam.txBFEnable;
771
772 limLog(pMac, LOG1, FL("txBFIniFeatureEnabled=%d"),
773 pftSessionEntry->txBFIniFeatureEnabled);
774
775 if (pftSessionEntry->txBFIniFeatureEnabled)
776 {
777 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP,
778 pftSessionEntry->txBFIniFeatureEnabled)
779 != eSIR_SUCCESS)
780 {
781 limLog(pMac, LOGE, FL("could not set "
782 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
783 }
784 limLog(pMac, LOG1, FL("txBFCsnValue=%d"),
785 pMac->roam.configParam.txBFCsnValue);
786
787 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED,
788 pMac->roam.configParam.txBFCsnValue)
789 != eSIR_SUCCESS)
790 {
791 limLog(pMac, LOGE, FL("could not set "
792 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
793 }
794
795 if (IS_MUMIMO_BFORMEE_CAPABLE)
796 pftSessionEntry->txMuBformee =
797 pMac->roam.configParam.txMuBformee;
798 }
799
800 limLog(pMac, LOG1, FL("txMuBformee = %d"),
801 pftSessionEntry->txMuBformee);
802
803 if (cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP,
804 pftSessionEntry->txMuBformee)
805 != eSIR_SUCCESS)
806 {
807 limLog(pMac, LOGE, FL("could not set "
808 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
809 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800810 }
811 else
812 {
813 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
814 }
815#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 // Self Mac
817 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
818 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800819#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700820 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700821#endif
822
823 /* Store beaconInterval */
824 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
825 pftSessionEntry->bssType = psessionEntry->bssType;
826
827 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
828 pftSessionEntry->nwType = pbssDescription->nwType;
829
830 /* Copy The channel Id to the session Table */
831 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
832 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
833
834
835 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
836 {
837 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
838 }
839 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
840 {
841 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
842 }
843 else
844 {
845 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700846 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 }
848
849 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
850 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800851 if( pMac->roam.configParam.shortSlotTime &&
852 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
853 {
854 pftSessionEntry->shortSlotTimeSupported = TRUE;
855 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700856
857 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
858 localPowerConstraint = regMax;
859 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
860 limGetIElenFromBssDescription(pbssDescription),
861 &pftSessionEntry->limCurrentBssQosCaps,
862 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700863 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700864
865 pftSessionEntry->limReassocBssQosCaps =
866 pftSessionEntry->limCurrentBssQosCaps;
867 pftSessionEntry->limReassocBssPropCap =
868 pftSessionEntry->limCurrentBssPropCap;
869
870
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800871#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800872 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
873#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700874 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800875#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700876
877#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800878 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 -0800879 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700880#endif
881
882 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
883
884 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
885 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800886 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700887
888 pftSessionEntry->encryptType = psessionEntry->encryptType;
889
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800890 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
891 {
892 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
893 }
894 else
895 {
896 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
897 }
898 pftSessionEntry->htSupportedChannelWidthSet =
899 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
900 pftSessionEntry->htRecommendedTxWidthSet =
901 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530902 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
903 (pftSessionEntry->htSupportedChannelWidthSet == 1))
904 {
905 limInitOBSSScanParams(pMac, pftSessionEntry);
906 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530907 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 return pftSessionEntry;
909}
910
911/*------------------------------------------------------------------
912 *
913 * Setup the session and the add bss req for the pre-auth AP.
914 *
915 *------------------------------------------------------------------*/
916void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
917{
918 tpPESession pftSessionEntry;
919
920 // Prepare the session right now with as much as possible.
921 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
922
923 if (pftSessionEntry)
924 {
925 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800926#ifdef FEATURE_WLAN_ESE
927 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700928#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800929#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
931#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700932
933#ifdef FEATURE_WLAN_LFR
934 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
935#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800936#ifdef WLAN_FEATURE_11W
937 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
938#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
940 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
941 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
942 }
943}
944
945/*------------------------------------------------------------------
946 * Resume Link Call Back
947 *------------------------------------------------------------------*/
948void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
949{
950 tpPESession psessionEntry;
951
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700952 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
953 return;
954
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 psessionEntry = (tpPESession)data;
956
957 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
958 {
959 limFTSetupAuthSession(pMac, psessionEntry);
960 }
961
962 // Post the FT Pre Auth Response to SME
963 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
964 pMac->ft.ftPEContext.saved_auth_rsp,
965 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
966
967}
968
969/*------------------------------------------------------------------
970 * Resume Link Call Back
971 *------------------------------------------------------------------*/
972void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
973 tpPESession psessionEntry)
974{
975 //Set the resume channel to Any valid channel (invalid).
976 //This will instruct HAL to set it to any previous valid channel.
977 peSetResumeChannel(pMac, 0, 0);
978 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
979}
980
981tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
982 tANI_U8 *ric_ies, tANI_U32 *ieLength)
983{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530984 /* BlockACK + RIC is not supported now, TODO later to support this */
985#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 tDot11fIERICDataDesc ricIe;
987 tDot11fFfBAStartingSequenceControl baSsnControl;
988 tDot11fFfAddBAParameterSet baParamSet;
989 tDot11fFfBATimeout baTimeout;
990
991 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
992 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
993 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
994 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
995
996 ricIe.present = 1;
997 ricIe.RICData.present = 1;
998 ricIe.RICData.resourceDescCount = 1;
999 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
1000 ricIe.RICDescriptor.present = 1;
1001 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
1002 baParamSet.tid = tid;
1003 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
1004 baParamSet.bufferSize = pTrafficClass->txBufSize;
1005 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
1006 baSsnControl.fragNumber = 0;
1007 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301008 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001009 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1010 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
1011 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
1012 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301013 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001014 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1015 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
1016 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
1017 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301018 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07001019 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
1020 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
1021 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
1022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301024#endif
1025
1026 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001027}
1028
1029tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
1030{
1031 tANI_U8 tid = 0;
1032 tpDphHashNode pSta;
1033 tANI_U16 numBA = 0, aid = 0;
1034 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
1035 tANI_U32 offset = 0, ieLength = 0;
1036 tSirRetStatus status = eSIR_SUCCESS;
1037
1038 // First, extract the DPH entry
1039 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
1040 if( NULL == pSta )
1041 {
1042 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -08001043 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
1044 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 return eSIR_FAILURE;
1046 }
1047
1048 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1049 {
1050 if (pSta->tcCfg[tid].fUseBATx)
1051 {
1052 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1053 if (eSIR_SUCCESS == status)
1054 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001055 // TODO RIC
1056 if ( ieLength > MAX_FTIE_SIZE )
1057 {
1058 ieLength = 0;
1059 return status;
1060 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001061 offset += ieLength;
1062 *ric_ies_length += ieLength;
1063 numBA++;
1064 }
1065 else
1066 {
1067 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1068 }
1069 }
1070 }
1071
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001072 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 -07001073 return status;
1074}
1075
1076/*------------------------------------------------------------------
1077 *
1078 * Will post pre auth response to SME.
1079 *
1080 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001081void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001082 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1083 tpPESession psessionEntry)
1084{
1085 tpSirFTPreAuthRsp pFTPreAuthRsp;
1086 tSirMsgQ mmhMsg;
1087 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001088 // TODO: RIC Support
1089 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001090
1091 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301092 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001094 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001095 VOS_ASSERT(pFTPreAuthRsp != NULL);
1096 return;
1097 }
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301098
Jeff Johnson295189b2012-06-20 16:38:30 -07001099#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001100 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001101#endif
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301102
1103 vos_mem_zero(pFTPreAuthRsp, rspLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001104 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1105 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1106 pFTPreAuthRsp->status = status;
1107 if (psessionEntry)
1108 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1109
1110 // The bssid of the AP we are sending Auth1 to.
1111 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1112 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1113 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1114
1115 // Attach the auth response now back to SME
1116 pFTPreAuthRsp->ft_ies_length = 0;
1117 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1118 {
1119 // Only 11r assoc has FT IEs.
1120 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1121 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1122 }
1123
1124#ifdef WLAN_FEATURE_VOWIFI_11R
1125 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1126 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001127 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1128 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1130 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1131 if (eSIR_SUCCESS != sirStatus)
1132 {
1133 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1134 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001135 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001136 }
1137#endif
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +05301138
1139 if (status != eSIR_SUCCESS)
1140 {
1141 /* Ensure that on Pre-Auth failure the cached Pre-Auth Req and
1142 * other allocated memory is freed up before returning.
1143 */
1144 limLog(pMac, LOG1, "Pre-Auth Failed, Cleanup!");
1145 limFTCleanup(pMac);
1146 }
1147
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 mmhMsg.type = pFTPreAuthRsp->messageType;
1149 mmhMsg.bodyptr = pFTPreAuthRsp;
1150 mmhMsg.bodyval = 0;
1151
1152#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001153 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001154#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001155 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1156}
1157
1158/*------------------------------------------------------------------
1159 *
1160 * Send the FT Pre Auth Response to SME when ever we have a status
1161 * ready to be sent to SME
1162 *
1163 * SME will be the one to send it up to the supplicant to receive
1164 * FTIEs which will be required for Reassoc Req.
1165 *
1166 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001167void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001168 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1169 tpPESession psessionEntry)
1170{
1171
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001172 tpPESession pftSessionEntry;
1173 tANI_U8 sessionId;
1174 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001175#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Deepthi Gowri639d5042015-11-16 20:23:39 +05301176 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT,
Sushant Kaushikb97a0082015-08-31 12:36:45 +05301177 psessionEntry, status, eSIR_SUCCESS);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001178#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001179
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 // Save the status of pre-auth
1181 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1182
1183 // Save the auth rsp, so we can send it to
1184 // SME once we resume link.
1185 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1186 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1187 {
1188 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1189 auth_rsp, auth_rsp_length);
1190 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1191 }
1192
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001193 /* Create FT session for the re-association at this point */
1194 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1195 {
1196 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1197 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1198 &sessionId, pMac->lim.maxStation)) == NULL)
1199 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001200 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301201 status = eSIR_FAILURE;
1202 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1203 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001204 }
1205 pftSessionEntry->peSessionId = sessionId;
1206 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1207 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1208 pftSessionEntry->bssType = psessionEntry->bssType;
1209
1210 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1211 {
1212 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1213 }
1214 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1215 {
1216 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1217 }
1218 else
1219 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001220 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001221 }
1222 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1223 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1224 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001225 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001226 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1227
1228 /* Update the ReAssoc BSSID of the current session */
1229 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001230 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001231 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301232out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 if (psessionEntry->currentOperChannel !=
1234 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1235 {
1236 // Need to move to the original AP channel
1237 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1238 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1239 }
1240 else
1241 {
1242#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001243 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1245#endif
1246 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1247 }
1248}
1249
1250/*------------------------------------------------------------------
1251 *
1252 * This function handles the 11R Reassoc Req from SME
1253 *
1254 *------------------------------------------------------------------*/
1255void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1256 tpPESession psessionEntry)
1257{
1258 tANI_U8 smeSessionId = 0;
1259 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001260 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 tLimMlmReassocReq *pMlmReassocReq;
1262 tANI_U16 caps;
1263 tANI_U32 val;
1264 tSirMsgQ msgQ;
1265 tSirRetStatus retCode;
1266 tANI_U32 teleBcnEn = 0;
1267
Jeff Johnson278b0492013-04-03 14:10:08 -07001268 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1270 psessionEntry->smeSessionId = smeSessionId;
1271 psessionEntry->transactionId = transactionId;
1272
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001273#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1274 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1275#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001276
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301277 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1278 {
1279 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1280 return;
1281 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301282 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1283 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 {
1285 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301286 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 return;
1288 }
1289
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301290 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1291 psessionEntry->bssId,
1292 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001293
1294 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1295 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1296 != eSIR_SUCCESS)
1297 {
1298 /**
1299 * Could not get ReassocFailureTimeout value
1300 * from CFG. Log error.
1301 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001302 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301303 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 return;
1305 }
1306
1307 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1308 {
1309 /**
1310 * Could not get Capabilities value
1311 * from CFG. Log error.
1312 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001313 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301314 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 return;
1316 }
Selvaraj, Sridhar5f149192016-04-15 12:53:28 +05301317
1318 lim_update_caps_info_for_bss(pMac, &caps,
1319 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo);
1320
1321 limLog(pMac, LOG1, FL("Capabilities info FT Reassoc: 0x%X"), caps);
1322
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001324
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 /* Update PE sessionId*/
1326 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1327
1328 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001329 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1330 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001332 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301333 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001334 return;
1335 }
1336
1337 if (teleBcnEn)
1338 {
1339 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001340 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 /**
1342 * Could not get ListenInterval value
1343 * from CFG. Log error.
1344 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001345 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301346 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001347 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 }
1350 else
1351 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001352 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 {
1354 /**
1355 * Could not get ListenInterval value
1356 * from CFG. Log error.
1357 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001358 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301359 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 return;
1361 }
1362 }
1363 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001364 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301366 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001367 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 }
1369
Jeff Johnson295189b2012-06-20 16:38:30 -07001370 pMlmReassocReq->listenInterval = (tANI_U16) val;
1371
1372 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1373
1374
1375 //we need to defer the message until we get the response back from HAL.
1376 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001377
Jeff Johnson295189b2012-06-20 16:38:30 -07001378 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1379 msgQ.reserved = 0;
1380 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1381 msgQ.bodyval = 0;
1382
1383
1384#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001385 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001386#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001387 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
1389 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001390 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 {
1392 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001393 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001394 retCode );
1395 }
1396 // Dont need this anymore
1397 pMac->ft.ftPEContext.pAddBssReq = NULL;
Girish Gowli1c2fc802015-01-19 16:18:07 +05301398 if (pMac->roam.configParam.roamDelayStatsEnabled)
1399 {
1400 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1401 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001402 return;
1403}
1404
1405/*------------------------------------------------------------------
1406 *
1407 * This function is called if preauth response is not received from the AP
1408 * within this timeout while FT in progress
1409 *
1410 *------------------------------------------------------------------*/
1411void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1412{
1413 tpPESession psessionEntry;
1414
1415 // We have failed pre auth. We need to resume link and get back on
1416 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301417 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001418
1419 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1420 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001421 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 return;
1423 }
1424
Abhishek Singh8a226222014-03-13 14:49:16 +05301425 /* To handle the race condition where we recieve preauth rsp after
1426 * timer has expired.
1427 */
Kanchanapally, Vidyullathaa7f6d212015-03-17 11:35:25 +05301428
1429 if (pMac->ft.ftPEContext.pFTPreAuthReq == NULL)
1430 {
1431 limLog(pMac, LOGE, FL("Auth Rsp might already be posted to SME"
1432 " and ftcleanup done! sessionId:%d"),
1433 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId);
1434 return;
1435 }
1436
Abhishek Singh8a226222014-03-13 14:49:16 +05301437 if (eANI_BOOLEAN_TRUE ==
1438 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1439 {
1440 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1441 " (session %p)"), psessionEntry);
1442 return;
1443 }
1444 else
1445 {
1446 /* Here we are sending preauth rsp with failure state
1447 * and which is forwarded to SME. Now, if we receive an preauth
1448 * resp from AP with success it would create a FT pesession, but
1449 * will be dropped in SME leaving behind the pesession.
1450 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1451 * limProcessAuthFrameNoSession.
1452 */
1453 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1454 " (session %p)"), psessionEntry);
1455 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1456 eANI_BOOLEAN_TRUE;
1457 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1459 // to get back.
1460 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1461}
1462
1463
1464/*------------------------------------------------------------------
1465 *
1466 * This function is called to process the update key request from SME
1467 *
1468 *------------------------------------------------------------------*/
1469tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1470{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301471 tAddBssParams * pAddBssParams;
1472 tSirFTUpdateKeyInfo * pKeyInfo;
1473 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001474
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301475 /* Sanity Check */
1476 if( pMac == NULL || pMsgBuf == NULL )
1477 {
1478 return TRUE;
1479 }
1480 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1481 {
1482 limLog( pMac, LOGE,
1483 FL( "pAddBssReq is NULL" ));
1484 return TRUE;
1485 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001486
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301487 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1488 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001489
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301490 /* Store the key information in the ADD BSS parameters */
1491 pAddBssParams->extSetStaKeyParamValid = 1;
1492 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301493 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1494 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301495 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1496 {
1497 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1498 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001499
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301500 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301501 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301502 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301503 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001504
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301505 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1506
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301507 limLog(pMac, LOG1,
1508 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301509
1510 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1511 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301512 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301513 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1514 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1515 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1516 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1517 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1518 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1519 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1520 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1521 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1522 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1523 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1524 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1525 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1526 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1527 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1528 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1529 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301530 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301531 }
1532
1533 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001534}
1535
1536tSirRetStatus
1537limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1538{
1539 tSirMsgQ msg;
1540 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1541 tpAggrAddTsParams pAggrAddTsParam;
1542 tpPESession psessionEntry = NULL;
1543 tpLimTspecInfo tspecInfo;
1544 tANI_U8 ac;
1545 tpDphHashNode pSta;
1546 tANI_U16 aid;
1547 tANI_U8 sessionId;
1548 int i;
1549
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301550 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1551 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001552 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301553 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 return eSIR_MEM_ALLOC_FAILED;
1555 }
1556
1557 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1558
1559 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001560 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301561 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 return eSIR_FAILURE;
1563 }
1564
1565 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1566 if (pSta == NULL)
1567 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001568 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301569 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001570 return eSIR_FAILURE;
1571 }
1572
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301573 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1574 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 pAggrAddTsParam->staIdx = psessionEntry->staId;
1576 // Fill in the sessionId specific to PE
1577 pAggrAddTsParam->sessionId = sessionId;
1578 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1579
1580 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1581 {
1582 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1583 {
1584 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1585 /* Since AddTS response was successful, check for the PSB flag
1586 * and directional flag inside the TS Info field.
1587 * An AC is trigger enabled AC if the PSB subfield is set to 1
1588 * in the uplink direction.
1589 * An AC is delivery enabled AC if the PSB subfield is set to 1
1590 * in the downlink direction.
1591 * An AC is trigger and delivery enabled AC if the PSB subfield
1592 * is set to 1 in the bi-direction field.
1593 */
1594 if (pTspec->tsinfo.traffic.psb == 1)
1595 {
1596 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1597 }
1598 else
1599 {
1600 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1601 }
1602 /* ADDTS success, so AC is now admitted. We shall now use the default
1603 * EDCA parameters as advertised by AP and send the updated EDCA params
1604 * to HAL.
1605 */
1606 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1607 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1608 {
1609 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1610 }
1611 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1612 {
1613 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1614 }
1615 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1616 {
1617 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1618 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1619 }
1620
1621 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1622
1623 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1624 {
1625 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1626 }
1627 else
1628 {
1629 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1630 }
1631
1632 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1633 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001634 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001635 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301636 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1638 }
1639
1640 // Copy the TSPEC paramters
1641 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1642 }
1643 }
1644
1645 msg.type = WDA_AGGR_QOS_REQ;
1646 msg.bodyptr = pAggrAddTsParam;
1647 msg.bodyval = 0;
1648
1649 /* We need to defer any incoming messages until we get a
1650 * WDA_AGGR_QOS_RSP from HAL.
1651 */
1652 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001653 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001654
1655 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1656 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001657 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301659 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 return eSIR_FAILURE;
1661 }
1662
1663 return eSIR_SUCCESS;
1664}
1665
1666void
1667limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1668 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1669{
1670 tpSirAggrQosRsp rsp;
1671 int i = 0;
1672
1673 if (! rspReqd)
1674 {
1675 return;
1676 }
1677
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301678 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1679 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001680 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301681 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001682 return;
1683 }
1684
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301685 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1687 rsp->sessionId = smesessionId;
1688 rsp->length = sizeof(*rsp);
1689 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1690
1691 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1692 {
1693 if( (1 << i) & aggrQosRsp->tspecIdx )
1694 {
1695 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1696 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1697 }
1698 }
1699
1700 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1701 return;
1702}
1703
1704
1705void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1706{
1707 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1708 //tpAggrQosParams pAggrQosRspMsg = NULL;
1709 tAddTsParams addTsParam = {0};
1710 tpDphHashNode pSta = NULL;
1711 tANI_U16 assocId =0;
1712 tSirMacAddr peerMacAddr;
1713 tANI_U8 rspReqd = 1;
1714 tpPESession psessionEntry = NULL;
1715 int i = 0;
1716
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301717 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001718
1719 /* Need to process all the deferred messages enqueued since sending the
1720 SIR_HAL_AGGR_ADD_TS_REQ */
1721 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1722
1723 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1724 if (NULL == pAggrQosRspMsg)
1725 {
1726 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1727 return;
1728 }
1729
1730 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1731 if (NULL == psessionEntry)
1732 {
1733 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001734 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001735 if( pAggrQosRspMsg != NULL )
1736 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301737 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001738 }
1739 return;
1740 }
1741
1742 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1743 {
1744 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1745 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1746 {
1747 /* send DELTS to the station */
1748 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1749
1750 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1751 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1752 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1753 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1754
1755 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1756 &addTsParam.tspec.tsinfo,
1757 &addTsParam.tspec, psessionEntry);
1758
1759 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1760 &psessionEntry->dph.dphHashTable);
1761 if (pSta != NULL)
1762 {
1763 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1764 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1765 }
1766 }
1767 }
1768
1769 /* Send the Aggr QoS response to SME */
1770
1771 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1772 psessionEntry->smeSessionId);
1773 if( pAggrQosRspMsg != NULL )
1774 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301775 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 }
1777 return;
1778}
1779
Jeff Johnson295189b2012-06-20 16:38:30 -07001780#endif /* WLAN_FEATURE_VOWIFI_11R */