blob: 089b96ca8a025da1e731ba81fc2c279d699bb82e [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * 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.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifdef WLAN_FEATURE_VOWIFI_11R
29/**=========================================================================
30
Kiet Lam842dad02014-02-18 18:44:02 -080031 \brief implementation for PE 11r VoWiFi FT Protocol
Jeff Johnson295189b2012-06-20 16:38:30 -070032
33 ========================================================================*/
34
35/* $Header$ */
36
37
38/*--------------------------------------------------------------------------
39 Include Files
40 ------------------------------------------------------------------------*/
41#include <limSendMessages.h>
42#include <limTypes.h>
43#include <limFT.h>
44#include <limFTDefs.h>
45#include <limUtils.h>
46#include <limPropExtsUtils.h>
47#include <limAssocUtils.h>
48#include <limSession.h>
49#include <limAdmitControl.h>
50#include "wmmApsd.h"
51
52#define LIM_FT_RIC_BA_SSN 1
53#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
54#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053055#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57/*--------------------------------------------------------------------------
58 Initialize the FT variables.
59 ------------------------------------------------------------------------*/
60void limFTOpen(tpAniSirGlobal pMac)
61{
62 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
63 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
64}
65
66/*--------------------------------------------------------------------------
67 Cleanup FT variables.
68 ------------------------------------------------------------------------*/
69void limFTCleanup(tpAniSirGlobal pMac)
70{
71 if (pMac->ft.ftPEContext.pFTPreAuthReq)
72 {
73#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070074 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070075 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070076#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080077 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
78 {
79 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
80 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
81 }
Jeff Johnson295189b2012-06-20 16:38:30 -070082 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
83 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
84 }
85
86 // This is the old session, should be deleted else where.
87 // We should not be cleaning it here, just set it to NULL.
88 if (pMac->ft.ftPEContext.psavedsessionEntry)
89 {
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070091 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
94 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
95 }
96
97 // This is the extra session we added as part of Auth resp
98 // clean it up.
99 if (pMac->ft.ftPEContext.pftSessionEntry)
100 {
101 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
102 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
106 }
107 pMac->ft.ftPEContext.pftSessionEntry = NULL;
108#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700109 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700110 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111#endif
112 }
113
114 if (pMac->ft.ftPEContext.pAddBssReq)
115 {
116 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
117 pMac->ft.ftPEContext.pAddBssReq = NULL;
118 }
119
120 if (pMac->ft.ftPEContext.pAddStaReq)
121 {
122 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
123 pMac->ft.ftPEContext.pAddStaReq = NULL;
124 }
125
126 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
127
128}
129
130/*--------------------------------------------------------------------------
131 Init FT variables.
132 ------------------------------------------------------------------------*/
133void limFTInit(tpAniSirGlobal pMac)
134{
135 if (pMac->ft.ftPEContext.pFTPreAuthReq)
136 {
137#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700138 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700139 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700140#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800141 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
142 {
143 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
144 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
145 }
146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
148 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
149 }
150
151 // This is the old session, should be deleted else where.
152 // We should not be cleaning it here, just set it to NULL.
153 if (pMac->ft.ftPEContext.psavedsessionEntry)
154 {
155#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700156 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700157 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#endif
159 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
160 }
161
162 // This is the extra session we added as part of Auth resp
163 // clean it up.
164 if (pMac->ft.ftPEContext.pftSessionEntry)
165 {
166 /* Cannot delete sessions across associations */
167#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700168 PELOGE(limLog( pMac, LOGE, "%s: Deleting session = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700169 __func__, pMac->ft.ftPEContext.pftSessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700170#endif
171 pMac->ft.ftPEContext.pftSessionEntry = NULL;
172 }
173
174 if (pMac->ft.ftPEContext.pAddBssReq)
175 {
176#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700177 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddBssReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700178 __func__, pMac->ft.ftPEContext.pAddBssReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700179#endif
180 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
181 pMac->ft.ftPEContext.pAddBssReq = NULL;
182 }
183
184
185 if (pMac->ft.ftPEContext.pAddStaReq)
186 {
187#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700188 PELOGE(limLog( pMac, LOGE, "%s: Freeing AddStaReq = %p ",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700189 __func__, pMac->ft.ftPEContext.pAddStaReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700190#endif
191 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
192 pMac->ft.ftPEContext.pAddStaReq = NULL;
193 }
194
195 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
196
197}
198
199/*------------------------------------------------------------------
200 *
201 * This is the handler after suspending the link.
202 * We suspend the link and then now proceed to switch channel.
203 *
204 *------------------------------------------------------------------*/
205void FTPreAuthSuspendLinkHandler(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
206{
207 tpPESession psessionEntry;
208
209 // The link is suspended of not ?
210 if (status != eHAL_STATUS_SUCCESS)
211 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700212 PELOGE(limLog( pMac, LOGE, "%s: Returning ", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700213 // Post the FT Pre Auth Response to SME
214 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, (tpPESession)data);
215
216 return;
217 }
218
219 psessionEntry = (tpPESession)data;
220 // Suspended, now move to a different channel.
221 // Perform some sanity check before proceeding.
222 if ((pMac->ft.ftPEContext.pFTPreAuthReq) && psessionEntry)
223 {
224 limChangeChannelWithCallback(pMac,
225 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum,
226 limPerformFTPreAuth, NULL, psessionEntry);
227 return;
228 }
229
230 // Else return error.
231 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
232}
233
234
235/*--------------------------------------------------------------------------
236 In this function, we process the FT Pre Auth Req.
237 We receive Pre-Auth
238 Suspend link
239 Register a call back
240 In the call back, we will need to accept frames from the new bssid
241 Send out the auth req to new AP.
242 Start timer and when the timer is done or if we receive the Auth response
243 We change channel
244 Resume link
245 ------------------------------------------------------------------------*/
246int limProcessFTPreAuthReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
247{
248 int bufConsumed = FALSE;
249 tpPESession psessionEntry;
250 tANI_U8 sessionId;
251
252 // Now we are starting fresh make sure all's cleanup.
253 limFTInit(pMac);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530254 // Can set it only after sending auth
255 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_FAILURE;
256
257 if( pMac->ft.ftPEContext.pFTPreAuthReq &&
258 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
259 {
260 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
261 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
262 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700263
264 // We need information from the Pre-Auth Req. Lets save that
265 pMac->ft.ftPEContext.pFTPreAuthReq = (tpSirFTPreAuthReq)pMsg->bodyptr;
266
267#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800268 PELOGE(limLog( pMac, LOG1, "%s: PE Auth ft_ies_length=%02x%02x%02x", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700269 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[0],
270 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[1],
271 pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies[2]);)
272#endif
273
274 // Get the current session entry
275 psessionEntry = peFindSessionByBssid(pMac,
276 pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &sessionId);
277 if (psessionEntry == NULL)
278 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700279 PELOGE(limLog( pMac, LOGE, "%s: Unable to find session for the following bssid",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700280 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700281 limPrintMacAddr( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, LOGE );
282 // Post the FT Pre Auth Response to SME
Gopichand Nakkala2d335f32013-01-04 12:24:28 -0800283 limPostFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, NULL);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530284 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
285 {
286 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
287 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
288 }
289 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 return TRUE;
291 }
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700292#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
293 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, psessionEntry, 0, 0);
294#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700295
296 // Dont need to suspend if APs are in same channel
297 if (psessionEntry->currentOperChannel != pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
298 {
299 // Need to suspend link only if the channels are different
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700300 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on different"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700301 " channel (session %p)", __func__, psessionEntry);)
Madan Mohan Koyyalamudi9b876782012-10-11 16:22:51 -0700302 limSuspendLink(pMac, eSIR_CHECK_ROAMING_SCAN, FTPreAuthSuspendLinkHandler,
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 (tANI_U32 *)psessionEntry);
304 }
305 else
306 {
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700307 PELOG2(limLog(pMac,LOG2,"%s: Performing pre-auth on same"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700308 " channel (session %p)", __func__, psessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700309 // We are in the same channel. Perform pre-auth
310 limPerformFTPreAuth(pMac, eHAL_STATUS_SUCCESS, NULL, psessionEntry);
311 }
312
313 return bufConsumed;
314}
315
316/*------------------------------------------------------------------
317 * Send the Auth1
318 * Receive back Auth2
319 *------------------------------------------------------------------*/
320void limPerformFTPreAuth(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
321 tpPESession psessionEntry)
322{
323 tSirMacAuthFrameBody authFrame;
324
325 if (psessionEntry->is11Rconnection)
326 {
327 // Only 11r assoc has FT IEs.
328 if (pMac->ft.ftPEContext.pFTPreAuthReq->ft_ies == NULL)
329 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800330 PELOGE(limLog( pMac, LOGE,
331 "%s: FTIEs for Auth Req Seq 1 is absent",
332 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700333 return;
334 }
335 }
336 if (status != eHAL_STATUS_SUCCESS)
337 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800338 PELOGE(limLog( pMac, LOGE,
339 "%s: Change channel not successful for FT pre-auth",
340 __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700341 return;
342 }
343 pMac->ft.ftPEContext.psavedsessionEntry = psessionEntry;
344
345#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700346 PELOG2(limLog(pMac,LOG2,"Entered wait auth2 state for FT"
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700347 " (old session %p)",
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -0700348 pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700349#endif
350
351
352 if (psessionEntry->is11Rconnection)
353 {
354 // Now we are on the right channel and need to send out Auth1 and
355 // receive Auth2.
356 authFrame.authAlgoNumber = eSIR_FT_AUTH; // Set the auth type to FT
357 }
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700358#if defined FEATURE_WLAN_CCX || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 else
360 {
361 // Will need to make isCCXconnection a enum may be for further
362 // improvements to this to match this algorithm number
363 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its CCX and 11r FT.
364 }
365#endif
366 authFrame.authTransactionSeqNumber = SIR_MAC_AUTH_FRAME_1;
367 authFrame.authStatusCode = 0;
368
369 // Start timer here to come back to operating channel.
370 pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId = psessionEntry->peSessionId;
371 if(TX_SUCCESS != tx_timer_activate(&pMac->lim.limTimers.gLimFTPreAuthRspTimer))
372 {
373#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700374 PELOGE(limLog( pMac, LOGE, "%s: FT Auth Rsp Timer Start Failed", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700375#endif
376 }
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800377MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_FT_PREAUTH_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700378
379#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800380 PELOGE(limLog( pMac, LOG1, "%s: FT Auth Rsp Timer Started", __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700381#endif
382
383 limSendAuthMgmtFrame(pMac, &authFrame,
384 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId,
385 LIM_NO_WEP_IN_FC, psessionEntry);
386
387 return;
388}
389
390
391/*------------------------------------------------------------------
392 *
393 * Create the new Add Bss Req to the new AP.
394 * This will be used when we are ready to FT to the new AP.
395 * The newly created ft Session entry is passed to this function
396 *
397 *------------------------------------------------------------------*/
398tSirRetStatus limFTPrepareAddBssReq( tpAniSirGlobal pMac,
399 tANI_U8 updateEntry, tpPESession pftSessionEntry,
400 tpSirBssDescription bssDescription )
401{
402 tpAddBssParams pAddBssParams = NULL;
403 tANI_U8 i;
404 tANI_U8 chanWidthSupp = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700405 tSchBeaconStruct *pBeaconStruct;
Jeff Johnson295189b2012-06-20 16:38:30 -0700406
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530407 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
408 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700409 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530410 limLog(pMac, LOGE, FL("Unable to allocate memory for creating ADD_BSS") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700411 return eSIR_MEM_ALLOC_FAILED;
412 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700413
414 // Package SIR_HAL_ADD_BSS_REQ message parameters
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530415 pAddBssParams = vos_mem_malloc(sizeof( tAddBssParams ));
416 if (NULL == pAddBssParams)
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530418 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 limLog( pMac, LOGP,
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530420 FL( "Unable to allocate memory for creating ADD_BSS" ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700421 return (eSIR_MEM_ALLOC_FAILED);
422 }
423
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530424 vos_mem_set((tANI_U8 *) pAddBssParams, sizeof( tAddBssParams ), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700425
426
427 limExtractApCapabilities( pMac,
428 (tANI_U8 *) bssDescription->ieFields,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700429 limGetIElenFromBssDescription( bssDescription ), pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
431 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700432 limDecideStaProtectionOnAssoc(pMac, pBeaconStruct, pftSessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700433
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530434 vos_mem_copy(pAddBssParams->bssId, bssDescription->bssId,
435 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700436
437 // Fill in tAddBssParams selfMacAddr
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530438 vos_mem_copy(pAddBssParams->selfMacAddr, pftSessionEntry->selfMacAddr,
439 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
441 pAddBssParams->bssType = pftSessionEntry->bssType;//eSIR_INFRASTRUCTURE_MODE;
442 pAddBssParams->operMode = BSS_OPERATIONAL_MODE_STA;
443
444 pAddBssParams->beaconInterval = bssDescription->beaconInterval;
445
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700446 pAddBssParams->dtimPeriod = pBeaconStruct->tim.dtimPeriod;
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 pAddBssParams->updateBss = updateEntry;
448
449
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700450 pAddBssParams->cfParamSet.cfpCount = pBeaconStruct->cfParamSet.cfpCount;
451 pAddBssParams->cfParamSet.cfpPeriod = pBeaconStruct->cfParamSet.cfpPeriod;
452 pAddBssParams->cfParamSet.cfpMaxDuration = pBeaconStruct->cfParamSet.cfpMaxDuration;
453 pAddBssParams->cfParamSet.cfpDurRemaining = pBeaconStruct->cfParamSet.cfpDurRemaining;
Jeff Johnson295189b2012-06-20 16:38:30 -0700454
455
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700456 pAddBssParams->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530457 vos_mem_copy(pAddBssParams->rateSet.rate,
458 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700459
460 pAddBssParams->nwType = bssDescription->nwType;
461
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700462 pAddBssParams->shortSlotTimeSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortSlotTime;
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 pAddBssParams->llaCoexist = (tANI_U8) pftSessionEntry->beaconParams.llaCoexist;
464 pAddBssParams->llbCoexist = (tANI_U8) pftSessionEntry->beaconParams.llbCoexist;
465 pAddBssParams->llgCoexist = (tANI_U8) pftSessionEntry->beaconParams.llgCoexist;
466 pAddBssParams->ht20Coexist = (tANI_U8) pftSessionEntry->beaconParams.ht20Coexist;
467
468 // Use the advertised capabilities from the received beacon/PR
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700469 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700471 pAddBssParams->htCapable = pBeaconStruct->HTCaps.present;
Jeff Johnson295189b2012-06-20 16:38:30 -0700472
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700473 if ( pBeaconStruct->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700474 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700475 pAddBssParams->htOperMode = (tSirMacHTOperatingMode)pBeaconStruct->HTInfo.opMode;
476 pAddBssParams->dualCTSProtection = ( tANI_U8 ) pBeaconStruct->HTInfo.dualCTSProtection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700477
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 chanWidthSupp = limGetHTCapability( pMac, eHT_SUPPORTED_CHANNEL_WIDTH_SET, pftSessionEntry);
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700479 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700480 (chanWidthSupp) )
481 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700482 pAddBssParams->txChannelWidthSet = ( tANI_U8 ) pBeaconStruct->HTInfo.recommendedTxWidthSet;
483 pAddBssParams->currentExtChannel = pBeaconStruct->HTInfo.secondaryChannelOffset;
Jeff Johnson295189b2012-06-20 16:38:30 -0700484 }
485 else
486 {
487 pAddBssParams->txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700488 pAddBssParams->currentExtChannel = PHY_SINGLE_CHANNEL_CENTERED;
Jeff Johnson295189b2012-06-20 16:38:30 -0700489 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700490 pAddBssParams->llnNonGFCoexist = (tANI_U8)pBeaconStruct->HTInfo.nonGFDevicesPresent;
491 pAddBssParams->fLsigTXOPProtectionFullSupport = (tANI_U8)pBeaconStruct->HTInfo.lsigTXOPProtectionFullSupport;
492 pAddBssParams->fRIFSMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 }
494 }
495
496 pAddBssParams->currentOperChannel = bssDescription->channelId;
497
498#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700499 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700500 pAddBssParams->currentOperChannel);
501#endif
502
503
504 // Populate the STA-related parameters here
505 // Note that the STA here refers to the AP
506 {
507 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
508
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530509 vos_mem_copy(pAddBssParams->staContext.bssId,
510 bssDescription->bssId,
511 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700512 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
513
514 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
515 pAddBssParams->staContext.uAPSD = 0;
516 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700517 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 pAddBssParams->staContext.updateSta = updateEntry;
519 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
520
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700521 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 {
523 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
524 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700525 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
526 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
527 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700528 (chanWidthSupp) )
529 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700530 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700531 }
532 else
533 {
534 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
535 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700536 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
537 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
538 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
539 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
540 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
541 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
542 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
543 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700544
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700545 if( pBeaconStruct->HTInfo.present )
546 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 }
548
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700549 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
550 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700551 pAddBssParams->staContext.wmmEnabled = 1;
552 else
553 pAddBssParams->staContext.wmmEnabled = 0;
554
555 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700556#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700557 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
558 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700559 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700560#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700561 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700562 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700563#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 limFillSupportedRatesInfo(pMac, NULL, &pAddBssParams->staContext.supportedRates,pftSessionEntry);
565
566 }
567
568
569 //Disable BA. It will be set as part of ADDBA negotiation.
570 for( i = 0; i < STACFG_MAX_TC; i++ )
571 {
572 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
573 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
574 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
575 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
576 }
577
578#if defined WLAN_FEATURE_VOWIFI
579 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
580#endif
581
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800582#ifdef WLAN_FEATURE_11W
583 if (pftSessionEntry->limRmfEnabled)
584 {
585 pAddBssParams->rmfEnabled = 1;
586 pAddBssParams->staContext.rmfEnabled = 1;
587 }
588#endif
589
Jeff Johnson295189b2012-06-20 16:38:30 -0700590 pAddBssParams->status = eHAL_STATUS_SUCCESS;
591 pAddBssParams->respReqd = true;
592
593 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
594 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
595
596 // Set a new state for MLME
597
598 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800599 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 -0700600 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
601
602 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
603
604#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800605 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700606#endif
607
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530608 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 return 0;
610}
611
612/*------------------------------------------------------------------
613 *
614 * Setup the new session for the pre-auth AP.
615 * Return the newly created session entry.
616 *
617 *------------------------------------------------------------------*/
618tpPESession limFillFTSession(tpAniSirGlobal pMac,
619 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
620{
621 tpPESession pftSessionEntry;
622 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700623 tPowerdBm localPowerConstraint;
624 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700625 tSchBeaconStruct *pBeaconStruct;
626
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530627 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
628 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700629 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530630 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700631 return NULL;
632 }
633
Jeff Johnson295189b2012-06-20 16:38:30 -0700634
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800635
636 /* Retrieve the session that has already been created and update the entry */
637 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700638#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700639 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700640#endif
641
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 pftSessionEntry->dot11mode = psessionEntry->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700643 pftSessionEntry->htCapability = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
645 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
646 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
647 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
648 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
649
650 // Fields to be filled later
651 pftSessionEntry->pLimJoinReq = NULL;
652 pftSessionEntry->smeSessionId = 0;
653 pftSessionEntry->transactionId = 0;
654
655 limExtractApCapabilities( pMac,
656 (tANI_U8 *) pbssDescription->ieFields,
657 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700658 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700659
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700660 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530661 vos_mem_copy(pftSessionEntry->rateSet.rate,
662 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700663
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700664 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530665 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700666 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700667
668
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700669 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530670 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700671 pftSessionEntry->ssId.length);
672
673
674 // Self Mac
675 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
676 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700677#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700678 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700679#endif
680
681 /* Store beaconInterval */
682 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
683 pftSessionEntry->bssType = psessionEntry->bssType;
684
685 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
686 pftSessionEntry->nwType = pbssDescription->nwType;
687
688 /* Copy The channel Id to the session Table */
689 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
690 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
691
692
693 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
694 {
695 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
696 }
697 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
698 {
699 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
700 }
701 else
702 {
703 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700704 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 }
706
707 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
708 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800709 if( pMac->roam.configParam.shortSlotTime &&
710 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
711 {
712 pftSessionEntry->shortSlotTimeSupported = TRUE;
713 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700714
715 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
716 localPowerConstraint = regMax;
717 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
718 limGetIElenFromBssDescription(pbssDescription),
719 &pftSessionEntry->limCurrentBssQosCaps,
720 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700721 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700722
723 pftSessionEntry->limReassocBssQosCaps =
724 pftSessionEntry->limCurrentBssQosCaps;
725 pftSessionEntry->limReassocBssPropCap =
726 pftSessionEntry->limCurrentBssPropCap;
727
728
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800729#ifdef FEATURE_WLAN_CCX
730 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
731#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800733#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700734
735#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800736 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 -0800737 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700738#endif
739
740 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
741
742 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
743 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800744 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700745
746 pftSessionEntry->encryptType = psessionEntry->encryptType;
747
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800748#ifdef WLAN_FEATURE_11AC
749 pftSessionEntry->vhtCapability = psessionEntry->vhtCapability;
750 pftSessionEntry->vhtCapabilityPresentInBeacon = psessionEntry->vhtCapabilityPresentInBeacon;
751#endif
752
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530753 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 return pftSessionEntry;
755}
756
757/*------------------------------------------------------------------
758 *
759 * Setup the session and the add bss req for the pre-auth AP.
760 *
761 *------------------------------------------------------------------*/
762void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
763{
764 tpPESession pftSessionEntry;
765
766 // Prepare the session right now with as much as possible.
767 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
768
769 if (pftSessionEntry)
770 {
771 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
772#ifdef FEATURE_WLAN_CCX
773 pftSessionEntry->isCCXconnection = psessionEntry->isCCXconnection;
774#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700775#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
777#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700778
779#ifdef FEATURE_WLAN_LFR
780 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
781#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800782#ifdef WLAN_FEATURE_11W
783 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
784#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
786 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
787 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
788 }
789}
790
791/*------------------------------------------------------------------
792 * Resume Link Call Back
793 *------------------------------------------------------------------*/
794void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
795{
796 tpPESession psessionEntry;
797
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700798 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
799 return;
800
Jeff Johnson295189b2012-06-20 16:38:30 -0700801 psessionEntry = (tpPESession)data;
802
803 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
804 {
805 limFTSetupAuthSession(pMac, psessionEntry);
806 }
807
808 // Post the FT Pre Auth Response to SME
809 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
810 pMac->ft.ftPEContext.saved_auth_rsp,
811 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
812
813}
814
815/*------------------------------------------------------------------
816 * Resume Link Call Back
817 *------------------------------------------------------------------*/
818void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
819 tpPESession psessionEntry)
820{
821 //Set the resume channel to Any valid channel (invalid).
822 //This will instruct HAL to set it to any previous valid channel.
823 peSetResumeChannel(pMac, 0, 0);
824 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
825}
826
827tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
828 tANI_U8 *ric_ies, tANI_U32 *ieLength)
829{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530830 /* BlockACK + RIC is not supported now, TODO later to support this */
831#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 tDot11fIERICDataDesc ricIe;
833 tDot11fFfBAStartingSequenceControl baSsnControl;
834 tDot11fFfAddBAParameterSet baParamSet;
835 tDot11fFfBATimeout baTimeout;
836
837 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
838 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
839 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
840 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
841
842 ricIe.present = 1;
843 ricIe.RICData.present = 1;
844 ricIe.RICData.resourceDescCount = 1;
845 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
846 ricIe.RICDescriptor.present = 1;
847 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
848 baParamSet.tid = tid;
849 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
850 baParamSet.bufferSize = pTrafficClass->txBufSize;
851 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
852 baSsnControl.fragNumber = 0;
853 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530854 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700855 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
856 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
857 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
858 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530859 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700860 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
861 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
862 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
863 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530864 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700865 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
866 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
867 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
868 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530870#endif
871
872 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700873}
874
875tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
876{
877 tANI_U8 tid = 0;
878 tpDphHashNode pSta;
879 tANI_U16 numBA = 0, aid = 0;
880 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
881 tANI_U32 offset = 0, ieLength = 0;
882 tSirRetStatus status = eSIR_SUCCESS;
883
884 // First, extract the DPH entry
885 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
886 if( NULL == pSta )
887 {
888 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800889 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
890 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 return eSIR_FAILURE;
892 }
893
894 for (tid = 0; tid < STACFG_MAX_TC; tid++)
895 {
896 if (pSta->tcCfg[tid].fUseBATx)
897 {
898 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
899 if (eSIR_SUCCESS == status)
900 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700901 // TODO RIC
902 if ( ieLength > MAX_FTIE_SIZE )
903 {
904 ieLength = 0;
905 return status;
906 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 offset += ieLength;
908 *ric_ies_length += ieLength;
909 numBA++;
910 }
911 else
912 {
913 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
914 }
915 }
916 }
917
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700918 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 -0700919 return status;
920}
921
922/*------------------------------------------------------------------
923 *
924 * Will post pre auth response to SME.
925 *
926 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -0800927void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
929 tpPESession psessionEntry)
930{
931 tpSirFTPreAuthRsp pFTPreAuthRsp;
932 tSirMsgQ mmhMsg;
933 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700934 // TODO: RIC Support
935 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -0700936
937 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530938 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700940 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 VOS_ASSERT(pFTPreAuthRsp != NULL);
942 return;
943 }
944 vos_mem_zero( pFTPreAuthRsp, rspLen);
945#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800946 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700947#endif
948
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530949 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
951 pFTPreAuthRsp->length = (tANI_U16) rspLen;
952 pFTPreAuthRsp->status = status;
953 if (psessionEntry)
954 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
955
956 // The bssid of the AP we are sending Auth1 to.
957 if (pMac->ft.ftPEContext.pFTPreAuthReq)
958 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
959 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
960
961 // Attach the auth response now back to SME
962 pFTPreAuthRsp->ft_ies_length = 0;
963 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
964 {
965 // Only 11r assoc has FT IEs.
966 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
967 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
968 }
969
970#ifdef WLAN_FEATURE_VOWIFI_11R
971 if ((psessionEntry) && (psessionEntry->is11Rconnection))
972 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700973 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
974 /*
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
976 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
977 if (eSIR_SUCCESS != sirStatus)
978 {
979 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
980 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700981 */
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 }
983#endif
984
985 mmhMsg.type = pFTPreAuthRsp->messageType;
986 mmhMsg.bodyptr = pFTPreAuthRsp;
987 mmhMsg.bodyval = 0;
988
989#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700990 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800991#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700992#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -0700993 if (status == eSIR_SUCCESS)
994 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
995 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -0700996#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
998}
999
1000/*------------------------------------------------------------------
1001 *
1002 * Send the FT Pre Auth Response to SME when ever we have a status
1003 * ready to be sent to SME
1004 *
1005 * SME will be the one to send it up to the supplicant to receive
1006 * FTIEs which will be required for Reassoc Req.
1007 *
1008 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001009void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1011 tpPESession psessionEntry)
1012{
1013
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001014 tpPESession pftSessionEntry;
1015 tANI_U8 sessionId;
1016 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001017#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1018 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1019#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001020
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 // Save the status of pre-auth
1022 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1023
1024 // Save the auth rsp, so we can send it to
1025 // SME once we resume link.
1026 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1027 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1028 {
1029 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1030 auth_rsp, auth_rsp_length);
1031 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1032 }
1033
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001034 /* Create FT session for the re-association at this point */
1035 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1036 {
1037 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1038 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1039 &sessionId, pMac->lim.maxStation)) == NULL)
1040 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001041 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001042 return;
1043 }
1044 pftSessionEntry->peSessionId = sessionId;
1045 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1046 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1047 pftSessionEntry->bssType = psessionEntry->bssType;
1048
1049 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1050 {
1051 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1052 }
1053 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1054 {
1055 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1056 }
1057 else
1058 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001059 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001060 }
1061 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1062 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1063 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001064 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001065 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1066
1067 /* Update the ReAssoc BSSID of the current session */
1068 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001069 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001070 }
1071
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 if (psessionEntry->currentOperChannel !=
1073 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1074 {
1075 // Need to move to the original AP channel
1076 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1077 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1078 }
1079 else
1080 {
1081#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001082 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001083 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1084#endif
1085 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1086 }
1087}
1088
1089/*------------------------------------------------------------------
1090 *
1091 * This function handles the 11R Reassoc Req from SME
1092 *
1093 *------------------------------------------------------------------*/
1094void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1095 tpPESession psessionEntry)
1096{
1097 tANI_U8 smeSessionId = 0;
1098 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001099 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001100 tLimMlmReassocReq *pMlmReassocReq;
1101 tANI_U16 caps;
1102 tANI_U32 val;
1103 tSirMsgQ msgQ;
1104 tSirRetStatus retCode;
1105 tANI_U32 teleBcnEn = 0;
1106
Jeff Johnson278b0492013-04-03 14:10:08 -07001107 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001108 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1109 psessionEntry->smeSessionId = smeSessionId;
1110 psessionEntry->transactionId = transactionId;
1111
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001112#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1113 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1114#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001115
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301116 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1117 {
1118 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1119 return;
1120 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301121 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1122 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001123 {
1124 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301125 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001126 return;
1127 }
1128
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301129 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1130 psessionEntry->bssId,
1131 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001132
1133 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1134 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1135 != eSIR_SUCCESS)
1136 {
1137 /**
1138 * Could not get ReassocFailureTimeout value
1139 * from CFG. Log error.
1140 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001141 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301142 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001143 return;
1144 }
1145
1146 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1147 {
1148 /**
1149 * Could not get Capabilities value
1150 * from CFG. Log error.
1151 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001152 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301153 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001154 return;
1155 }
1156 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001157
Jeff Johnson295189b2012-06-20 16:38:30 -07001158 /* Update PE sessionId*/
1159 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1160
1161 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001162 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1163 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001165 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301166 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001167 return;
1168 }
1169
1170 if (teleBcnEn)
1171 {
1172 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001173 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001174 /**
1175 * Could not get ListenInterval value
1176 * from CFG. Log error.
1177 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001178 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301179 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001181 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001182 }
1183 else
1184 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001185 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 {
1187 /**
1188 * Could not get ListenInterval value
1189 * from CFG. Log error.
1190 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001191 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301192 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001193 return;
1194 }
1195 }
1196 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001197 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001198 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301199 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001200 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001201 }
1202
Jeff Johnson295189b2012-06-20 16:38:30 -07001203 pMlmReassocReq->listenInterval = (tANI_U16) val;
1204
1205 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1206
1207
1208 //we need to defer the message until we get the response back from HAL.
1209 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001210
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1212 msgQ.reserved = 0;
1213 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1214 msgQ.bodyval = 0;
1215
1216
1217#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001218 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001219#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001220 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001221
1222 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001223 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001224 {
1225 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001226 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 retCode );
1228 }
1229 // Dont need this anymore
1230 pMac->ft.ftPEContext.pAddBssReq = NULL;
1231 return;
1232}
1233
1234/*------------------------------------------------------------------
1235 *
1236 * This function is called if preauth response is not received from the AP
1237 * within this timeout while FT in progress
1238 *
1239 *------------------------------------------------------------------*/
1240void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1241{
1242 tpPESession psessionEntry;
1243
1244 // We have failed pre auth. We need to resume link and get back on
1245 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301246 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001247
1248 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1249 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001250 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 return;
1252 }
1253
1254 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1255 // to get back.
1256 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1257}
1258
1259
1260/*------------------------------------------------------------------
1261 *
1262 * This function is called to process the update key request from SME
1263 *
1264 *------------------------------------------------------------------*/
1265tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1266{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301267 tAddBssParams * pAddBssParams;
1268 tSirFTUpdateKeyInfo * pKeyInfo;
1269 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001270
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301271 /* Sanity Check */
1272 if( pMac == NULL || pMsgBuf == NULL )
1273 {
1274 return TRUE;
1275 }
1276 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1277 {
1278 limLog( pMac, LOGE,
1279 FL( "pAddBssReq is NULL" ));
1280 return TRUE;
1281 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001282
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301283 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1284 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001285
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301286 /* Store the key information in the ADD BSS parameters */
1287 pAddBssParams->extSetStaKeyParamValid = 1;
1288 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301289 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1290 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301291 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1292 {
1293 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1294 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001295
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301296 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1297 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1298 pAddBssParams->extSetStaKeyParamValid,
1299 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001300
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301301 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1302
1303 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001304 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301305
1306 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1307 {
1308 PELOG1(limLog(pMac, LOG1,
1309 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1310 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1311 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1312 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1313 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1314 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1315 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1316 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1317 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1318 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1319 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1320 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1321 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1322 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1323 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1324 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1325 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1326 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1327 }
1328
1329 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001330}
1331
1332tSirRetStatus
1333limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1334{
1335 tSirMsgQ msg;
1336 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1337 tpAggrAddTsParams pAggrAddTsParam;
1338 tpPESession psessionEntry = NULL;
1339 tpLimTspecInfo tspecInfo;
1340 tANI_U8 ac;
1341 tpDphHashNode pSta;
1342 tANI_U16 aid;
1343 tANI_U8 sessionId;
1344 int i;
1345
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301346 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1347 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301349 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 return eSIR_MEM_ALLOC_FAILED;
1351 }
1352
1353 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1354
1355 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001356 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301357 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 return eSIR_FAILURE;
1359 }
1360
1361 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1362 if (pSta == NULL)
1363 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001364 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301365 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 return eSIR_FAILURE;
1367 }
1368
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301369 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1370 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 pAggrAddTsParam->staIdx = psessionEntry->staId;
1372 // Fill in the sessionId specific to PE
1373 pAggrAddTsParam->sessionId = sessionId;
1374 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1375
1376 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1377 {
1378 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1379 {
1380 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1381 /* Since AddTS response was successful, check for the PSB flag
1382 * and directional flag inside the TS Info field.
1383 * An AC is trigger enabled AC if the PSB subfield is set to 1
1384 * in the uplink direction.
1385 * An AC is delivery enabled AC if the PSB subfield is set to 1
1386 * in the downlink direction.
1387 * An AC is trigger and delivery enabled AC if the PSB subfield
1388 * is set to 1 in the bi-direction field.
1389 */
1390 if (pTspec->tsinfo.traffic.psb == 1)
1391 {
1392 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1393 }
1394 else
1395 {
1396 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1397 }
1398 /* ADDTS success, so AC is now admitted. We shall now use the default
1399 * EDCA parameters as advertised by AP and send the updated EDCA params
1400 * to HAL.
1401 */
1402 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1403 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1404 {
1405 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1406 }
1407 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1408 {
1409 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1410 }
1411 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1412 {
1413 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1414 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1415 }
1416
1417 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1418
1419 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1420 {
1421 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1422 }
1423 else
1424 {
1425 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1426 }
1427
1428 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1429 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001430 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301432 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001433 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1434 }
1435
1436 // Copy the TSPEC paramters
1437 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1438 }
1439 }
1440
1441 msg.type = WDA_AGGR_QOS_REQ;
1442 msg.bodyptr = pAggrAddTsParam;
1443 msg.bodyval = 0;
1444
1445 /* We need to defer any incoming messages until we get a
1446 * WDA_AGGR_QOS_RSP from HAL.
1447 */
1448 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001449 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001450
1451 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1452 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001453 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301455 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 return eSIR_FAILURE;
1457 }
1458
1459 return eSIR_SUCCESS;
1460}
1461
1462void
1463limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1464 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1465{
1466 tpSirAggrQosRsp rsp;
1467 int i = 0;
1468
1469 if (! rspReqd)
1470 {
1471 return;
1472 }
1473
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301474 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1475 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301477 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001478 return;
1479 }
1480
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301481 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1483 rsp->sessionId = smesessionId;
1484 rsp->length = sizeof(*rsp);
1485 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1486
1487 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1488 {
1489 if( (1 << i) & aggrQosRsp->tspecIdx )
1490 {
1491 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1492 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1493 }
1494 }
1495
1496 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1497 return;
1498}
1499
1500
1501void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1502{
1503 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1504 //tpAggrQosParams pAggrQosRspMsg = NULL;
1505 tAddTsParams addTsParam = {0};
1506 tpDphHashNode pSta = NULL;
1507 tANI_U16 assocId =0;
1508 tSirMacAddr peerMacAddr;
1509 tANI_U8 rspReqd = 1;
1510 tpPESession psessionEntry = NULL;
1511 int i = 0;
1512
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001513 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515 /* Need to process all the deferred messages enqueued since sending the
1516 SIR_HAL_AGGR_ADD_TS_REQ */
1517 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1518
1519 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1520 if (NULL == pAggrQosRspMsg)
1521 {
1522 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1523 return;
1524 }
1525
1526 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1527 if (NULL == psessionEntry)
1528 {
1529 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001530 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001531 if( pAggrQosRspMsg != NULL )
1532 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301533 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 }
1535 return;
1536 }
1537
1538 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1539 {
1540 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1541 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1542 {
1543 /* send DELTS to the station */
1544 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1545
1546 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1547 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1548 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1549 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1550
1551 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1552 &addTsParam.tspec.tsinfo,
1553 &addTsParam.tspec, psessionEntry);
1554
1555 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1556 &psessionEntry->dph.dphHashTable);
1557 if (pSta != NULL)
1558 {
1559 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1560 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1561 }
1562 }
1563 }
1564
1565 /* Send the Aggr QoS response to SME */
1566
1567 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1568 psessionEntry->smeSessionId);
1569 if( pAggrQosRspMsg != NULL )
1570 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301571 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001572 }
1573 return;
1574}
1575
Jeff Johnson295189b2012-06-20 16:38:30 -07001576#endif /* WLAN_FEATURE_VOWIFI_11R */