blob: bd400a4fd2fcd4905d6c6936ff9ff9d5229e90ba [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifdef WLAN_FEATURE_VOWIFI_11R
29/**=========================================================================
30
Kiet Lam842dad02014-02-18 18:44:02 -080031 \brief implementation for PE 11r VoWiFi FT Protocol
Jeff Johnson295189b2012-06-20 16:38:30 -070032
33 ========================================================================*/
34
35/* $Header$ */
36
37
38/*--------------------------------------------------------------------------
39 Include Files
40 ------------------------------------------------------------------------*/
41#include <limSendMessages.h>
42#include <limTypes.h>
43#include <limFT.h>
44#include <limFTDefs.h>
45#include <limUtils.h>
46#include <limPropExtsUtils.h>
47#include <limAssocUtils.h>
48#include <limSession.h>
49#include <limAdmitControl.h>
50#include "wmmApsd.h"
51
Mukul Sharma38a6bbc2014-06-30 00:25:39 +053052#ifdef DEBUG_ROAM_DELAY
53#include "vos_utils.h"
54#endif
55
Jeff Johnson295189b2012-06-20 16:38:30 -070056#define LIM_FT_RIC_BA_SSN 1
57#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
58#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053059#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070060
61/*--------------------------------------------------------------------------
62 Initialize the FT variables.
63 ------------------------------------------------------------------------*/
64void limFTOpen(tpAniSirGlobal pMac)
65{
66 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
67 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
68}
69
70/*--------------------------------------------------------------------------
71 Cleanup FT variables.
72 ------------------------------------------------------------------------*/
73void limFTCleanup(tpAniSirGlobal pMac)
74{
75 if (pMac->ft.ftPEContext.pFTPreAuthReq)
76 {
77#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070078 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070079 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070080#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080081 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
82 {
83 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
84 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
85 }
Jeff Johnson295189b2012-06-20 16:38:30 -070086 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
87 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
88 }
89
90 // This is the old session, should be deleted else where.
91 // We should not be cleaning it here, just set it to NULL.
92 if (pMac->ft.ftPEContext.psavedsessionEntry)
93 {
94#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070095 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070096 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070097#endif
98 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
99 }
100
101 // This is the extra session we added as part of Auth resp
102 // clean it up.
103 if (pMac->ft.ftPEContext.pftSessionEntry)
104 {
105 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
106 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
107 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700108 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700109 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
110 }
111 pMac->ft.ftPEContext.pftSessionEntry = NULL;
112#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700113 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700114 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700115#endif
116 }
117
118 if (pMac->ft.ftPEContext.pAddBssReq)
119 {
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +0530120 vos_mem_zero(pMac->ft.ftPEContext.pAddBssReq, sizeof(tAddBssParams));
Jeff Johnson295189b2012-06-20 16:38:30 -0700121 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
122 pMac->ft.ftPEContext.pAddBssReq = NULL;
123 }
124
125 if (pMac->ft.ftPEContext.pAddStaReq)
126 {
127 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
128 pMac->ft.ftPEContext.pAddStaReq = NULL;
129 }
130
131 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
132
133}
134
135/*--------------------------------------------------------------------------
136 Init FT variables.
137 ------------------------------------------------------------------------*/
138void limFTInit(tpAniSirGlobal pMac)
139{
140 if (pMac->ft.ftPEContext.pFTPreAuthReq)
141 {
142#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700143 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700144 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700145#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800146 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
147 {
148 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
149 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
150 }
151
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
153 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
154 }
155
156 // This is the old session, should be deleted else where.
157 // We should not be cleaning it here, just set it to NULL.
158 if (pMac->ft.ftPEContext.psavedsessionEntry)
159 {
160#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700161 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700162 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700163#endif
164 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
165 }
166
167 // This is the extra session we added as part of Auth resp
168 // clean it up.
169 if (pMac->ft.ftPEContext.pftSessionEntry)
170 {
Abhishek Singh8a226222014-03-13 14:49:16 +0530171
Jeff Johnson295189b2012-06-20 16:38:30 -0700172#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700173 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700174 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175#endif
Abhishek Singh8a226222014-03-13 14:49:16 +0530176 /* Delete the previous valid preauth pesession if it is still in
177 * mMlmState= eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE
178 * and limSmeState = eLIM_SME_WT_REASSOC_STATE. This means last
179 * preauth didnt went through and its Session was not deleted.
180 */
181 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
182 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState
183 == eLIM_SME_WT_REASSOC_STATE) &&
184 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limMlmState
185 == eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE) )
186 {
187 limLog( pMac, LOGE, FL("Deleting Preauth Session %d"),
188 ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);
189 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
190 }
191
Jeff Johnson295189b2012-06-20 16:38:30 -0700192 pMac->ft.ftPEContext.pftSessionEntry = NULL;
193 }
194
195 if (pMac->ft.ftPEContext.pAddBssReq)
196 {
197#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700198 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700199 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700200#endif
201 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
202 pMac->ft.ftPEContext.pAddBssReq = NULL;
203 }
204
205
206 if (pMac->ft.ftPEContext.pAddStaReq)
207 {
208#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700209 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700210 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700211#endif
212 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
213 pMac->ft.ftPEContext.pAddStaReq = NULL;
214 }
215
216 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
217
218}
219
220/*------------------------------------------------------------------
221 *
222 * This is the handler after suspending the link.
223 * We suspend the link and then now proceed to switch channel.
224 *
225 *------------------------------------------------------------------*/
226void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
227{
228 tpPESession psessionEntry;
229
230 // The link is suspended of not ?
231 if (status != eHAL_STATUS_SUCCESS)
232 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700233 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 // Post the FT Pre Auth Response to SME
235 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
236
237 return;
238 }
239
240 psessionEntry = (tpPESession)data;
241 // Suspended, now move to a different channel.
242 // Perform some sanity check before proceeding.
243 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
244 {
245 limChangeChannelWithCallback(pMac,
246 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
247 limPerformFTPreAuth, NULL, psessionEntry);
248 return;
249 }
250
251 // Else return error.
252 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
253}
254
255
256/*--------------------------------------------------------------------------
257 In this function, we process the FT Pre Auth Req.
258 We receive Pre-Auth
259 Suspend link
260 Register a call back
261 In the call back, we will need to accept frames from the new bssid
262 Send out the auth req to new AP.
263 Start timer and when the timer is done or if we receive the Auth response
264 We change channel
265 Resume link
266 ------------------------------------------------------------------------*/
267int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
268{
269 int bufConsumed = FALSE;
270 tpPESession psessionEntry;
271 tANI_U8 sessionId;
272
273 // Now we are starting fresh make sure all's cleanup.
274 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530275 // Can set it only after sending auth
276 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
277
278 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
279 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
280 {
281 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
282 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
283 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700284
285 // We need information from the Pre-Auth Req. Lets save that
286 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
287
288#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800289 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
291 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
292 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
293#endif
294
295 // Get the current session entry
296 psessionEntry = peFindSessionByBssid(pMac,
297 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
298 if (psessionEntry == NULL)
299 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700300 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700301 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
303 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800304 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530305 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
306 {
307 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
308 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
309 }
310 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700311 return TRUE;
312 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700313#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
314 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
315#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 // Dont need to suspend if APs are in same channel
318 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
319 {
320 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700321 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700322 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700323 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 (tANI_U32 *)psessionEntry);
325 }
326 else
327 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700328 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700329 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700330 // We are in the same channel. Perform pre-auth
331 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
332 }
333
334 return bufConsumed;
335}
336
337/*------------------------------------------------------------------
338 * Send the Auth1
339 * Receive back Auth2
340 *------------------------------------------------------------------*/
341void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
342 tpPESession psessionEntry)
343{
344 tSirMacAuthFrameBody authFrame;
345
346 if (psessionEntry->is11Rconnection)
347 {
348 // Only 11r assoc has FT IEs.
349 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
350 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800351 PELOGE(limLog( pMac, LOGE,
352 "%s: FTIEs for Auth Req Seq 1 is absent",
353 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530354 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700355 }
356 }
357 if (status != eHAL_STATUS_SUCCESS)
358 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800359 PELOGE(limLog( pMac, LOGE,
360 "%s: Change channel not successful for FT pre-auth",
361 __func__);)
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530362 goto preauth_fail;
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 }
364 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
365
366#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700367 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700368 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700369 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700370#endif
371
372
373 if (psessionEntry->is11Rconnection)
374 {
375 // Now we are on the right channel and need to send out Auth1 and
376 // receive Auth2.
377 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
378 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800379#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700380 else
381 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800382 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800384 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 }
386#endif
387 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
388 authFrame.authStatusCode = 0;
389
390 // Start timer here to come back to operating channel.
391 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
392 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
393 {
394#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700395 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700396#endif
397 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800398MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700399
400#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800401 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700402#endif
403
404 limSendAuthMgmtFrame(pMac, &authFrame,
405 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
406 LIM_NO_WEP_IN_FC, psessionEntry);
407
408 return;
Ganesh Kondabattini2bc754b2014-07-31 14:05:09 +0530409preauth_fail:
410 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
411 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700412}
413
414
415/*------------------------------------------------------------------
416 *
417 * Create the new Add Bss Req to the new AP.
418 * This will be used when we are ready to FT to the new AP.
419 * The newly created ft Session entry is passed to this function
420 *
421 *------------------------------------------------------------------*/
422tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
423 tANI_U8 updateEntry, tpPESession pftSessionEntry,
424 tpSirBssDescription bssDescription )
425{
426 tpAddBssParams pAddBssParams = NULL;
427 tANI_U8 i;
428 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700429 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530431 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
432 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700433 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700435 return eSIR_MEM_ALLOC_FAILED;
436 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700437
438 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530439 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
440 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530442 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530444 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 return (eSIR_MEM_ALLOC_FAILED);
446 }
447
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530448 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700449
450
451 limExtractApCapabilities( pMac,
452 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700453 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
455 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700456 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530458 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
459 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700460
461 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530462 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
463 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700464
465 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
466 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
467
468 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
469
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 pAddBssParams->updateBss = updateEntry;
472
473
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700474 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
475 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
476 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
477 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700478
479
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700480 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530481 vos_mem_copy(pAddBssParams->rateSet.rate,
482 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700483
484 pAddBssParams->nwType = bssDescription->nwType;
485
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700486 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700487 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
488 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
489 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
490 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
491
492 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700493 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700494 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700495 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700496
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700497 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700499 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
500 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700501
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700503 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700504 (chanWidthSupp) )
505 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700506 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
507 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 }
509 else
510 {
511 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700512 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700513 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
515 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
516 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700517 }
518 }
519
520 pAddBssParams->currentOperChannel = bssDescription->channelId;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800521 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
522
523#ifdef WLAN_FEATURE_11AC
524 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
525 {
526 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
527 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
528 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
529 pAddBssParams->currentOperChannel,
530 pAddBssParams->currentExtChannel,
531 pftSessionEntry->apCenterChan,
532 pftSessionEntry);
533 }
534 else
535 {
536 pAddBssParams->vhtCapable = 0;
537 }
538#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700539
540#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700541 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 pAddBssParams->currentOperChannel);
543#endif
544
545
546 // Populate the STA-related parameters here
547 // Note that the STA here refers to the AP
548 {
549 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
550
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530551 vos_mem_copy(pAddBssParams->staContext.bssId,
552 bssDescription->bssId,
553 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700554 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
555
556 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
557 pAddBssParams->staContext.uAPSD = 0;
558 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700559 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 pAddBssParams->staContext.updateSta = updateEntry;
561 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
562
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700563 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 {
565 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
566 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700567 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
568 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
569 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 (chanWidthSupp) )
571 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700572 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 }
574 else
575 {
576 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
577 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800578#ifdef WLAN_FEATURE_11AC
579 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
580 {
581 pAddBssParams->staContext.vhtCapable = 1;
582 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
583 pBeaconStruct->VHTCaps.muBeamformerCap) &&
584 pftSessionEntry->txBFIniFeatureEnabled)
585 {
586 pAddBssParams->staContext.vhtTxBFCapable = 1;
587 }
588 }
589#endif
590 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
591 (chanWidthSupp) )
592 {
593 pAddBssParams->staContext.txChannelWidthSet =
594 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
595#ifdef WLAN_FEATURE_11AC
596 if (pAddBssParams->staContext.vhtCapable)
597 {
598 pAddBssParams->staContext.vhtTxChannelWidthSet =
599 pBeaconStruct->VHTOperation.chanWidth;
600 }
601#endif
602 }
603 else
604 {
605 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
606 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700607 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
608 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
609 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
610 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
611 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
612 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
613 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
614 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700615
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700616 if( pBeaconStruct->HTInfo.present )
617 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 }
619
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700620 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
621 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 pAddBssParams->staContext.wmmEnabled = 1;
623 else
624 pAddBssParams->staContext.wmmEnabled = 0;
625
626 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700627#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700628 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
629 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700630 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700631#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700632 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700634#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800635 if (pftSessionEntry->htCapability)
636 {
637 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
638 if (pftSessionEntry->vhtCapability)
639 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
640 }
641 else
642 {
643 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
644 {
645 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
646 }
647 else
648 {
649 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
650 }
651 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 }
653
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 //Disable BA. It will be set as part of ADDBA negotiation.
655 for( i = 0; i < STACFG_MAX_TC; i++ )
656 {
657 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
658 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
659 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
660 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
661 }
662
663#if defined WLAN_FEATURE_VOWIFI
664 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
665#endif
666
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800667#ifdef WLAN_FEATURE_11W
668 if (pftSessionEntry->limRmfEnabled)
669 {
670 pAddBssParams->rmfEnabled = 1;
671 pAddBssParams->staContext.rmfEnabled = 1;
672 }
673#endif
674
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 pAddBssParams->status = eHAL_STATUS_SUCCESS;
676 pAddBssParams->respReqd = true;
677
678 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
679 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
680
681 // Set a new state for MLME
682
683 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800684 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 -0700685 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
686
687 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
688
689#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800690 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700691#endif
692
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530693 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 return 0;
695}
696
697/*------------------------------------------------------------------
698 *
699 * Setup the new session for the pre-auth AP.
700 * Return the newly created session entry.
701 *
702 *------------------------------------------------------------------*/
703tpPESession limFillFTSession(tpAniSirGlobal pMac,
704 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
705{
706 tpPESession pftSessionEntry;
707 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700708 tPowerdBm localPowerConstraint;
709 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700710 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800711 uint32 selfDot11Mode;
712 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700713
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530714 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
715 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700716 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530717 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700718 return NULL;
719 }
720
Jeff Johnson295189b2012-06-20 16:38:30 -0700721
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800722
723 /* Retrieve the session that has already been created and update the entry */
724 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800725#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700726 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700727#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
729 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
730 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
731 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
732
733 // Fields to be filled later
734 pftSessionEntry->pLimJoinReq = NULL;
735 pftSessionEntry->smeSessionId = 0;
736 pftSessionEntry->transactionId = 0;
737
738 limExtractApCapabilities( pMac,
739 (tANI_U8 *) pbssDescription->ieFields,
740 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700741 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700742
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700743 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530744 vos_mem_copy(pftSessionEntry->rateSet.rate,
745 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700746
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700747 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530748 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700749 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700750
751
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700752 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530753 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 pftSessionEntry->ssId.length);
755
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800756 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
757 pftSessionEntry->dot11mode = selfDot11Mode;
758 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
759 && pBeaconStruct->VHTCaps.present);
760 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
761 && pBeaconStruct->HTCaps.present);
762#ifdef WLAN_FEATURE_11AC
763 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
764 {
765 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
766 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
767 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
768 }
769 else
770 {
771 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
772 }
773#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700774 // Self Mac
775 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
776 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800777#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700778 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700779#endif
780
781 /* Store beaconInterval */
782 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
783 pftSessionEntry->bssType = psessionEntry->bssType;
784
785 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
786 pftSessionEntry->nwType = pbssDescription->nwType;
787
788 /* Copy The channel Id to the session Table */
789 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
790 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
791
792
793 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
794 {
795 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
796 }
797 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
798 {
799 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
800 }
801 else
802 {
803 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700804 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700805 }
806
807 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
808 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800809 if( pMac->roam.configParam.shortSlotTime &&
810 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
811 {
812 pftSessionEntry->shortSlotTimeSupported = TRUE;
813 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700814
815 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
816 localPowerConstraint = regMax;
817 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
818 limGetIElenFromBssDescription(pbssDescription),
819 &pftSessionEntry->limCurrentBssQosCaps,
820 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700821 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700822
823 pftSessionEntry->limReassocBssQosCaps =
824 pftSessionEntry->limCurrentBssQosCaps;
825 pftSessionEntry->limReassocBssPropCap =
826 pftSessionEntry->limCurrentBssPropCap;
827
828
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800829#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800830 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
831#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800833#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700834
835#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800836 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 -0800837 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700838#endif
839
840 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
841
842 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
843 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800844 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
846 pftSessionEntry->encryptType = psessionEntry->encryptType;
847
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800848 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
849 {
850 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
851 }
852 else
853 {
854 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
855 }
856 pftSessionEntry->htSupportedChannelWidthSet =
857 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
858 pftSessionEntry->htRecommendedTxWidthSet =
859 pftSessionEntry->htSupportedChannelWidthSet;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +0530860 if ((pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)&&
861 (pftSessionEntry->htSupportedChannelWidthSet == 1))
862 {
863 limInitOBSSScanParams(pMac, pftSessionEntry);
864 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530865 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 return pftSessionEntry;
867}
868
869/*------------------------------------------------------------------
870 *
871 * Setup the session and the add bss req for the pre-auth AP.
872 *
873 *------------------------------------------------------------------*/
874void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
875{
876 tpPESession pftSessionEntry;
877
878 // Prepare the session right now with as much as possible.
879 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
880
881 if (pftSessionEntry)
882 {
883 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800884#ifdef FEATURE_WLAN_ESE
885 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700886#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800887#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
889#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700890
891#ifdef FEATURE_WLAN_LFR
892 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
893#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800894#ifdef WLAN_FEATURE_11W
895 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
896#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
898 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
899 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
900 }
901}
902
903/*------------------------------------------------------------------
904 * Resume Link Call Back
905 *------------------------------------------------------------------*/
906void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
907{
908 tpPESession psessionEntry;
909
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700910 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
911 return;
912
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 psessionEntry = (tpPESession)data;
914
915 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
916 {
917 limFTSetupAuthSession(pMac, psessionEntry);
918 }
919
920 // Post the FT Pre Auth Response to SME
921 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
922 pMac->ft.ftPEContext.saved_auth_rsp,
923 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
924
925}
926
927/*------------------------------------------------------------------
928 * Resume Link Call Back
929 *------------------------------------------------------------------*/
930void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
931 tpPESession psessionEntry)
932{
933 //Set the resume channel to Any valid channel (invalid).
934 //This will instruct HAL to set it to any previous valid channel.
935 peSetResumeChannel(pMac, 0, 0);
936 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
937}
938
939tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
940 tANI_U8 *ric_ies, tANI_U32 *ieLength)
941{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530942 /* BlockACK + RIC is not supported now, TODO later to support this */
943#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 tDot11fIERICDataDesc ricIe;
945 tDot11fFfBAStartingSequenceControl baSsnControl;
946 tDot11fFfAddBAParameterSet baParamSet;
947 tDot11fFfBATimeout baTimeout;
948
949 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
950 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
951 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
952 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
953
954 ricIe.present = 1;
955 ricIe.RICData.present = 1;
956 ricIe.RICData.resourceDescCount = 1;
957 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
958 ricIe.RICDescriptor.present = 1;
959 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
960 baParamSet.tid = tid;
961 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
962 baParamSet.bufferSize = pTrafficClass->txBufSize;
963 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
964 baSsnControl.fragNumber = 0;
965 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530966 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700967 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
968 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
969 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
970 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530971 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700972 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
973 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
974 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
975 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530976 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700977 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
978 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
979 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
980 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530982#endif
983
984 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700985}
986
987tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
988{
989 tANI_U8 tid = 0;
990 tpDphHashNode pSta;
991 tANI_U16 numBA = 0, aid = 0;
992 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
993 tANI_U32 offset = 0, ieLength = 0;
994 tSirRetStatus status = eSIR_SUCCESS;
995
996 // First, extract the DPH entry
997 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
998 if( NULL == pSta )
999 {
1000 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -08001001 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
1002 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001003 return eSIR_FAILURE;
1004 }
1005
1006 for (tid = 0; tid < STACFG_MAX_TC; tid++)
1007 {
1008 if (pSta->tcCfg[tid].fUseBATx)
1009 {
1010 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
1011 if (eSIR_SUCCESS == status)
1012 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001013 // TODO RIC
1014 if ( ieLength > MAX_FTIE_SIZE )
1015 {
1016 ieLength = 0;
1017 return status;
1018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001019 offset += ieLength;
1020 *ric_ies_length += ieLength;
1021 numBA++;
1022 }
1023 else
1024 {
1025 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
1026 }
1027 }
1028 }
1029
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001030 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 -07001031 return status;
1032}
1033
1034/*------------------------------------------------------------------
1035 *
1036 * Will post pre auth response to SME.
1037 *
1038 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001039void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001040 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1041 tpPESession psessionEntry)
1042{
1043 tpSirFTPreAuthRsp pFTPreAuthRsp;
1044 tSirMsgQ mmhMsg;
1045 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001046 // TODO: RIC Support
1047 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001048
1049 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301050 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001052 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001053 VOS_ASSERT(pFTPreAuthRsp != NULL);
1054 return;
1055 }
1056 vos_mem_zero( pFTPreAuthRsp, rspLen);
1057#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001058 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001059#endif
1060
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301061 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1063 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1064 pFTPreAuthRsp->status = status;
1065 if (psessionEntry)
1066 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1067
1068 // The bssid of the AP we are sending Auth1 to.
1069 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1070 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1071 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1072
1073 // Attach the auth response now back to SME
1074 pFTPreAuthRsp->ft_ies_length = 0;
1075 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1076 {
1077 // Only 11r assoc has FT IEs.
1078 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1079 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1080 }
1081
1082#ifdef WLAN_FEATURE_VOWIFI_11R
1083 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1084 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001085 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1086 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1088 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1089 if (eSIR_SUCCESS != sirStatus)
1090 {
1091 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1092 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001093 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 }
1095#endif
1096
1097 mmhMsg.type = pFTPreAuthRsp->messageType;
1098 mmhMsg.bodyptr = pFTPreAuthRsp;
1099 mmhMsg.bodyval = 0;
1100
1101#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001102 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001103#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001104#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001105 if (status == eSIR_SUCCESS)
1106 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1107 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001108#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1110}
1111
1112/*------------------------------------------------------------------
1113 *
1114 * Send the FT Pre Auth Response to SME when ever we have a status
1115 * ready to be sent to SME
1116 *
1117 * SME will be the one to send it up to the supplicant to receive
1118 * FTIEs which will be required for Reassoc Req.
1119 *
1120 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001121void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1123 tpPESession psessionEntry)
1124{
1125
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001126 tpPESession pftSessionEntry;
1127 tANI_U8 sessionId;
1128 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001129#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1130 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1131#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001132
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 // Save the status of pre-auth
1134 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1135
1136 // Save the auth rsp, so we can send it to
1137 // SME once we resume link.
1138 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1139 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1140 {
1141 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1142 auth_rsp, auth_rsp_length);
1143 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1144 }
1145
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001146 /* Create FT session for the re-association at this point */
1147 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1148 {
1149 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1150 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1151 &sessionId, pMac->lim.maxStation)) == NULL)
1152 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001153 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
mukul sharmaa8f96f02014-12-03 22:41:07 +05301154 status = eSIR_FAILURE;
1155 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1156 goto out;
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001157 }
1158 pftSessionEntry->peSessionId = sessionId;
1159 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1160 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1161 pftSessionEntry->bssType = psessionEntry->bssType;
1162
1163 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1164 {
1165 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1166 }
1167 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1168 {
1169 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1170 }
1171 else
1172 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001173 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001174 }
1175 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1176 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1177 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001178 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001179 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1180
1181 /* Update the ReAssoc BSSID of the current session */
1182 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001183 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001184 }
mukul sharmaa8f96f02014-12-03 22:41:07 +05301185out:
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 if (psessionEntry->currentOperChannel !=
1187 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1188 {
1189 // Need to move to the original AP channel
1190 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1191 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1192 }
1193 else
1194 {
1195#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001196 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1198#endif
1199 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1200 }
1201}
1202
1203/*------------------------------------------------------------------
1204 *
1205 * This function handles the 11R Reassoc Req from SME
1206 *
1207 *------------------------------------------------------------------*/
1208void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1209 tpPESession psessionEntry)
1210{
1211 tANI_U8 smeSessionId = 0;
1212 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001213 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001214 tLimMlmReassocReq *pMlmReassocReq;
1215 tANI_U16 caps;
1216 tANI_U32 val;
1217 tSirMsgQ msgQ;
1218 tSirRetStatus retCode;
1219 tANI_U32 teleBcnEn = 0;
1220
Jeff Johnson278b0492013-04-03 14:10:08 -07001221 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001222 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1223 psessionEntry->smeSessionId = smeSessionId;
1224 psessionEntry->transactionId = transactionId;
1225
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001226#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1227 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1228#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301230 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1231 {
1232 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1233 return;
1234 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301235 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1236 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001237 {
1238 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301239 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001240 return;
1241 }
1242
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301243 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1244 psessionEntry->bssId,
1245 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001246
1247 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1248 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1249 != eSIR_SUCCESS)
1250 {
1251 /**
1252 * Could not get ReassocFailureTimeout value
1253 * from CFG. Log error.
1254 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001255 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301256 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 return;
1258 }
1259
1260 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1261 {
1262 /**
1263 * Could not get Capabilities value
1264 * from CFG. Log error.
1265 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001266 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301267 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 return;
1269 }
1270 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001271
Jeff Johnson295189b2012-06-20 16:38:30 -07001272 /* Update PE sessionId*/
1273 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1274
1275 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001276 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1277 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001279 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301280 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001281 return;
1282 }
1283
1284 if (teleBcnEn)
1285 {
1286 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001287 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001288 /**
1289 * Could not get ListenInterval value
1290 * from CFG. Log error.
1291 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001292 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301293 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001295 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001296 }
1297 else
1298 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001299 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 {
1301 /**
1302 * Could not get ListenInterval value
1303 * from CFG. Log error.
1304 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001305 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301306 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001307 return;
1308 }
1309 }
1310 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001311 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001312 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301313 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001314 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 }
1316
Jeff Johnson295189b2012-06-20 16:38:30 -07001317 pMlmReassocReq->listenInterval = (tANI_U16) val;
1318
1319 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1320
1321
1322 //we need to defer the message until we get the response back from HAL.
1323 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001324
Jeff Johnson295189b2012-06-20 16:38:30 -07001325 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1326 msgQ.reserved = 0;
1327 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1328 msgQ.bodyval = 0;
1329
1330
1331#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001332 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001333#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001334 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001335
1336 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001337 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001338 {
1339 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001340 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 retCode );
1342 }
1343 // Dont need this anymore
1344 pMac->ft.ftPEContext.pAddBssReq = NULL;
Mukul Sharma38a6bbc2014-06-30 00:25:39 +05301345#ifdef DEBUG_ROAM_DELAY
1346 vos_record_roam_event(e_LIM_ADD_BS_REQ, NULL, 0);
1347#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 return;
1349}
1350
1351/*------------------------------------------------------------------
1352 *
1353 * This function is called if preauth response is not received from the AP
1354 * within this timeout while FT in progress
1355 *
1356 *------------------------------------------------------------------*/
1357void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1358{
1359 tpPESession psessionEntry;
1360
1361 // We have failed pre auth. We need to resume link and get back on
1362 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301363 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001364
1365 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1366 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001367 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001368 return;
1369 }
1370
Abhishek Singh8a226222014-03-13 14:49:16 +05301371 /* To handle the race condition where we recieve preauth rsp after
1372 * timer has expired.
1373 */
1374 if (eANI_BOOLEAN_TRUE ==
1375 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed)
1376 {
1377 limLog(pMac,LOGE,FL("Auth rsp already posted to SME"
1378 " (session %p)"), psessionEntry);
1379 return;
1380 }
1381 else
1382 {
1383 /* Here we are sending preauth rsp with failure state
1384 * and which is forwarded to SME. Now, if we receive an preauth
1385 * resp from AP with success it would create a FT pesession, but
1386 * will be dropped in SME leaving behind the pesession.
1387 * Mark Preauth rsp processed so that any rsp from AP is dropped in
1388 * limProcessAuthFrameNoSession.
1389 */
1390 limLog(pMac,LOG1,FL("Auth rsp not yet posted to SME"
1391 " (session %p)"), psessionEntry);
1392 pMac->ft.ftPEContext.pFTPreAuthReq->bPreAuthRspProcessed =
1393 eANI_BOOLEAN_TRUE;
1394 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001395 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1396 // to get back.
1397 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1398}
1399
1400
1401/*------------------------------------------------------------------
1402 *
1403 * This function is called to process the update key request from SME
1404 *
1405 *------------------------------------------------------------------*/
1406tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1407{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301408 tAddBssParams * pAddBssParams;
1409 tSirFTUpdateKeyInfo * pKeyInfo;
1410 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301412 /* Sanity Check */
1413 if( pMac == NULL || pMsgBuf == NULL )
1414 {
1415 return TRUE;
1416 }
1417 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1418 {
1419 limLog( pMac, LOGE,
1420 FL( "pAddBssReq is NULL" ));
1421 return TRUE;
1422 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001423
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301424 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1425 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001426
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301427 /* Store the key information in the ADD BSS parameters */
1428 pAddBssParams->extSetStaKeyParamValid = 1;
1429 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301430 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1431 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301432 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1433 {
1434 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1435 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001436
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301437 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301438 limLog(pMac, LOG1, FL("Key valid %d key len = %d"),
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301439 pAddBssParams->extSetStaKeyParamValid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301440 pAddBssParams->extSetStaKeyParam.key[0].keyLength);
Jeff Johnson295189b2012-06-20 16:38:30 -07001441
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301442 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1443
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301444 limLog(pMac, LOG1,
1445 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301446
1447 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1448 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301449 limLog(pMac, LOG1,
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301450 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1451 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1452 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1453 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1454 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1455 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1456 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1457 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1458 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1459 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1460 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1461 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1462 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1463 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1464 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1465 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1466 pAddBssParams->extSetStaKeyParam.key[0].key[14],
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301467 pAddBssParams->extSetStaKeyParam.key[0].key[15]);
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301468 }
1469
1470 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001471}
1472
1473tSirRetStatus
1474limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1475{
1476 tSirMsgQ msg;
1477 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1478 tpAggrAddTsParams pAggrAddTsParam;
1479 tpPESession psessionEntry = NULL;
1480 tpLimTspecInfo tspecInfo;
1481 tANI_U8 ac;
1482 tpDphHashNode pSta;
1483 tANI_U16 aid;
1484 tANI_U8 sessionId;
1485 int i;
1486
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301487 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1488 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301490 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 return eSIR_MEM_ALLOC_FAILED;
1492 }
1493
1494 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1495
1496 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001497 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301498 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001499 return eSIR_FAILURE;
1500 }
1501
1502 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1503 if (pSta == NULL)
1504 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001505 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301506 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001507 return eSIR_FAILURE;
1508 }
1509
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301510 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1511 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 pAggrAddTsParam->staIdx = psessionEntry->staId;
1513 // Fill in the sessionId specific to PE
1514 pAggrAddTsParam->sessionId = sessionId;
1515 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1516
1517 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1518 {
1519 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1520 {
1521 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1522 /* Since AddTS response was successful, check for the PSB flag
1523 * and directional flag inside the TS Info field.
1524 * An AC is trigger enabled AC if the PSB subfield is set to 1
1525 * in the uplink direction.
1526 * An AC is delivery enabled AC if the PSB subfield is set to 1
1527 * in the downlink direction.
1528 * An AC is trigger and delivery enabled AC if the PSB subfield
1529 * is set to 1 in the bi-direction field.
1530 */
1531 if (pTspec->tsinfo.traffic.psb == 1)
1532 {
1533 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1534 }
1535 else
1536 {
1537 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1538 }
1539 /* ADDTS success, so AC is now admitted. We shall now use the default
1540 * EDCA parameters as advertised by AP and send the updated EDCA params
1541 * to HAL.
1542 */
1543 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1544 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1545 {
1546 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1547 }
1548 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1549 {
1550 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1551 }
1552 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1553 {
1554 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1555 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1556 }
1557
1558 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1559
1560 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1561 {
1562 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1563 }
1564 else
1565 {
1566 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1567 }
1568
1569 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1570 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001571 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301573 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1575 }
1576
1577 // Copy the TSPEC paramters
1578 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1579 }
1580 }
1581
1582 msg.type = WDA_AGGR_QOS_REQ;
1583 msg.bodyptr = pAggrAddTsParam;
1584 msg.bodyval = 0;
1585
1586 /* We need to defer any incoming messages until we get a
1587 * WDA_AGGR_QOS_RSP from HAL.
1588 */
1589 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001590 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001591
1592 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1593 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001594 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301596 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 return eSIR_FAILURE;
1598 }
1599
1600 return eSIR_SUCCESS;
1601}
1602
1603void
1604limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1605 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1606{
1607 tpSirAggrQosRsp rsp;
1608 int i = 0;
1609
1610 if (! rspReqd)
1611 {
1612 return;
1613 }
1614
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301615 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1616 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301618 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 return;
1620 }
1621
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301622 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001623 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1624 rsp->sessionId = smesessionId;
1625 rsp->length = sizeof(*rsp);
1626 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1627
1628 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1629 {
1630 if( (1 << i) & aggrQosRsp->tspecIdx )
1631 {
1632 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1633 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1634 }
1635 }
1636
1637 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1638 return;
1639}
1640
1641
1642void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1643{
1644 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1645 //tpAggrQosParams pAggrQosRspMsg = NULL;
1646 tAddTsParams addTsParam = {0};
1647 tpDphHashNode pSta = NULL;
1648 tANI_U16 assocId =0;
1649 tSirMacAddr peerMacAddr;
1650 tANI_U8 rspReqd = 1;
1651 tpPESession psessionEntry = NULL;
1652 int i = 0;
1653
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301654 limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001655
1656 /* Need to process all the deferred messages enqueued since sending the
1657 SIR_HAL_AGGR_ADD_TS_REQ */
1658 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1659
1660 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1661 if (NULL == pAggrQosRspMsg)
1662 {
1663 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1664 return;
1665 }
1666
1667 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1668 if (NULL == psessionEntry)
1669 {
1670 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001671 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001672 if( pAggrQosRspMsg != NULL )
1673 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301674 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 }
1676 return;
1677 }
1678
1679 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1680 {
1681 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1682 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1683 {
1684 /* send DELTS to the station */
1685 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1686
1687 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1688 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1689 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1690 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1691
1692 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1693 &addTsParam.tspec.tsinfo,
1694 &addTsParam.tspec, psessionEntry);
1695
1696 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1697 &psessionEntry->dph.dphHashTable);
1698 if (pSta != NULL)
1699 {
1700 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1701 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1702 }
1703 }
1704 }
1705
1706 /* Send the Aggr QoS response to SME */
1707
1708 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1709 psessionEntry->smeSessionId);
1710 if( pAggrQosRspMsg != NULL )
1711 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301712 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001713 }
1714 return;
1715}
1716
Jeff Johnson295189b2012-06-20 16:38:30 -07001717#endif /* WLAN_FEATURE_VOWIFI_11R */