blob: c896117d1a7f10de8835505534fcb41cdfdfabcb [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -08002 * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Jeff Johnson295189b2012-06-20 16:38:30 -070028#ifdef WLAN_FEATURE_VOWIFI_11R
29/**=========================================================================
30
Kiet Lam842dad02014-02-18 18:44:02 -080031 \brief implementation for PE 11r VoWiFi FT Protocol
Jeff Johnson295189b2012-06-20 16:38:30 -070032
33 ========================================================================*/
34
35/* $Header$ */
36
37
38/*--------------------------------------------------------------------------
39 Include Files
40 ------------------------------------------------------------------------*/
41#include <limSendMessages.h>
42#include <limTypes.h>
43#include <limFT.h>
44#include <limFTDefs.h>
45#include <limUtils.h>
46#include <limPropExtsUtils.h>
47#include <limAssocUtils.h>
48#include <limSession.h>
49#include <limAdmitControl.h>
50#include "wmmApsd.h"
51
52#define LIM_FT_RIC_BA_SSN 1
53#define LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 248
54#define LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA 1
Gopichand Nakkala3d295922013-05-07 16:19:14 +053055#define LIM_FT_RIC_DESCRIPTOR_MAX_VAR_DATA_LEN 255
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57/*--------------------------------------------------------------------------
58 Initialize the FT variables.
59 ------------------------------------------------------------------------*/
60void limFTOpen(tpAniSirGlobal pMac)
61{
62 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
63 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
64}
65
66/*--------------------------------------------------------------------------
67 Cleanup FT variables.
68 ------------------------------------------------------------------------*/
69void limFTCleanup(tpAniSirGlobal pMac)
70{
71 if (pMac->ft.ftPEContext.pFTPreAuthReq)
72 {
73#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070074 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070075 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -070076#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -080077 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
78 {
79 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
80 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
81 }
Jeff Johnson295189b2012-06-20 16:38:30 -070082 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
83 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
84 }
85
86 // This is the old session, should be deleted else where.
87 // We should not be cleaning it here, just set it to NULL.
88 if (pMac->ft.ftPEContext.psavedsessionEntry)
89 {
90#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -070091 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -070092 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -070093#endif
94 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
95 }
96
97 // This is the extra session we added as part of Auth resp
98 // clean it up.
99 if (pMac->ft.ftPEContext.pftSessionEntry)
100 {
101 if ((((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->valid) &&
102 (((tpPESession)(pMac->ft.ftPEContext.pftSessionEntry))->limSmeState == eLIM_SME_WT_REASSOC_STATE))
103 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700104 PELOGE(limLog( pMac, LOGE, "%s: Deleting Preauth Session %d", __func__, ((tpPESession)pMac->ft.ftPEContext.pftSessionEntry)->peSessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 peDeleteSession(pMac, pMac->ft.ftPEContext.pftSessionEntry);
106 }
107 pMac->ft.ftPEContext.pftSessionEntry = NULL;
108#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700109 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700110 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111#endif
112 }
113
114 if (pMac->ft.ftPEContext.pAddBssReq)
115 {
116 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
117 pMac->ft.ftPEContext.pAddBssReq = NULL;
118 }
119
120 if (pMac->ft.ftPEContext.pAddStaReq)
121 {
122 vos_mem_free(pMac->ft.ftPEContext.pAddStaReq);
123 pMac->ft.ftPEContext.pAddStaReq = NULL;
124 }
125
126 pMac->ft.ftPEContext.ftPreAuthStatus = eSIR_SUCCESS;
127
128}
129
130/*--------------------------------------------------------------------------
131 Init FT variables.
132 ------------------------------------------------------------------------*/
133void limFTInit(tpAniSirGlobal pMac)
134{
135 if (pMac->ft.ftPEContext.pFTPreAuthReq)
136 {
137#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700138 PELOGE(limLog( pMac, LOGE, "%s: Freeing pFTPreAuthReq= %p",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700139 __func__, pMac->ft.ftPEContext.pFTPreAuthReq);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700140#endif
Dhanashri Atree3a2a592013-03-08 13:18:42 -0800141 if (pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription)
142 {
143 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription);
144 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription = NULL;
145 }
146
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 vos_mem_free(pMac->ft.ftPEContext.pFTPreAuthReq);
148 pMac->ft.ftPEContext.pFTPreAuthReq = NULL;
149 }
150
151 // This is the old session, should be deleted else where.
152 // We should not be cleaning it here, just set it to NULL.
153 if (pMac->ft.ftPEContext.psavedsessionEntry)
154 {
155#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700156 PELOGE(limLog( pMac, LOGE, "%s: Setting psavedsessionEntry= %p to NULL",
Madan Mohan Koyyalamudi87054ba2012-11-02 13:24:12 -0700157 __func__, pMac->ft.ftPEContext.psavedsessionEntry);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700158#endif
159 pMac->ft.ftPEContext.psavedsessionEntry = NULL;
160 }
161
162 // This is the extra session we added as part of Auth resp
163 // clean it up.
164 if (pMac->ft.ftPEContext.pftSessionEntry)
165 {
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 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800358#if defined FEATURE_WLAN_ESE || defined FEATURE_WLAN_LFR
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 else
360 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800361 // Will need to make isESEconnection a enum may be for further
Jeff Johnson295189b2012-06-20 16:38:30 -0700362 // improvements to this to match this algorithm number
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800363 authFrame.authAlgoNumber = eSIR_OPEN_SYSTEM; // For now if its ESE and 11r FT.
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 }
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;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800497 pftSessionEntry->htSecondaryChannelOffset = pAddBssParams->currentExtChannel;
498
499#ifdef WLAN_FEATURE_11AC
500 if (pftSessionEntry->vhtCapability && pftSessionEntry->vhtCapabilityPresentInBeacon)
501 {
502 pAddBssParams->vhtCapable = pBeaconStruct->VHTCaps.present;
503 pAddBssParams->vhtTxChannelWidthSet = pBeaconStruct->VHTOperation.chanWidth;
504 pAddBssParams->currentExtChannel = limGet11ACPhyCBState ( pMac,
505 pAddBssParams->currentOperChannel,
506 pAddBssParams->currentExtChannel,
507 pftSessionEntry->apCenterChan,
508 pftSessionEntry);
509 }
510 else
511 {
512 pAddBssParams->vhtCapable = 0;
513 }
514#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700515
516#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700517 limLog( pMac, LOG1, FL( "SIR_HAL_ADD_BSS_REQ with channel = %d..." ),
Jeff Johnson295189b2012-06-20 16:38:30 -0700518 pAddBssParams->currentOperChannel);
519#endif
520
521
522 // Populate the STA-related parameters here
523 // Note that the STA here refers to the AP
524 {
525 pAddBssParams->staContext.staType = STA_ENTRY_OTHER; // Identifying AP as an STA
526
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530527 vos_mem_copy(pAddBssParams->staContext.bssId,
528 bssDescription->bssId,
529 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -0700530 pAddBssParams->staContext.listenInterval = bssDescription->beaconInterval;
531
532 pAddBssParams->staContext.assocId = 0; // Is SMAC OK with this?
533 pAddBssParams->staContext.uAPSD = 0;
534 pAddBssParams->staContext.maxSPLen = 0;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700535 pAddBssParams->staContext.shortPreambleSupported = (tANI_U8)pBeaconStruct->capabilityInfo.shortPreamble;
Jeff Johnson295189b2012-06-20 16:38:30 -0700536 pAddBssParams->staContext.updateSta = updateEntry;
537 pAddBssParams->staContext.encryptType = pftSessionEntry->encryptType;
538
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700539 if (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode) && ( pBeaconStruct->HTCaps.present ))
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 {
541 pAddBssParams->staContext.us32MaxAmpduDuration = 0;
542 pAddBssParams->staContext.htCapable = 1;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700543 pAddBssParams->staContext.greenFieldCapable = ( tANI_U8 ) pBeaconStruct->HTCaps.greenField;
544 pAddBssParams->staContext.lsigTxopProtection = ( tANI_U8 ) pBeaconStruct->HTCaps.lsigTXOPProtection;
545 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 (chanWidthSupp) )
547 {
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700548 pAddBssParams->staContext.txChannelWidthSet = ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700549 }
550 else
551 {
552 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
553 }
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800554#ifdef WLAN_FEATURE_11AC
555 if (pftSessionEntry->vhtCapability && pBeaconStruct->VHTCaps.present)
556 {
557 pAddBssParams->staContext.vhtCapable = 1;
558 if ((pBeaconStruct->VHTCaps.suBeamFormerCap ||
559 pBeaconStruct->VHTCaps.muBeamformerCap) &&
560 pftSessionEntry->txBFIniFeatureEnabled)
561 {
562 pAddBssParams->staContext.vhtTxBFCapable = 1;
563 }
564 }
565#endif
566 if( (pBeaconStruct->HTCaps.supportedChannelWidthSet) &&
567 (chanWidthSupp) )
568 {
569 pAddBssParams->staContext.txChannelWidthSet =
570 ( tANI_U8 )pBeaconStruct->HTInfo.recommendedTxWidthSet;
571#ifdef WLAN_FEATURE_11AC
572 if (pAddBssParams->staContext.vhtCapable)
573 {
574 pAddBssParams->staContext.vhtTxChannelWidthSet =
575 pBeaconStruct->VHTOperation.chanWidth;
576 }
577#endif
578 }
579 else
580 {
581 pAddBssParams->staContext.txChannelWidthSet = WNI_CFG_CHANNEL_BONDING_MODE_DISABLE;
582 }
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700583 pAddBssParams->staContext.mimoPS = (tSirMacHTMIMOPowerSaveState)pBeaconStruct->HTCaps.mimoPowerSave;
584 pAddBssParams->staContext.delBASupport = ( tANI_U8 ) pBeaconStruct->HTCaps.delayedBA;
585 pAddBssParams->staContext.maxAmsduSize = ( tANI_U8 ) pBeaconStruct->HTCaps.maximalAMSDUsize;
586 pAddBssParams->staContext.maxAmpduDensity = pBeaconStruct->HTCaps.mpduDensity;
587 pAddBssParams->staContext.fDsssCckMode40Mhz = (tANI_U8)pBeaconStruct->HTCaps.dsssCckMode40MHz;
588 pAddBssParams->staContext.fShortGI20Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI20MHz;
589 pAddBssParams->staContext.fShortGI40Mhz = (tANI_U8)pBeaconStruct->HTCaps.shortGI40MHz;
590 pAddBssParams->staContext.maxAmpduSize= pBeaconStruct->HTCaps.maxRxAMPDUFactor;
Jeff Johnson295189b2012-06-20 16:38:30 -0700591
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700592 if( pBeaconStruct->HTInfo.present )
593 pAddBssParams->staContext.rifsMode = pBeaconStruct->HTInfo.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -0700594 }
595
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700596 if ((pftSessionEntry->limWmeEnabled && pBeaconStruct->wmeEdcaPresent) ||
597 (pftSessionEntry->limQosEnabled && pBeaconStruct->edcaPresent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 pAddBssParams->staContext.wmmEnabled = 1;
599 else
600 pAddBssParams->staContext.wmmEnabled = 0;
601
602 //Update the rates
Jeff Johnsone7245742012-09-05 17:12:55 -0700603#ifdef WLAN_FEATURE_11AC
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700604 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
605 pBeaconStruct->HTCaps.supportedMCSSet,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700606 false,pftSessionEntry,&pBeaconStruct->VHTCaps);
Jeff Johnsone7245742012-09-05 17:12:55 -0700607#else
Leela Venkata Kiran Kumar Reddy Chirala85c9fb12013-09-05 20:47:36 -0700608 limPopulatePeerRateSet(pMac, &pAddBssParams->staContext.supportedRates,
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 beaconStruct.HTCaps.supportedMCSSet, false,pftSessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -0700610#endif
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800611 if (pftSessionEntry->htCapability)
612 {
613 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11n;
614 if (pftSessionEntry->vhtCapability)
615 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11ac;
616 }
617 else
618 {
619 if (pftSessionEntry->limRFBand == SIR_BAND_5_GHZ)
620 {
621 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11a;
622 }
623 else
624 {
625 pAddBssParams->staContext.supportedRates.opRateMode = eSTA_11bg;
626 }
627 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700628 }
629
Jeff Johnson295189b2012-06-20 16:38:30 -0700630 //Disable BA. It will be set as part of ADDBA negotiation.
631 for( i = 0; i < STACFG_MAX_TC; i++ )
632 {
633 pAddBssParams->staContext.staTCParams[i].txUseBA = eBA_DISABLE;
634 pAddBssParams->staContext.staTCParams[i].rxUseBA = eBA_DISABLE;
635 pAddBssParams->staContext.staTCParams[i].txBApolicy = eBA_POLICY_IMMEDIATE;
636 pAddBssParams->staContext.staTCParams[i].rxBApolicy = eBA_POLICY_IMMEDIATE;
637 }
638
639#if defined WLAN_FEATURE_VOWIFI
640 pAddBssParams->maxTxPower = pftSessionEntry->maxTxPower;
641#endif
642
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800643#ifdef WLAN_FEATURE_11W
644 if (pftSessionEntry->limRmfEnabled)
645 {
646 pAddBssParams->rmfEnabled = 1;
647 pAddBssParams->staContext.rmfEnabled = 1;
648 }
649#endif
650
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 pAddBssParams->status = eHAL_STATUS_SUCCESS;
652 pAddBssParams->respReqd = true;
653
654 pAddBssParams->staContext.sessionId = pftSessionEntry->peSessionId;
655 pAddBssParams->sessionId = pftSessionEntry->peSessionId;
656
657 // Set a new state for MLME
658
659 pftSessionEntry->limMlmState = eLIM_MLM_WT_ADD_BSS_RSP_FT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800660 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 -0700661 pAddBssParams->halPersona=(tANI_U8)pftSessionEntry->pePersona; //pass on the session persona to hal
662
663 pMac->ft.ftPEContext.pAddBssReq = pAddBssParams;
664
665#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800666 limLog( pMac, LOG1, FL( "Saving SIR_HAL_ADD_BSS_REQ for pre-auth ap..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700667#endif
668
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530669 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700670 return 0;
671}
672
673/*------------------------------------------------------------------
674 *
675 * Setup the new session for the pre-auth AP.
676 * Return the newly created session entry.
677 *
678 *------------------------------------------------------------------*/
679tpPESession limFillFTSession(tpAniSirGlobal pMac,
680 tpSirBssDescription pbssDescription, tpPESession psessionEntry)
681{
682 tpPESession pftSessionEntry;
683 tANI_U8 currentBssUapsd;
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 tPowerdBm localPowerConstraint;
685 tPowerdBm regMax;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700686 tSchBeaconStruct *pBeaconStruct;
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800687 uint32 selfDot11Mode;
688 ePhyChanBondState cbMode;
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700689
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530690 pBeaconStruct = vos_mem_malloc(sizeof(tSchBeaconStruct));
691 if (NULL == pBeaconStruct)
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700692 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530693 limLog(pMac, LOGE, FL("Unable to allocate memory for creating limFillFTSession") );
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700694 return NULL;
695 }
696
Jeff Johnson295189b2012-06-20 16:38:30 -0700697
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -0800698
699 /* Retrieve the session that has already been created and update the entry */
700 pftSessionEntry = pMac->ft.ftPEContext.pftSessionEntry;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800701#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700702 limPrintMacAddr(pMac, pbssDescription->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700703#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700704 pftSessionEntry->limWmeEnabled = psessionEntry->limWmeEnabled;
705 pftSessionEntry->limQosEnabled = psessionEntry->limQosEnabled;
706 pftSessionEntry->limWsmEnabled = psessionEntry->limWsmEnabled;
707 pftSessionEntry->lim11hEnable = psessionEntry->lim11hEnable;
708
709 // Fields to be filled later
710 pftSessionEntry->pLimJoinReq = NULL;
711 pftSessionEntry->smeSessionId = 0;
712 pftSessionEntry->transactionId = 0;
713
714 limExtractApCapabilities( pMac,
715 (tANI_U8 *) pbssDescription->ieFields,
716 limGetIElenFromBssDescription( pbssDescription ),
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700717 pBeaconStruct );
Jeff Johnson295189b2012-06-20 16:38:30 -0700718
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700719 pftSessionEntry->rateSet.numRates = pBeaconStruct->supportedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530720 vos_mem_copy(pftSessionEntry->rateSet.rate,
721 pBeaconStruct->supportedRates.rate, pBeaconStruct->supportedRates.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700722
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700723 pftSessionEntry->extRateSet.numRates = pBeaconStruct->extendedRates.numRates;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530724 vos_mem_copy(pftSessionEntry->extRateSet.rate,
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700725 pBeaconStruct->extendedRates.rate, pftSessionEntry->extRateSet.numRates);
Jeff Johnson295189b2012-06-20 16:38:30 -0700726
727
Madan Mohan Koyyalamudi19032762012-10-21 12:42:11 -0700728 pftSessionEntry->ssId.length = pBeaconStruct->ssId.length;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530729 vos_mem_copy(pftSessionEntry->ssId.ssId, pBeaconStruct->ssId.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 pftSessionEntry->ssId.length);
731
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800732 wlan_cfgGetInt(pMac, WNI_CFG_DOT11_MODE, &selfDot11Mode);
733 pftSessionEntry->dot11mode = selfDot11Mode;
734 pftSessionEntry->vhtCapability = (IS_DOT11_MODE_VHT(pftSessionEntry->dot11mode)
735 && pBeaconStruct->VHTCaps.present);
736 pftSessionEntry->htCapability = (IS_DOT11_MODE_HT(pftSessionEntry->dot11mode)
737 && pBeaconStruct->HTCaps.present);
738#ifdef WLAN_FEATURE_11AC
739 if ( pBeaconStruct->VHTCaps.present && pBeaconStruct->VHTOperation.present)
740 {
741 pftSessionEntry->vhtCapabilityPresentInBeacon = 1;
742 pftSessionEntry->apCenterChan = pBeaconStruct->VHTOperation.chanCenterFreqSeg1;
743 pftSessionEntry->apChanWidth = pBeaconStruct->VHTOperation.chanWidth;
744 }
745 else
746 {
747 pftSessionEntry->vhtCapabilityPresentInBeacon = 0;
748 }
749#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700750 // Self Mac
751 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
752 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800753#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -0700754 limPrintMacAddr(pMac, pftSessionEntry->limReAssocbssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700755#endif
756
757 /* Store beaconInterval */
758 pftSessionEntry->beaconParams.beaconInterval = pbssDescription->beaconInterval;
759 pftSessionEntry->bssType = psessionEntry->bssType;
760
761 pftSessionEntry->statypeForBss = STA_ENTRY_PEER;
762 pftSessionEntry->nwType = pbssDescription->nwType;
763
764 /* Copy The channel Id to the session Table */
765 pftSessionEntry->limReassocChannelId = pbssDescription->channelId;
766 pftSessionEntry->currentOperChannel = pbssDescription->channelId;
767
768
769 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
770 {
771 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
772 }
773 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
774 {
775 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
776 }
777 else
778 {
779 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere80007262013-03-18 19:45:50 -0700780 limLog(pMac, LOGE, FL("Invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700781 }
782
783 pftSessionEntry->limCurrentBssCaps = pbssDescription->capabilityInfo;
784 pftSessionEntry->limReassocBssCaps = pbssDescription->capabilityInfo;
Srinivas Girigowda3353f1e2013-02-04 16:22:51 -0800785 if( pMac->roam.configParam.shortSlotTime &&
786 SIR_MAC_GET_SHORT_SLOT_TIME(pftSessionEntry->limReassocBssCaps))
787 {
788 pftSessionEntry->shortSlotTimeSupported = TRUE;
789 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700790
791 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, pftSessionEntry->currentOperChannel );
792 localPowerConstraint = regMax;
793 limExtractApCapability( pMac, (tANI_U8 *) pbssDescription->ieFields,
794 limGetIElenFromBssDescription(pbssDescription),
795 &pftSessionEntry->limCurrentBssQosCaps,
796 &pftSessionEntry->limCurrentBssPropCap,
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700797 &currentBssUapsd , &localPowerConstraint, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700798
799 pftSessionEntry->limReassocBssQosCaps =
800 pftSessionEntry->limCurrentBssQosCaps;
801 pftSessionEntry->limReassocBssPropCap =
802 pftSessionEntry->limCurrentBssPropCap;
803
804
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800805#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800806 pftSessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
807#else
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 pftSessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -0800809#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700810
811#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800812 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 -0800813 __func__, regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap, pftSessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -0700814#endif
815
816 pftSessionEntry->limRFBand = limGetRFBand(pftSessionEntry->currentOperChannel);
817
818 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
819 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -0800820 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pftSessionEntry->peSessionId, pftSessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700821
822 pftSessionEntry->encryptType = psessionEntry->encryptType;
823
Varun Reddy Yeturuee871e32014-02-20 14:20:51 -0800824 if (pftSessionEntry->limRFBand == SIR_BAND_2_4_GHZ)
825 {
826 cbMode = pMac->roam.configParam.channelBondingMode24GHz;
827 }
828 else
829 {
830 cbMode = pMac->roam.configParam.channelBondingMode5GHz;
831 }
832 pftSessionEntry->htSupportedChannelWidthSet =
833 cbMode && pBeaconStruct->HTCaps.supportedChannelWidthSet;
834 pftSessionEntry->htRecommendedTxWidthSet =
835 pftSessionEntry->htSupportedChannelWidthSet;
Chet Lanctotf19c1f62013-12-13 13:56:21 -0800836
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +0530837 vos_mem_free(pBeaconStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 return pftSessionEntry;
839}
840
841/*------------------------------------------------------------------
842 *
843 * Setup the session and the add bss req for the pre-auth AP.
844 *
845 *------------------------------------------------------------------*/
846void limFTSetupAuthSession(tpAniSirGlobal pMac, tpPESession psessionEntry)
847{
848 tpPESession pftSessionEntry;
849
850 // Prepare the session right now with as much as possible.
851 pftSessionEntry = limFillFTSession(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription, psessionEntry);
852
853 if (pftSessionEntry)
854 {
855 pftSessionEntry->is11Rconnection = psessionEntry->is11Rconnection;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800856#ifdef FEATURE_WLAN_ESE
857 pftSessionEntry->isESEconnection = psessionEntry->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -0700858#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800859#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 pftSessionEntry->isFastTransitionEnabled = psessionEntry->isFastTransitionEnabled;
861#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700862
863#ifdef FEATURE_WLAN_LFR
864 pftSessionEntry->isFastRoamIniFeatureEnabled = psessionEntry->isFastRoamIniFeatureEnabled;
865#endif
Chet Lanctota4fd8e62013-12-10 16:02:32 -0800866#ifdef WLAN_FEATURE_11W
867 pftSessionEntry->limRmfEnabled = psessionEntry->limRmfEnabled;
868#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 limFTPrepareAddBssReq( pMac, FALSE, pftSessionEntry,
870 pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription );
871 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
872 }
873}
874
875/*------------------------------------------------------------------
876 * Resume Link Call Back
877 *------------------------------------------------------------------*/
878void limFTProcessPreAuthResult(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data)
879{
880 tpPESession psessionEntry;
881
Srinivas Girigowda4585f0d2013-10-28 18:07:40 -0700882 if (!pMac->ft.ftPEContext.pFTPreAuthReq)
883 return;
884
Jeff Johnson295189b2012-06-20 16:38:30 -0700885 psessionEntry = (tpPESession)data;
886
887 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
888 {
889 limFTSetupAuthSession(pMac, psessionEntry);
890 }
891
892 // Post the FT Pre Auth Response to SME
893 limPostFTPreAuthRsp(pMac, pMac->ft.ftPEContext.ftPreAuthStatus,
894 pMac->ft.ftPEContext.saved_auth_rsp,
895 pMac->ft.ftPEContext.saved_auth_rsp_length, psessionEntry);
896
897}
898
899/*------------------------------------------------------------------
900 * Resume Link Call Back
901 *------------------------------------------------------------------*/
902void limPerformPostFTPreAuthAndChannelChange(tpAniSirGlobal pMac, eHalStatus status, tANI_U32 *data,
903 tpPESession psessionEntry)
904{
905 //Set the resume channel to Any valid channel (invalid).
906 //This will instruct HAL to set it to any previous valid channel.
907 peSetResumeChannel(pMac, 0, 0);
908 limResumeLink(pMac, limFTProcessPreAuthResult, (tANI_U32 *)psessionEntry);
909}
910
911tSirRetStatus limCreateRICBlockAckIE(tpAniSirGlobal pMac, tANI_U8 tid, tCfgTrafficClass *pTrafficClass,
912 tANI_U8 *ric_ies, tANI_U32 *ieLength)
913{
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530914 /* BlockACK + RIC is not supported now, TODO later to support this */
915#if 0
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 tDot11fIERICDataDesc ricIe;
917 tDot11fFfBAStartingSequenceControl baSsnControl;
918 tDot11fFfAddBAParameterSet baParamSet;
919 tDot11fFfBATimeout baTimeout;
920
921 vos_mem_zero(&ricIe, sizeof(tDot11fIERICDataDesc));
922 vos_mem_zero(&baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
923 vos_mem_zero(&baParamSet, sizeof(tDot11fFfAddBAParameterSet));
924 vos_mem_zero(&baTimeout, sizeof(tDot11fFfBATimeout));
925
926 ricIe.present = 1;
927 ricIe.RICData.present = 1;
928 ricIe.RICData.resourceDescCount = 1;
929 ricIe.RICData.Identifier = LIM_FT_RIC_BA_DIALOG_TOKEN_TID_0 + tid;
930 ricIe.RICDescriptor.present = 1;
931 ricIe.RICDescriptor.resourceType = LIM_FT_RIC_DESCRIPTOR_RESOURCE_TYPE_BA;
932 baParamSet.tid = tid;
933 baParamSet.policy = pTrafficClass->fTxBApolicy; // Immediate Block Ack
934 baParamSet.bufferSize = pTrafficClass->txBufSize;
935 vos_mem_copy((v_VOID_t *)&baTimeout, (v_VOID_t *)&pTrafficClass->tuTxBAWaitTimeout, sizeof(baTimeout));
936 baSsnControl.fragNumber = 0;
937 baSsnControl.ssn = LIM_FT_RIC_BA_SSN;
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530938 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700939 dot11fPackFfAddBAParameterSet(pMac, &baParamSet, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
940 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baParamSet, sizeof(tDot11fFfAddBAParameterSet));
941 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfAddBAParameterSet);
942 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530943 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700944 dot11fPackFfBATimeout(pMac, &baTimeout, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
945 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baTimeout, sizeof(tDot11fFfBATimeout));
946 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBATimeout);
947 }
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530948 if (ricIe.RICDescriptor.num_variableData < sizeof (ricIe.RICDescriptor.variableData)) {
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700949 dot11fPackFfBAStartingSequenceControl(pMac, &baSsnControl, &ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData]);
950 //vos_mem_copy(&ricIe.RICDescriptor.variableData[ricIe.RICDescriptor.num_variableData], &baSsnControl, sizeof(tDot11fFfBAStartingSequenceControl));
951 ricIe.RICDescriptor.num_variableData += sizeof(tDot11fFfBAStartingSequenceControl);
952 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 return (tSirRetStatus) dot11fPackIeRICDataDesc(pMac, &ricIe, ric_ies, sizeof(tDot11fIERICDataDesc), ieLength);
Gopichand Nakkala3d295922013-05-07 16:19:14 +0530954#endif
955
956 return eSIR_FAILURE;
Jeff Johnson295189b2012-06-20 16:38:30 -0700957}
958
959tSirRetStatus limFTFillRICBlockAckInfo(tpAniSirGlobal pMac, tANI_U8 *ric_ies, tANI_U32 *ric_ies_length)
960{
961 tANI_U8 tid = 0;
962 tpDphHashNode pSta;
963 tANI_U16 numBA = 0, aid = 0;
964 tpPESession psessionEntry = pMac->ft.ftPEContext.psavedsessionEntry;
965 tANI_U32 offset = 0, ieLength = 0;
966 tSirRetStatus status = eSIR_SUCCESS;
967
968 // First, extract the DPH entry
969 pSta = dphLookupHashEntry( pMac, pMac->ft.ftPEContext.pFTPreAuthReq->currbssId, &aid, &psessionEntry->dph.dphHashTable);
970 if( NULL == pSta )
971 {
972 PELOGE(limLog( pMac, LOGE,
Arif Hussain24bafea2013-11-15 15:10:03 -0800973 FL( "STA context not found for saved session's BSSID " MAC_ADDRESS_STR ),
974 MAC_ADDR_ARRAY(pMac->ft.ftPEContext.pFTPreAuthReq->currbssId));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 return eSIR_FAILURE;
976 }
977
978 for (tid = 0; tid < STACFG_MAX_TC; tid++)
979 {
980 if (pSta->tcCfg[tid].fUseBATx)
981 {
982 status = limCreateRICBlockAckIE(pMac, tid, &pSta->tcCfg[tid], ric_ies + offset, &ieLength);
983 if (eSIR_SUCCESS == status)
984 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -0700985 // TODO RIC
986 if ( ieLength > MAX_FTIE_SIZE )
987 {
988 ieLength = 0;
989 return status;
990 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 offset += ieLength;
992 *ric_ies_length += ieLength;
993 numBA++;
994 }
995 else
996 {
997 PELOGE(limLog(pMac, LOGE, FL("BA RIC IE creation for TID %d failed with status %d"), tid, status);)
998 }
999 }
1000 }
1001
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001002 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 -07001003 return status;
1004}
1005
1006/*------------------------------------------------------------------
1007 *
1008 * Will post pre auth response to SME.
1009 *
1010 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001011void limPostFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1013 tpPESession psessionEntry)
1014{
1015 tpSirFTPreAuthRsp pFTPreAuthRsp;
1016 tSirMsgQ mmhMsg;
1017 tANI_U16 rspLen = sizeof(tSirFTPreAuthRsp);
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001018 // TODO: RIC Support
1019 //tSirRetStatus sirStatus = eSIR_SUCCESS;
Jeff Johnson295189b2012-06-20 16:38:30 -07001020
1021 pFTPreAuthRsp = (tpSirFTPreAuthRsp)vos_mem_malloc(rspLen);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301022 if (NULL == pFTPreAuthRsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001023 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001024 PELOGE(limLog( pMac, LOGE, "Failed to allocate memory");)
Jeff Johnson295189b2012-06-20 16:38:30 -07001025 VOS_ASSERT(pFTPreAuthRsp != NULL);
1026 return;
1027 }
1028 vos_mem_zero( pFTPreAuthRsp, rspLen);
1029#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001030 PELOGE(limLog( pMac, LOG1, FL("Auth Rsp = %p"), pFTPreAuthRsp);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001031#endif
1032
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301033 vos_mem_set((tANI_U8*)pFTPreAuthRsp, rspLen, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001034 pFTPreAuthRsp->messageType = eWNI_SME_FT_PRE_AUTH_RSP;
1035 pFTPreAuthRsp->length = (tANI_U16) rspLen;
1036 pFTPreAuthRsp->status = status;
1037 if (psessionEntry)
1038 pFTPreAuthRsp->smeSessionId = psessionEntry->smeSessionId;
1039
1040 // The bssid of the AP we are sending Auth1 to.
1041 if (pMac->ft.ftPEContext.pFTPreAuthReq)
1042 sirCopyMacAddr(pFTPreAuthRsp->preAuthbssId,
1043 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId);
1044
1045 // Attach the auth response now back to SME
1046 pFTPreAuthRsp->ft_ies_length = 0;
1047 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1048 {
1049 // Only 11r assoc has FT IEs.
1050 vos_mem_copy(pFTPreAuthRsp->ft_ies, auth_rsp, auth_rsp_length);
1051 pFTPreAuthRsp->ft_ies_length = auth_rsp_length;
1052 }
1053
1054#ifdef WLAN_FEATURE_VOWIFI_11R
1055 if ((psessionEntry) && (psessionEntry->is11Rconnection))
1056 {
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001057 /* TODO: RIC SUPPORT Fill in the Block Ack RIC IEs in the preAuthRsp */
1058 /*
Jeff Johnson295189b2012-06-20 16:38:30 -07001059 sirStatus = limFTFillRICBlockAckInfo(pMac, pFTPreAuthRsp->ric_ies,
1060 (tANI_U32 *)&pFTPreAuthRsp->ric_ies_length);
1061 if (eSIR_SUCCESS != sirStatus)
1062 {
1063 PELOGE(limLog(pMac, LOGE, FL("Fill RIC BA Info failed with status %d"), sirStatus);)
1064 }
Madan Mohan Koyyalamudiea773882012-11-02 13:37:21 -07001065 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001066 }
1067#endif
1068
1069 mmhMsg.type = pFTPreAuthRsp->messageType;
1070 mmhMsg.bodyptr = pFTPreAuthRsp;
1071 mmhMsg.bodyval = 0;
1072
1073#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001074 PELOGE(limLog( pMac, LOG1, "Posted Auth Rsp to SME with status of 0x%x", status);)
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001075#endif
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001076#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Rajesh Chauhan913ab4f2013-07-17 14:36:31 -07001077 if (status == eSIR_SUCCESS)
1078 limDiagEventReport(pMac, WLAN_PE_DIAG_PREAUTH_DONE, psessionEntry,
1079 status, 0);
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001080#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001081 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
1082}
1083
1084/*------------------------------------------------------------------
1085 *
1086 * Send the FT Pre Auth Response to SME when ever we have a status
1087 * ready to be sent to SME
1088 *
1089 * SME will be the one to send it up to the supplicant to receive
1090 * FTIEs which will be required for Reassoc Req.
1091 *
1092 *------------------------------------------------------------------*/
Srikant Kuppaa3ed0a32013-02-20 07:24:43 -08001093void limHandleFTPreAuthRsp(tpAniSirGlobal pMac, tSirRetStatus status,
Jeff Johnson295189b2012-06-20 16:38:30 -07001094 tANI_U8 *auth_rsp, tANI_U16 auth_rsp_length,
1095 tpPESession psessionEntry)
1096{
1097
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001098 tpPESession pftSessionEntry;
1099 tANI_U8 sessionId;
1100 tpSirBssDescription pbssDescription;
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001101#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1102 limDiagEventReport(pMac, WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, psessionEntry, (tANI_U16)status, 0);
1103#endif
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001104
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 // Save the status of pre-auth
1106 pMac->ft.ftPEContext.ftPreAuthStatus = status;
1107
1108 // Save the auth rsp, so we can send it to
1109 // SME once we resume link.
1110 pMac->ft.ftPEContext.saved_auth_rsp_length = 0;
1111 if ((auth_rsp != NULL) && (auth_rsp_length < MAX_FTIE_SIZE))
1112 {
1113 vos_mem_copy(pMac->ft.ftPEContext.saved_auth_rsp,
1114 auth_rsp, auth_rsp_length);
1115 pMac->ft.ftPEContext.saved_auth_rsp_length = auth_rsp_length;
1116 }
1117
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001118 /* Create FT session for the re-association at this point */
1119 if (pMac->ft.ftPEContext.ftPreAuthStatus == eSIR_SUCCESS)
1120 {
1121 pbssDescription = pMac->ft.ftPEContext.pFTPreAuthReq->pbssDescription;
1122 if((pftSessionEntry = peCreateSession(pMac, pbssDescription->bssId,
1123 &sessionId, pMac->lim.maxStation)) == NULL)
1124 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001125 limLog(pMac, LOGE, FL("Session Can not be created for pre-auth 11R AP"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001126 return;
1127 }
1128 pftSessionEntry->peSessionId = sessionId;
1129 sirCopyMacAddr(pftSessionEntry->selfMacAddr, psessionEntry->selfMacAddr);
1130 sirCopyMacAddr(pftSessionEntry->limReAssocbssId, pbssDescription->bssId);
1131 pftSessionEntry->bssType = psessionEntry->bssType;
1132
1133 if (pftSessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1134 {
1135 pftSessionEntry->limSystemRole = eLIM_STA_ROLE;
1136 }
1137 else if(pftSessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1138 {
1139 pftSessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1140 }
1141 else
1142 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001143 limLog(pMac, LOGE, FL("Invalid bss type"));
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001144 }
1145 pftSessionEntry->limPrevSmeState = pftSessionEntry->limSmeState;
1146 pftSessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
1147 pMac->ft.ftPEContext.pftSessionEntry = pftSessionEntry;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001148 PELOGE(limLog(pMac, LOG1,"%s:created session (%p) with id = %d",
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001149 __func__, pftSessionEntry, pftSessionEntry->peSessionId);)
1150
1151 /* Update the ReAssoc BSSID of the current session */
1152 sirCopyMacAddr(psessionEntry->limReAssocbssId, pbssDescription->bssId);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001153 limPrintMacAddr(pMac, psessionEntry->limReAssocbssId, LOG1);
Dhanashri Atreaf3e84d2013-01-18 18:03:06 -08001154 }
1155
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 if (psessionEntry->currentOperChannel !=
1157 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum)
1158 {
1159 // Need to move to the original AP channel
1160 limChangeChannelWithCallback(pMac, psessionEntry->currentOperChannel,
1161 limPerformPostFTPreAuthAndChannelChange, NULL, psessionEntry);
1162 }
1163 else
1164 {
1165#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001166 PELOGE(limLog( pMac, LOG1, "Pre auth on same channel as connected AP channel %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthchannelNum);)
1168#endif
1169 limFTProcessPreAuthResult(pMac, status, (tANI_U32 *)psessionEntry);
1170 }
1171}
1172
1173/*------------------------------------------------------------------
1174 *
1175 * This function handles the 11R Reassoc Req from SME
1176 *
1177 *------------------------------------------------------------------*/
1178void limProcessMlmFTReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf,
1179 tpPESession psessionEntry)
1180{
1181 tANI_U8 smeSessionId = 0;
1182 tANI_U16 transactionId = 0;
Jeff Johnson278b0492013-04-03 14:10:08 -07001183 tANI_U8 chanNum = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001184 tLimMlmReassocReq *pMlmReassocReq;
1185 tANI_U16 caps;
1186 tANI_U32 val;
1187 tSirMsgQ msgQ;
1188 tSirRetStatus retCode;
1189 tANI_U32 teleBcnEn = 0;
1190
Jeff Johnson278b0492013-04-03 14:10:08 -07001191 chanNum = psessionEntry->currentOperChannel;
Jeff Johnson295189b2012-06-20 16:38:30 -07001192 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
1193 psessionEntry->smeSessionId = smeSessionId;
1194 psessionEntry->transactionId = transactionId;
1195
Leela Venkata Kiran Kumar Reddy Chirala2365ee62013-05-09 17:30:12 -07001196#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1197 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOCIATING, psessionEntry, 0, 0);
1198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001199
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301200 if (NULL == pMac->ft.ftPEContext.pAddBssReq)
1201 {
1202 limLog(pMac, LOGE, FL("pAddBssReq is NULL"));
1203 return;
1204 }
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301205 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
1206 if (NULL == pMlmReassocReq)
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 {
1208 // Log error
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301209 limLog(pMac, LOGE, FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 return;
1211 }
1212
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301213 vos_mem_copy(pMlmReassocReq->peerMacAddr,
1214 psessionEntry->bssId,
1215 sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001216
1217 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
1218 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
1219 != eSIR_SUCCESS)
1220 {
1221 /**
1222 * Could not get ReassocFailureTimeout value
1223 * from CFG. Log error.
1224 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001225 limLog(pMac, LOGE, FL("could not retrieve ReassocFailureTimeout value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301226 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 return;
1228 }
1229
1230 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
1231 {
1232 /**
1233 * Could not get Capabilities value
1234 * from CFG. Log error.
1235 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001236 limLog(pMac, LOGE, FL("could not retrieve Capabilities value"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301237 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 return;
1239 }
1240 pMlmReassocReq->capabilityInfo = caps;
Jeff Johnson278b0492013-04-03 14:10:08 -07001241
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 /* Update PE sessionId*/
1243 pMlmReassocReq->sessionId = psessionEntry->peSessionId;
1244
1245 /* If telescopic beaconing is enabled, set listen interval to WNI_CFG_TELE_BCN_MAX_LI */
Jeff Johnson278b0492013-04-03 14:10:08 -07001246 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
1247 eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001249 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301250 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001251 return;
1252 }
1253
1254 if (teleBcnEn)
1255 {
1256 if (wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) != eSIR_SUCCESS)
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001257 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001258 /**
1259 * Could not get ListenInterval value
1260 * from CFG. Log error.
1261 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001262 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301263 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001264 return;
Varun Reddy Yeturuea6bd082013-01-28 10:31:22 -08001265 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001266 }
1267 else
1268 {
Jeff Johnson278b0492013-04-03 14:10:08 -07001269 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 {
1271 /**
1272 * Could not get ListenInterval value
1273 * from CFG. Log error.
1274 */
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001275 limLog(pMac, LOGE, FL("could not retrieve ListenInterval"));
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301276 vos_mem_free(pMlmReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 return;
1278 }
1279 }
1280 if (limSetLinkState(pMac, eSIR_LINK_PREASSOC_STATE, psessionEntry->bssId,
Jeff Johnson278b0492013-04-03 14:10:08 -07001281 psessionEntry->selfMacAddr, NULL, NULL) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001282 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301283 vos_mem_free(pMlmReassocReq);
Jeff Johnson278b0492013-04-03 14:10:08 -07001284 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07001285 }
1286
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 pMlmReassocReq->listenInterval = (tANI_U16) val;
1288
1289 psessionEntry->pLimMlmReassocReq = pMlmReassocReq;
1290
1291
1292 //we need to defer the message until we get the response back from HAL.
1293 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnson278b0492013-04-03 14:10:08 -07001294
Jeff Johnson295189b2012-06-20 16:38:30 -07001295 msgQ.type = SIR_HAL_ADD_BSS_REQ;
1296 msgQ.reserved = 0;
1297 msgQ.bodyptr = pMac->ft.ftPEContext.pAddBssReq;
1298 msgQ.bodyval = 0;
1299
1300
1301#if defined WLAN_FEATURE_VOWIFI_11R_DEBUG
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001302 limLog( pMac, LOG1, FL( "Sending SIR_HAL_ADD_BSS_REQ..." ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001303#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001304 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001305
1306 retCode = wdaPostCtrlMsg( pMac, &msgQ );
Jeff Johnson278b0492013-04-03 14:10:08 -07001307 if( eSIR_SUCCESS != retCode)
Jeff Johnson295189b2012-06-20 16:38:30 -07001308 {
1309 vos_mem_free(pMac->ft.ftPEContext.pAddBssReq);
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001310 limLog( pMac, LOGE, FL("Posting ADD_BSS_REQ to HAL failed, reason=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001311 retCode );
1312 }
1313 // Dont need this anymore
1314 pMac->ft.ftPEContext.pAddBssReq = NULL;
1315 return;
1316}
1317
1318/*------------------------------------------------------------------
1319 *
1320 * This function is called if preauth response is not received from the AP
1321 * within this timeout while FT in progress
1322 *
1323 *------------------------------------------------------------------*/
1324void limProcessFTPreauthRspTimeout(tpAniSirGlobal pMac)
1325{
1326 tpPESession psessionEntry;
1327
1328 // We have failed pre auth. We need to resume link and get back on
1329 // home channel.
Madan Mohan Koyyalamudi67b82f62013-06-21 18:35:53 +05301330 limLog(pMac, LOG1, FL("FT Pre-Auth Time Out!!!!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001331
1332 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimFTPreAuthRspTimer.sessionId))== NULL)
1333 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001334 limLog(pMac, LOGE, FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 return;
1336 }
1337
1338 // Ok, so attempted at Pre-Auth and failed. If we are off channel. We need
1339 // to get back.
1340 limHandleFTPreAuthRsp(pMac, eSIR_FAILURE, NULL, 0, psessionEntry);
1341}
1342
1343
1344/*------------------------------------------------------------------
1345 *
1346 * This function is called to process the update key request from SME
1347 *
1348 *------------------------------------------------------------------*/
1349tANI_BOOLEAN limProcessFTUpdateKey(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1350{
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301351 tAddBssParams * pAddBssParams;
1352 tSirFTUpdateKeyInfo * pKeyInfo;
1353 tANI_U32 val = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07001354
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301355 /* Sanity Check */
1356 if( pMac == NULL || pMsgBuf == NULL )
1357 {
1358 return TRUE;
1359 }
1360 if(pMac->ft.ftPEContext.pAddBssReq == NULL)
1361 {
1362 limLog( pMac, LOGE,
1363 FL( "pAddBssReq is NULL" ));
1364 return TRUE;
1365 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001366
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301367 pAddBssParams = pMac->ft.ftPEContext.pAddBssReq;
1368 pKeyInfo = (tSirFTUpdateKeyInfo *)pMsgBuf;
Jeff Johnson295189b2012-06-20 16:38:30 -07001369
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301370 /* Store the key information in the ADD BSS parameters */
1371 pAddBssParams->extSetStaKeyParamValid = 1;
1372 pAddBssParams->extSetStaKeyParam.encType = pKeyInfo->keyMaterial.edType;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301373 vos_mem_copy((tANI_U8 *) &pAddBssParams->extSetStaKeyParam.key,
1374 (tANI_U8 *) &pKeyInfo->keyMaterial.key, sizeof(tSirKeys));
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301375 if(eSIR_SUCCESS != wlan_cfgGetInt(pMac, WNI_CFG_SINGLE_TID_RC, &val))
1376 {
1377 limLog( pMac, LOGP, FL( "Unable to read WNI_CFG_SINGLE_TID_RC" ));
1378 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001379
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301380 pAddBssParams->extSetStaKeyParam.singleTidRc = val;
1381 PELOG1(limLog(pMac, LOG1, FL("Key valid %d"),
1382 pAddBssParams->extSetStaKeyParamValid,
1383 pAddBssParams->extSetStaKeyParam.key[0].keyLength);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001384
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301385 pAddBssParams->extSetStaKeyParam.staIdx = 0;
1386
1387 PELOG1(limLog(pMac, LOG1,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001388 FL("BSSID = "MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pKeyInfo->bssId));)
Gopichand Nakkala3d295922013-05-07 16:19:14 +05301389
1390 if(pAddBssParams->extSetStaKeyParam.key[0].keyLength == 16)
1391 {
1392 PELOG1(limLog(pMac, LOG1,
1393 FL("BSS key = %02X-%02X-%02X-%02X-%02X-%02X-%02X- "
1394 "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X"),
1395 pAddBssParams->extSetStaKeyParam.key[0].key[0],
1396 pAddBssParams->extSetStaKeyParam.key[0].key[1],
1397 pAddBssParams->extSetStaKeyParam.key[0].key[2],
1398 pAddBssParams->extSetStaKeyParam.key[0].key[3],
1399 pAddBssParams->extSetStaKeyParam.key[0].key[4],
1400 pAddBssParams->extSetStaKeyParam.key[0].key[5],
1401 pAddBssParams->extSetStaKeyParam.key[0].key[6],
1402 pAddBssParams->extSetStaKeyParam.key[0].key[7],
1403 pAddBssParams->extSetStaKeyParam.key[0].key[8],
1404 pAddBssParams->extSetStaKeyParam.key[0].key[9],
1405 pAddBssParams->extSetStaKeyParam.key[0].key[10],
1406 pAddBssParams->extSetStaKeyParam.key[0].key[11],
1407 pAddBssParams->extSetStaKeyParam.key[0].key[12],
1408 pAddBssParams->extSetStaKeyParam.key[0].key[13],
1409 pAddBssParams->extSetStaKeyParam.key[0].key[14],
1410 pAddBssParams->extSetStaKeyParam.key[0].key[15]);)
1411 }
1412
1413 return TRUE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001414}
1415
1416tSirRetStatus
1417limProcessFTAggrQosReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf )
1418{
1419 tSirMsgQ msg;
1420 tSirAggrQosReq * aggrQosReq = (tSirAggrQosReq *)pMsgBuf;
1421 tpAggrAddTsParams pAggrAddTsParam;
1422 tpPESession psessionEntry = NULL;
1423 tpLimTspecInfo tspecInfo;
1424 tANI_U8 ac;
1425 tpDphHashNode pSta;
1426 tANI_U16 aid;
1427 tANI_U8 sessionId;
1428 int i;
1429
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301430 pAggrAddTsParam = vos_mem_malloc(sizeof(tAggrAddTsParams));
1431 if (NULL == pAggrAddTsParam)
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301433 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 return eSIR_MEM_ALLOC_FAILED;
1435 }
1436
1437 psessionEntry = peFindSessionByBssid(pMac, aggrQosReq->bssId, &sessionId);
1438
1439 if (psessionEntry == NULL) {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001440 PELOGE(limLog(pMac, LOGE, FL("psession Entry Null for sessionId = %d"), aggrQosReq->sessionId);)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301441 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 return eSIR_FAILURE;
1443 }
1444
1445 pSta = dphLookupHashEntry(pMac, aggrQosReq->bssId, &aid, &psessionEntry->dph.dphHashTable);
1446 if (pSta == NULL)
1447 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001448 PELOGE(limLog(pMac, LOGE, FL("Station context not found - ignoring AddTsRsp"));)
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301449 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 return eSIR_FAILURE;
1451 }
1452
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301453 vos_mem_set((tANI_U8 *)pAggrAddTsParam,
1454 sizeof(tAggrAddTsParams), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 pAggrAddTsParam->staIdx = psessionEntry->staId;
1456 // Fill in the sessionId specific to PE
1457 pAggrAddTsParam->sessionId = sessionId;
1458 pAggrAddTsParam->tspecIdx = aggrQosReq->aggrInfo.tspecIdx;
1459
1460 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1461 {
1462 if (aggrQosReq->aggrInfo.tspecIdx & (1<<i))
1463 {
1464 tSirMacTspecIE *pTspec = &aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1465 /* Since AddTS response was successful, check for the PSB flag
1466 * and directional flag inside the TS Info field.
1467 * An AC is trigger enabled AC if the PSB subfield is set to 1
1468 * in the uplink direction.
1469 * An AC is delivery enabled AC if the PSB subfield is set to 1
1470 * in the downlink direction.
1471 * An AC is trigger and delivery enabled AC if the PSB subfield
1472 * is set to 1 in the bi-direction field.
1473 */
1474 if (pTspec->tsinfo.traffic.psb == 1)
1475 {
1476 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, SET_UAPSD_MASK);
1477 }
1478 else
1479 {
1480 limSetTspecUapsdMask(pMac, &pTspec->tsinfo, CLEAR_UAPSD_MASK);
1481 }
1482 /* ADDTS success, so AC is now admitted. We shall now use the default
1483 * EDCA parameters as advertised by AP and send the updated EDCA params
1484 * to HAL.
1485 */
1486 ac = upToAc(pTspec->tsinfo.traffic.userPrio);
1487 if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_UPLINK)
1488 {
1489 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1490 }
1491 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_DNLINK)
1492 {
1493 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1494 }
1495 else if(pTspec->tsinfo.traffic.direction == SIR_MAC_DIRECTION_BIDIR)
1496 {
1497 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] |= (1 << ac);
1498 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] |= (1 << ac);
1499 }
1500
1501 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
1502
1503 if (pSta->aniPeer == eANI_BOOLEAN_TRUE)
1504 {
1505 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_TRUE);
1506 }
1507 else
1508 {
1509 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pSta->bssId, eANI_BOOLEAN_FALSE);
1510 }
1511
1512 if(eSIR_SUCCESS != limTspecAdd(pMac, pSta->staAddr, pSta->assocId, pTspec, 0, &tspecInfo))
1513 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001514 PELOGE(limLog(pMac, LOGE, FL("Adding entry in lim Tspec Table failed "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 pMac->lim.gLimAddtsSent = false;
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301516 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001517 return eSIR_FAILURE; //Error handling. send the response with error status. need to send DelTS to tear down the TSPEC status.
1518 }
1519
1520 // Copy the TSPEC paramters
1521 pAggrAddTsParam->tspec[i] = aggrQosReq->aggrInfo.aggrAddTsInfo[i].tspec;
1522 }
1523 }
1524
1525 msg.type = WDA_AGGR_QOS_REQ;
1526 msg.bodyptr = pAggrAddTsParam;
1527 msg.bodyval = 0;
1528
1529 /* We need to defer any incoming messages until we get a
1530 * WDA_AGGR_QOS_RSP from HAL.
1531 */
1532 SET_LIM_PROCESS_DEFD_MESGS(pMac, false);
Jeff Johnsone7245742012-09-05 17:12:55 -07001533 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07001534
1535 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
1536 {
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001537 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001538 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301539 vos_mem_free(pAggrAddTsParam);
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 return eSIR_FAILURE;
1541 }
1542
1543 return eSIR_SUCCESS;
1544}
1545
1546void
1547limFTSendAggrQosRsp(tpAniSirGlobal pMac, tANI_U8 rspReqd,
1548 tpAggrAddTsParams aggrQosRsp, tANI_U8 smesessionId)
1549{
1550 tpSirAggrQosRsp rsp;
1551 int i = 0;
1552
1553 if (! rspReqd)
1554 {
1555 return;
1556 }
1557
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301558 rsp = vos_mem_malloc(sizeof(tSirAggrQosRsp));
1559 if (NULL == rsp)
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301561 limLog(pMac, LOGP, FL("AllocateMemory failed for tSirAggrQosRsp"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001562 return;
1563 }
1564
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301565 vos_mem_set((tANI_U8 *) rsp, sizeof(*rsp), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001566 rsp->messageType = eWNI_SME_FT_AGGR_QOS_RSP;
1567 rsp->sessionId = smesessionId;
1568 rsp->length = sizeof(*rsp);
1569 rsp->aggrInfo.tspecIdx = aggrQosRsp->tspecIdx;
1570
1571 for( i = 0; i < SIR_QOS_NUM_AC_MAX; i++ )
1572 {
1573 if( (1 << i) & aggrQosRsp->tspecIdx )
1574 {
1575 rsp->aggrInfo.aggrRsp[i].status = aggrQosRsp->status[i];
1576 rsp->aggrInfo.aggrRsp[i].tspec = aggrQosRsp->tspec[i];
1577 }
1578 }
1579
1580 limSendSmeAggrQosRsp(pMac, rsp, smesessionId);
1581 return;
1582}
1583
1584
1585void limProcessFTAggrQoSRsp(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1586{
1587 tpAggrAddTsParams pAggrQosRspMsg = NULL;
1588 //tpAggrQosParams pAggrQosRspMsg = NULL;
1589 tAddTsParams addTsParam = {0};
1590 tpDphHashNode pSta = NULL;
1591 tANI_U16 assocId =0;
1592 tSirMacAddr peerMacAddr;
1593 tANI_U8 rspReqd = 1;
1594 tpPESession psessionEntry = NULL;
1595 int i = 0;
1596
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001597 PELOG1(limLog(pMac, LOG1, FL(" Received AGGR_QOS_RSP from HAL"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001598
1599 /* Need to process all the deferred messages enqueued since sending the
1600 SIR_HAL_AGGR_ADD_TS_REQ */
1601 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1602
1603 pAggrQosRspMsg = (tpAggrAddTsParams) (limMsg->bodyptr);
1604 if (NULL == pAggrQosRspMsg)
1605 {
1606 PELOGE(limLog(pMac, LOGE, FL("NULL pAggrQosRspMsg"));)
1607 return;
1608 }
1609
1610 psessionEntry = peFindSessionBySessionId(pMac, pAggrQosRspMsg->sessionId);
1611 if (NULL == psessionEntry)
1612 {
1613 // Cant find session entry
Kiran Kumar Lokere80007262013-03-18 19:45:50 -07001614 PELOGE(limLog(pMac, LOGE, FL("Cant find session entry for %s"), __func__);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 if( pAggrQosRspMsg != NULL )
1616 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301617 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 }
1619 return;
1620 }
1621
1622 for( i = 0; i < HAL_QOS_NUM_AC_MAX; i++ )
1623 {
1624 if((((1 << i) & pAggrQosRspMsg->tspecIdx)) &&
1625 (pAggrQosRspMsg->status[i] != eHAL_STATUS_SUCCESS))
1626 {
1627 /* send DELTS to the station */
1628 sirCopyMacAddr(peerMacAddr,psessionEntry->bssId);
1629
1630 addTsParam.staIdx = pAggrQosRspMsg->staIdx;
1631 addTsParam.sessionId = pAggrQosRspMsg->sessionId;
1632 addTsParam.tspec = pAggrQosRspMsg->tspec[i];
1633 addTsParam.tspecIdx = pAggrQosRspMsg->tspecIdx;
1634
1635 limSendDeltsReqActionFrame(pMac, peerMacAddr, rspReqd,
1636 &addTsParam.tspec.tsinfo,
1637 &addTsParam.tspec, psessionEntry);
1638
1639 pSta = dphLookupAssocId(pMac, addTsParam.staIdx, &assocId,
1640 &psessionEntry->dph.dphHashTable);
1641 if (pSta != NULL)
1642 {
1643 limAdmitControlDeleteTS(pMac, assocId, &addTsParam.tspec.tsinfo,
1644 NULL, (tANI_U8 *)&addTsParam.tspecIdx);
1645 }
1646 }
1647 }
1648
1649 /* Send the Aggr QoS response to SME */
1650
1651 limFTSendAggrQosRsp(pMac, rspReqd, pAggrQosRspMsg,
1652 psessionEntry->smeSessionId);
1653 if( pAggrQosRspMsg != NULL )
1654 {
Bansidhar Gopalachari3999e2e2013-07-12 10:57:01 +05301655 vos_mem_free(pAggrQosRspMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 }
1657 return;
1658}
1659
Jeff Johnson295189b2012-06-20 16:38:30 -07001660#endif /* WLAN_FEATURE_VOWIFI_11R */