blob: e35d71a44cd088d2ddbb3f501b37f7705dfec788 [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);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530251 // Can set it only after sending auth
252 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
253
254 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
255 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
256 {
257 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
258 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
259 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700260
261 // We need information from the Pre-Auth Req. Lets save that
262 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
263
264#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800265 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700266 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
267 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
268 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
269#endif
270
271 // Get the current session entry
272 psessionEntry = peFindSessionByBssid(pMac,
273 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
274 if (psessionEntry == NULL)
275 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700276 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700277 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
279 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800280 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530281 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
282 {
283 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
284 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
285 }
286 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 return TRUE;
288 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700289#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
290 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
291#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700292
293 // Dont need to suspend if APs are in same channel
294 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
295 {
296 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700297 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700298 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700299 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700300 (tANI_U32 *)psessionEntry);
301 }
302 else
303 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700304 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700305 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700306 // We are in the same channel. Perform pre-auth
307 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
308 }
309
310 return bufConsumed;
311}
312
313/*------------------------------------------------------------------
314 * Send the Auth1
315 * Receive back Auth2
316 *------------------------------------------------------------------*/
317void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
318 tpPESession psessionEntry)
319{
320 tSirMacAuthFrameBody authFrame;
321
322 if (psessionEntry->is11Rconnection)
323 {
324 // Only 11r assoc has FT IEs.
325 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
326 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700327 PELOGE(limLog( pMac, LOGE, "%s: FTIEs for Auth Req Seq 1 is absent");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 return;
329 }
330 }
331 if (status != eHAL_STATUS_SUCCESS)
332 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700333 PELOGE(limLog( pMac, LOGE, "%s: Change channel not successful for FT pre-auth");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 return;
335 }
336 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
337
338#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700339 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700340 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700341 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700342#endif
343
344
345 if (psessionEntry->is11Rconnection)
346 {
347 // Now we are on the right channel and need to send out Auth1 and
348 // receive Auth2.
349 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
350 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700351#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 else
353 {
354 // Will need to make isCCXconnection a enum may be for further
355 // improvements to this to match this algorithm number
356 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
357 }
358#endif
359 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
360 authFrame.authStatusCode = 0;
361
362 // Start timer here to come back to operating channel.
363 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
364 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
365 {
366#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700367 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700368#endif
369 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800370MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700371
372#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800373 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700374#endif
375
376 limSendAuthMgmtFrame(pMac, &authFrame,
377 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
378 LIM_NO_WEP_IN_FC, psessionEntry);
379
380 return;
381}
382
383
384/*------------------------------------------------------------------
385 *
386 * Create the new Add Bss Req to the new AP.
387 * This will be used when we are ready to FT to the new AP.
388 * The newly created ft Session entry is passed to this function
389 *
390 *------------------------------------------------------------------*/
391tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
392 tANI_U8 updateEntry, tpPESession pftSessionEntry,
393 tpSirBssDescription bssDescription )
394{
395 tpAddBssParams pAddBssParams = NULL;
396 tANI_U8 i;
397 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700398 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700399
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530400 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
401 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700402 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530403 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700404 return eSIR_MEM_ALLOC_FAILED;
405 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700406
407 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530408 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
409 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530411 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530413 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700414 return (eSIR_MEM_ALLOC_FAILED);
415 }
416
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530417 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700418
419
420 limExtractApCapabilities( pMac,
421 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700422 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
424 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700425 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700426
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530427 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
428 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700429
430 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530431 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
432 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700433
434 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
435 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
436
437 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
438
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700439 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 pAddBssParams->updateBss = updateEntry;
441
442
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700443 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
444 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
445 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
446 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700447
448
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700449 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530450 vos_mem_copy(pAddBssParams->rateSet.rate,
451 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700452
453 pAddBssParams->nwType = bssDescription->nwType;
454
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700455 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
457 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
458 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
459 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
460
461 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700464 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700465
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700466 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700467 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700468 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
469 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700470
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700472 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 (chanWidthSupp) )
474 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700475 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
476 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 }
478 else
479 {
480 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700481 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700482 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700483 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
484 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
485 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700486 }
487 }
488
489 pAddBssParams->currentOperChannel = bssDescription->channelId;
490
491#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700492 limLog( pMac, LOGE, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 pAddBssParams->currentOperChannel);
494#endif
495
496
497 // Populate the STA-related parameters here
498 // Note that the STA here refers to the AP
499 {
500 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
501
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530502 vos_mem_copy(pAddBssParams->staContext.bssId,
503 bssDescription->bssId,
504 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700505 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
506
507 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
508 pAddBssParams->staContext.uAPSD = 0;
509 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700510 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700511 pAddBssParams->staContext.updateSta = updateEntry;
512 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
513
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700514 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700515 {
516 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
517 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700518 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
519 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
520 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 (chanWidthSupp) )
522 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700523 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 }
525 else
526 {
527 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
528 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700529 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
530 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
531 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
532 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
533 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
534 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
535 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
536 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700537
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700538 if( pBeaconStruct->HTInfo.present )
539 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 }
541
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700542 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
543 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 pAddBssParams->staContext.wmmEnabled = 1;
545 else
546 pAddBssParams->staContext.wmmEnabled = 0;
547
548 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700549#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700550 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
551 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700552 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700553#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700554 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700555 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700556#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
558
559 }
560
561
562 //Disable BA. It will be set as part of ADDBA negotiation.
563 for( i = 0; i < STACFG_MAX_TC; i++ )
564 {
565 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
566 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
567 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
568 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
569 }
570
571#if defined WLAN_FEATURE_VOWIFI
572 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
573#endif
574
575 pAddBssParams->status = eHAL_STATUS_SUCCESS;
576 pAddBssParams->respReqd = true;
577
578 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
579 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
580
581 // Set a new state for MLME
582
583 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800584 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 -0700585 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
586
587 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
588
589#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800590 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700591#endif
592
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530593 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 return 0;
595}
596
597/*------------------------------------------------------------------
598 *
599 * Setup the new session for the pre-auth AP.
600 * Return the newly created session entry.
601 *
602 *------------------------------------------------------------------*/
603tpPESession limFillFTSession(tpAniSirGlobal pMac,
604 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
605{
606 tpPESession pftSessionEntry;
607 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 tPowerdBm localPowerConstraint;
609 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700610 tSchBeaconStruct *pBeaconStruct;
611
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530612 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
613 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700614 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530615 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700616 return NULL;
617 }
618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800620
621 /* Retrieve the session that has already been created and update the entry */
622 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700623#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 limPrintMacAddr(pMac, pbssDescription->bssId, LOGE);
625#endif
626
Jeff Johnson295189b2012-06-20 16:38:30 -0700627 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700628 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700629
630 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
631 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
632 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
633 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
634
635 // Fields to be filled later
636 pftSessionEntry->pLimJoinReq = NULL;
637 pftSessionEntry->smeSessionId = 0;
638 pftSessionEntry->transactionId = 0;
639
640 limExtractApCapabilities( pMac,
641 (tANI_U8 *) pbssDescription->ieFields,
642 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700643 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700645 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530646 vos_mem_copy(pftSessionEntry->rateSet.rate,
647 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700648
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700649 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530650 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700651 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700652
653
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700654 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530655 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 pftSessionEntry->ssId.length);
657
658
659 // Self Mac
660 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
661 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700662#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOGE);
664#endif
665
666 /* Store beaconInterval */
667 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
668 pftSessionEntry->bssType = psessionEntry->bssType;
669
670 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
671 pftSessionEntry->nwType = pbssDescription->nwType;
672
673 /* Copy The channel Id to the session Table */
674 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
675 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
676
677
678 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
679 {
680 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
681 }
682 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
683 {
684 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
685 }
686 else
687 {
688 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700689 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 }
691
692 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
693 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800694 if( pMac->roam.configParam.shortSlotTime &&
695 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
696 {
697 pftSessionEntry->shortSlotTimeSupported = TRUE;
698 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700699
700 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
701 localPowerConstraint = regMax;
702 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
703 limGetIElenFromBssDescription(pbssDescription),
704 &pftSessionEntry->limCurrentBssQosCaps,
705 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700706 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700707
708 pftSessionEntry->limReassocBssQosCaps =
709 pftSessionEntry->limCurrentBssQosCaps;
710 pftSessionEntry->limReassocBssPropCap =
711 pftSessionEntry->limCurrentBssPropCap;
712
713
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800714#ifdef FEATURE_WLAN_CCX
715 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
716#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700717 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800718#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700719
720#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800721 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 -0800722 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700723#endif
724
725 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
726
727 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
728 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800729 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700730
731 pftSessionEntry->encryptType = psessionEntry->encryptType;
732
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530733 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700734 return pftSessionEntry;
735}
736
737/*------------------------------------------------------------------
738 *
739 * Setup the session and the add bss req for the pre-auth AP.
740 *
741 *------------------------------------------------------------------*/
742void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
743{
744 tpPESession pftSessionEntry;
745
746 // Prepare the session right now with as much as possible.
747 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
748
749 if (pftSessionEntry)
750 {
751 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
752#ifdef FEATURE_WLAN_CCX
753 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
754#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700755#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
757#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700758
759#ifdef FEATURE_WLAN_LFR
760 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
761#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
763 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
764 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
765 }
766}
767
768/*------------------------------------------------------------------
769 * Resume Link Call Back
770 *------------------------------------------------------------------*/
771void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
772{
773 tpPESession psessionEntry;
774
775 psessionEntry = (tpPESession)data;
776
777 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
778 {
779 limFTSetupAuthSession(pMac, psessionEntry);
780 }
781
782 // Post the FT Pre Auth Response to SME
783 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
784 pMac->ft.ftPEContext.saved_auth_rsp,
785 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
786
787}
788
789/*------------------------------------------------------------------
790 * Resume Link Call Back
791 *------------------------------------------------------------------*/
792void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
793 tpPESession psessionEntry)
794{
795 //Set the resume channel to Any valid channel (invalid).
796 //This will instruct HAL to set it to any previous valid channel.
797 peSetResumeChannel(pMac, 0, 0);
798 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
799}
800
801tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
802 tANI_U8 *ric_ies, tANI_U32 *ieLength)
803{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530804 /* BlockACK + RIC is not supported now, TODO later to support this */
805#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 tDot11fIERICDataDesc ricIe;
807 tDot11fFfBAStartingSequenceControl baSsnControl;
808 tDot11fFfAddBAParameterSet baParamSet;
809 tDot11fFfBATimeout baTimeout;
810
811 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
812 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
813 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
814 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
815
816 ricIe.present = 1;
817 ricIe.RICData.present = 1;
818 ricIe.RICData.resourceDescCount = 1;
819 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
820 ricIe.RICDescriptor.present = 1;
821 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
822 baParamSet.tid = tid;
823 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
824 baParamSet.bufferSize = pTrafficClass->txBufSize;
825 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
826 baSsnControl.fragNumber = 0;
827 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530828 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700829 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
830 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
831 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
832 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530833 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700834 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
835 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
836 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
837 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530838 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700839 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
840 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
841 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
842 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530844#endif
845
846 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700847}
848
849tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
850{
851 tANI_U8 tid = 0;
852 tpDphHashNode pSta;
853 tANI_U16 numBA = 0, aid = 0;
854 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
855 tANI_U32 offset = 0, ieLength = 0;
856 tSirRetStatus status = eSIR_SUCCESS;
857
858 // First, extract the DPH entry
859 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
860 if( NULL == pSta )
861 {
862 PELOGE(limLog( pMac, LOGE,
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700863 FL( "STA context not found for saved session's BSSID %02x:%02x:%02x:%02x:%02x:%02x" ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[0],
865 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[1],
866 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[2],
867 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[3],
868 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[4],
869 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId[5] );)
870 return eSIR_FAILURE;
871 }
872
873 for (tid = 0; tid < STACFG_MAX_TC; tid++)
874 {
875 if (pSta->tcCfg[tid].fUseBATx)
876 {
877 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
878 if (eSIR_SUCCESS == status)
879 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700880 // TODO RIC
881 if ( ieLength > MAX_FTIE_SIZE )
882 {
883 ieLength = 0;
884 return status;
885 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 offset += ieLength;
887 *ric_ies_length += ieLength;
888 numBA++;
889 }
890 else
891 {
892 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
893 }
894 }
895 }
896
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700897 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 -0700898 return status;
899}
900
901/*------------------------------------------------------------------
902 *
903 * Will post pre auth response to SME.
904 *
905 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800906void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
908 tpPESession psessionEntry)
909{
910 tpSirFTPreAuthRsp pFTPreAuthRsp;
911 tSirMsgQ mmhMsg;
912 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700913 // TODO: RIC Support
914 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700915
916 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530917 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700919 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 VOS_ASSERT(pFTPreAuthRsp != NULL);
921 return;
922 }
923 vos_mem_zero( pFTPreAuthRsp, rspLen);
924#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800925 PELOGE(limLog( pMac, LOG1, "%s: Auth Rsp = %p", pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700926#endif
927
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530928 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
930 pFTPreAuthRsp->length = (tANI_U16) rspLen;
931 pFTPreAuthRsp->status = status;
932 if (psessionEntry)
933 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
934
935 // The bssid of the AP we are sending Auth1 to.
936 if (pMac->ft.ftPEContext.pFTPreAuthReq)
937 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
938 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
939
940 // Attach the auth response now back to SME
941 pFTPreAuthRsp->ft_ies_length = 0;
942 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
943 {
944 // Only 11r assoc has FT IEs.
945 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
946 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
947 }
948
949#ifdef WLAN_FEATURE_VOWIFI_11R
950 if ((psessionEntry) && (psessionEntry->is11Rconnection))
951 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700952 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
953 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
955 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
956 if (eSIR_SUCCESS != sirStatus)
957 {
958 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
959 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700960 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 }
962#endif
963
964 mmhMsg.type = pFTPreAuthRsp->messageType;
965 mmhMsg.bodyptr = pFTPreAuthRsp;
966 mmhMsg.bodyval = 0;
967
968#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800969 PELOGE(limLog( pMac, LOGE, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800970#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700971#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -0700972 if (status == eSIR_SUCCESS)
973 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
974 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700975#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
977}
978
979/*------------------------------------------------------------------
980 *
981 * Send the FT Pre Auth Response to SME when ever we have a status
982 * ready to be sent to SME
983 *
984 * SME will be the one to send it up to the supplicant to receive
985 * FTIEs which will be required for Reassoc Req.
986 *
987 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800988void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
990 tpPESession psessionEntry)
991{
992
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800993 tpPESession pftSessionEntry;
994 tANI_U8 sessionId;
995 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700996#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
997 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
998#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800999
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 // Save the status of pre-auth
1001 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1002
1003 // Save the auth rsp, so we can send it to
1004 // SME once we resume link.
1005 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1006 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1007 {
1008 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1009 auth_rsp, auth_rsp_length);
1010 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1011 }
1012
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001013 /* Create FT session for the re-association at this point */
1014 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1015 {
1016 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1017 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1018 &sessionId, pMac->lim.maxStation)) == NULL)
1019 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001020 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001021 return;
1022 }
1023 pftSessionEntry->peSessionId = sessionId;
1024 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1025 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1026 pftSessionEntry->bssType = psessionEntry->bssType;
1027
1028 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1029 {
1030 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1031 }
1032 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1033 {
1034 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1035 }
1036 else
1037 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001038 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001039 }
1040 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1041 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1042 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001043 PELOGE(limLog(pMac,LOGE,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001044 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1045
1046 /* Update the ReAssoc BSSID of the current session */
1047 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
1048 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOGE);
1049 }
1050
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 if (psessionEntry->currentOperChannel !=
1052 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1053 {
1054 // Need to move to the original AP channel
1055 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1056 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1057 }
1058 else
1059 {
1060#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001061 PELOGE(limLog( pMac, LOGE, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001062 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1063#endif
1064 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1065 }
1066}
1067
1068/*------------------------------------------------------------------
1069 *
1070 * This function handles the 11R Reassoc Req from SME
1071 *
1072 *------------------------------------------------------------------*/
1073void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1074 tpPESession psessionEntry)
1075{
1076 tANI_U8 smeSessionId = 0;
1077 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001078 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 tLimMlmReassocReq *pMlmReassocReq;
1080 tANI_U16 caps;
1081 tANI_U32 val;
1082 tSirMsgQ msgQ;
1083 tSirRetStatus retCode;
1084 tANI_U32 teleBcnEn = 0;
1085
Jeff Johnson278b0492013-04-03 14:10:08 -07001086 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001087 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1088 psessionEntry->smeSessionId = smeSessionId;
1089 psessionEntry->transactionId = transactionId;
1090
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001091#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1092 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1093#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001094
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301095 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1096 {
1097 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1098 return;
1099 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301100 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1101 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001102 {
1103 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301104 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 return;
1106 }
1107
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301108 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1109 psessionEntry->bssId,
1110 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001111
1112 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1113 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1114 != eSIR_SUCCESS)
1115 {
1116 /**
1117 * Could not get ReassocFailureTimeout value
1118 * from CFG. Log error.
1119 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001120 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301121 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001122 return;
1123 }
1124
1125 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1126 {
1127 /**
1128 * Could not get Capabilities value
1129 * from CFG. Log error.
1130 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001131 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301132 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001133 return;
1134 }
1135 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001136
Jeff Johnson295189b2012-06-20 16:38:30 -07001137 /* Update PE sessionId*/
1138 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1139
1140 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001141 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1142 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001144 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301145 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001146 return;
1147 }
1148
1149 if (teleBcnEn)
1150 {
1151 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001152 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 /**
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"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301158 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001159 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001160 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 }
1162 else
1163 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001164 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 {
1166 /**
1167 * Could not get ListenInterval value
1168 * from CFG. Log error.
1169 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001170 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301171 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 return;
1173 }
1174 }
1175 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001176 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001177 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301178 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001179 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 }
1181
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 pMlmReassocReq->listenInterval = (tANI_U16) val;
1183
1184 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1185
1186
1187 //we need to defer the message until we get the response back from HAL.
1188 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001189
Jeff Johnson295189b2012-06-20 16:38:30 -07001190 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1191 msgQ.reserved = 0;
1192 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1193 msgQ.bodyval = 0;
1194
1195
1196#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
1197 limLog( pMac, LOGE, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
1198#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001199 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001200
1201 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001202 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 {
1204 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001205 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 retCode );
1207 }
1208 // Dont need this anymore
1209 pMac->ft.ftPEContext.pAddBssReq = NULL;
1210 return;
1211}
1212
1213/*------------------------------------------------------------------
1214 *
1215 * This function is called if preauth response is not received from the AP
1216 * within this timeout while FT in progress
1217 *
1218 *------------------------------------------------------------------*/
1219void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1220{
1221 tpPESession psessionEntry;
1222
1223 // We have failed pre auth. We need to resume link and get back on
1224 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301225 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001226
1227 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1228 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001229 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 return;
1231 }
1232
1233 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1234 // to get back.
1235 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1236}
1237
1238
1239/*------------------------------------------------------------------
1240 *
1241 * This function is called to process the update key request from SME
1242 *
1243 *------------------------------------------------------------------*/
1244tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1245{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301246 tAddBssParams * pAddBssParams;
1247 tSirFTUpdateKeyInfo * pKeyInfo;
1248 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001249
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301250 /* Sanity Check */
1251 if( pMac == NULL || pMsgBuf == NULL )
1252 {
1253 return TRUE;
1254 }
1255 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1256 {
1257 limLog( pMac, LOGE,
1258 FL( "pAddBssReq is NULL" ));
1259 return TRUE;
1260 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001261
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301262 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1263 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001264
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301265 /* Store the key information in the ADD BSS parameters */
1266 pAddBssParams->extSetStaKeyParamValid = 1;
1267 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301268 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1269 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301270 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1271 {
1272 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1273 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001274
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301275 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1276 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1277 pAddBssParams->extSetStaKeyParamValid,
1278 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001279
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301280 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1281
1282 PELOG1(limLog(pMac, LOG1,
1283 FL("BSSID = %02X-%02X-%02X-%02X-%02X-%02X"),
1284 pKeyInfo->bssId[0], pKeyInfo->bssId[1],
1285 pKeyInfo->bssId[2], pKeyInfo->bssId[3],
1286 pKeyInfo->bssId[4], pKeyInfo->bssId[5]);)
1287
1288 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1289 {
1290 PELOG1(limLog(pMac, LOG1,
1291 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1292 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1293 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1294 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1295 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1296 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1297 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1298 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1299 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1300 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1301 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1302 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1303 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1304 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1305 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1306 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1307 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1308 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1309 }
1310
1311 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001312}
1313
1314tSirRetStatus
1315limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1316{
1317 tSirMsgQ msg;
1318 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1319 tpAggrAddTsParams pAggrAddTsParam;
1320 tpPESession psessionEntry = NULL;
1321 tpLimTspecInfo tspecInfo;
1322 tANI_U8 ac;
1323 tpDphHashNode pSta;
1324 tANI_U16 aid;
1325 tANI_U8 sessionId;
1326 int i;
1327
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301328 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1329 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301331 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001332 return eSIR_MEM_ALLOC_FAILED;
1333 }
1334
1335 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1336
1337 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001338 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301339 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001340 return eSIR_FAILURE;
1341 }
1342
1343 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1344 if (pSta == NULL)
1345 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001346 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301347 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 return eSIR_FAILURE;
1349 }
1350
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301351 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1352 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001353 pAggrAddTsParam->staIdx = psessionEntry->staId;
1354 // Fill in the sessionId specific to PE
1355 pAggrAddTsParam->sessionId = sessionId;
1356 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1357
1358 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1359 {
1360 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1361 {
1362 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1363 /* Since AddTS response was successful, check for the PSB flag
1364 * and directional flag inside the TS Info field.
1365 * An AC is trigger enabled AC if the PSB subfield is set to 1
1366 * in the uplink direction.
1367 * An AC is delivery enabled AC if the PSB subfield is set to 1
1368 * in the downlink direction.
1369 * An AC is trigger and delivery enabled AC if the PSB subfield
1370 * is set to 1 in the bi-direction field.
1371 */
1372 if (pTspec->tsinfo.traffic.psb == 1)
1373 {
1374 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1375 }
1376 else
1377 {
1378 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1379 }
1380 /* ADDTS success, so AC is now admitted. We shall now use the default
1381 * EDCA parameters as advertised by AP and send the updated EDCA params
1382 * to HAL.
1383 */
1384 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1385 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1386 {
1387 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1388 }
1389 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1390 {
1391 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1392 }
1393 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1394 {
1395 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1396 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1397 }
1398
1399 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1400
1401 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1402 {
1403 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1404 }
1405 else
1406 {
1407 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1408 }
1409
1410 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1411 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001412 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301414 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1416 }
1417
1418 // Copy the TSPEC paramters
1419 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1420 }
1421 }
1422
1423 msg.type = WDA_AGGR_QOS_REQ;
1424 msg.bodyptr = pAggrAddTsParam;
1425 msg.bodyval = 0;
1426
1427 /* We need to defer any incoming messages until we get a
1428 * WDA_AGGR_QOS_RSP from HAL.
1429 */
1430 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001432
1433 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1434 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001435 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301437 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 return eSIR_FAILURE;
1439 }
1440
1441 return eSIR_SUCCESS;
1442}
1443
1444void
1445limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1446 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1447{
1448 tpSirAggrQosRsp rsp;
1449 int i = 0;
1450
1451 if (! rspReqd)
1452 {
1453 return;
1454 }
1455
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301456 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1457 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301459 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 return;
1461 }
1462
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301463 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1465 rsp->sessionId = smesessionId;
1466 rsp->length = sizeof(*rsp);
1467 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1468
1469 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1470 {
1471 if( (1 << i) & aggrQosRsp->tspecIdx )
1472 {
1473 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1474 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1475 }
1476 }
1477
1478 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1479 return;
1480}
1481
1482
1483void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1484{
1485 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1486 //tpAggrQosParams pAggrQosRspMsg = NULL;
1487 tAddTsParams addTsParam = {0};
1488 tpDphHashNode pSta = NULL;
1489 tANI_U16 assocId =0;
1490 tSirMacAddr peerMacAddr;
1491 tANI_U8 rspReqd = 1;
1492 tpPESession psessionEntry = NULL;
1493 int i = 0;
1494
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001495 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
1497 /* Need to process all the deferred messages enqueued since sending the
1498 SIR_HAL_AGGR_ADD_TS_REQ */
1499 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1500
1501 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1502 if (NULL == pAggrQosRspMsg)
1503 {
1504 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1505 return;
1506 }
1507
1508 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1509 if (NULL == psessionEntry)
1510 {
1511 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001512 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 if( pAggrQosRspMsg != NULL )
1514 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301515 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001516 }
1517 return;
1518 }
1519
1520 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1521 {
1522 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1523 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1524 {
1525 /* send DELTS to the station */
1526 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1527
1528 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1529 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1530 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1531 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1532
1533 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1534 &addTsParam.tspec.tsinfo,
1535 &addTsParam.tspec, psessionEntry);
1536
1537 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1538 &psessionEntry->dph.dphHashTable);
1539 if (pSta != NULL)
1540 {
1541 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1542 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1543 }
1544 }
1545 }
1546
1547 /* Send the Aggr QoS response to SME */
1548
1549 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1550 psessionEntry->smeSessionId);
1551 if( pAggrQosRspMsg != NULL )
1552 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301553 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 }
1555 return;
1556}
1557
Jeff Johnson295189b2012-06-20 16:38:30 -07001558#endif /* WLAN_FEATURE_VOWIFI_11R */