blob: 16a0a0a2bb39b76e06d5e0ec9584d230f24af236 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -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.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Varun Reddy Yeturu08614702013-04-15 21:58:13 -070041
42
Jeff Johnson295189b2012-06-20 16:38:30 -070043/*
44 * Airgo Networks, Inc proprietary. All rights reserved.
45 * This file schBeaconProcess.cc contains beacon processing related
46 * functions
47 *
48 * Author: Sandesh Goel
49 * Date: 02/25/02
50 * History:-
51 * Date Modified by Modification Information
52 * --------------------------------------------------------------------
53 *
54 */
55
56#include "palTypes.h"
Jeff Johnson487b4022013-02-27 17:53:55 -080057#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070058
59#include "cfgApi.h"
60#include "pmmApi.h"
61#include "limApi.h"
62#include "utilsApi.h"
63#include "schDebug.h"
64#include "schApi.h"
65
Jeff Johnson295189b2012-06-20 16:38:30 -070066
67#include "limUtils.h"
68#include "limSendMessages.h"
69#include "limStaHashApi.h"
70
71#if defined WLAN_FEATURE_VOWIFI
72#include "rrmApi.h"
73#endif
74
75#ifdef FEATURE_WLAN_DIAG_SUPPORT
76#include "vos_diag_core_log.h"
77#endif //FEATURE_WLAN_DIAG_SUPPORT
78
79/**
80 * Number of bytes of variation in beacon length from the last beacon
81 * to trigger reprogramming of rx delay register
82 */
83#define SCH_BEACON_LEN_DELTA 3
84
85// calculate 2^cw - 1
86#define CW_GET(cw) (((cw) == 0) ? 1 : ((1 << (cw)) - 1))
87
88static void
89ap_beacon_process(
90 tpAniSirGlobal pMac,
91 tANI_U8* pRxPacketInfo,
92 tpSchBeaconStruct pBcnStruct,
93 tpUpdateBeaconParams pBeaconParams,
94 tpPESession psessionEntry)
95{
96 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
97 tANI_U32 phyMode;
98 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
99 //Get RF band from psessionEntry
100 rfBand = psessionEntry->limRFBand;
101
102 limGetPhyMode(pMac, &phyMode, psessionEntry);
103
104 if(SIR_BAND_5_GHZ == rfBand)
105 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700106 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 {
108 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
109 {
110 //11a (non HT) AP overlaps or
111 //HT AP with HT op mode as mixed overlaps.
112 //HT AP with HT op mode as overlap legacy overlaps.
113 if ((!pBcnStruct->HTInfo.present) ||
114 (eSIR_HT_OP_MODE_MIXED == pBcnStruct->HTInfo.opMode) ||
115 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode))
116 {
117 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11aParams));
118
119 if (pMac->lim.gLimOverlap11aParams.numSta &&
120 !pMac->lim.gLimOverlap11aParams.protectionEnabled)
121 {
122 limEnable11aProtection(pMac, true, true, pBeaconParams,psessionEntry);
123 }
124 }
125 //HT AP with HT20 op mode overlaps.
126 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
127 {
128 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
129
130 if (pMac->lim.gLimOverlapHt20Params.numSta &&
131 !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
132 {
133 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
134 }
135 }
136 }
137 }
138 }
139 else if(SIR_BAND_2_4_GHZ == rfBand)
140 {
141 //We are 11G AP.
142 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700143 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -0700144 {
145 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
146 {
147 if (((!(pBcnStruct->erpPresent)) &&
148 !(pBcnStruct->HTInfo.present))||
149 //if erp not present then 11B AP overlapping
150 (pBcnStruct->erpPresent &&
151 (pBcnStruct->erpIEInfo.useProtection ||
152 pBcnStruct->erpIEInfo.nonErpPresent)))
153 {
154#ifdef FEATURE_WLAN_CCX
155 if( psessionEntry->isCCXconnection )
156 {
157 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700158 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 pBcnStruct->erpPresent,
160 pBcnStruct->erpIEInfo.useProtection,
161 pBcnStruct->erpIEInfo.nonErpPresent);
162 }
163#endif
164 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
165 }
166
167 }
168 }
169 // handling the case when HT AP has overlapping legacy BSS.
Jeff Johnsone7245742012-09-05 17:12:55 -0700170 else if(psessionEntry->htCapability)
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700171 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
173 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700174 if (((!(pBcnStruct->erpPresent)) &&
175 !(pBcnStruct->HTInfo.present))||
176 //if erp not present then 11B AP overlapping
177 (pBcnStruct->erpPresent &&
178 (pBcnStruct->erpIEInfo.useProtection ||
179 pBcnStruct->erpIEInfo.nonErpPresent)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700180 {
181#ifdef FEATURE_WLAN_CCX
182 if( psessionEntry->isCCXconnection )
183 {
184 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700185 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d", __func__,
Jeff Johnson295189b2012-06-20 16:38:30 -0700186 pBcnStruct->erpPresent,
187 pBcnStruct->erpIEInfo.useProtection,
188 pBcnStruct->erpIEInfo.nonErpPresent);
189 }
190#endif
191 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
192 }
193
194 //11g device overlaps
195 if (pBcnStruct->erpPresent &&
196 !(pBcnStruct->erpIEInfo.useProtection ||
197 pBcnStruct->erpIEInfo.nonErpPresent) && !(pBcnStruct->HTInfo.present))
198 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700199 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
200
201 if (psessionEntry->gLimOverlap11gParams.numSta &&
202 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700203 {
204 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
205 }
206 }
207
208 //ht device overlaps.
209 //here we will check for HT related devices only which might need protection.
210 //check for 11b and 11g is already done in the previous blocks.
211 //so we will not check for HT operating mode as MIXED.
212 if (pBcnStruct->HTInfo.present)
213 {
214 //if we are not already in mixed mode or legacy mode as HT operating mode
215 //and received beacon has HT operating mode as legacy
216 //then we need to enable protection from 11g station.
217 //we don't need protection from 11b because if that's needed then our operating
218 //mode would have already been set to legacy in the previous blocks.
219 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
220 {
221 if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
222 (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
223 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700224 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
225 if (psessionEntry->gLimOverlap11gParams.numSta &&
226 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700227 {
228 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
229 }
230 }
231 }
232 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
233 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700234 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlapHt20Params));
235 if (psessionEntry->gLimOverlapHt20Params.numSta &&
236 !psessionEntry->gLimOverlapHt20Params.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700237 {
238 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
239 }
240 }
241 }
242
243 }
244 }
245 }
246 pMac->sch.gSchBcnIgnored++;
247}
248// --------------------------------------------------------------------
249
250
251
252
253/**
254 * __schBeaconProcessNoSession
255 *
256 * FUNCTION:
257 * Process the received beacon frame when
258 * -- Station is not scanning
259 * -- No corresponding session is found
260 *
261 * LOGIC:
262 * Following scenarios exist when Session Does not exist:
263 * * IBSS Beacons, when IBSS session already exists with same SSID,
264 * but from STA which has not yet joined and has a different BSSID.
265 * - invoke limHandleIBSScoalescing with the session context of existing IBSS session.
266 *
267 * * IBSS Beacons when IBSS session does not exist, only Infra or BT-AMP session exists,
268 * then save the beacon in the scan results and throw it away.
269 *
270 * * Infra Beacons
271 * - beacons received when no session active
272 * should not come here, it should be handled as part of scanning,
273 * else they should not be getting received, should update scan results and drop it if that happens.
274 * - beacons received when IBSS session active:
275 * update scan results and drop it.
276 * - beacons received when Infra session(STA) is active:
277 * update scan results and drop it
278 * - beacons received when BT-STA session is active:
279 * update scan results and drop it.
280 * - beacons received when Infra/BT-STA or Infra/IBSS is active.
281 * update scan results and drop it.
282 *
283
284 */
285static void __schBeaconProcessNoSession(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,tANI_U8* pRxPacketInfo)
286{
287 tpPESession psessionEntry = NULL;
288
289 if( (psessionEntry = limIsIBSSSessionActive(pMac)) != NULL)
290 {
291 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
292 }
293
294 //If station(STA/BT-STA/BT-AP/IBSS) mode, Always save the beacon in the scan results, if atleast one session is active
295 //schBeaconProcessNoSession will be called only when there is atleast one session active, so not checking
296 //it again here.
297 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
298 return;
299}
300
301
302
303/*
304 * __schBeaconProcessForSession
305 *
306 * FUNCTION:
307 * Process the received beacon frame when
308 * -- Station is not scanning
309 * -- Corresponding session is found
310 *
311 * LOGIC:
312 * Following scenarios exist when Session exists
313 * * IBSS STA receving beacons from IBSS Peers, who are part of IBSS.
314 * - call limHandleIBSScoalescing with that session context.
315 * * Infra STA receving beacons from AP to which it is connected
316 * - call schBeaconProcessFromAP with that session's context.
317 * * BTAMP STA receving beacons from BTAMP AP
318 * - call schBeaconProcessFromAP with that session's context.
319 * * BTAMP AP receiving beacons from BTAMP STA
320 * (here need to make sure BTAP creates session entry for BT STA)
321 * - just update the beacon count for heart beat purposes for now,
322 * for now, don't process the beacon.
323 * * Infra/IBSS both active and receives IBSS beacon:
324 * - call limHandleIBSScoalescing with that session context.
325 * * Infra/IBSS both active and receives Infra beacon:
326 * - call schBeaconProcessFromAP with that session's context.
327 * any updates to EDCA parameters will be effective for IBSS as well,
328 * even though no WMM for IBSS ?? Need to figure out how to handle this scenario.
329 * * Infra/BTSTA both active and receive Infra beacon.
330 * - change in EDCA parameters on Infra affect the BTSTA link.
331 * Update the same parameters on BT link
332 * * Infra/BTSTA both active and receive BT-AP beacon.
333 * -update beacon cnt for heartbeat
334 * * Infra/BTAP both active and receive Infra beacon.
335 * - BT-AP starts advertising BE parameters from Infra AP, if they get changed.
336 *
337 * * Infra/BTAP both active and receive BTSTA beacon.
338 * - update beacon cnt for heartbeat
339 */
340
341static void __schBeaconProcessForSession( tpAniSirGlobal pMac,
342 tpSchBeaconStruct pBeacon,
343 tANI_U8* pRxPacketInfo,
344 tpPESession psessionEntry)
345{
346 tANI_U32 bi;
347 tANI_U8 bssIdx = 0;
348 //tpSirMacMgmtHdr pMh = SIR_MAC_BD_TO_MPDUHEADER(pRxPacketInfo);
349 //tANI_U8 bssid[sizeof(tSirMacAddr)];
350 tUpdateBeaconParams beaconParams;
351 tANI_U8 sendProbeReq = FALSE;
352 tpDphHashNode pStaDs = NULL;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700353#ifdef WLAN_FEATURE_11AC
354 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
355 tANI_U16 aid;
356 tANI_U8 operMode;
357#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700358
359
360 beaconParams.paramChangeBitmap = 0;
361
362 if(eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
363 {
364 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
365 }
366 else if( (eLIM_STA_ROLE == psessionEntry->limSystemRole) ||
367 (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
368 {
369 /*
370 * This handles two cases:
371 * -- Infra STA receving beacons from AP
372 * -- BTAMP_STA receving beacons from BTAMP_AP
373 */
374
375
376 //Always save the beacon into LIM's cached scan results
377 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
378
379 /**
380 * This is the Beacon received from the AP we're currently associated with. Check
381 * if there are any changes in AP's capabilities
382 */
383 if((tANI_U8) pBeacon->channelNumber != psessionEntry->currentOperChannel)
384 {
385 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700386 "Ignoring beacon!"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 psessionEntry->currentOperChannel, pBeacon->channelNumber);)
388 goto fail;
389 }
390 limDetectChangeInApCapabilities(pMac, pBeacon, psessionEntry);
391 if(limGetStaHashBssidx(pMac, DPH_STA_HASH_INDEX_PEER, &bssIdx, psessionEntry) != eSIR_SUCCESS)
392 goto fail;
393 beaconParams.bssIdx = bssIdx;
394 palCopyMemory( pMac->hHdd, ( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) );
395 psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount;
396 psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod;
397 psessionEntry->currentBssBeaconCnt++;
398
399
400
Jeff Johnsone7245742012-09-05 17:12:55 -0700401 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
402 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700403
404 /* Read beacon interval session Entry */
405 bi = psessionEntry->beaconParams.beaconInterval;
406 if (bi != pBeacon->beaconInterval)
407 {
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700408 PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 pBeacon->beaconInterval, bi);)
410
411 bi = pBeacon->beaconInterval;
412 psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
413 beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
414 beaconParams.beaconInterval = (tANI_U16)bi;
415 }
416
417 if (pBeacon->cfPresent)
418 {
419 cfgSetInt(pMac, WNI_CFG_CFP_PERIOD, pBeacon->cfParamSet.cfpPeriod);
420 limSendCFParams(pMac, bssIdx, pBeacon->cfParamSet.cfpCount, pBeacon->cfParamSet.cfpPeriod);
421 }
422
423 if (pBeacon->timPresent)
424 {
425 cfgSetInt(pMac, WNI_CFG_DTIM_PERIOD, pBeacon->tim.dtimPeriod);
426 //No need to send DTIM Period and Count to HAL/SMAC
427 //SMAC already parses TIM bit.
428 }
429
430
431 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
432
433 limDecideStaProtection(pMac, pBeacon, &beaconParams, psessionEntry);
434 if (pBeacon->erpPresent)
435 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 if (pBeacon->erpIEInfo.barkerPreambleMode)
437 limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
438 else
439 limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 }
441 limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
442
443 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
444 if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
445 (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
446 {
447 if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
448 {
449 if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700450 PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700451 else if(pStaDs != NULL)
452 {
453 // If needed, downgrade the EDCA parameters
454 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
455
456 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
457 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
458 else
459 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
460 }
461 else
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700462 PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700463 }
464 }
465 else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
466 (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
467 sendProbeReq = TRUE;
468 }
469
Jeff Johnsone7245742012-09-05 17:12:55 -0700470 if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 {
472 limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
473 }
474
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
476 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
477 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 /* Channel Switch information element updated */
479 if(pBeacon->channelSwitchPresent ||
480 pBeacon->propIEinfo.propChannelSwitchPresent)
481 {
482 limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
483 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700484 else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700485 {
486 limCancelDot11hChannelSwitch(pMac, psessionEntry);
487 }
488 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700489
Mohit Khanna4a70d262012-09-11 16:30:12 -0700490#ifdef WLAN_FEATURE_11AC
491 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
492 {
493 // check for VHT capability
494 if(psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
495 {
496 pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid, &psessionEntry->dph.dphHashTable);
497 operMode = pStaDs->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pStaDs->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
498 if( operMode != pBeacon->OperatingMode.chanWidth)
499 {
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700500 PELOG1(limLog(pMac, LOG1, FL(" received Chanwidth %d, staIdx = %d"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700501 pBeacon->OperatingMode.chanWidth,
502 pStaDs->staIndex);)
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700503 PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700504 pMh->sa[0],
505 pMh->sa[1],
506 pMh->sa[2],
507 pMh->sa[3],
508 pMh->sa[4],
509 pMh->sa[5]);)
510
511 if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
512 {
513 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
514 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
515 }
516 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
517 {
518 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
519 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
520 }
521 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
522 {
523 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
524 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
525 }
526 limCheckVHTOpModeChange(pMac, psessionEntry, pBeacon->OperatingMode.chanWidth, pStaDs->staIndex);
527 }
528 }
529 }
530#endif
531
Jeff Johnson295189b2012-06-20 16:38:30 -0700532#if defined FEATURE_WLAN_CCX
533 if( psessionEntry->isCCXconnection )
534 {
535 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
536 if (pBeacon->ccxTxPwr.present)
537 {
538 localConstraint = pBeacon->ccxTxPwr.power_limit;
539 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700540 maxTxPower = limGetMaxTxPower(regMax, localConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700541
542 //If maxTxPower is increased or decreased
543 if( maxTxPower != psessionEntry->maxTxPower )
544 {
545 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
546 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
Jeff Johnsone7245742012-09-05 17:12:55 -0700547 if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 psessionEntry->maxTxPower = maxTxPower;
549 }
550 }
551 }
552#endif
553
554
555#if defined WLAN_FEATURE_VOWIFI
556 if( pMac->rrm.rrmPEContext.rrmEnable )
557 {
558 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
559 if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
560 {
561 localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
562 }
563 else
564 {
565 localConstraint = 0;
566 }
Gopichand Nakkalaaa340d72013-02-28 15:26:52 +0530567 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
568 //Get the maxTxPower in the range of 13 to 19
569 maxTxPower = rrmGetMinOfMaxTxPower(regMax, (regMax - localConstraint));
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 //If maxTxPower is increased or decreased
571 if( maxTxPower != psessionEntry->maxTxPower )
572 {
573#if defined WLAN_VOWIFI_DEBUG
574 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
575 limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
576#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700577 if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 psessionEntry->maxTxPower = maxTxPower;
579
580 }
581 }
582#endif
583
584 // Indicate to LIM that Beacon is received
585
586 if (pBeacon->HTInfo.present)
587 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
588 else
589 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
590
591 // I don't know if any additional IE is required here. Currently, not include addIE.
592 if(sendProbeReq)
593 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
594 psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
595 psessionEntry->dot11mode, 0, NULL);
596
Jeff Johnson295189b2012-06-20 16:38:30 -0700597 if(beaconParams.paramChangeBitmap)
598 {
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700599 PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. "), psessionEntry->peSessionId);)
600 PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
602 }
603
604fail:
605 return;
606
607}
608
609
610
611/**
612 * schBeaconProcess
613 *
614 * FUNCTION:
615 * Process the received beacon frame
616 *
617 * LOGIC:
618 *
619 * ASSUMPTIONS:
620 *
621 * NOTE:
622 *
623 * @param pRxPacketInfo pointer to buffer descriptor
624 * @return None
625 */
626
627void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
628{
629 static tSchBeaconStruct beaconStruct;
630 tUpdateBeaconParams beaconParams;
631 tpPESession pAPSession = NULL;
632 beaconParams.paramChangeBitmap = 0;
633
634 pMac->sch.gSchBcnRcvCnt++;
635
636 // Convert the beacon frame into a structure
637 if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
638 {
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700639 PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700640 pMac->sch.gSchBcnParseErrorCnt++;
641 return;
642 }
643
644 if (beaconStruct.ssidPresent)
645 {
646 beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
647 }
648
649 /*
650 * First process the beacon in the context of any existing AP or BTAP session.
651 * This takes cares of following two scenarios:
652 * - psessionEntry = NULL:
653 * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
654 * - psessionEntry is non NULL:
655 * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
656 * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
657 *
658 *
659 */
660
Varun Reddy Yeturu08614702013-04-15 21:58:13 -0700661 if (((pAPSession = limIsApSessionActive(pMac)) != NULL)
662#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
663 && (!(WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo)))
664#endif
665 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700666 {
667 beaconParams.bssIdx = pAPSession->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700668 if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700669 ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
670
671 if (beaconParams.paramChangeBitmap)
672 {
673 //Update the beacons and apply the new settings to HAL
674 schSetFixedBeaconFields(pMac, pAPSession);
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700675 PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. "), pAPSession->peSessionId);)
676 PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x "), beaconParams.paramChangeBitmap);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700677 limSendBeaconParams(pMac, &beaconParams, pAPSession);
678 }
679 }
680
681 /*
682 * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
683 */
684 if(psessionEntry == NULL)
685 {
686 __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
687 }
688 else
689 {
690 __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
691 }
692
693}
694
695
696
697
698
699// --------------------------------------------------------------------
700/**
701 * schBeaconEdcaProcess
702 *
703 * FUNCTION:
704 * Process the EDCA parameter set in the received beacon frame
705 *
706 * LOGIC:
707 *
708 * ASSUMPTIONS:
709 *
710 * NOTE:
711 *
712 * @param edca reference to edca parameters in beacon struct
713 * @return success
714 */
715
716tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
717{
718 tANI_U8 i;
719#ifdef FEATURE_WLAN_DIAG_SUPPORT
720 vos_log_qos_edca_pkt_type *log_ptr = NULL;
721#endif //FEATURE_WLAN_DIAG_SUPPORT
722
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700723 PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
725
726 psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
727 psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
728 psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
729 psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
730 psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
731//log: LOG_WLAN_QOS_EDCA_C
732#ifdef FEATURE_WLAN_DIAG_SUPPORT
733 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
734 if(log_ptr)
735 {
736 log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
737 log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
738 psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
739 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
740 log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
741 log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
742 psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
743 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
744 log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
745 log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
746 psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
747 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
748 log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
749 log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
750 psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
751 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
752 }
753 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
754#endif //FEATURE_WLAN_DIAG_SUPPORT
755 PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
756 for(i=0; i<MAX_NUM_AC; i++)
757 {
Kiran Kumar Lokere8ad8fbf2013-03-18 16:07:05 -0700758 PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 i,
760 psessionEntry->gLimEdcaParams[i].aci.aifsn,
761 psessionEntry->gLimEdcaParams[i].aci.acm,
762 psessionEntry->gLimEdcaParams[i].cw.min,
763 psessionEntry->gLimEdcaParams[i].cw.max,
764 psessionEntry->gLimEdcaParams[i].txoplimit);)
765 }
766
767 return eSIR_SUCCESS;
768}