blob: 496b140f3dea384d2e05f0adacc8269d1d837f0a [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 {
120 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
121 pMac->ft.ftPEContext.pAddBssReq = NULL;
122 }
123
124 if (pMac->ft.ftPEContext.pAddStaReq)
125 {
126 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
127 pMac->ft.ftPEContext.pAddStaReq = NULL;
128 }
129
130 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
131
132}
133
134/*--------------------------------------------------------------------------
135 Init FT variables.
136 ------------------------------------------------------------------------*/
137void limFTInit(tpAniSirGlobal pMac)
138{
139 if (pMac->ft.ftPEContext.pFTPreAuthReq)
140 {
141#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700142 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700143 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700144#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800145 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
146 {
147 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
148 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
149 }
150
Jeff Johnson295189b2012-06-20 16:38:30 -0700151 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
152 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
153 }
154
155 // This is the old session, should be deleted else where.
156 // We should not be cleaning it here, just set it to NULL.
157 if (pMac->ft.ftPEContext.psavedsessionEntry)
158 {
159#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700160 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700161 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700162#endif
163 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
164 }
165
166 // This is the extra session we added as part of Auth resp
167 // clean it up.
168 if (pMac->ft.ftPEContext.pftSessionEntry)
169 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530170
Jeff Johnson295189b2012-06-20 16:38:30 -0700171#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700172 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700173 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700174#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530175 /* Delete the previous valid preauth pesession if it is still in
176 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
177 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
178 * preauth didnt went through and its Session was not deleted.
179 */
180 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
181 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
182 == eLIM_SME_WT_REASSOC_STATE) &&
183 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
184 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
185 {
186 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
187 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
188 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
189 }
190
Jeff Johnson295189b2012-06-20 16:38:30 -0700191 pMac->ft.ftPEContext.pftSessionEntry = NULL;
192 }
193
194 if (pMac->ft.ftPEContext.pAddBssReq)
195 {
196#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700197 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700198 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700199#endif
200 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
201 pMac->ft.ftPEContext.pAddBssReq = NULL;
202 }
203
204
205 if (pMac->ft.ftPEContext.pAddStaReq)
206 {
207#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700208 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700209 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700210#endif
211 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
212 pMac->ft.ftPEContext.pAddStaReq = NULL;
213 }
214
215 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
216
217}
218
219/*------------------------------------------------------------------
220 *
221 * This is the handler after suspending the link.
222 * We suspend the link and then now proceed to switch channel.
223 *
224 *------------------------------------------------------------------*/
225void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
226{
227 tpPESession psessionEntry;
228
229 // The link is suspended of not ?
230 if (status != eHAL_STATUS_SUCCESS)
231 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700232 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700233 // Post the FT Pre Auth Response to SME
234 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
235
236 return;
237 }
238
239 psessionEntry = (tpPESession)data;
240 // Suspended, now move to a different channel.
241 // Perform some sanity check before proceeding.
242 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
243 {
244 limChangeChannelWithCallback(pMac,
245 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
246 limPerformFTPreAuth, NULL, psessionEntry);
247 return;
248 }
249
250 // Else return error.
251 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
252}
253
254
255/*--------------------------------------------------------------------------
256 In this function, we process the FT Pre Auth Req.
257 We receive Pre-Auth
258 Suspend link
259 Register a call back
260 In the call back, we will need to accept frames from the new bssid
261 Send out the auth req to new AP.
262 Start timer and when the timer is done or if we receive the Auth response
263 We change channel
264 Resume link
265 ------------------------------------------------------------------------*/
266int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
267{
268 int bufConsumed = FALSE;
269 tpPESession psessionEntry;
270 tANI_U8 sessionId;
271
272 // Now we are starting fresh make sure all's cleanup.
273 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530274 // Can set it only after sending auth
275 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
276
277 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
278 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
279 {
280 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
281 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
282 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700283
284 // We need information from the Pre-Auth Req. Lets save that
285 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
286
287#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800288 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700289 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
290 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
291 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
292#endif
293
294 // Get the current session entry
295 psessionEntry = peFindSessionByBssid(pMac,
296 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
297 if (psessionEntry == NULL)
298 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700299 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700300 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700301 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
302 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800303 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530304 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
305 {
306 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
307 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
308 }
309 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700310 return TRUE;
311 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700312#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
313 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
314#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700315
316 // Dont need to suspend if APs are in same channel
317 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
318 {
319 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700320 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700321 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700322 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 (tANI_U32 *)psessionEntry);
324 }
325 else
326 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700327 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700328 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 // We are in the same channel. Perform pre-auth
330 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
331 }
332
333 return bufConsumed;
334}
335
336/*------------------------------------------------------------------
337 * Send the Auth1
338 * Receive back Auth2
339 *------------------------------------------------------------------*/
340void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
341 tpPESession psessionEntry)
342{
343 tSirMacAuthFrameBody authFrame;
344
345 if (psessionEntry->is11Rconnection)
346 {
347 // Only 11r assoc has FT IEs.
348 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
349 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800350 PELOGE(limLog( pMac, LOGE,
351 "%s: FTIEs for Auth Req Seq 1 is absent",
352 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700353 return;
354 }
355 }
356 if (status != eHAL_STATUS_SUCCESS)
357 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800358 PELOGE(limLog( pMac, LOGE,
359 "%s: Change channel not successful for FT pre-auth",
360 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361 return;
362 }
363 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
364
365#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700366 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700367 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700368 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700369#endif
370
371
372 if (psessionEntry->is11Rconnection)
373 {
374 // Now we are on the right channel and need to send out Auth1 and
375 // receive Auth2.
376 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
377 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800378#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 else
380 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800381 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700382 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800383 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700384 }
385#endif
386 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
387 authFrame.authStatusCode = 0;
388
389 // Start timer here to come back to operating channel.
390 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
391 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
392 {
393#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700394 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700395#endif
396 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800397MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
399#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800400 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700401#endif
402
403 limSendAuthMgmtFrame(pMac, &authFrame,
404 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
405 LIM_NO_WEP_IN_FC, psessionEntry);
406
407 return;
408}
409
410
411/*------------------------------------------------------------------
412 *
413 * Create the new Add Bss Req to the new AP.
414 * This will be used when we are ready to FT to the new AP.
415 * The newly created ft Session entry is passed to this function
416 *
417 *------------------------------------------------------------------*/
418tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
419 tANI_U8 updateEntry, tpPESession pftSessionEntry,
420 tpSirBssDescription bssDescription )
421{
422 tpAddBssParams pAddBssParams = NULL;
423 tANI_U8 i;
424 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700426
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530427 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
428 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700429 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530430 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700431 return eSIR_MEM_ALLOC_FAILED;
432 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700433
434 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530435 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
436 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530438 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530440 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 return (eSIR_MEM_ALLOC_FAILED);
442 }
443
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530444 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700445
446
447 limExtractApCapabilities( pMac,
448 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700449 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700450
451 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700452 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530454 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
455 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530458 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
459 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700460
461 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
462 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
463
464 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
465
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700466 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 pAddBssParams->updateBss = updateEntry;
468
469
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
471 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
472 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
473 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700474
475
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700476 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530477 vos_mem_copy(pAddBssParams->rateSet.rate,
478 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700479
480 pAddBssParams->nwType = bssDescription->nwType;
481
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700482 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
484 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
485 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
486 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
487
488 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700491 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700492
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700493 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700495 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
496 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700497
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700499 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 (chanWidthSupp) )
501 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700502 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
503 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 }
505 else
506 {
507 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700508 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
511 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
512 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 }
514 }
515
516 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800517 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
518
519#ifdef WLAN_FEATURE_11AC
520 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
521 {
522 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
523 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
524 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
525 pAddBssParams->currentOperChannel,
526 pAddBssParams->currentExtChannel,
527 pftSessionEntry->apCenterChan,
528 pftSessionEntry);
529 }
530 else
531 {
532 pAddBssParams->vhtCapable = 0;
533 }
534#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700535
536#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700537 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 pAddBssParams->currentOperChannel);
539#endif
540
541
542 // Populate the STA-related parameters here
543 // Note that the STA here refers to the AP
544 {
545 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
546
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530547 vos_mem_copy(pAddBssParams->staContext.bssId,
548 bssDescription->bssId,
549 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
551
552 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
553 pAddBssParams->staContext.uAPSD = 0;
554 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700555 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 pAddBssParams->staContext.updateSta = updateEntry;
557 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
558
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700559 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 {
561 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
562 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700563 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
564 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
565 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700566 (chanWidthSupp) )
567 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700568 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 }
570 else
571 {
572 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
573 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800574#ifdef WLAN_FEATURE_11AC
575 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
576 {
577 pAddBssParams->staContext.vhtCapable = 1;
578 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
579 pBeaconStruct->VHTCaps.muBeamformerCap) &&
580 pftSessionEntry->txBFIniFeatureEnabled)
581 {
582 pAddBssParams->staContext.vhtTxBFCapable = 1;
583 }
584 }
585#endif
586 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
587 (chanWidthSupp) )
588 {
589 pAddBssParams->staContext.txChannelWidthSet =
590 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
591#ifdef WLAN_FEATURE_11AC
592 if (pAddBssParams->staContext.vhtCapable)
593 {
594 pAddBssParams->staContext.vhtTxChannelWidthSet =
595 pBeaconStruct->VHTOperation.chanWidth;
596 }
597#endif
598 }
599 else
600 {
601 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
602 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700603 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
604 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
605 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
606 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
607 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
608 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
609 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
610 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700611
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700612 if( pBeaconStruct->HTInfo.present )
613 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 }
615
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700616 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
617 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 pAddBssParams->staContext.wmmEnabled = 1;
619 else
620 pAddBssParams->staContext.wmmEnabled = 0;
621
622 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700623#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700624 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
625 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700626 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700627#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700628 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700630#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800631 if (pftSessionEntry->htCapability)
632 {
633 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
634 if (pftSessionEntry->vhtCapability)
635 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
636 }
637 else
638 {
639 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
640 {
641 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
642 }
643 else
644 {
645 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
646 }
647 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700648 }
649
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 //Disable BA. It will be set as part of ADDBA negotiation.
651 for( i = 0; i < STACFG_MAX_TC; i++ )
652 {
653 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
654 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
655 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
656 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
657 }
658
659#if defined WLAN_FEATURE_VOWIFI
660 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
661#endif
662
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800663#ifdef WLAN_FEATURE_11W
664 if (pftSessionEntry->limRmfEnabled)
665 {
666 pAddBssParams->rmfEnabled = 1;
667 pAddBssParams->staContext.rmfEnabled = 1;
668 }
669#endif
670
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 pAddBssParams->status = eHAL_STATUS_SUCCESS;
672 pAddBssParams->respReqd = true;
673
674 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
675 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
676
677 // Set a new state for MLME
678
679 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800680 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, pftSessionEntry->peSessionId, eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
682
683 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
684
685#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800686 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700687#endif
688
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530689 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 return 0;
691}
692
693/*------------------------------------------------------------------
694 *
695 * Setup the new session for the pre-auth AP.
696 * Return the newly created session entry.
697 *
698 *------------------------------------------------------------------*/
699tpPESession limFillFTSession(tpAniSirGlobal pMac,
700 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
701{
702 tpPESession pftSessionEntry;
703 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 tPowerdBm localPowerConstraint;
705 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700706 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800707 uint32 selfDot11Mode;
708 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700709
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530710 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
711 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700712 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530713 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700714 return NULL;
715 }
716
Jeff Johnson295189b2012-06-20 16:38:30 -0700717
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800718
719 /* Retrieve the session that has already been created and update the entry */
720 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800721#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700722 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700723#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
725 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
726 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
727 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
728
729 // Fields to be filled later
730 pftSessionEntry->pLimJoinReq = NULL;
731 pftSessionEntry->smeSessionId = 0;
732 pftSessionEntry->transactionId = 0;
733
734 limExtractApCapabilities( pMac,
735 (tANI_U8 *) pbssDescription->ieFields,
736 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700737 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700739 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530740 vos_mem_copy(pftSessionEntry->rateSet.rate,
741 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700742
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700743 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530744 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700745 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700746
747
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700748 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530749 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 pftSessionEntry->ssId.length);
751
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800752 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
753 pftSessionEntry->dot11mode = selfDot11Mode;
754 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
755 && pBeaconStruct->VHTCaps.present);
756 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
757 && pBeaconStruct->HTCaps.present);
758#ifdef WLAN_FEATURE_11AC
759 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
760 {
761 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
762 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
763 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
764 }
765 else
766 {
767 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
768 }
769#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700770 // Self Mac
771 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
772 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800773#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700774 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700775#endif
776
777 /* Store beaconInterval */
778 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
779 pftSessionEntry->bssType = psessionEntry->bssType;
780
781 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
782 pftSessionEntry->nwType = pbssDescription->nwType;
783
784 /* Copy The channel Id to the session Table */
785 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
786 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
787
788
789 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
790 {
791 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
792 }
793 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
794 {
795 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
796 }
797 else
798 {
799 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700800 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 }
802
803 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
804 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800805 if( pMac->roam.configParam.shortSlotTime &&
806 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
807 {
808 pftSessionEntry->shortSlotTimeSupported = TRUE;
809 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700810
811 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
812 localPowerConstraint = regMax;
813 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
814 limGetIElenFromBssDescription(pbssDescription),
815 &pftSessionEntry->limCurrentBssQosCaps,
816 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700817 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700818
819 pftSessionEntry->limReassocBssQosCaps =
820 pftSessionEntry->limCurrentBssQosCaps;
821 pftSessionEntry->limReassocBssPropCap =
822 pftSessionEntry->limCurrentBssPropCap;
823
824
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800825#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800826 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
827#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800829#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700830
831#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800832 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 -0800833 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700834#endif
835
836 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
837
838 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
839 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800840 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700841
842 pftSessionEntry->encryptType = psessionEntry->encryptType;
843
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800844 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
845 {
846 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
847 }
848 else
849 {
850 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
851 }
852 pftSessionEntry->htSupportedChannelWidthSet =
853 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
854 pftSessionEntry->htRecommendedTxWidthSet =
855 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530856 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
857 (pftSessionEntry->htSupportedChannelWidthSet == 1))
858 {
859 limInitOBSSScanParams(pMac, pftSessionEntry);
860 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530861 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 return pftSessionEntry;
863}
864
865/*------------------------------------------------------------------
866 *
867 * Setup the session and the add bss req for the pre-auth AP.
868 *
869 *------------------------------------------------------------------*/
870void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
871{
872 tpPESession pftSessionEntry;
873
874 // Prepare the session right now with as much as possible.
875 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
876
877 if (pftSessionEntry)
878 {
879 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800880#ifdef FEATURE_WLAN_ESE
881 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700882#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800883#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
885#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700886
887#ifdef FEATURE_WLAN_LFR
888 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
889#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800890#ifdef WLAN_FEATURE_11W
891 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
892#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
894 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
895 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
896 }
897}
898
899/*------------------------------------------------------------------
900 * Resume Link Call Back
901 *------------------------------------------------------------------*/
902void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
903{
904 tpPESession psessionEntry;
905
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700906 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
907 return;
908
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 psessionEntry = (tpPESession)data;
910
911 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
912 {
913 limFTSetupAuthSession(pMac, psessionEntry);
914 }
915
916 // Post the FT Pre Auth Response to SME
917 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
918 pMac->ft.ftPEContext.saved_auth_rsp,
919 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
920
921}
922
923/*------------------------------------------------------------------
924 * Resume Link Call Back
925 *------------------------------------------------------------------*/
926void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
927 tpPESession psessionEntry)
928{
929 //Set the resume channel to Any valid channel (invalid).
930 //This will instruct HAL to set it to any previous valid channel.
931 peSetResumeChannel(pMac, 0, 0);
932 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
933}
934
935tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
936 tANI_U8 *ric_ies, tANI_U32 *ieLength)
937{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530938 /* BlockACK + RIC is not supported now, TODO later to support this */
939#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700940 tDot11fIERICDataDesc ricIe;
941 tDot11fFfBAStartingSequenceControl baSsnControl;
942 tDot11fFfAddBAParameterSet baParamSet;
943 tDot11fFfBATimeout baTimeout;
944
945 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
946 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
947 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
948 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
949
950 ricIe.present = 1;
951 ricIe.RICData.present = 1;
952 ricIe.RICData.resourceDescCount = 1;
953 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
954 ricIe.RICDescriptor.present = 1;
955 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
956 baParamSet.tid = tid;
957 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
958 baParamSet.bufferSize = pTrafficClass->txBufSize;
959 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
960 baSsnControl.fragNumber = 0;
961 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530962 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700963 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
964 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
965 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
966 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530967 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700968 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
969 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
970 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
971 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530972 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700973 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
974 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
975 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
976 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700977 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530978#endif
979
980 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700981}
982
983tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
984{
985 tANI_U8 tid = 0;
986 tpDphHashNode pSta;
987 tANI_U16 numBA = 0, aid = 0;
988 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
989 tANI_U32 offset = 0, ieLength = 0;
990 tSirRetStatus status = eSIR_SUCCESS;
991
992 // First, extract the DPH entry
993 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
994 if( NULL == pSta )
995 {
996 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800997 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
998 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 return eSIR_FAILURE;
1000 }
1001
1002 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1003 {
1004 if (pSta->tcCfg[tid].fUseBATx)
1005 {
1006 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1007 if (eSIR_SUCCESS == status)
1008 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001009 // TODO RIC
1010 if ( ieLength > MAX_FTIE_SIZE )
1011 {
1012 ieLength = 0;
1013 return status;
1014 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001015 offset += ieLength;
1016 *ric_ies_length += ieLength;
1017 numBA++;
1018 }
1019 else
1020 {
1021 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1022 }
1023 }
1024 }
1025
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001026 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 -07001027 return status;
1028}
1029
1030/*------------------------------------------------------------------
1031 *
1032 * Will post pre auth response to SME.
1033 *
1034 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001035void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001036 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1037 tpPESession psessionEntry)
1038{
1039 tpSirFTPreAuthRsp pFTPreAuthRsp;
1040 tSirMsgQ mmhMsg;
1041 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001042 // TODO: RIC Support
1043 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001044
1045 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301046 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001047 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001048 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 VOS_ASSERT(pFTPreAuthRsp != NULL);
1050 return;
1051 }
1052 vos_mem_zero( pFTPreAuthRsp, rspLen);
1053#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001054 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001055#endif
1056
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301057 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1059 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1060 pFTPreAuthRsp->status = status;
1061 if (psessionEntry)
1062 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1063
1064 // The bssid of the AP we are sending Auth1 to.
1065 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1066 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1067 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1068
1069 // Attach the auth response now back to SME
1070 pFTPreAuthRsp->ft_ies_length = 0;
1071 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1072 {
1073 // Only 11r assoc has FT IEs.
1074 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1075 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1076 }
1077
1078#ifdef WLAN_FEATURE_VOWIFI_11R
1079 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1080 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001081 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1082 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1084 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1085 if (eSIR_SUCCESS != sirStatus)
1086 {
1087 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1088 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001089 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001090 }
1091#endif
1092
1093 mmhMsg.type = pFTPreAuthRsp->messageType;
1094 mmhMsg.bodyptr = pFTPreAuthRsp;
1095 mmhMsg.bodyval = 0;
1096
1097#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001098 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001099#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001100#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001101 if (status == eSIR_SUCCESS)
1102 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1103 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001104#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1106}
1107
1108/*------------------------------------------------------------------
1109 *
1110 * Send the FT Pre Auth Response to SME when ever we have a status
1111 * ready to be sent to SME
1112 *
1113 * SME will be the one to send it up to the supplicant to receive
1114 * FTIEs which will be required for Reassoc Req.
1115 *
1116 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001117void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1119 tpPESession psessionEntry)
1120{
1121
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001122 tpPESession pftSessionEntry;
1123 tANI_U8 sessionId;
1124 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001125#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1126 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1127#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001128
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 // Save the status of pre-auth
1130 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1131
1132 // Save the auth rsp, so we can send it to
1133 // SME once we resume link.
1134 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1135 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1136 {
1137 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1138 auth_rsp, auth_rsp_length);
1139 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1140 }
1141
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001142 /* Create FT session for the re-association at this point */
1143 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1144 {
1145 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1146 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1147 &sessionId, pMac->lim.maxStation)) == NULL)
1148 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001149 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001150 return;
1151 }
1152 pftSessionEntry->peSessionId = sessionId;
1153 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1154 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1155 pftSessionEntry->bssType = psessionEntry->bssType;
1156
1157 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1158 {
1159 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1160 }
1161 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1162 {
1163 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1164 }
1165 else
1166 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001167 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001168 }
1169 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1170 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1171 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001172 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001173 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1174
1175 /* Update the ReAssoc BSSID of the current session */
1176 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001177 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001178 }
1179
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 if (psessionEntry->currentOperChannel !=
1181 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1182 {
1183 // Need to move to the original AP channel
1184 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1185 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1186 }
1187 else
1188 {
1189#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001190 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001191 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1192#endif
1193 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1194 }
1195}
1196
1197/*------------------------------------------------------------------
1198 *
1199 * This function handles the 11R Reassoc Req from SME
1200 *
1201 *------------------------------------------------------------------*/
1202void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1203 tpPESession psessionEntry)
1204{
1205 tANI_U8 smeSessionId = 0;
1206 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001207 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 tLimMlmReassocReq *pMlmReassocReq;
1209 tANI_U16 caps;
1210 tANI_U32 val;
1211 tSirMsgQ msgQ;
1212 tSirRetStatus retCode;
1213 tANI_U32 teleBcnEn = 0;
1214
Jeff Johnson278b0492013-04-03 14:10:08 -07001215 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1217 psessionEntry->smeSessionId = smeSessionId;
1218 psessionEntry->transactionId = transactionId;
1219
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001220#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1221 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1222#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001223
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301224 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1225 {
1226 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1227 return;
1228 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301229 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1230 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001231 {
1232 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301233 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 return;
1235 }
1236
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301237 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1238 psessionEntry->bssId,
1239 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001240
1241 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1242 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1243 != eSIR_SUCCESS)
1244 {
1245 /**
1246 * Could not get ReassocFailureTimeout value
1247 * from CFG. Log error.
1248 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001249 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301250 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 return;
1252 }
1253
1254 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1255 {
1256 /**
1257 * Could not get Capabilities value
1258 * from CFG. Log error.
1259 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001260 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301261 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 return;
1263 }
1264 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001265
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 /* Update PE sessionId*/
1267 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1268
1269 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001270 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1271 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001272 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001273 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301274 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001275 return;
1276 }
1277
1278 if (teleBcnEn)
1279 {
1280 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001281 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 /**
1283 * Could not get ListenInterval value
1284 * from CFG. Log error.
1285 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001286 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301287 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001288 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001289 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 }
1291 else
1292 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001293 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 {
1295 /**
1296 * Could not get ListenInterval value
1297 * from CFG. Log error.
1298 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001299 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301300 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001301 return;
1302 }
1303 }
1304 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001305 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301307 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001308 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 }
1310
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 pMlmReassocReq->listenInterval = (tANI_U16) val;
1312
1313 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1314
1315
1316 //we need to defer the message until we get the response back from HAL.
1317 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001318
Jeff Johnson295189b2012-06-20 16:38:30 -07001319 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1320 msgQ.reserved = 0;
1321 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1322 msgQ.bodyval = 0;
1323
1324
1325#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001326 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001327#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001328 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001329
1330 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001331 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 {
1333 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001334 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 retCode );
1336 }
1337 // Dont need this anymore
1338 pMac->ft.ftPEContext.pAddBssReq = NULL;
Mukul Sharma38a6bbc2014-06-30 00:25:39 +05301339#ifdef DEBUG_ROAM_DELAY
1340 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1341#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001342 return;
1343}
1344
1345/*------------------------------------------------------------------
1346 *
1347 * This function is called if preauth response is not received from the AP
1348 * within this timeout while FT in progress
1349 *
1350 *------------------------------------------------------------------*/
1351void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1352{
1353 tpPESession psessionEntry;
1354
1355 // We have failed pre auth. We need to resume link and get back on
1356 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301357 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
1359 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1360 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001361 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 return;
1363 }
1364
Abhishek Singh8a226222014-03-13 14:49:16 +05301365 /* To handle the race condition where we recieve preauth rsp after
1366 * timer has expired.
1367 */
1368 if (eANI_BOOLEAN_TRUE ==
1369 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1370 {
1371 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1372 " (session %p)"), psessionEntry);
1373 return;
1374 }
1375 else
1376 {
1377 /* Here we are sending preauth rsp with failure state
1378 * and which is forwarded to SME. Now, if we receive an preauth
1379 * resp from AP with success it would create a FT pesession, but
1380 * will be dropped in SME leaving behind the pesession.
1381 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1382 * limProcessAuthFrameNoSession.
1383 */
1384 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1385 " (session %p)"), psessionEntry);
1386 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1387 eANI_BOOLEAN_TRUE;
1388 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001389 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1390 // to get back.
1391 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1392}
1393
1394
1395/*------------------------------------------------------------------
1396 *
1397 * This function is called to process the update key request from SME
1398 *
1399 *------------------------------------------------------------------*/
1400tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1401{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301402 tAddBssParams * pAddBssParams;
1403 tSirFTUpdateKeyInfo * pKeyInfo;
1404 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001405
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301406 /* Sanity Check */
1407 if( pMac == NULL || pMsgBuf == NULL )
1408 {
1409 return TRUE;
1410 }
1411 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1412 {
1413 limLog( pMac, LOGE,
1414 FL( "pAddBssReq is NULL" ));
1415 return TRUE;
1416 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001417
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301418 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1419 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301421 /* Store the key information in the ADD BSS parameters */
1422 pAddBssParams->extSetStaKeyParamValid = 1;
1423 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301424 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1425 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301426 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1427 {
1428 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1429 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001430
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301431 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1432 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1433 pAddBssParams->extSetStaKeyParamValid,
1434 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001435
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301436 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1437
1438 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001439 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301440
1441 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1442 {
1443 PELOG1(limLog(pMac, LOG1,
1444 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1445 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1446 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1451 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1452 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1455 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1456 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1457 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1458 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1459 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1460 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1461 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1462 }
1463
1464 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001465}
1466
1467tSirRetStatus
1468limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1469{
1470 tSirMsgQ msg;
1471 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1472 tpAggrAddTsParams pAggrAddTsParam;
1473 tpPESession psessionEntry = NULL;
1474 tpLimTspecInfo tspecInfo;
1475 tANI_U8 ac;
1476 tpDphHashNode pSta;
1477 tANI_U16 aid;
1478 tANI_U8 sessionId;
1479 int i;
1480
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301481 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1482 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001483 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301484 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 return eSIR_MEM_ALLOC_FAILED;
1486 }
1487
1488 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1489
1490 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001491 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301492 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 return eSIR_FAILURE;
1494 }
1495
1496 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1497 if (pSta == NULL)
1498 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001499 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301500 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001501 return eSIR_FAILURE;
1502 }
1503
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301504 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1505 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 pAggrAddTsParam->staIdx = psessionEntry->staId;
1507 // Fill in the sessionId specific to PE
1508 pAggrAddTsParam->sessionId = sessionId;
1509 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1510
1511 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1512 {
1513 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1514 {
1515 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1516 /* Since AddTS response was successful, check for the PSB flag
1517 * and directional flag inside the TS Info field.
1518 * An AC is trigger enabled AC if the PSB subfield is set to 1
1519 * in the uplink direction.
1520 * An AC is delivery enabled AC if the PSB subfield is set to 1
1521 * in the downlink direction.
1522 * An AC is trigger and delivery enabled AC if the PSB subfield
1523 * is set to 1 in the bi-direction field.
1524 */
1525 if (pTspec->tsinfo.traffic.psb == 1)
1526 {
1527 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1528 }
1529 else
1530 {
1531 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1532 }
1533 /* ADDTS success, so AC is now admitted. We shall now use the default
1534 * EDCA parameters as advertised by AP and send the updated EDCA params
1535 * to HAL.
1536 */
1537 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1538 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1539 {
1540 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1541 }
1542 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1543 {
1544 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1545 }
1546 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1547 {
1548 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1549 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1550 }
1551
1552 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1553
1554 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1555 {
1556 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1557 }
1558 else
1559 {
1560 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1561 }
1562
1563 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1564 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001565 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301567 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1569 }
1570
1571 // Copy the TSPEC paramters
1572 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1573 }
1574 }
1575
1576 msg.type = WDA_AGGR_QOS_REQ;
1577 msg.bodyptr = pAggrAddTsParam;
1578 msg.bodyval = 0;
1579
1580 /* We need to defer any incoming messages until we get a
1581 * WDA_AGGR_QOS_RSP from HAL.
1582 */
1583 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001584 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001585
1586 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1587 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001588 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301590 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 return eSIR_FAILURE;
1592 }
1593
1594 return eSIR_SUCCESS;
1595}
1596
1597void
1598limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1599 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1600{
1601 tpSirAggrQosRsp rsp;
1602 int i = 0;
1603
1604 if (! rspReqd)
1605 {
1606 return;
1607 }
1608
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301609 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1610 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301612 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 return;
1614 }
1615
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301616 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1618 rsp->sessionId = smesessionId;
1619 rsp->length = sizeof(*rsp);
1620 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1621
1622 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1623 {
1624 if( (1 << i) & aggrQosRsp->tspecIdx )
1625 {
1626 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1627 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1628 }
1629 }
1630
1631 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1632 return;
1633}
1634
1635
1636void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1637{
1638 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1639 //tpAggrQosParams pAggrQosRspMsg = NULL;
1640 tAddTsParams addTsParam = {0};
1641 tpDphHashNode pSta = NULL;
1642 tANI_U16 assocId =0;
1643 tSirMacAddr peerMacAddr;
1644 tANI_U8 rspReqd = 1;
1645 tpPESession psessionEntry = NULL;
1646 int i = 0;
1647
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001648 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001649
1650 /* Need to process all the deferred messages enqueued since sending the
1651 SIR_HAL_AGGR_ADD_TS_REQ */
1652 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1653
1654 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1655 if (NULL == pAggrQosRspMsg)
1656 {
1657 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1658 return;
1659 }
1660
1661 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1662 if (NULL == psessionEntry)
1663 {
1664 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001665 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 if( pAggrQosRspMsg != NULL )
1667 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301668 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 }
1670 return;
1671 }
1672
1673 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1674 {
1675 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1676 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1677 {
1678 /* send DELTS to the station */
1679 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1680
1681 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1682 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1683 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1684 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1685
1686 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1687 &addTsParam.tspec.tsinfo,
1688 &addTsParam.tspec, psessionEntry);
1689
1690 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1691 &psessionEntry->dph.dphHashTable);
1692 if (pSta != NULL)
1693 {
1694 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1695 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1696 }
1697 }
1698 }
1699
1700 /* Send the Aggr QoS response to SME */
1701
1702 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1703 psessionEntry->smeSessionId);
1704 if( pAggrQosRspMsg != NULL )
1705 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301706 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 }
1708 return;
1709}
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711#endif /* WLAN_FEATURE_VOWIFI_11R */