blob: b4b2ca7107a4295c6bfa983f619b09441aa2a61e [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
52#define LIM_FT_RIC_BA_SSN 1
53#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
54#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053055#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57/*--------------------------------------------------------------------------
58 Initialize the FT variables.
59 ------------------------------------------------------------------------*/
60void limFTOpen(tpAniSirGlobal pMac)
61{
62 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
63 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
64}
65
66/*--------------------------------------------------------------------------
67 Cleanup FT variables.
68 ------------------------------------------------------------------------*/
69void limFTCleanup(tpAniSirGlobal pMac)
70{
71 if (pMac->ft.ftPEContext.pFTPreAuthReq)
72 {
73#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070074 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070075 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070076#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080077 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
78 {
79 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
80 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
81 }
Jeff Johnson295189b2012-06-20 16:38:30 -070082 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
83 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
84 }
85
86 // This is the old session, should be deleted else where.
87 // We should not be cleaning it here, just set it to NULL.
88 if (pMac->ft.ftPEContext.psavedsessionEntry)
89 {
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070091 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
94 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
95 }
96
97 // This is the extra session we added as part of Auth resp
98 // clean it up.
99 if (pMac->ft.ftPEContext.pftSessionEntry)
100 {
101 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
102 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
106 }
107 pMac->ft.ftPEContext.pftSessionEntry = NULL;
108#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700109 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700110 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111#endif
112 }
113
114 if (pMac->ft.ftPEContext.pAddBssReq)
115 {
116 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
117 pMac->ft.ftPEContext.pAddBssReq = NULL;
118 }
119
120 if (pMac->ft.ftPEContext.pAddStaReq)
121 {
122 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
123 pMac->ft.ftPEContext.pAddStaReq = NULL;
124 }
125
126 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
127
128}
129
130/*--------------------------------------------------------------------------
131 Init FT variables.
132 ------------------------------------------------------------------------*/
133void limFTInit(tpAniSirGlobal pMac)
134{
135 if (pMac->ft.ftPEContext.pFTPreAuthReq)
136 {
137#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700138 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700139 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700140#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800141 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
142 {
143 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
144 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
145 }
146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
148 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
149 }
150
151 // This is the old session, should be deleted else where.
152 // We should not be cleaning it here, just set it to NULL.
153 if (pMac->ft.ftPEContext.psavedsessionEntry)
154 {
155#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700156 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700157 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#endif
159 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
160 }
161
162 // This is the extra session we added as part of Auth resp
163 // clean it up.
164 if (pMac->ft.ftPEContext.pftSessionEntry)
165 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530166
Jeff Johnson295189b2012-06-20 16:38:30 -0700167#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700168 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700169 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700170#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530171 /* Delete the previous valid preauth pesession if it is still in
172 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
173 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
174 * preauth didnt went through and its Session was not deleted.
175 */
176 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
177 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
178 == eLIM_SME_WT_REASSOC_STATE) &&
179 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
180 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
181 {
182 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
183 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
184 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
185 }
186
Jeff Johnson295189b2012-06-20 16:38:30 -0700187 pMac->ft.ftPEContext.pftSessionEntry = NULL;
188 }
189
190 if (pMac->ft.ftPEContext.pAddBssReq)
191 {
192#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700193 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700194 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700195#endif
196 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
197 pMac->ft.ftPEContext.pAddBssReq = NULL;
198 }
199
200
201 if (pMac->ft.ftPEContext.pAddStaReq)
202 {
203#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700204 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700205 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700206#endif
207 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
208 pMac->ft.ftPEContext.pAddStaReq = NULL;
209 }
210
211 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
212
213}
214
215/*------------------------------------------------------------------
216 *
217 * This is the handler after suspending the link.
218 * We suspend the link and then now proceed to switch channel.
219 *
220 *------------------------------------------------------------------*/
221void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
222{
223 tpPESession psessionEntry;
224
225 // The link is suspended of not ?
226 if (status != eHAL_STATUS_SUCCESS)
227 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700228 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700229 // Post the FT Pre Auth Response to SME
230 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
231
232 return;
233 }
234
235 psessionEntry = (tpPESession)data;
236 // Suspended, now move to a different channel.
237 // Perform some sanity check before proceeding.
238 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
239 {
240 limChangeChannelWithCallback(pMac,
241 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
242 limPerformFTPreAuth, NULL, psessionEntry);
243 return;
244 }
245
246 // Else return error.
247 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
248}
249
250
251/*--------------------------------------------------------------------------
252 In this function, we process the FT Pre Auth Req.
253 We receive Pre-Auth
254 Suspend link
255 Register a call back
256 In the call back, we will need to accept frames from the new bssid
257 Send out the auth req to new AP.
258 Start timer and when the timer is done or if we receive the Auth response
259 We change channel
260 Resume link
261 ------------------------------------------------------------------------*/
262int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
263{
264 int bufConsumed = FALSE;
265 tpPESession psessionEntry;
266 tANI_U8 sessionId;
267
268 // Now we are starting fresh make sure all's cleanup.
269 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530270 // Can set it only after sending auth
271 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
272
273 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
274 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
275 {
276 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
277 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
278 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
280 // We need information from the Pre-Auth Req. Lets save that
281 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
282
283#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800284 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700285 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
286 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
287 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
288#endif
289
290 // Get the current session entry
291 psessionEntry = peFindSessionByBssid(pMac,
292 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
293 if (psessionEntry == NULL)
294 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700295 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700296 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
298 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800299 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530300 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
301 {
302 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
303 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
304 }
305 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 return TRUE;
307 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700308#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
309 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
310#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700311
312 // Dont need to suspend if APs are in same channel
313 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
314 {
315 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700316 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700317 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700318 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 (tANI_U32 *)psessionEntry);
320 }
321 else
322 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700323 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700324 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 // We are in the same channel. Perform pre-auth
326 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
327 }
328
329 return bufConsumed;
330}
331
332/*------------------------------------------------------------------
333 * Send the Auth1
334 * Receive back Auth2
335 *------------------------------------------------------------------*/
336void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
337 tpPESession psessionEntry)
338{
339 tSirMacAuthFrameBody authFrame;
340
341 if (psessionEntry->is11Rconnection)
342 {
343 // Only 11r assoc has FT IEs.
344 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
345 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800346 PELOGE(limLog( pMac, LOGE,
347 "%s: FTIEs for Auth Req Seq 1 is absent",
348 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 return;
350 }
351 }
352 if (status != eHAL_STATUS_SUCCESS)
353 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800354 PELOGE(limLog( pMac, LOGE,
355 "%s: Change channel not successful for FT pre-auth",
356 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700357 return;
358 }
359 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
360
361#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700362 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700363 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700364 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700365#endif
366
367
368 if (psessionEntry->is11Rconnection)
369 {
370 // Now we are on the right channel and need to send out Auth1 and
371 // receive Auth2.
372 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
373 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800374#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700375 else
376 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800377 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800379 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 }
381#endif
382 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
383 authFrame.authStatusCode = 0;
384
385 // Start timer here to come back to operating channel.
386 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
387 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
388 {
389#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700390 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700391#endif
392 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800393MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700394
395#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800396 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700397#endif
398
399 limSendAuthMgmtFrame(pMac, &authFrame,
400 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
401 LIM_NO_WEP_IN_FC, psessionEntry);
402
403 return;
404}
405
406
407/*------------------------------------------------------------------
408 *
409 * Create the new Add Bss Req to the new AP.
410 * This will be used when we are ready to FT to the new AP.
411 * The newly created ft Session entry is passed to this function
412 *
413 *------------------------------------------------------------------*/
414tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
415 tANI_U8 updateEntry, tpPESession pftSessionEntry,
416 tpSirBssDescription bssDescription )
417{
418 tpAddBssParams pAddBssParams = NULL;
419 tANI_U8 i;
420 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700421 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700422
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530423 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
424 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530426 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700427 return eSIR_MEM_ALLOC_FAILED;
428 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700429
430 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530431 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
432 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530436 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 return (eSIR_MEM_ALLOC_FAILED);
438 }
439
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530440 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
442
443 limExtractApCapabilities( pMac,
444 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700445 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700446
447 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700448 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530450 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
451 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
453 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530454 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
455 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700456
457 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
458 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
459
460 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
461
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 pAddBssParams->updateBss = updateEntry;
464
465
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700466 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
467 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
468 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
469 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
471
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700472 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530473 vos_mem_copy(pAddBssParams->rateSet.rate,
474 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700475
476 pAddBssParams->nwType = bssDescription->nwType;
477
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700478 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700479 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
480 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
481 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
482 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
483
484 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700485 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700487 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700488
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700489 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700491 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
492 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700495 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700496 (chanWidthSupp) )
497 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700498 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
499 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 }
501 else
502 {
503 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700504 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700506 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
507 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
508 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700509 }
510 }
511
512 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800513 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
514
515#ifdef WLAN_FEATURE_11AC
516 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
517 {
518 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
519 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
520 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
521 pAddBssParams->currentOperChannel,
522 pAddBssParams->currentExtChannel,
523 pftSessionEntry->apCenterChan,
524 pftSessionEntry);
525 }
526 else
527 {
528 pAddBssParams->vhtCapable = 0;
529 }
530#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700531
532#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700533 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 pAddBssParams->currentOperChannel);
535#endif
536
537
538 // Populate the STA-related parameters here
539 // Note that the STA here refers to the AP
540 {
541 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
542
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530543 vos_mem_copy(pAddBssParams->staContext.bssId,
544 bssDescription->bssId,
545 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
547
548 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
549 pAddBssParams->staContext.uAPSD = 0;
550 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700551 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700552 pAddBssParams->staContext.updateSta = updateEntry;
553 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
554
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700555 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700556 {
557 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
558 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700559 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
560 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
561 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 (chanWidthSupp) )
563 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700564 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 }
566 else
567 {
568 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
569 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800570#ifdef WLAN_FEATURE_11AC
571 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
572 {
573 pAddBssParams->staContext.vhtCapable = 1;
574 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
575 pBeaconStruct->VHTCaps.muBeamformerCap) &&
576 pftSessionEntry->txBFIniFeatureEnabled)
577 {
578 pAddBssParams->staContext.vhtTxBFCapable = 1;
579 }
580 }
581#endif
582 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
583 (chanWidthSupp) )
584 {
585 pAddBssParams->staContext.txChannelWidthSet =
586 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
587#ifdef WLAN_FEATURE_11AC
588 if (pAddBssParams->staContext.vhtCapable)
589 {
590 pAddBssParams->staContext.vhtTxChannelWidthSet =
591 pBeaconStruct->VHTOperation.chanWidth;
592 }
593#endif
594 }
595 else
596 {
597 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
598 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700599 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
600 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
601 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
602 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
603 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
604 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
605 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
606 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700607
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700608 if( pBeaconStruct->HTInfo.present )
609 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 }
611
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700612 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
613 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pAddBssParams->staContext.wmmEnabled = 1;
615 else
616 pAddBssParams->staContext.wmmEnabled = 0;
617
618 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700619#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700620 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
621 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700622 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700623#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700624 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700625 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700626#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800627 if (pftSessionEntry->htCapability)
628 {
629 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
630 if (pftSessionEntry->vhtCapability)
631 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
632 }
633 else
634 {
635 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
636 {
637 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
638 }
639 else
640 {
641 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
642 }
643 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700644 }
645
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 //Disable BA. It will be set as part of ADDBA negotiation.
647 for( i = 0; i < STACFG_MAX_TC; i++ )
648 {
649 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
650 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
651 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
652 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
653 }
654
655#if defined WLAN_FEATURE_VOWIFI
656 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
657#endif
658
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800659#ifdef WLAN_FEATURE_11W
660 if (pftSessionEntry->limRmfEnabled)
661 {
662 pAddBssParams->rmfEnabled = 1;
663 pAddBssParams->staContext.rmfEnabled = 1;
664 }
665#endif
666
Jeff Johnson295189b2012-06-20 16:38:30 -0700667 pAddBssParams->status = eHAL_STATUS_SUCCESS;
668 pAddBssParams->respReqd = true;
669
670 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
671 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
672
673 // Set a new state for MLME
674
675 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800676 MTRACE(macTrace(pMac, TRACE_CODE_MLM_STATE, pftSessionEntry->peSessionId, eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE));
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
678
679 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
680
681#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800682 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700683#endif
684
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530685 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 return 0;
687}
688
689/*------------------------------------------------------------------
690 *
691 * Setup the new session for the pre-auth AP.
692 * Return the newly created session entry.
693 *
694 *------------------------------------------------------------------*/
695tpPESession limFillFTSession(tpAniSirGlobal pMac,
696 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
697{
698 tpPESession pftSessionEntry;
699 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 tPowerdBm localPowerConstraint;
701 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700702 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800703 uint32 selfDot11Mode;
704 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700705
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530706 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
707 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700708 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530709 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700710 return NULL;
711 }
712
Jeff Johnson295189b2012-06-20 16:38:30 -0700713
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800714
715 /* Retrieve the session that has already been created and update the entry */
716 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800717#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700718 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700719#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
721 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
722 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
723 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
724
725 // Fields to be filled later
726 pftSessionEntry->pLimJoinReq = NULL;
727 pftSessionEntry->smeSessionId = 0;
728 pftSessionEntry->transactionId = 0;
729
730 limExtractApCapabilities( pMac,
731 (tANI_U8 *) pbssDescription->ieFields,
732 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700733 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700735 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530736 vos_mem_copy(pftSessionEntry->rateSet.rate,
737 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700738
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700739 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530740 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700741 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700742
743
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700744 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530745 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 pftSessionEntry->ssId.length);
747
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800748 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
749 pftSessionEntry->dot11mode = selfDot11Mode;
750 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
751 && pBeaconStruct->VHTCaps.present);
752 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
753 && pBeaconStruct->HTCaps.present);
754#ifdef WLAN_FEATURE_11AC
755 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
756 {
757 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
758 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
759 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
760 }
761 else
762 {
763 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
764 }
765#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 // Self Mac
767 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
768 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800769#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700770 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700771#endif
772
773 /* Store beaconInterval */
774 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
775 pftSessionEntry->bssType = psessionEntry->bssType;
776
777 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
778 pftSessionEntry->nwType = pbssDescription->nwType;
779
780 /* Copy The channel Id to the session Table */
781 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
782 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
783
784
785 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
786 {
787 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
788 }
789 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
790 {
791 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
792 }
793 else
794 {
795 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700796 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 }
798
799 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
800 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800801 if( pMac->roam.configParam.shortSlotTime &&
802 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
803 {
804 pftSessionEntry->shortSlotTimeSupported = TRUE;
805 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700806
807 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
808 localPowerConstraint = regMax;
809 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
810 limGetIElenFromBssDescription(pbssDescription),
811 &pftSessionEntry->limCurrentBssQosCaps,
812 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700813 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700814
815 pftSessionEntry->limReassocBssQosCaps =
816 pftSessionEntry->limCurrentBssQosCaps;
817 pftSessionEntry->limReassocBssPropCap =
818 pftSessionEntry->limCurrentBssPropCap;
819
820
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800821#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800822 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
823#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800825#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700826
827#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800828 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 -0800829 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700830#endif
831
832 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
833
834 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
835 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800836 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700837
838 pftSessionEntry->encryptType = psessionEntry->encryptType;
839
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800840 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
841 {
842 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
843 }
844 else
845 {
846 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
847 }
848 pftSessionEntry->htSupportedChannelWidthSet =
849 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
850 pftSessionEntry->htRecommendedTxWidthSet =
851 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530852 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
853 (pftSessionEntry->htSupportedChannelWidthSet == 1))
854 {
855 limInitOBSSScanParams(pMac, pftSessionEntry);
856 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530857 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700858 return pftSessionEntry;
859}
860
861/*------------------------------------------------------------------
862 *
863 * Setup the session and the add bss req for the pre-auth AP.
864 *
865 *------------------------------------------------------------------*/
866void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
867{
868 tpPESession pftSessionEntry;
869
870 // Prepare the session right now with as much as possible.
871 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
872
873 if (pftSessionEntry)
874 {
875 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800876#ifdef FEATURE_WLAN_ESE
877 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700878#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800879#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
881#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700882
883#ifdef FEATURE_WLAN_LFR
884 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
885#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800886#ifdef WLAN_FEATURE_11W
887 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
888#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
890 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
891 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
892 }
893}
894
895/*------------------------------------------------------------------
896 * Resume Link Call Back
897 *------------------------------------------------------------------*/
898void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
899{
900 tpPESession psessionEntry;
901
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700902 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
903 return;
904
Jeff Johnson295189b2012-06-20 16:38:30 -0700905 psessionEntry = (tpPESession)data;
906
907 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
908 {
909 limFTSetupAuthSession(pMac, psessionEntry);
910 }
911
912 // Post the FT Pre Auth Response to SME
913 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
914 pMac->ft.ftPEContext.saved_auth_rsp,
915 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
916
917}
918
919/*------------------------------------------------------------------
920 * Resume Link Call Back
921 *------------------------------------------------------------------*/
922void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
923 tpPESession psessionEntry)
924{
925 //Set the resume channel to Any valid channel (invalid).
926 //This will instruct HAL to set it to any previous valid channel.
927 peSetResumeChannel(pMac, 0, 0);
928 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
929}
930
931tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
932 tANI_U8 *ric_ies, tANI_U32 *ieLength)
933{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530934 /* BlockACK + RIC is not supported now, TODO later to support this */
935#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 tDot11fIERICDataDesc ricIe;
937 tDot11fFfBAStartingSequenceControl baSsnControl;
938 tDot11fFfAddBAParameterSet baParamSet;
939 tDot11fFfBATimeout baTimeout;
940
941 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
942 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
943 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
944 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
945
946 ricIe.present = 1;
947 ricIe.RICData.present = 1;
948 ricIe.RICData.resourceDescCount = 1;
949 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
950 ricIe.RICDescriptor.present = 1;
951 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
952 baParamSet.tid = tid;
953 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
954 baParamSet.bufferSize = pTrafficClass->txBufSize;
955 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
956 baSsnControl.fragNumber = 0;
957 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530958 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700959 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
960 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
961 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
962 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530963 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700964 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
965 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
966 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
967 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530968 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700969 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
970 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
971 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
972 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530974#endif
975
976 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700977}
978
979tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
980{
981 tANI_U8 tid = 0;
982 tpDphHashNode pSta;
983 tANI_U16 numBA = 0, aid = 0;
984 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
985 tANI_U32 offset = 0, ieLength = 0;
986 tSirRetStatus status = eSIR_SUCCESS;
987
988 // First, extract the DPH entry
989 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
990 if( NULL == pSta )
991 {
992 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800993 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
994 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 return eSIR_FAILURE;
996 }
997
998 for (tid = 0; tid < STACFG_MAX_TC; tid++)
999 {
1000 if (pSta->tcCfg[tid].fUseBATx)
1001 {
1002 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1003 if (eSIR_SUCCESS == status)
1004 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001005 // TODO RIC
1006 if ( ieLength > MAX_FTIE_SIZE )
1007 {
1008 ieLength = 0;
1009 return status;
1010 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 offset += ieLength;
1012 *ric_ies_length += ieLength;
1013 numBA++;
1014 }
1015 else
1016 {
1017 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1018 }
1019 }
1020 }
1021
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001022 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 -07001023 return status;
1024}
1025
1026/*------------------------------------------------------------------
1027 *
1028 * Will post pre auth response to SME.
1029 *
1030 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001031void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001032 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1033 tpPESession psessionEntry)
1034{
1035 tpSirFTPreAuthRsp pFTPreAuthRsp;
1036 tSirMsgQ mmhMsg;
1037 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001038 // TODO: RIC Support
1039 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001040
1041 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301042 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001044 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 VOS_ASSERT(pFTPreAuthRsp != NULL);
1046 return;
1047 }
1048 vos_mem_zero( pFTPreAuthRsp, rspLen);
1049#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001050 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001051#endif
1052
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301053 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001054 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1055 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1056 pFTPreAuthRsp->status = status;
1057 if (psessionEntry)
1058 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1059
1060 // The bssid of the AP we are sending Auth1 to.
1061 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1062 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1063 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1064
1065 // Attach the auth response now back to SME
1066 pFTPreAuthRsp->ft_ies_length = 0;
1067 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1068 {
1069 // Only 11r assoc has FT IEs.
1070 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1071 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1072 }
1073
1074#ifdef WLAN_FEATURE_VOWIFI_11R
1075 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1076 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001077 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1078 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1080 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1081 if (eSIR_SUCCESS != sirStatus)
1082 {
1083 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1084 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001085 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001086 }
1087#endif
1088
1089 mmhMsg.type = pFTPreAuthRsp->messageType;
1090 mmhMsg.bodyptr = pFTPreAuthRsp;
1091 mmhMsg.bodyval = 0;
1092
1093#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001094 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001095#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001096#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001097 if (status == eSIR_SUCCESS)
1098 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1099 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001100#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1102}
1103
1104/*------------------------------------------------------------------
1105 *
1106 * Send the FT Pre Auth Response to SME when ever we have a status
1107 * ready to be sent to SME
1108 *
1109 * SME will be the one to send it up to the supplicant to receive
1110 * FTIEs which will be required for Reassoc Req.
1111 *
1112 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001113void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001114 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1115 tpPESession psessionEntry)
1116{
1117
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001118 tpPESession pftSessionEntry;
1119 tANI_U8 sessionId;
1120 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001121#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1122 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1123#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001124
Jeff Johnson295189b2012-06-20 16:38:30 -07001125 // Save the status of pre-auth
1126 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1127
1128 // Save the auth rsp, so we can send it to
1129 // SME once we resume link.
1130 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1131 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1132 {
1133 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1134 auth_rsp, auth_rsp_length);
1135 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1136 }
1137
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001138 /* Create FT session for the re-association at this point */
1139 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1140 {
1141 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1142 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1143 &sessionId, pMac->lim.maxStation)) == NULL)
1144 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001145 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001146 return;
1147 }
1148 pftSessionEntry->peSessionId = sessionId;
1149 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1150 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1151 pftSessionEntry->bssType = psessionEntry->bssType;
1152
1153 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1154 {
1155 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1156 }
1157 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1158 {
1159 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1160 }
1161 else
1162 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001163 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001164 }
1165 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1166 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1167 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001168 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001169 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1170
1171 /* Update the ReAssoc BSSID of the current session */
1172 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001173 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001174 }
1175
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 if (psessionEntry->currentOperChannel !=
1177 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1178 {
1179 // Need to move to the original AP channel
1180 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1181 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1182 }
1183 else
1184 {
1185#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001186 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001187 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1188#endif
1189 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1190 }
1191}
1192
1193/*------------------------------------------------------------------
1194 *
1195 * This function handles the 11R Reassoc Req from SME
1196 *
1197 *------------------------------------------------------------------*/
1198void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1199 tpPESession psessionEntry)
1200{
1201 tANI_U8 smeSessionId = 0;
1202 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001203 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 tLimMlmReassocReq *pMlmReassocReq;
1205 tANI_U16 caps;
1206 tANI_U32 val;
1207 tSirMsgQ msgQ;
1208 tSirRetStatus retCode;
1209 tANI_U32 teleBcnEn = 0;
1210
Jeff Johnson278b0492013-04-03 14:10:08 -07001211 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1213 psessionEntry->smeSessionId = smeSessionId;
1214 psessionEntry->transactionId = transactionId;
1215
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001216#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1217 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001219
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301220 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1221 {
1222 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1223 return;
1224 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301225 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1226 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 {
1228 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301229 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 return;
1231 }
1232
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301233 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1234 psessionEntry->bssId,
1235 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001236
1237 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1238 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1239 != eSIR_SUCCESS)
1240 {
1241 /**
1242 * Could not get ReassocFailureTimeout value
1243 * from CFG. Log error.
1244 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001245 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301246 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001247 return;
1248 }
1249
1250 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1251 {
1252 /**
1253 * Could not get Capabilities value
1254 * from CFG. Log error.
1255 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001256 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301257 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 return;
1259 }
1260 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001261
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 /* Update PE sessionId*/
1263 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1264
1265 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001266 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1267 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001269 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301270 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001271 return;
1272 }
1273
1274 if (teleBcnEn)
1275 {
1276 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001277 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 /**
1279 * Could not get ListenInterval value
1280 * from CFG. Log error.
1281 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001282 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301283 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001285 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 }
1287 else
1288 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001289 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001290 {
1291 /**
1292 * Could not get ListenInterval value
1293 * from CFG. Log error.
1294 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001295 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301296 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 return;
1298 }
1299 }
1300 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001301 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301303 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001304 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 }
1306
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 pMlmReassocReq->listenInterval = (tANI_U16) val;
1308
1309 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1310
1311
1312 //we need to defer the message until we get the response back from HAL.
1313 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001314
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1316 msgQ.reserved = 0;
1317 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1318 msgQ.bodyval = 0;
1319
1320
1321#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001322 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001323#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001324 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
1326 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001327 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001328 {
1329 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001330 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001331 retCode );
1332 }
1333 // Dont need this anymore
1334 pMac->ft.ftPEContext.pAddBssReq = NULL;
1335 return;
1336}
1337
1338/*------------------------------------------------------------------
1339 *
1340 * This function is called if preauth response is not received from the AP
1341 * within this timeout while FT in progress
1342 *
1343 *------------------------------------------------------------------*/
1344void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1345{
1346 tpPESession psessionEntry;
1347
1348 // We have failed pre auth. We need to resume link and get back on
1349 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301350 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001351
1352 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1353 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001354 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001355 return;
1356 }
1357
Abhishek Singh8a226222014-03-13 14:49:16 +05301358 /* To handle the race condition where we recieve preauth rsp after
1359 * timer has expired.
1360 */
1361 if (eANI_BOOLEAN_TRUE ==
1362 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1363 {
1364 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1365 " (session %p)"), psessionEntry);
1366 return;
1367 }
1368 else
1369 {
1370 /* Here we are sending preauth rsp with failure state
1371 * and which is forwarded to SME. Now, if we receive an preauth
1372 * resp from AP with success it would create a FT pesession, but
1373 * will be dropped in SME leaving behind the pesession.
1374 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1375 * limProcessAuthFrameNoSession.
1376 */
1377 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1378 " (session %p)"), psessionEntry);
1379 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1380 eANI_BOOLEAN_TRUE;
1381 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001382 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1383 // to get back.
1384 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1385}
1386
1387
1388/*------------------------------------------------------------------
1389 *
1390 * This function is called to process the update key request from SME
1391 *
1392 *------------------------------------------------------------------*/
1393tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1394{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301395 tAddBssParams * pAddBssParams;
1396 tSirFTUpdateKeyInfo * pKeyInfo;
1397 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301399 /* Sanity Check */
1400 if( pMac == NULL || pMsgBuf == NULL )
1401 {
1402 return TRUE;
1403 }
1404 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1405 {
1406 limLog( pMac, LOGE,
1407 FL( "pAddBssReq is NULL" ));
1408 return TRUE;
1409 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001410
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301411 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1412 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001413
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301414 /* Store the key information in the ADD BSS parameters */
1415 pAddBssParams->extSetStaKeyParamValid = 1;
1416 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301417 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1418 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301419 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1420 {
1421 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1422 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001423
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301424 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1425 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1426 pAddBssParams->extSetStaKeyParamValid,
1427 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301429 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1430
1431 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001432 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301433
1434 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1435 {
1436 PELOG1(limLog(pMac, LOG1,
1437 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1438 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1439 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1440 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1441 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1442 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1443 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1444 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1445 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1446 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1447 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1448 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1449 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1450 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1451 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1452 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1455 }
1456
1457 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001458}
1459
1460tSirRetStatus
1461limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1462{
1463 tSirMsgQ msg;
1464 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1465 tpAggrAddTsParams pAggrAddTsParam;
1466 tpPESession psessionEntry = NULL;
1467 tpLimTspecInfo tspecInfo;
1468 tANI_U8 ac;
1469 tpDphHashNode pSta;
1470 tANI_U16 aid;
1471 tANI_U8 sessionId;
1472 int i;
1473
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301474 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1475 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301477 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 return eSIR_MEM_ALLOC_FAILED;
1479 }
1480
1481 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1482
1483 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001484 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301485 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 return eSIR_FAILURE;
1487 }
1488
1489 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1490 if (pSta == NULL)
1491 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001492 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301493 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001494 return eSIR_FAILURE;
1495 }
1496
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301497 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1498 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 pAggrAddTsParam->staIdx = psessionEntry->staId;
1500 // Fill in the sessionId specific to PE
1501 pAggrAddTsParam->sessionId = sessionId;
1502 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1503
1504 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1505 {
1506 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1507 {
1508 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1509 /* Since AddTS response was successful, check for the PSB flag
1510 * and directional flag inside the TS Info field.
1511 * An AC is trigger enabled AC if the PSB subfield is set to 1
1512 * in the uplink direction.
1513 * An AC is delivery enabled AC if the PSB subfield is set to 1
1514 * in the downlink direction.
1515 * An AC is trigger and delivery enabled AC if the PSB subfield
1516 * is set to 1 in the bi-direction field.
1517 */
1518 if (pTspec->tsinfo.traffic.psb == 1)
1519 {
1520 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1521 }
1522 else
1523 {
1524 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1525 }
1526 /* ADDTS success, so AC is now admitted. We shall now use the default
1527 * EDCA parameters as advertised by AP and send the updated EDCA params
1528 * to HAL.
1529 */
1530 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1531 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1532 {
1533 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1534 }
1535 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1536 {
1537 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1538 }
1539 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1540 {
1541 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1542 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1543 }
1544
1545 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1546
1547 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1548 {
1549 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1550 }
1551 else
1552 {
1553 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1554 }
1555
1556 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1557 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001558 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301560 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001561 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1562 }
1563
1564 // Copy the TSPEC paramters
1565 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1566 }
1567 }
1568
1569 msg.type = WDA_AGGR_QOS_REQ;
1570 msg.bodyptr = pAggrAddTsParam;
1571 msg.bodyval = 0;
1572
1573 /* We need to defer any incoming messages until we get a
1574 * WDA_AGGR_QOS_RSP from HAL.
1575 */
1576 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001577 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1580 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001581 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301583 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 return eSIR_FAILURE;
1585 }
1586
1587 return eSIR_SUCCESS;
1588}
1589
1590void
1591limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1592 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1593{
1594 tpSirAggrQosRsp rsp;
1595 int i = 0;
1596
1597 if (! rspReqd)
1598 {
1599 return;
1600 }
1601
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301602 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1603 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301605 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 return;
1607 }
1608
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301609 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1611 rsp->sessionId = smesessionId;
1612 rsp->length = sizeof(*rsp);
1613 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1614
1615 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1616 {
1617 if( (1 << i) & aggrQosRsp->tspecIdx )
1618 {
1619 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1620 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1621 }
1622 }
1623
1624 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1625 return;
1626}
1627
1628
1629void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1630{
1631 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1632 //tpAggrQosParams pAggrQosRspMsg = NULL;
1633 tAddTsParams addTsParam = {0};
1634 tpDphHashNode pSta = NULL;
1635 tANI_U16 assocId =0;
1636 tSirMacAddr peerMacAddr;
1637 tANI_U8 rspReqd = 1;
1638 tpPESession psessionEntry = NULL;
1639 int i = 0;
1640
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001641 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001642
1643 /* Need to process all the deferred messages enqueued since sending the
1644 SIR_HAL_AGGR_ADD_TS_REQ */
1645 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1646
1647 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1648 if (NULL == pAggrQosRspMsg)
1649 {
1650 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1651 return;
1652 }
1653
1654 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1655 if (NULL == psessionEntry)
1656 {
1657 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001658 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 if( pAggrQosRspMsg != NULL )
1660 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301661 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 }
1663 return;
1664 }
1665
1666 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1667 {
1668 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1669 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1670 {
1671 /* send DELTS to the station */
1672 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1673
1674 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1675 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1676 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1677 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1678
1679 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1680 &addTsParam.tspec.tsinfo,
1681 &addTsParam.tspec, psessionEntry);
1682
1683 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1684 &psessionEntry->dph.dphHashTable);
1685 if (pSta != NULL)
1686 {
1687 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1688 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1689 }
1690 }
1691 }
1692
1693 /* Send the Aggr QoS response to SME */
1694
1695 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1696 psessionEntry->smeSessionId);
1697 if( pAggrQosRspMsg != NULL )
1698 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301699 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 }
1701 return;
1702}
1703
Jeff Johnson295189b2012-06-20 16:38:30 -07001704#endif /* WLAN_FEATURE_VOWIFI_11R */