blob: 369515f763f920d33e4d114c0a5b59770060d271 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +05302 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
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.
20*/
Jeff Johnson295189b2012-06-20 16:38:30 -070021#ifdef WLAN_FEATURE_VOWIFI_11R
22/**=========================================================================
23
24 \brief implementation for PE 11r VoWiFi FT Protocol
25
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053026 Copyright 2008 (c) Qualcomm Technologies, Inc. All Rights Reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070027
Gopichand Nakkalaa481dcb2013-06-17 18:28:00 +053028 Qualcomm Technologies Confidential and Proprietary.
Jeff Johnson295189b2012-06-20 16:38:30 -070029
30 ========================================================================*/
31
32/* $Header$ */
33
34
35/*--------------------------------------------------------------------------
36 Include Files
37 ------------------------------------------------------------------------*/
38#include <limSendMessages.h>
39#include <limTypes.h>
40#include <limFT.h>
41#include <limFTDefs.h>
42#include <limUtils.h>
43#include <limPropExtsUtils.h>
44#include <limAssocUtils.h>
45#include <limSession.h>
46#include <limAdmitControl.h>
47#include "wmmApsd.h"
48
49#define LIM_FT_RIC_BA_SSN 1
50#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
51#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053052#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070053
54/*--------------------------------------------------------------------------
55 Initialize the FT variables.
56 ------------------------------------------------------------------------*/
57void limFTOpen(tpAniSirGlobal pMac)
58{
59 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
60 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
61}
62
63/*--------------------------------------------------------------------------
64 Cleanup FT variables.
65 ------------------------------------------------------------------------*/
66void limFTCleanup(tpAniSirGlobal pMac)
67{
68 if (pMac->ft.ftPEContext.pFTPreAuthReq)
69 {
70#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070071 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070072 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070073#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080074 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
75 {
76 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
77 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
78 }
Jeff Johnson295189b2012-06-20 16:38:30 -070079 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
80 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
81 }
82
83 // This is the old session, should be deleted else where.
84 // We should not be cleaning it here, just set it to NULL.
85 if (pMac->ft.ftPEContext.psavedsessionEntry)
86 {
87#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070088 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070089 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070090#endif
91 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
92 }
93
94 // This is the extra session we added as part of Auth resp
95 // clean it up.
96 if (pMac->ft.ftPEContext.pftSessionEntry)
97 {
98 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
99 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
100 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700101 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700102 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
103 }
104 pMac->ft.ftPEContext.pftSessionEntry = NULL;
105#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700106 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700107 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700108#endif
109 }
110
111 if (pMac->ft.ftPEContext.pAddBssReq)
112 {
113 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
114 pMac->ft.ftPEContext.pAddBssReq = NULL;
115 }
116
117 if (pMac->ft.ftPEContext.pAddStaReq)
118 {
119 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
120 pMac->ft.ftPEContext.pAddStaReq = NULL;
121 }
122
123 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
124
125}
126
127/*--------------------------------------------------------------------------
128 Init FT variables.
129 ------------------------------------------------------------------------*/
130void limFTInit(tpAniSirGlobal pMac)
131{
132 if (pMac->ft.ftPEContext.pFTPreAuthReq)
133 {
134#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700135 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700136 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700137#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800138 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
139 {
140 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
141 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
142 }
143
Jeff Johnson295189b2012-06-20 16:38:30 -0700144 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
145 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
146 }
147
148 // This is the old session, should be deleted else where.
149 // We should not be cleaning it here, just set it to NULL.
150 if (pMac->ft.ftPEContext.psavedsessionEntry)
151 {
152#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700153 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700154 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700155#endif
156 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
157 }
158
159 // This is the extra session we added as part of Auth resp
160 // clean it up.
161 if (pMac->ft.ftPEContext.pftSessionEntry)
162 {
163 /* Cannot delete sessions across associations */
164#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700165 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700166 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700167#endif
168 pMac->ft.ftPEContext.pftSessionEntry = NULL;
169 }
170
171 if (pMac->ft.ftPEContext.pAddBssReq)
172 {
173#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700174 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700175 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700176#endif
177 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
178 pMac->ft.ftPEContext.pAddBssReq = NULL;
179 }
180
181
182 if (pMac->ft.ftPEContext.pAddStaReq)
183 {
184#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700185 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700186 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700187#endif
188 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
189 pMac->ft.ftPEContext.pAddStaReq = NULL;
190 }
191
192 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
193
194}
195
196/*------------------------------------------------------------------
197 *
198 * This is the handler after suspending the link.
199 * We suspend the link and then now proceed to switch channel.
200 *
201 *------------------------------------------------------------------*/
202void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
203{
204 tpPESession psessionEntry;
205
206 // The link is suspended of not ?
207 if (status != eHAL_STATUS_SUCCESS)
208 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700209 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700210 // Post the FT Pre Auth Response to SME
211 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
212
213 return;
214 }
215
216 psessionEntry = (tpPESession)data;
217 // Suspended, now move to a different channel.
218 // Perform some sanity check before proceeding.
219 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
220 {
221 limChangeChannelWithCallback(pMac,
222 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
223 limPerformFTPreAuth, NULL, psessionEntry);
224 return;
225 }
226
227 // Else return error.
228 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
229}
230
231
232/*--------------------------------------------------------------------------
233 In this function, we process the FT Pre Auth Req.
234 We receive Pre-Auth
235 Suspend link
236 Register a call back
237 In the call back, we will need to accept frames from the new bssid
238 Send out the auth req to new AP.
239 Start timer and when the timer is done or if we receive the Auth response
240 We change channel
241 Resume link
242 ------------------------------------------------------------------------*/
243int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
244{
245 int bufConsumed = FALSE;
246 tpPESession psessionEntry;
247 tANI_U8 sessionId;
248
249 // Now we are starting fresh make sure all's cleanup.
250 limFTInit(pMac);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700251 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE; // Can set it only after sending auth
Jeff Johnson295189b2012-06-20 16:38:30 -0700252
253 // We need information from the Pre-Auth Req. Lets save that
254 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
255
256#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800257 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700258 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
259 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
260 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
261#endif
262
263 // Get the current session entry
264 psessionEntry = peFindSessionByBssid(pMac,
265 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
266 if (psessionEntry == NULL)
267 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700268 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700269 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700270 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
271 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800272 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700273 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 return TRUE;
275 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700276#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
277 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
278#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700279
280 // Dont need to suspend if APs are in same channel
281 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
282 {
283 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700284 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700285 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700286 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 (tANI_U32 *)psessionEntry);
288 }
289 else
290 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700291 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700292 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700293 // We are in the same channel. Perform pre-auth
294 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
295 }
296
297 return bufConsumed;
298}
299
300/*------------------------------------------------------------------
301 * Send the Auth1
302 * Receive back Auth2
303 *------------------------------------------------------------------*/
304void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
305 tpPESession psessionEntry)
306{
307 tSirMacAuthFrameBody authFrame;
308
309 if (psessionEntry->is11Rconnection)
310 {
311 // Only 11r assoc has FT IEs.
312 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
313 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700314 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 return;
316 }
317 }
318 if (status != eHAL_STATUS_SUCCESS)
319 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700320 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 return;
322 }
323 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
324
325#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700326 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700327 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700328 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700329#endif
330
331
332 if (psessionEntry->is11Rconnection)
333 {
334 // Now we are on the right channel and need to send out Auth1 and
335 // receive Auth2.
336 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
337 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700338#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 else
340 {
341 // Will need to make isCCXconnection a enum may be for further
342 // improvements to this to match this algorithm number
343 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
344 }
345#endif
346 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
347 authFrame.authStatusCode = 0;
348
349 // Start timer here to come back to operating channel.
350 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
351 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
352 {
353#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700354 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700355#endif
356 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800357MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800360 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700361#endif
362
363 limSendAuthMgmtFrame(pMac, &authFrame,
364 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
365 LIM_NO_WEP_IN_FC, psessionEntry);
366
367 return;
368}
369
370
371/*------------------------------------------------------------------
372 *
373 * Create the new Add Bss Req to the new AP.
374 * This will be used when we are ready to FT to the new AP.
375 * The newly created ft Session entry is passed to this function
376 *
377 *------------------------------------------------------------------*/
378tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
379 tANI_U8 updateEntry, tpPESession pftSessionEntry,
380 tpSirBssDescription bssDescription )
381{
382 tpAddBssParams pAddBssParams = NULL;
383 tANI_U8 i;
384 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700385 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700386
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700387 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
388 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
389 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700390 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700391 return eSIR_MEM_ALLOC_FAILED;
392 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700393
394 // Package SIR_HAL_ADD_BSS_REQ message parameters
395 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
396 (void **) &pAddBssParams, sizeof( tAddBssParams )))
397 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700398 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 limLog( pMac, LOGP,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700400 FL( "Unable to PAL allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 return (eSIR_MEM_ALLOC_FAILED);
402 }
403
404 palZeroMemory( pMac->hHdd, (tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ));
405
406
407 limExtractApCapabilities( pMac,
408 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700409 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700410
411 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700412 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
414 palCopyMemory( pMac->hHdd, pAddBssParams->bssId, bssDescription->bssId,
415 sizeof( tSirMacAddr ));
416
417 // Fill in tAddBssParams selfMacAddr
418 palCopyMemory( pMac->hHdd, pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
419 sizeof( tSirMacAddr ));
420
421 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
422 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
423
424 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
425
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700426 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 pAddBssParams->updateBss = updateEntry;
428
429
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700430 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
431 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
432 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
433 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700434
435
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700436 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700437 palCopyMemory( pMac->hHdd, pAddBssParams->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700438 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700439
440 pAddBssParams->nwType = bssDescription->nwType;
441
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700442 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
444 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
445 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
446 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
447
448 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700449 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700451 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700453 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700454 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700455 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
456 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700457
Jeff Johnson295189b2012-06-20 16:38:30 -0700458 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700459 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 (chanWidthSupp) )
461 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
463 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 }
465 else
466 {
467 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700468 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700470 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
471 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
472 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 }
474 }
475
476 pAddBssParams->currentOperChannel = bssDescription->channelId;
477
478#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700479 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 pAddBssParams->currentOperChannel);
481#endif
482
483
484 // Populate the STA-related parameters here
485 // Note that the STA here refers to the AP
486 {
487 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
488
489 palCopyMemory( pMac->hHdd, pAddBssParams->staContext.bssId,
490 bssDescription->bssId,
491 sizeof( tSirMacAddr ));
492 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
493
494 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
495 pAddBssParams->staContext.uAPSD = 0;
496 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700497 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700498 pAddBssParams->staContext.updateSta = updateEntry;
499 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
500
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700501 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 {
503 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
504 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700505 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
506 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
507 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700508 (chanWidthSupp) )
509 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 }
512 else
513 {
514 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
515 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700516 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
517 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
518 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
519 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
520 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
521 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
522 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
523 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700524
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700525 if( pBeaconStruct->HTInfo.present )
526 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700527 }
528
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700529 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
530 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 pAddBssParams->staContext.wmmEnabled = 1;
532 else
533 pAddBssParams->staContext.wmmEnabled = 0;
534
535 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700536#ifdef WLAN_FEATURE_11AC
537 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700538 pBeaconStruct->HTCaps.supportedMCSSet,
539 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700540#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700541 limPopulateOwnRateSet(pMac, &pAddBssParams->staContext.supportedRates,
542 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700543#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
545
546 }
547
548
549 //Disable BA. It will be set as part of ADDBA negotiation.
550 for( i = 0; i < STACFG_MAX_TC; i++ )
551 {
552 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
553 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
554 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
555 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
556 }
557
558#if defined WLAN_FEATURE_VOWIFI
559 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
560#endif
561
562 pAddBssParams->status = eHAL_STATUS_SUCCESS;
563 pAddBssParams->respReqd = true;
564
565 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
566 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
567
568 // Set a new state for MLME
569
570 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800571 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 -0700572 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
573
574 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
575
576#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800577 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700578#endif
579
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700580 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 return 0;
582}
583
584/*------------------------------------------------------------------
585 *
586 * Setup the new session for the pre-auth AP.
587 * Return the newly created session entry.
588 *
589 *------------------------------------------------------------------*/
590tpPESession limFillFTSession(tpAniSirGlobal pMac,
591 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
592{
593 tpPESession pftSessionEntry;
594 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 tPowerdBm localPowerConstraint;
596 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700597 tSchBeaconStruct *pBeaconStruct;
598
599 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
600 (void **)&pBeaconStruct, sizeof(tSchBeaconStruct)))
601 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700602 limLog(pMac, LOGE, FL("Unable to PAL allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700603 return NULL;
604 }
605
Jeff Johnson295189b2012-06-20 16:38:30 -0700606
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800607
608 /* Retrieve the session that has already been created and update the entry */
609 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700610#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700611 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
612#endif
613
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700615 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700616
617 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
618 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
619 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
620 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
621
622 // Fields to be filled later
623 pftSessionEntry->pLimJoinReq = NULL;
624 pftSessionEntry->smeSessionId = 0;
625 pftSessionEntry->transactionId = 0;
626
627 limExtractApCapabilities( pMac,
628 (tANI_U8 *) pbssDescription->ieFields,
629 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700630 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700631
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700632 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 palCopyMemory( pMac->hHdd, pftSessionEntry->rateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700634 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates );
Jeff Johnson295189b2012-06-20 16:38:30 -0700635
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700636 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 palCopyMemory(pMac->hHdd, pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700638 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700639
640
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700641 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
642 palCopyMemory( pMac->hHdd, pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 pftSessionEntry->ssId.length);
644
645
646 // Self Mac
647 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
648 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700649#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
651#endif
652
653 /* Store beaconInterval */
654 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
655 pftSessionEntry->bssType = psessionEntry->bssType;
656
657 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
658 pftSessionEntry->nwType = pbssDescription->nwType;
659
660 /* Copy The channel Id to the session Table */
661 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
662 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
663
664
665 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
666 {
667 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
668 }
669 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
670 {
671 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
672 }
673 else
674 {
675 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700676 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 }
678
679 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
680 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800681 if( pMac->roam.configParam.shortSlotTime &&
682 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
683 {
684 pftSessionEntry->shortSlotTimeSupported = TRUE;
685 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700686
687 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
688 localPowerConstraint = regMax;
689 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
690 limGetIElenFromBssDescription(pbssDescription),
691 &pftSessionEntry->limCurrentBssQosCaps,
692 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700693 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700694
695 pftSessionEntry->limReassocBssQosCaps =
696 pftSessionEntry->limCurrentBssQosCaps;
697 pftSessionEntry->limReassocBssPropCap =
698 pftSessionEntry->limCurrentBssPropCap;
699
700
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800701#ifdef FEATURE_WLAN_CCX
702 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
703#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800705#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700706
707#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800708 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 -0800709 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700710#endif
711
712 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
713
714 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
715 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800716 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700717
718 pftSessionEntry->encryptType = psessionEntry->encryptType;
719
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700720 palFreeMemory(pMac->hHdd, pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 return pftSessionEntry;
722}
723
724/*------------------------------------------------------------------
725 *
726 * Setup the session and the add bss req for the pre-auth AP.
727 *
728 *------------------------------------------------------------------*/
729void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
730{
731 tpPESession pftSessionEntry;
732
733 // Prepare the session right now with as much as possible.
734 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
735
736 if (pftSessionEntry)
737 {
738 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
739#ifdef FEATURE_WLAN_CCX
740 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
741#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700742#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
744#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700745
746#ifdef FEATURE_WLAN_LFR
747 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
748#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700749 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
750 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
751 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
752 }
753}
754
755/*------------------------------------------------------------------
756 * Resume Link Call Back
757 *------------------------------------------------------------------*/
758void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
759{
760 tpPESession psessionEntry;
761
762 psessionEntry = (tpPESession)data;
763
764 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
765 {
766 limFTSetupAuthSession(pMac, psessionEntry);
767 }
768
769 // Post the FT Pre Auth Response to SME
770 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
771 pMac->ft.ftPEContext.saved_auth_rsp,
772 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
773
774}
775
776/*------------------------------------------------------------------
777 * Resume Link Call Back
778 *------------------------------------------------------------------*/
779void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
780 tpPESession psessionEntry)
781{
782 //Set the resume channel to Any valid channel (invalid).
783 //This will instruct HAL to set it to any previous valid channel.
784 peSetResumeChannel(pMac, 0, 0);
785 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
786}
787
788tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
789 tANI_U8 *ric_ies, tANI_U32 *ieLength)
790{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530791 /* BlockACK + RIC is not supported now, TODO later to support this */
792#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700793 tDot11fIERICDataDesc ricIe;
794 tDot11fFfBAStartingSequenceControl baSsnControl;
795 tDot11fFfAddBAParameterSet baParamSet;
796 tDot11fFfBATimeout baTimeout;
797
798 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
799 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
800 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
801 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
802
803 ricIe.present = 1;
804 ricIe.RICData.present = 1;
805 ricIe.RICData.resourceDescCount = 1;
806 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
807 ricIe.RICDescriptor.present = 1;
808 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
809 baParamSet.tid = tid;
810 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
811 baParamSet.bufferSize = pTrafficClass->txBufSize;
812 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
813 baSsnControl.fragNumber = 0;
814 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530815 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700816 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
817 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
818 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
819 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530820 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700821 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
822 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
823 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
824 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530825 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700826 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
827 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
828 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
829 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530831#endif
832
833 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700834}
835
836tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
837{
838 tANI_U8 tid = 0;
839 tpDphHashNode pSta;
840 tANI_U16 numBA = 0, aid = 0;
841 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
842 tANI_U32 offset = 0, ieLength = 0;
843 tSirRetStatus status = eSIR_SUCCESS;
844
845 // First, extract the DPH entry
846 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
847 if( NULL == pSta )
848 {
849 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700850 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x" ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
852 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
853 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
854 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
855 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
856 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
857 return eSIR_FAILURE;
858 }
859
860 for (tid = 0; tid < STACFG_MAX_TC; tid++)
861 {
862 if (pSta->tcCfg[tid].fUseBATx)
863 {
864 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
865 if (eSIR_SUCCESS == status)
866 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700867 // TODO RIC
868 if ( ieLength > MAX_FTIE_SIZE )
869 {
870 ieLength = 0;
871 return status;
872 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 offset += ieLength;
874 *ric_ies_length += ieLength;
875 numBA++;
876 }
877 else
878 {
879 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
880 }
881 }
882 }
883
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700884 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 -0700885 return status;
886}
887
888/*------------------------------------------------------------------
889 *
890 * Will post pre auth response to SME.
891 *
892 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800893void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
895 tpPESession psessionEntry)
896{
897 tpSirFTPreAuthRsp pFTPreAuthRsp;
898 tSirMsgQ mmhMsg;
899 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700900 // TODO: RIC Support
901 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
904 if(NULL == pFTPreAuthRsp)
905 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700906 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 VOS_ASSERT(pFTPreAuthRsp != NULL);
908 return;
909 }
910 vos_mem_zero( pFTPreAuthRsp, rspLen);
911#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800912 PELOGE(limLog( pMac, LOG1, "%s: Auth Rsp = %p", pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700913#endif
914
915 palZeroMemory(pMac, (tANI_U8*)pFTPreAuthRsp, rspLen);
916 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
917 pFTPreAuthRsp->length = (tANI_U16) rspLen;
918 pFTPreAuthRsp->status = status;
919 if (psessionEntry)
920 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
921
922 // The bssid of the AP we are sending Auth1 to.
923 if (pMac->ft.ftPEContext.pFTPreAuthReq)
924 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
925 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
926
927 // Attach the auth response now back to SME
928 pFTPreAuthRsp->ft_ies_length = 0;
929 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
930 {
931 // Only 11r assoc has FT IEs.
932 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
933 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
934 }
935
936#ifdef WLAN_FEATURE_VOWIFI_11R
937 if ((psessionEntry) && (psessionEntry->is11Rconnection))
938 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700939 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
940 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
942 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
943 if (eSIR_SUCCESS != sirStatus)
944 {
945 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
946 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700947 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700948 }
949#endif
950
951 mmhMsg.type = pFTPreAuthRsp->messageType;
952 mmhMsg.bodyptr = pFTPreAuthRsp;
953 mmhMsg.bodyval = 0;
954
955#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800956 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800957#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700958#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -0700959 if (status == eSIR_SUCCESS)
960 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
961 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700962#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
964}
965
966/*------------------------------------------------------------------
967 *
968 * Send the FT Pre Auth Response to SME when ever we have a status
969 * ready to be sent to SME
970 *
971 * SME will be the one to send it up to the supplicant to receive
972 * FTIEs which will be required for Reassoc Req.
973 *
974 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800975void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
977 tpPESession psessionEntry)
978{
979
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800980 tpPESession pftSessionEntry;
981 tANI_U8 sessionId;
982 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700983#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
984 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
985#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800986
Jeff Johnson295189b2012-06-20 16:38:30 -0700987 // Save the status of pre-auth
988 pMac->ft.ftPEContext.ftPreAuthStatus = status;
989
990 // Save the auth rsp, so we can send it to
991 // SME once we resume link.
992 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
993 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
994 {
995 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
996 auth_rsp, auth_rsp_length);
997 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
998 }
999
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001000 /* Create FT session for the re-association at this point */
1001 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1002 {
1003 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1004 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1005 &sessionId, pMac->lim.maxStation)) == NULL)
1006 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001007 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001008 return;
1009 }
1010 pftSessionEntry->peSessionId = sessionId;
1011 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1012 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1013 pftSessionEntry->bssType = psessionEntry->bssType;
1014
1015 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1016 {
1017 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1018 }
1019 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1020 {
1021 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1022 }
1023 else
1024 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001025 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001026 }
1027 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1028 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1029 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001030 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001031 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1032
1033 /* Update the ReAssoc BSSID of the current session */
1034 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1035 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1036 }
1037
Jeff Johnson295189b2012-06-20 16:38:30 -07001038 if (psessionEntry->currentOperChannel !=
1039 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1040 {
1041 // Need to move to the original AP channel
1042 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1043 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1044 }
1045 else
1046 {
1047#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001048 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001049 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1050#endif
1051 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1052 }
1053}
1054
1055/*------------------------------------------------------------------
1056 *
1057 * This function handles the 11R Reassoc Req from SME
1058 *
1059 *------------------------------------------------------------------*/
1060void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1061 tpPESession psessionEntry)
1062{
1063 tANI_U8 smeSessionId = 0;
1064 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001065 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 tLimMlmReassocReq *pMlmReassocReq;
1067 tANI_U16 caps;
1068 tANI_U32 val;
1069 tSirMsgQ msgQ;
1070 tSirRetStatus retCode;
1071 tANI_U32 teleBcnEn = 0;
1072
Jeff Johnson278b0492013-04-03 14:10:08 -07001073 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001074 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1075 psessionEntry->smeSessionId = smeSessionId;
1076 psessionEntry->transactionId = transactionId;
1077
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001078#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1079 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1080#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001081
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301082 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1083 {
1084 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1085 return;
1086 }
Jeff Johnson278b0492013-04-03 14:10:08 -07001087 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq,
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 sizeof(tLimMlmReassocReq)))
1089 {
1090 // Log error
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001091 limLog(pMac, LOGE, FL("call to palAllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 return;
1093 }
1094
1095 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
1096 psessionEntry->bssId,
1097 sizeof(tSirMacAddr));
1098
1099 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1100 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1101 != eSIR_SUCCESS)
1102 {
1103 /**
1104 * Could not get ReassocFailureTimeout value
1105 * from CFG. Log error.
1106 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001107 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001108 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001109 return;
1110 }
1111
1112 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1113 {
1114 /**
1115 * Could not get Capabilities value
1116 * from CFG. Log error.
1117 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001118 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001119 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001120 return;
1121 }
1122 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001123
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 /* Update PE sessionId*/
1125 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1126
1127 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001128 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1129 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001130 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001131 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
1132 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1133 return;
1134 }
1135
1136 if (teleBcnEn)
1137 {
1138 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001139 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 /**
1141 * Could not get ListenInterval value
1142 * from CFG. Log error.
1143 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001144 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001145 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001147 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001148 }
1149 else
1150 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001151 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001152 {
1153 /**
1154 * Could not get ListenInterval value
1155 * from CFG. Log error.
1156 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001157 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Jeff Johnson278b0492013-04-03 14:10:08 -07001158 palFreeMemory(pMac->hHdd, pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 return;
1160 }
1161 }
1162 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001163 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001165 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1166 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 }
1168
1169 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
1170 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
1171 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001172 palFreeMemory(pMac->hHdd, pMlmReassocReq);
1173 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 }
1175
Jeff Johnson295189b2012-06-20 16:38:30 -07001176 pMlmReassocReq->listenInterval = (tANI_U16) val;
1177
1178 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1179
1180
1181 //we need to defer the message until we get the response back from HAL.
1182 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001183
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1185 msgQ.reserved = 0;
1186 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1187 msgQ.bodyval = 0;
1188
1189
1190#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1191 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1192#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001193 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001194
1195 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001196 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001197 {
1198 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001199 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001200 retCode );
1201 }
1202 // Dont need this anymore
1203 pMac->ft.ftPEContext.pAddBssReq = NULL;
1204 return;
1205}
1206
1207/*------------------------------------------------------------------
1208 *
1209 * This function is called if preauth response is not received from the AP
1210 * within this timeout while FT in progress
1211 *
1212 *------------------------------------------------------------------*/
1213void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1214{
1215 tpPESession psessionEntry;
1216
1217 // We have failed pre auth. We need to resume link and get back on
1218 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301219 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001220
1221 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1222 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001223 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 return;
1225 }
1226
1227 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1228 // to get back.
1229 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1230}
1231
1232
1233/*------------------------------------------------------------------
1234 *
1235 * This function is called to process the update key request from SME
1236 *
1237 *------------------------------------------------------------------*/
1238tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1239{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301240 tAddBssParams * pAddBssParams;
1241 tSirFTUpdateKeyInfo * pKeyInfo;
1242 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001243
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301244 /* Sanity Check */
1245 if( pMac == NULL || pMsgBuf == NULL )
1246 {
1247 return TRUE;
1248 }
1249 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1250 {
1251 limLog( pMac, LOGE,
1252 FL( "pAddBssReq is NULL" ));
1253 return TRUE;
1254 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001255
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301256 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1257 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001258
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301259 /* Store the key information in the ADD BSS parameters */
1260 pAddBssParams->extSetStaKeyParamValid = 1;
1261 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
1262 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof( tSirKeys ));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301264 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1265 {
1266 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1267 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001268
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301269 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1270 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1271 pAddBssParams->extSetStaKeyParamValid,
1272 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001273
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301274 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1275
1276 PELOG1(limLog(pMac, LOG1,
1277 FL("BSSID = %02X-%02X-%02X-%02X-%02X-%02X"),
1278 pKeyInfo->bssId[0], pKeyInfo->bssId[1],
1279 pKeyInfo->bssId[2], pKeyInfo->bssId[3],
1280 pKeyInfo->bssId[4], pKeyInfo->bssId[5]);)
1281
1282 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1283 {
1284 PELOG1(limLog(pMac, LOG1,
1285 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1286 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1287 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1288 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1289 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1290 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1291 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1292 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1293 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1294 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1295 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1296 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1297 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1298 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1299 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1300 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1301 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1302 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1303 }
1304
1305 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001306}
1307
1308tSirRetStatus
1309limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1310{
1311 tSirMsgQ msg;
1312 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1313 tpAggrAddTsParams pAggrAddTsParam;
1314 tpPESession psessionEntry = NULL;
1315 tpLimTspecInfo tspecInfo;
1316 tANI_U8 ac;
1317 tpDphHashNode pSta;
1318 tANI_U16 aid;
1319 tANI_U8 sessionId;
1320 int i;
1321
1322 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
1323 (void **)&pAggrAddTsParam,
1324 sizeof(tAggrAddTsParams)))
1325 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001326 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001327 return eSIR_MEM_ALLOC_FAILED;
1328 }
1329
1330 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1331
1332 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001333 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301334 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 return eSIR_FAILURE;
1336 }
1337
1338 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1339 if (pSta == NULL)
1340 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001341 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301342 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 return eSIR_FAILURE;
1344 }
1345
1346 palZeroMemory( pMac->hHdd, (tANI_U8 *)pAggrAddTsParam,
1347 sizeof(tAggrAddTsParams));
1348 pAggrAddTsParam->staIdx = psessionEntry->staId;
1349 // Fill in the sessionId specific to PE
1350 pAggrAddTsParam->sessionId = sessionId;
1351 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1352
1353 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1354 {
1355 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1356 {
1357 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1358 /* Since AddTS response was successful, check for the PSB flag
1359 * and directional flag inside the TS Info field.
1360 * An AC is trigger enabled AC if the PSB subfield is set to 1
1361 * in the uplink direction.
1362 * An AC is delivery enabled AC if the PSB subfield is set to 1
1363 * in the downlink direction.
1364 * An AC is trigger and delivery enabled AC if the PSB subfield
1365 * is set to 1 in the bi-direction field.
1366 */
1367 if (pTspec->tsinfo.traffic.psb == 1)
1368 {
1369 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1370 }
1371 else
1372 {
1373 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1374 }
1375 /* ADDTS success, so AC is now admitted. We shall now use the default
1376 * EDCA parameters as advertised by AP and send the updated EDCA params
1377 * to HAL.
1378 */
1379 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1380 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1381 {
1382 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1383 }
1384 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1385 {
1386 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1387 }
1388 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1389 {
1390 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1391 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1392 }
1393
1394 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1395
1396 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1397 {
1398 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1399 }
1400 else
1401 {
1402 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1403 }
1404
1405 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1406 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001407 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 pMac->lim.gLimAddtsSent = false;
Gopichand Nakkala6a4f4902013-03-28 12:08:37 +05301409 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001410 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1411 }
1412
1413 // Copy the TSPEC paramters
1414 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1415 }
1416 }
1417
1418 msg.type = WDA_AGGR_QOS_REQ;
1419 msg.bodyptr = pAggrAddTsParam;
1420 msg.bodyval = 0;
1421
1422 /* We need to defer any incoming messages until we get a
1423 * WDA_AGGR_QOS_RSP from HAL.
1424 */
1425 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001426 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
1428 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1429 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001430 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1432 palFreeMemory(pMac->hHdd, (tANI_U8*)pAggrAddTsParam);
1433 return eSIR_FAILURE;
1434 }
1435
1436 return eSIR_SUCCESS;
1437}
1438
1439void
1440limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1441 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1442{
1443 tpSirAggrQosRsp rsp;
1444 int i = 0;
1445
1446 if (! rspReqd)
1447 {
1448 return;
1449 }
1450
1451 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&rsp,
1452 sizeof(tSirAggrQosRsp)))
1453 {
1454 limLog(pMac, LOGP, FL("palAllocateMemory failed for tSirAggrQosRsp"));
1455 return;
1456 }
1457
1458 palZeroMemory( pMac->hHdd, (tANI_U8 *) rsp, sizeof(*rsp));
1459 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1460 rsp->sessionId = smesessionId;
1461 rsp->length = sizeof(*rsp);
1462 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1463
1464 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1465 {
1466 if( (1 << i) & aggrQosRsp->tspecIdx )
1467 {
1468 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1469 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1470 }
1471 }
1472
1473 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1474 return;
1475}
1476
1477
1478void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1479{
1480 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1481 //tpAggrQosParams pAggrQosRspMsg = NULL;
1482 tAddTsParams addTsParam = {0};
1483 tpDphHashNode pSta = NULL;
1484 tANI_U16 assocId =0;
1485 tSirMacAddr peerMacAddr;
1486 tANI_U8 rspReqd = 1;
1487 tpPESession psessionEntry = NULL;
1488 int i = 0;
1489
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001490 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001491
1492 /* Need to process all the deferred messages enqueued since sending the
1493 SIR_HAL_AGGR_ADD_TS_REQ */
1494 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1495
1496 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1497 if (NULL == pAggrQosRspMsg)
1498 {
1499 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1500 return;
1501 }
1502
1503 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1504 if (NULL == psessionEntry)
1505 {
1506 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001507 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001508 if( pAggrQosRspMsg != NULL )
1509 {
1510 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1511 }
1512 return;
1513 }
1514
1515 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1516 {
1517 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1518 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1519 {
1520 /* send DELTS to the station */
1521 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1522
1523 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1524 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1525 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1526 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1527
1528 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1529 &addTsParam.tspec.tsinfo,
1530 &addTsParam.tspec, psessionEntry);
1531
1532 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1533 &psessionEntry->dph.dphHashTable);
1534 if (pSta != NULL)
1535 {
1536 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1537 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1538 }
1539 }
1540 }
1541
1542 /* Send the Aggr QoS response to SME */
1543
1544 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1545 psessionEntry->smeSessionId);
1546 if( pAggrQosRspMsg != NULL )
1547 {
1548 palFreeMemory( pMac->hHdd, (void *)pAggrQosRspMsg );
1549 }
1550 return;
1551}
1552
1553
1554/*--------------------------------------------------------------------------
1555 Determines if a session with ccx or 11r assoc is present.
1556 If present it will return TRUE else FALSE
1557 ------------------------------------------------------------------------*/
1558int limisFastTransitionRequired(tpAniSirGlobal pMac, int sessionId)
1559{
1560 if(pMac->lim.gpSession[sessionId].valid == TRUE)
1561 {
1562 // If ccx or 11r connection is found we need to return TRUE
1563 if((pMac->lim.gpSession[sessionId].bssType == eSIR_INFRASTRUCTURE_MODE) &&
1564 (((pMac->lim.gpSession[sessionId].is11Rconnection)
1565#ifdef FEATURE_WLAN_CCX
1566 || (pMac->lim.gpSession[sessionId].isCCXconnection)
1567#endif
Jeff Johnson43971f52012-07-17 12:26:56 -07001568#ifdef FEATURE_WLAN_LFR
1569 || (pMac->lim.gpSession[sessionId].isFastRoamIniFeatureEnabled)
1570#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001571 )&&
1572 pMac->lim.gpSession[sessionId].isFastTransitionEnabled))
1573 {
1574 // Make sure we have 11r/CCX and FT enabled only then we need
1575 // the values to be altered from cfg for FW RSSI Period alteration.
1576 return TRUE;
1577 }
1578 }
1579
1580 return FALSE;
1581}
1582
1583#endif /* WLAN_FEATURE_VOWIFI_11R */