blob: 735f04c10453a2f268063bd1c1ed852b8547f87c [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifdef WLAN_FEATURE_VOWIFI_11R
29/**=========================================================================
30
Kiet Lam842dad02014-02-18 18:44:02 -080031 \brief implementation for PE 11r VoWiFi FT Protocol
Jeff Johnson295189b2012-06-20 16:38:30 -070032
33 ========================================================================*/
34
35/* $Header$ */
36
37
38/*--------------------------------------------------------------------------
39 Include Files
40 ------------------------------------------------------------------------*/
41#include <limSendMessages.h>
42#include <limTypes.h>
43#include <limFT.h>
44#include <limFTDefs.h>
45#include <limUtils.h>
46#include <limPropExtsUtils.h>
47#include <limAssocUtils.h>
48#include <limSession.h>
49#include <limAdmitControl.h>
50#include "wmmApsd.h"
51
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053052#ifdef DEBUG_ROAM_DELAY
53#include "vos_utils.h"
54#endif
55
Jeff Johnson295189b2012-06-20 16:38:30 -070056#define LIM_FT_RIC_BA_SSN 1
57#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
58#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053059#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070060
61/*--------------------------------------------------------------------------
62 Initialize the FT variables.
63 ------------------------------------------------------------------------*/
64void limFTOpen(tpAniSirGlobal pMac)
65{
66 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
67 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
68}
69
70/*--------------------------------------------------------------------------
71 Cleanup FT variables.
72 ------------------------------------------------------------------------*/
73void limFTCleanup(tpAniSirGlobal pMac)
74{
75 if (pMac->ft.ftPEContext.pFTPreAuthReq)
76 {
77#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070078 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070079 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070080#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080081 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
82 {
83 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
84 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
85 }
Jeff Johnson295189b2012-06-20 16:38:30 -070086 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
87 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
88 }
89
90 // This is the old session, should be deleted else where.
91 // We should not be cleaning it here, just set it to NULL.
92 if (pMac->ft.ftPEContext.psavedsessionEntry)
93 {
94#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070095 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070096 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070097#endif
98 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
99 }
100
101 // This is the extra session we added as part of Auth resp
102 // clean it up.
103 if (pMac->ft.ftPEContext.pftSessionEntry)
104 {
105 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
106 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
107 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700108 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700109 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
110 }
111 pMac->ft.ftPEContext.pftSessionEntry = NULL;
112#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700113 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700114 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700115#endif
116 }
117
118 if (pMac->ft.ftPEContext.pAddBssReq)
119 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +0530120 vos_mem_zero(pMac->ft.ftPEContext.pAddBssReq, sizeof(tAddBssParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700121 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
122 pMac->ft.ftPEContext.pAddBssReq = NULL;
123 }
124
125 if (pMac->ft.ftPEContext.pAddStaReq)
126 {
127 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
128 pMac->ft.ftPEContext.pAddStaReq = NULL;
129 }
130
131 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
132
133}
134
135/*--------------------------------------------------------------------------
136 Init FT variables.
137 ------------------------------------------------------------------------*/
138void limFTInit(tpAniSirGlobal pMac)
139{
140 if (pMac->ft.ftPEContext.pFTPreAuthReq)
141 {
142#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700143 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700144 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700145#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800146 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
147 {
148 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
149 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
150 }
151
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
153 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
154 }
155
156 // This is the old session, should be deleted else where.
157 // We should not be cleaning it here, just set it to NULL.
158 if (pMac->ft.ftPEContext.psavedsessionEntry)
159 {
160#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700161 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700162 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700163#endif
164 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
165 }
166
167 // This is the extra session we added as part of Auth resp
168 // clean it up.
169 if (pMac->ft.ftPEContext.pftSessionEntry)
170 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530171
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700173 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700174 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530176 /* Delete the previous valid preauth pesession if it is still in
177 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
178 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
179 * preauth didnt went through and its Session was not deleted.
180 */
181 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
182 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
183 == eLIM_SME_WT_REASSOC_STATE) &&
184 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
185 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
186 {
187 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
188 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
189 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
190 }
191
Jeff Johnson295189b2012-06-20 16:38:30 -0700192 pMac->ft.ftPEContext.pftSessionEntry = NULL;
193 }
194
195 if (pMac->ft.ftPEContext.pAddBssReq)
196 {
197#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700198 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700199 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700200#endif
201 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
202 pMac->ft.ftPEContext.pAddBssReq = NULL;
203 }
204
205
206 if (pMac->ft.ftPEContext.pAddStaReq)
207 {
208#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700209 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700210 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700211#endif
212 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
213 pMac->ft.ftPEContext.pAddStaReq = NULL;
214 }
215
216 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
217
218}
219
220/*------------------------------------------------------------------
221 *
222 * This is the handler after suspending the link.
223 * We suspend the link and then now proceed to switch channel.
224 *
225 *------------------------------------------------------------------*/
226void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
227{
228 tpPESession psessionEntry;
229
230 // The link is suspended of not ?
231 if (status != eHAL_STATUS_SUCCESS)
232 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700233 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 // Post the FT Pre Auth Response to SME
235 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
236
237 return;
238 }
239
240 psessionEntry = (tpPESession)data;
241 // Suspended, now move to a different channel.
242 // Perform some sanity check before proceeding.
243 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
244 {
245 limChangeChannelWithCallback(pMac,
246 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
247 limPerformFTPreAuth, NULL, psessionEntry);
248 return;
249 }
250
251 // Else return error.
252 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
253}
254
255
256/*--------------------------------------------------------------------------
257 In this function, we process the FT Pre Auth Req.
258 We receive Pre-Auth
259 Suspend link
260 Register a call back
261 In the call back, we will need to accept frames from the new bssid
262 Send out the auth req to new AP.
263 Start timer and when the timer is done or if we receive the Auth response
264 We change channel
265 Resume link
266 ------------------------------------------------------------------------*/
267int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
268{
269 int bufConsumed = FALSE;
270 tpPESession psessionEntry;
271 tANI_U8 sessionId;
272
273 // Now we are starting fresh make sure all's cleanup.
274 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530275 // Can set it only after sending auth
276 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
277
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 // We need information from the Pre-Auth Req. Lets save that
279 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
280
281#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +0530282 PELOGE(limLog( pMac, LOG1, "%s: PRE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700283 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
284 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
285 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
286#endif
287
288 // Get the current session entry
289 psessionEntry = peFindSessionByBssid(pMac,
290 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
291 if (psessionEntry == NULL)
292 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700293 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700294 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
296 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800297 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530298 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
299 {
300 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
301 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
302 }
303 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700304 return TRUE;
305 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700306#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
307 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
308#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700309
310 // Dont need to suspend if APs are in same channel
311 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
312 {
313 // Need to suspend link only if the channels are different
Abhishek Singh525045c2014-12-15 17:18:45 +0530314 limLog(pMac, LOG1, FL(" Performing pre-auth on different"
315 " channel (session %p)"), psessionEntry);
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700316 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700317 (tANI_U32 *)psessionEntry);
318 }
319 else
320 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530321 limLog(pMac, LOG1, FL(" Performing pre-auth on same"
322 " channel (session %p)"), psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 // We are in the same channel. Perform pre-auth
324 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
325 }
326
327 return bufConsumed;
328}
329
330/*------------------------------------------------------------------
331 * Send the Auth1
332 * Receive back Auth2
333 *------------------------------------------------------------------*/
334void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
335 tpPESession psessionEntry)
336{
337 tSirMacAuthFrameBody authFrame;
338
339 if (psessionEntry->is11Rconnection)
340 {
341 // Only 11r assoc has FT IEs.
342 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
343 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800344 PELOGE(limLog( pMac, LOGE,
345 "%s: FTIEs for Auth Req Seq 1 is absent",
346 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530347 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700348 }
349 }
350 if (status != eHAL_STATUS_SUCCESS)
351 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800352 PELOGE(limLog( pMac, LOGE,
353 "%s: Change channel not successful for FT pre-auth",
354 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530355 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 }
357 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
358
359#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Abhishek Singh525045c2014-12-15 17:18:45 +0530360 limLog(pMac, LOG1, FL("Entered wait auth2 state for FT"
361 " (old session %p)"),
362 pMac->ft.ftPEContext.psavedsessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700363#endif
364
365
366 if (psessionEntry->is11Rconnection)
367 {
368 // Now we are on the right channel and need to send out Auth1 and
369 // receive Auth2.
370 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
371 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800372#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700373 else
374 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800375 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800377 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 }
379#endif
380 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
381 authFrame.authStatusCode = 0;
382
383 // Start timer here to come back to operating channel.
384 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
385 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
386 {
387#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700388 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700389#endif
390 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800391MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700392
393#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800394 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700395#endif
396
397 limSendAuthMgmtFrame(pMac, &authFrame,
398 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
399 LIM_NO_WEP_IN_FC, psessionEntry);
400
401 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530402preauth_fail:
403 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
404 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700405}
406
407
408/*------------------------------------------------------------------
409 *
410 * Create the new Add Bss Req to the new AP.
411 * This will be used when we are ready to FT to the new AP.
412 * The newly created ft Session entry is passed to this function
413 *
414 *------------------------------------------------------------------*/
415tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
416 tANI_U8 updateEntry, tpPESession pftSessionEntry,
417 tpSirBssDescription bssDescription )
418{
419 tpAddBssParams pAddBssParams = NULL;
420 tANI_U8 i;
421 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700422 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530424 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
425 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700426 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530427 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700428 return eSIR_MEM_ALLOC_FAILED;
429 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
431 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530432 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
433 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530435 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530437 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 return (eSIR_MEM_ALLOC_FAILED);
439 }
440
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530441 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700442
443
444 limExtractApCapabilities( pMac,
445 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700446 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700447
448 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700449 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530451 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
452 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
454 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530455 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
456 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
458 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
459 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
460
461 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
462
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700463 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 pAddBssParams->updateBss = updateEntry;
465
466
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700467 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
468 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
469 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
470 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471
472
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700473 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530474 vos_mem_copy(pAddBssParams->rateSet.rate,
475 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700476
477 pAddBssParams->nwType = bssDescription->nwType;
478
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700479 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
481 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
482 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
483 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
484
485 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700486 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700488 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700489
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700490 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700491 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700492 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
493 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700494
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700496 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700497 (chanWidthSupp) )
498 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700499 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
500 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 }
502 else
503 {
504 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700505 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700506 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700507 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
508 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
509 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700510 }
511 }
512
513 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800514 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
515
516#ifdef WLAN_FEATURE_11AC
517 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
518 {
519 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
520 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
521 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
522 pAddBssParams->currentOperChannel,
523 pAddBssParams->currentExtChannel,
524 pftSessionEntry->apCenterChan,
525 pftSessionEntry);
526 }
527 else
528 {
529 pAddBssParams->vhtCapable = 0;
530 }
531#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700532
533#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700534 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 pAddBssParams->currentOperChannel);
536#endif
537
538
539 // Populate the STA-related parameters here
540 // Note that the STA here refers to the AP
541 {
542 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
543
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530544 vos_mem_copy(pAddBssParams->staContext.bssId,
545 bssDescription->bssId,
546 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
548
549 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
550 pAddBssParams->staContext.uAPSD = 0;
551 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700552 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 pAddBssParams->staContext.updateSta = updateEntry;
554 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
555
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700556 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 {
558 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
559 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700560 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
561 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
562 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 (chanWidthSupp) )
564 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700565 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 }
567 else
568 {
569 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
570 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800571#ifdef WLAN_FEATURE_11AC
572 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
573 {
574 pAddBssParams->staContext.vhtCapable = 1;
575 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
576 pBeaconStruct->VHTCaps.muBeamformerCap) &&
577 pftSessionEntry->txBFIniFeatureEnabled)
578 {
579 pAddBssParams->staContext.vhtTxBFCapable = 1;
580 }
581 }
582#endif
583 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
584 (chanWidthSupp) )
585 {
586 pAddBssParams->staContext.txChannelWidthSet =
587 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
588#ifdef WLAN_FEATURE_11AC
589 if (pAddBssParams->staContext.vhtCapable)
590 {
591 pAddBssParams->staContext.vhtTxChannelWidthSet =
592 pBeaconStruct->VHTOperation.chanWidth;
593 }
594#endif
595 }
596 else
597 {
598 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
599 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700600 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
601 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
602 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
603 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
604 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
605 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
606 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
607 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700609 if( pBeaconStruct->HTInfo.present )
610 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 }
612
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700613 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
614 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700615 pAddBssParams->staContext.wmmEnabled = 1;
616 else
617 pAddBssParams->staContext.wmmEnabled = 0;
618
619 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700620#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700621 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
622 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700623 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700624#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700625 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700626 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700627#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800628 if (pftSessionEntry->htCapability)
629 {
630 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
631 if (pftSessionEntry->vhtCapability)
632 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
633 }
634 else
635 {
636 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
637 {
638 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
639 }
640 else
641 {
642 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
643 }
644 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 }
646
Jeff Johnson295189b2012-06-20 16:38:30 -0700647 //Disable BA. It will be set as part of ADDBA negotiation.
648 for( i = 0; i < STACFG_MAX_TC; i++ )
649 {
650 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
651 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
652 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
653 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
654 }
655
656#if defined WLAN_FEATURE_VOWIFI
657 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
658#endif
659
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800660#ifdef WLAN_FEATURE_11W
661 if (pftSessionEntry->limRmfEnabled)
662 {
663 pAddBssParams->rmfEnabled = 1;
664 pAddBssParams->staContext.rmfEnabled = 1;
665 }
666#endif
667
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 pAddBssParams->status = eHAL_STATUS_SUCCESS;
669 pAddBssParams->respReqd = true;
670
671 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
672 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
673
674 // Set a new state for MLME
675
676 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800677 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 -0700678 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
679
680 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
681
682#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800683 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700684#endif
685
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530686 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 return 0;
688}
689
690/*------------------------------------------------------------------
691 *
692 * Setup the new session for the pre-auth AP.
693 * Return the newly created session entry.
694 *
695 *------------------------------------------------------------------*/
696tpPESession limFillFTSession(tpAniSirGlobal pMac,
697 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
698{
699 tpPESession pftSessionEntry;
700 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 tPowerdBm localPowerConstraint;
702 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700703 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800704 uint32 selfDot11Mode;
705 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700706
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530707 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
708 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700709 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530710 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700711 return NULL;
712 }
713
Jeff Johnson295189b2012-06-20 16:38:30 -0700714
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800715
716 /* Retrieve the session that has already been created and update the entry */
717 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800718#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700719 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700720#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
722 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
723 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
724 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
725
726 // Fields to be filled later
727 pftSessionEntry->pLimJoinReq = NULL;
728 pftSessionEntry->smeSessionId = 0;
729 pftSessionEntry->transactionId = 0;
730
731 limExtractApCapabilities( pMac,
732 (tANI_U8 *) pbssDescription->ieFields,
733 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700734 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700735
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700736 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530737 vos_mem_copy(pftSessionEntry->rateSet.rate,
738 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700739
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700740 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530741 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700742 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
744
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700745 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530746 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 pftSessionEntry->ssId.length);
748
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800749 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
750 pftSessionEntry->dot11mode = selfDot11Mode;
751 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
752 && pBeaconStruct->VHTCaps.present);
753 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
754 && pBeaconStruct->HTCaps.present);
755#ifdef WLAN_FEATURE_11AC
756 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
757 {
758 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
759 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
760 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
761 }
762 else
763 {
764 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
765 }
766#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 // Self Mac
768 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
769 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800770#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700771 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700772#endif
773
774 /* Store beaconInterval */
775 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
776 pftSessionEntry->bssType = psessionEntry->bssType;
777
778 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
779 pftSessionEntry->nwType = pbssDescription->nwType;
780
781 /* Copy The channel Id to the session Table */
782 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
783 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
784
785
786 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
787 {
788 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
789 }
790 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
791 {
792 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
793 }
794 else
795 {
796 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700797 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700798 }
799
800 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
801 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800802 if( pMac->roam.configParam.shortSlotTime &&
803 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
804 {
805 pftSessionEntry->shortSlotTimeSupported = TRUE;
806 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700807
808 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
809 localPowerConstraint = regMax;
810 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
811 limGetIElenFromBssDescription(pbssDescription),
812 &pftSessionEntry->limCurrentBssQosCaps,
813 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700814 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815
816 pftSessionEntry->limReassocBssQosCaps =
817 pftSessionEntry->limCurrentBssQosCaps;
818 pftSessionEntry->limReassocBssPropCap =
819 pftSessionEntry->limCurrentBssPropCap;
820
821
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800822#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800823 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
824#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800826#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700827
828#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800829 limLog( pMac, LOG1, "%s: Regulatory max = %d, local power constraint = %d, ini tx power = %d, max tx = %d",
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800830 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700831#endif
832
833 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
834
835 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
836 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800837 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700838
839 pftSessionEntry->encryptType = psessionEntry->encryptType;
840
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800841 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
842 {
843 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
844 }
845 else
846 {
847 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
848 }
849 pftSessionEntry->htSupportedChannelWidthSet =
850 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
851 pftSessionEntry->htRecommendedTxWidthSet =
852 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530853 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
854 (pftSessionEntry->htSupportedChannelWidthSet == 1))
855 {
856 limInitOBSSScanParams(pMac, pftSessionEntry);
857 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530858 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 return pftSessionEntry;
860}
861
862/*------------------------------------------------------------------
863 *
864 * Setup the session and the add bss req for the pre-auth AP.
865 *
866 *------------------------------------------------------------------*/
867void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
868{
869 tpPESession pftSessionEntry;
870
871 // Prepare the session right now with as much as possible.
872 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
873
874 if (pftSessionEntry)
875 {
876 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800877#ifdef FEATURE_WLAN_ESE
878 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700879#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800880#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
882#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700883
884#ifdef FEATURE_WLAN_LFR
885 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
886#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800887#ifdef WLAN_FEATURE_11W
888 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
889#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
891 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
892 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
893 }
894}
895
896/*------------------------------------------------------------------
897 * Resume Link Call Back
898 *------------------------------------------------------------------*/
899void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
900{
901 tpPESession psessionEntry;
902
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700903 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
904 return;
905
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 psessionEntry = (tpPESession)data;
907
908 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
909 {
910 limFTSetupAuthSession(pMac, psessionEntry);
911 }
912
913 // Post the FT Pre Auth Response to SME
914 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
915 pMac->ft.ftPEContext.saved_auth_rsp,
916 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
917
918}
919
920/*------------------------------------------------------------------
921 * Resume Link Call Back
922 *------------------------------------------------------------------*/
923void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
924 tpPESession psessionEntry)
925{
926 //Set the resume channel to Any valid channel (invalid).
927 //This will instruct HAL to set it to any previous valid channel.
928 peSetResumeChannel(pMac, 0, 0);
929 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
930}
931
932tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
933 tANI_U8 *ric_ies, tANI_U32 *ieLength)
934{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530935 /* BlockACK + RIC is not supported now, TODO later to support this */
936#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 tDot11fIERICDataDesc ricIe;
938 tDot11fFfBAStartingSequenceControl baSsnControl;
939 tDot11fFfAddBAParameterSet baParamSet;
940 tDot11fFfBATimeout baTimeout;
941
942 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
943 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
944 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
945 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
946
947 ricIe.present = 1;
948 ricIe.RICData.present = 1;
949 ricIe.RICData.resourceDescCount = 1;
950 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
951 ricIe.RICDescriptor.present = 1;
952 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
953 baParamSet.tid = tid;
954 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
955 baParamSet.bufferSize = pTrafficClass->txBufSize;
956 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
957 baSsnControl.fragNumber = 0;
958 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530959 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700960 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
961 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
962 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
963 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530964 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700965 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
966 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
967 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
968 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530969 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700970 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
971 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
972 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
973 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530975#endif
976
977 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700978}
979
980tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
981{
982 tANI_U8 tid = 0;
983 tpDphHashNode pSta;
984 tANI_U16 numBA = 0, aid = 0;
985 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
986 tANI_U32 offset = 0, ieLength = 0;
987 tSirRetStatus status = eSIR_SUCCESS;
988
989 // First, extract the DPH entry
990 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
991 if( NULL == pSta )
992 {
993 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800994 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
995 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 return eSIR_FAILURE;
997 }
998
999 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1000 {
1001 if (pSta->tcCfg[tid].fUseBATx)
1002 {
1003 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1004 if (eSIR_SUCCESS == status)
1005 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001006 // TODO RIC
1007 if ( ieLength > MAX_FTIE_SIZE )
1008 {
1009 ieLength = 0;
1010 return status;
1011 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 offset += ieLength;
1013 *ric_ies_length += ieLength;
1014 numBA++;
1015 }
1016 else
1017 {
1018 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1019 }
1020 }
1021 }
1022
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001023 PELOGE(limLog(pMac, LOGE, FL("Number of BA RIC IEs created = %d: Total length = %d"), numBA, *ric_ies_length);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 return status;
1025}
1026
1027/*------------------------------------------------------------------
1028 *
1029 * Will post pre auth response to SME.
1030 *
1031 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001032void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1034 tpPESession psessionEntry)
1035{
1036 tpSirFTPreAuthRsp pFTPreAuthRsp;
1037 tSirMsgQ mmhMsg;
1038 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001039 // TODO: RIC Support
1040 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001041
1042 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301043 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001044 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001045 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001046 VOS_ASSERT(pFTPreAuthRsp != NULL);
1047 return;
1048 }
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301049
Jeff Johnson295189b2012-06-20 16:38:30 -07001050#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001051 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001052#endif
Kanchanapally, Vidyullatha31b8d142015-01-30 14:25:18 +05301053
1054 vos_mem_zero(pFTPreAuthRsp, rspLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1056 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1057 pFTPreAuthRsp->status = status;
1058 if (psessionEntry)
1059 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1060
1061 // The bssid of the AP we are sending Auth1 to.
1062 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1063 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1064 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1065
1066 // Attach the auth response now back to SME
1067 pFTPreAuthRsp->ft_ies_length = 0;
1068 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1069 {
1070 // Only 11r assoc has FT IEs.
1071 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1072 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1073 }
1074
1075#ifdef WLAN_FEATURE_VOWIFI_11R
1076 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1077 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001078 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1079 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1081 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1082 if (eSIR_SUCCESS != sirStatus)
1083 {
1084 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1085 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001086 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 }
1088#endif
1089
1090 mmhMsg.type = pFTPreAuthRsp->messageType;
1091 mmhMsg.bodyptr = pFTPreAuthRsp;
1092 mmhMsg.bodyval = 0;
1093
1094#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001095 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001096#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001097#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001098 if (status == eSIR_SUCCESS)
1099 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1100 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001101#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1103}
1104
1105/*------------------------------------------------------------------
1106 *
1107 * Send the FT Pre Auth Response to SME when ever we have a status
1108 * ready to be sent to SME
1109 *
1110 * SME will be the one to send it up to the supplicant to receive
1111 * FTIEs which will be required for Reassoc Req.
1112 *
1113 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001114void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001115 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1116 tpPESession psessionEntry)
1117{
1118
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001119 tpPESession pftSessionEntry;
1120 tANI_U8 sessionId;
1121 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001122#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1123 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1124#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001125
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 // Save the status of pre-auth
1127 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1128
1129 // Save the auth rsp, so we can send it to
1130 // SME once we resume link.
1131 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1132 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1133 {
1134 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1135 auth_rsp, auth_rsp_length);
1136 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1137 }
1138
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001139 /* Create FT session for the re-association at this point */
1140 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1141 {
1142 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1143 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1144 &sessionId, pMac->lim.maxStation)) == NULL)
1145 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001146 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301147 status = eSIR_FAILURE;
1148 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1149 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001150 }
1151 pftSessionEntry->peSessionId = sessionId;
1152 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1153 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1154 pftSessionEntry->bssType = psessionEntry->bssType;
1155
1156 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1157 {
1158 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1159 }
1160 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1161 {
1162 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1163 }
1164 else
1165 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001166 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001167 }
1168 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1169 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1170 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001171 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001172 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1173
1174 /* Update the ReAssoc BSSID of the current session */
1175 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001176 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001177 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301178out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001179 if (psessionEntry->currentOperChannel !=
1180 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1181 {
1182 // Need to move to the original AP channel
1183 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1184 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1185 }
1186 else
1187 {
1188#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001189 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1191#endif
1192 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1193 }
1194}
1195
1196/*------------------------------------------------------------------
1197 *
1198 * This function handles the 11R Reassoc Req from SME
1199 *
1200 *------------------------------------------------------------------*/
1201void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1202 tpPESession psessionEntry)
1203{
1204 tANI_U8 smeSessionId = 0;
1205 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001206 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 tLimMlmReassocReq *pMlmReassocReq;
1208 tANI_U16 caps;
1209 tANI_U32 val;
1210 tSirMsgQ msgQ;
1211 tSirRetStatus retCode;
1212 tANI_U32 teleBcnEn = 0;
1213
Jeff Johnson278b0492013-04-03 14:10:08 -07001214 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1216 psessionEntry->smeSessionId = smeSessionId;
1217 psessionEntry->transactionId = transactionId;
1218
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001219#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1220 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1221#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001222
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301223 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1224 {
1225 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1226 return;
1227 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301228 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1229 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 {
1231 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301232 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 return;
1234 }
1235
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301236 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1237 psessionEntry->bssId,
1238 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001239
1240 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1241 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1242 != eSIR_SUCCESS)
1243 {
1244 /**
1245 * Could not get ReassocFailureTimeout value
1246 * from CFG. Log error.
1247 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001248 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301249 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001250 return;
1251 }
1252
1253 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1254 {
1255 /**
1256 * Could not get Capabilities value
1257 * from CFG. Log error.
1258 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001259 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301260 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001261 return;
1262 }
1263 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001264
Jeff Johnson295189b2012-06-20 16:38:30 -07001265 /* Update PE sessionId*/
1266 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1267
1268 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001269 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1270 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001272 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301273 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001274 return;
1275 }
1276
1277 if (teleBcnEn)
1278 {
1279 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001280 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001281 /**
1282 * Could not get ListenInterval value
1283 * from CFG. Log error.
1284 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001285 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301286 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001288 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001289 }
1290 else
1291 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001292 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001293 {
1294 /**
1295 * Could not get ListenInterval value
1296 * from CFG. Log error.
1297 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001298 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301299 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 return;
1301 }
1302 }
1303 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001304 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301306 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001307 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 }
1309
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 pMlmReassocReq->listenInterval = (tANI_U16) val;
1311
1312 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1313
1314
1315 //we need to defer the message until we get the response back from HAL.
1316 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001317
Jeff Johnson295189b2012-06-20 16:38:30 -07001318 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1319 msgQ.reserved = 0;
1320 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1321 msgQ.bodyval = 0;
1322
1323
1324#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001325 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001326#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001327 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001328
1329 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001330 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 {
1332 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001333 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 retCode );
1335 }
1336 // Dont need this anymore
1337 pMac->ft.ftPEContext.pAddBssReq = NULL;
Mukul Sharma38a6bbc2014-06-30 00:25:39 +05301338#ifdef DEBUG_ROAM_DELAY
1339 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1340#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 return;
1342}
1343
1344/*------------------------------------------------------------------
1345 *
1346 * This function is called if preauth response is not received from the AP
1347 * within this timeout while FT in progress
1348 *
1349 *------------------------------------------------------------------*/
1350void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1351{
1352 tpPESession psessionEntry;
1353
1354 // We have failed pre auth. We need to resume link and get back on
1355 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301356 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001357
1358 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1359 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001360 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001361 return;
1362 }
1363
Abhishek Singh8a226222014-03-13 14:49:16 +05301364 /* To handle the race condition where we recieve preauth rsp after
1365 * timer has expired.
1366 */
1367 if (eANI_BOOLEAN_TRUE ==
1368 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1369 {
1370 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1371 " (session %p)"), psessionEntry);
1372 return;
1373 }
1374 else
1375 {
1376 /* Here we are sending preauth rsp with failure state
1377 * and which is forwarded to SME. Now, if we receive an preauth
1378 * resp from AP with success it would create a FT pesession, but
1379 * will be dropped in SME leaving behind the pesession.
1380 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1381 * limProcessAuthFrameNoSession.
1382 */
1383 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1384 " (session %p)"), psessionEntry);
1385 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1386 eANI_BOOLEAN_TRUE;
1387 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001388 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1389 // to get back.
1390 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1391}
1392
1393
1394/*------------------------------------------------------------------
1395 *
1396 * This function is called to process the update key request from SME
1397 *
1398 *------------------------------------------------------------------*/
1399tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1400{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301401 tAddBssParams * pAddBssParams;
1402 tSirFTUpdateKeyInfo * pKeyInfo;
1403 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001404
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301405 /* Sanity Check */
1406 if( pMac == NULL || pMsgBuf == NULL )
1407 {
1408 return TRUE;
1409 }
1410 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1411 {
1412 limLog( pMac, LOGE,
1413 FL( "pAddBssReq is NULL" ));
1414 return TRUE;
1415 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001416
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301417 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1418 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001419
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301420 /* Store the key information in the ADD BSS parameters */
1421 pAddBssParams->extSetStaKeyParamValid = 1;
1422 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301423 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1424 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301425 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1426 {
1427 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1428 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001429
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301430 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301431 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301432 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301433 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001434
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301435 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1436
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301437 limLog(pMac, LOG1,
1438 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301439
1440 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1441 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301442 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301443 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1444 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1445 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1446 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1451 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1452 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1455 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1456 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1457 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1458 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1459 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301460 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301461 }
1462
1463 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001464}
1465
1466tSirRetStatus
1467limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1468{
1469 tSirMsgQ msg;
1470 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1471 tpAggrAddTsParams pAggrAddTsParam;
1472 tpPESession psessionEntry = NULL;
1473 tpLimTspecInfo tspecInfo;
1474 tANI_U8 ac;
1475 tpDphHashNode pSta;
1476 tANI_U16 aid;
1477 tANI_U8 sessionId;
1478 int i;
1479
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301480 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1481 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301483 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001484 return eSIR_MEM_ALLOC_FAILED;
1485 }
1486
1487 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1488
1489 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001490 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301491 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 return eSIR_FAILURE;
1493 }
1494
1495 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1496 if (pSta == NULL)
1497 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001498 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301499 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 return eSIR_FAILURE;
1501 }
1502
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301503 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1504 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 pAggrAddTsParam->staIdx = psessionEntry->staId;
1506 // Fill in the sessionId specific to PE
1507 pAggrAddTsParam->sessionId = sessionId;
1508 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1509
1510 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1511 {
1512 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1513 {
1514 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1515 /* Since AddTS response was successful, check for the PSB flag
1516 * and directional flag inside the TS Info field.
1517 * An AC is trigger enabled AC if the PSB subfield is set to 1
1518 * in the uplink direction.
1519 * An AC is delivery enabled AC if the PSB subfield is set to 1
1520 * in the downlink direction.
1521 * An AC is trigger and delivery enabled AC if the PSB subfield
1522 * is set to 1 in the bi-direction field.
1523 */
1524 if (pTspec->tsinfo.traffic.psb == 1)
1525 {
1526 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1527 }
1528 else
1529 {
1530 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1531 }
1532 /* ADDTS success, so AC is now admitted. We shall now use the default
1533 * EDCA parameters as advertised by AP and send the updated EDCA params
1534 * to HAL.
1535 */
1536 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1537 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1538 {
1539 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1540 }
1541 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1542 {
1543 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1544 }
1545 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1546 {
1547 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1548 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1549 }
1550
1551 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1552
1553 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1554 {
1555 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1556 }
1557 else
1558 {
1559 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1560 }
1561
1562 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1563 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001564 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001565 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301566 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1568 }
1569
1570 // Copy the TSPEC paramters
1571 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1572 }
1573 }
1574
1575 msg.type = WDA_AGGR_QOS_REQ;
1576 msg.bodyptr = pAggrAddTsParam;
1577 msg.bodyval = 0;
1578
1579 /* We need to defer any incoming messages until we get a
1580 * WDA_AGGR_QOS_RSP from HAL.
1581 */
1582 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001583 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001584
1585 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1586 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001587 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301589 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001590 return eSIR_FAILURE;
1591 }
1592
1593 return eSIR_SUCCESS;
1594}
1595
1596void
1597limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1598 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1599{
1600 tpSirAggrQosRsp rsp;
1601 int i = 0;
1602
1603 if (! rspReqd)
1604 {
1605 return;
1606 }
1607
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301608 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1609 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301611 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001612 return;
1613 }
1614
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301615 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001616 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1617 rsp->sessionId = smesessionId;
1618 rsp->length = sizeof(*rsp);
1619 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1620
1621 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1622 {
1623 if( (1 << i) & aggrQosRsp->tspecIdx )
1624 {
1625 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1626 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1627 }
1628 }
1629
1630 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1631 return;
1632}
1633
1634
1635void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1636{
1637 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1638 //tpAggrQosParams pAggrQosRspMsg = NULL;
1639 tAddTsParams addTsParam = {0};
1640 tpDphHashNode pSta = NULL;
1641 tANI_U16 assocId =0;
1642 tSirMacAddr peerMacAddr;
1643 tANI_U8 rspReqd = 1;
1644 tpPESession psessionEntry = NULL;
1645 int i = 0;
1646
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301647 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001648
1649 /* Need to process all the deferred messages enqueued since sending the
1650 SIR_HAL_AGGR_ADD_TS_REQ */
1651 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1652
1653 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1654 if (NULL == pAggrQosRspMsg)
1655 {
1656 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1657 return;
1658 }
1659
1660 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1661 if (NULL == psessionEntry)
1662 {
1663 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001664 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 if( pAggrQosRspMsg != NULL )
1666 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301667 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 }
1669 return;
1670 }
1671
1672 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1673 {
1674 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1675 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1676 {
1677 /* send DELTS to the station */
1678 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1679
1680 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1681 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1682 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1683 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1684
1685 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1686 &addTsParam.tspec.tsinfo,
1687 &addTsParam.tspec, psessionEntry);
1688
1689 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1690 &psessionEntry->dph.dphHashTable);
1691 if (pSta != NULL)
1692 {
1693 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1694 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1695 }
1696 }
1697 }
1698
1699 /* Send the Aggr QoS response to SME */
1700
1701 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1702 psessionEntry->smeSessionId);
1703 if( pAggrQosRspMsg != NULL )
1704 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301705 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 }
1707 return;
1708}
1709
Jeff Johnson295189b2012-06-20 16:38:30 -07001710#endif /* WLAN_FEATURE_VOWIFI_11R */