blob: d6d56b74d3dd67f94a46bb6475f505aa82437848 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Jeff Johnson32d95a32012-09-10 13:15:23 -07002 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -07003 *
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
22/*
23 * Airgo Networks, Inc proprietary. All rights reserved.
24 * This file schBeaconProcess.cc contains beacon processing related
25 * functions
26 *
27 * Author: Sandesh Goel
28 * Date: 02/25/02
29 * History:-
30 * Date Modified by Modification Information
31 * --------------------------------------------------------------------
32 *
33 */
34
35#include "palTypes.h"
36#include "wniCfgAp.h"
37
38#include "cfgApi.h"
39#include "pmmApi.h"
40#include "limApi.h"
41#include "utilsApi.h"
42#include "schDebug.h"
43#include "schApi.h"
44
45#ifdef FEATURE_WLAN_NON_INTEGRATED_SOC
46#include "halCommonApi.h"
47#endif
48
49#include "limUtils.h"
50#include "limSendMessages.h"
51#include "limStaHashApi.h"
52
53#if defined WLAN_FEATURE_VOWIFI
54#include "rrmApi.h"
55#endif
56
57#ifdef FEATURE_WLAN_DIAG_SUPPORT
58#include "vos_diag_core_log.h"
59#endif //FEATURE_WLAN_DIAG_SUPPORT
60
61/**
62 * Number of bytes of variation in beacon length from the last beacon
63 * to trigger reprogramming of rx delay register
64 */
65#define SCH_BEACON_LEN_DELTA 3
66
67// calculate 2^cw - 1
68#define CW_GET(cw) (((cw) == 0) ? 1 : ((1 << (cw)) - 1))
69
70static void
71ap_beacon_process(
72 tpAniSirGlobal pMac,
73 tANI_U8* pRxPacketInfo,
74 tpSchBeaconStruct pBcnStruct,
75 tpUpdateBeaconParams pBeaconParams,
76 tpPESession psessionEntry)
77{
78 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
79 tANI_U32 phyMode;
80 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
81 //Get RF band from psessionEntry
82 rfBand = psessionEntry->limRFBand;
83
84 limGetPhyMode(pMac, &phyMode, psessionEntry);
85
86 if(SIR_BAND_5_GHZ == rfBand)
87 {
Jeff Johnsone7245742012-09-05 17:12:55 -070088 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -070089 {
90 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
91 {
92 //11a (non HT) AP overlaps or
93 //HT AP with HT op mode as mixed overlaps.
94 //HT AP with HT op mode as overlap legacy overlaps.
95 if ((!pBcnStruct->HTInfo.present) ||
96 (eSIR_HT_OP_MODE_MIXED == pBcnStruct->HTInfo.opMode) ||
97 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode))
98 {
99 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11aParams));
100
101 if (pMac->lim.gLimOverlap11aParams.numSta &&
102 !pMac->lim.gLimOverlap11aParams.protectionEnabled)
103 {
104 limEnable11aProtection(pMac, true, true, pBeaconParams,psessionEntry);
105 }
106 }
107 //HT AP with HT20 op mode overlaps.
108 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
109 {
110 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
111
112 if (pMac->lim.gLimOverlapHt20Params.numSta &&
113 !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
114 {
115 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
116 }
117 }
118 }
119 }
120 }
121 else if(SIR_BAND_2_4_GHZ == rfBand)
122 {
123 //We are 11G AP.
124 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700125 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 {
127 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
128 {
129 if (((!(pBcnStruct->erpPresent)) &&
130 !(pBcnStruct->HTInfo.present))||
131 //if erp not present then 11B AP overlapping
132 (pBcnStruct->erpPresent &&
133 (pBcnStruct->erpIEInfo.useProtection ||
134 pBcnStruct->erpIEInfo.nonErpPresent)))
135 {
136#ifdef FEATURE_WLAN_CCX
137 if( psessionEntry->isCCXconnection )
138 {
139 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
140 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
141 pBcnStruct->erpPresent,
142 pBcnStruct->erpIEInfo.useProtection,
143 pBcnStruct->erpIEInfo.nonErpPresent);
144 }
145#endif
146 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
147 }
148
149 }
150 }
151 // handling the case when HT AP has overlapping legacy BSS.
Jeff Johnsone7245742012-09-05 17:12:55 -0700152 else if(psessionEntry->htCapability)
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700153 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700154 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
155 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700156 if (((!(pBcnStruct->erpPresent)) &&
157 !(pBcnStruct->HTInfo.present))||
158 //if erp not present then 11B AP overlapping
159 (pBcnStruct->erpPresent &&
160 (pBcnStruct->erpIEInfo.useProtection ||
161 pBcnStruct->erpIEInfo.nonErpPresent)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700162 {
163#ifdef FEATURE_WLAN_CCX
164 if( psessionEntry->isCCXconnection )
165 {
166 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
167 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
168 pBcnStruct->erpPresent,
169 pBcnStruct->erpIEInfo.useProtection,
170 pBcnStruct->erpIEInfo.nonErpPresent);
171 }
172#endif
173 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
174 }
175
176 //11g device overlaps
177 if (pBcnStruct->erpPresent &&
178 !(pBcnStruct->erpIEInfo.useProtection ||
179 pBcnStruct->erpIEInfo.nonErpPresent) && !(pBcnStruct->HTInfo.present))
180 {
181#ifdef WLAN_SOFTAP_FEATURE
182 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
183
184 if (psessionEntry->gLimOverlap11gParams.numSta &&
185 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
186#else
187 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11gParams));
188
189 if (pMac->lim.gLimOverlap11gParams.numSta &&
190 !pMac->lim.gLimOverlap11gParams.protectionEnabled)
191#endif
192 {
193 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
194 }
195 }
196
197 //ht device overlaps.
198 //here we will check for HT related devices only which might need protection.
199 //check for 11b and 11g is already done in the previous blocks.
200 //so we will not check for HT operating mode as MIXED.
201 if (pBcnStruct->HTInfo.present)
202 {
203 //if we are not already in mixed mode or legacy mode as HT operating mode
204 //and received beacon has HT operating mode as legacy
205 //then we need to enable protection from 11g station.
206 //we don't need protection from 11b because if that's needed then our operating
207 //mode would have already been set to legacy in the previous blocks.
208 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
209 {
210 if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
211 (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
212 {
213#ifdef WLAN_SOFTAP_FEATURE
214 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
215 if (psessionEntry->gLimOverlap11gParams.numSta &&
216 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
217#else
218 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11gParams));
219
220 if (pMac->lim.gLimOverlap11gParams.numSta &&
221 !pMac->lim.gLimOverlap11gParams.protectionEnabled)
222#endif
223 {
224 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
225 }
226 }
227 }
228 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
229 {
230#ifdef WLAN_SOFTAP_FEATURE
231 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlapHt20Params));
232 if (psessionEntry->gLimOverlapHt20Params.numSta &&
233 !psessionEntry->gLimOverlapHt20Params.protectionEnabled)
234#else
235 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
236
237 if (pMac->lim.gLimOverlapHt20Params.numSta &&
238 !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
239#endif
240 {
241 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
242 }
243 }
244 }
245
246 }
247 }
248 }
249 pMac->sch.gSchBcnIgnored++;
250}
251// --------------------------------------------------------------------
252
253
254
255
256/**
257 * __schBeaconProcessNoSession
258 *
259 * FUNCTION:
260 * Process the received beacon frame when
261 * -- Station is not scanning
262 * -- No corresponding session is found
263 *
264 * LOGIC:
265 * Following scenarios exist when Session Does not exist:
266 * * IBSS Beacons, when IBSS session already exists with same SSID,
267 * but from STA which has not yet joined and has a different BSSID.
268 * - invoke limHandleIBSScoalescing with the session context of existing IBSS session.
269 *
270 * * IBSS Beacons when IBSS session does not exist, only Infra or BT-AMP session exists,
271 * then save the beacon in the scan results and throw it away.
272 *
273 * * Infra Beacons
274 * - beacons received when no session active
275 * should not come here, it should be handled as part of scanning,
276 * else they should not be getting received, should update scan results and drop it if that happens.
277 * - beacons received when IBSS session active:
278 * update scan results and drop it.
279 * - beacons received when Infra session(STA) is active:
280 * update scan results and drop it
281 * - beacons received when BT-STA session is active:
282 * update scan results and drop it.
283 * - beacons received when Infra/BT-STA or Infra/IBSS is active.
284 * update scan results and drop it.
285 *
286
287 */
288static void __schBeaconProcessNoSession(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,tANI_U8* pRxPacketInfo)
289{
290 tpPESession psessionEntry = NULL;
291
292 if( (psessionEntry = limIsIBSSSessionActive(pMac)) != NULL)
293 {
294 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
295 }
296
297 //If station(STA/BT-STA/BT-AP/IBSS) mode, Always save the beacon in the scan results, if atleast one session is active
298 //schBeaconProcessNoSession will be called only when there is atleast one session active, so not checking
299 //it again here.
300 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
301 return;
302}
303
304
305
306/*
307 * __schBeaconProcessForSession
308 *
309 * FUNCTION:
310 * Process the received beacon frame when
311 * -- Station is not scanning
312 * -- Corresponding session is found
313 *
314 * LOGIC:
315 * Following scenarios exist when Session exists
316 * * IBSS STA receving beacons from IBSS Peers, who are part of IBSS.
317 * - call limHandleIBSScoalescing with that session context.
318 * * Infra STA receving beacons from AP to which it is connected
319 * - call schBeaconProcessFromAP with that session's context.
320 * * BTAMP STA receving beacons from BTAMP AP
321 * - call schBeaconProcessFromAP with that session's context.
322 * * BTAMP AP receiving beacons from BTAMP STA
323 * (here need to make sure BTAP creates session entry for BT STA)
324 * - just update the beacon count for heart beat purposes for now,
325 * for now, don't process the beacon.
326 * * Infra/IBSS both active and receives IBSS beacon:
327 * - call limHandleIBSScoalescing with that session context.
328 * * Infra/IBSS both active and receives Infra beacon:
329 * - call schBeaconProcessFromAP with that session's context.
330 * any updates to EDCA parameters will be effective for IBSS as well,
331 * even though no WMM for IBSS ?? Need to figure out how to handle this scenario.
332 * * Infra/BTSTA both active and receive Infra beacon.
333 * - change in EDCA parameters on Infra affect the BTSTA link.
334 * Update the same parameters on BT link
335 * * Infra/BTSTA both active and receive BT-AP beacon.
336 * -update beacon cnt for heartbeat
337 * * Infra/BTAP both active and receive Infra beacon.
338 * - BT-AP starts advertising BE parameters from Infra AP, if they get changed.
339 *
340 * * Infra/BTAP both active and receive BTSTA beacon.
341 * - update beacon cnt for heartbeat
342 */
343
344static void __schBeaconProcessForSession( tpAniSirGlobal pMac,
345 tpSchBeaconStruct pBeacon,
346 tANI_U8* pRxPacketInfo,
347 tpPESession psessionEntry)
348{
349 tANI_U32 bi;
350 tANI_U8 bssIdx = 0;
351 //tpSirMacMgmtHdr pMh = SIR_MAC_BD_TO_MPDUHEADER(pRxPacketInfo);
352 //tANI_U8 bssid[sizeof(tSirMacAddr)];
353 tUpdateBeaconParams beaconParams;
354 tANI_U8 sendProbeReq = FALSE;
355 tpDphHashNode pStaDs = NULL;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700356#ifdef WLAN_FEATURE_11AC
357 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
358 tANI_U16 aid;
359 tANI_U8 operMode;
360#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700361
362
363 beaconParams.paramChangeBitmap = 0;
364
365 if(eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
366 {
367 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
368 }
369 else if( (eLIM_STA_ROLE == psessionEntry->limSystemRole) ||
370 (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
371 {
372 /*
373 * This handles two cases:
374 * -- Infra STA receving beacons from AP
375 * -- BTAMP_STA receving beacons from BTAMP_AP
376 */
377
378
379 //Always save the beacon into LIM's cached scan results
380 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
381
382 /**
383 * This is the Beacon received from the AP we're currently associated with. Check
384 * if there are any changes in AP's capabilities
385 */
386 if((tANI_U8) pBeacon->channelNumber != psessionEntry->currentOperChannel)
387 {
388 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
389 "Ignoring beacon!\n"),
390 psessionEntry->currentOperChannel, pBeacon->channelNumber);)
391 goto fail;
392 }
393 limDetectChangeInApCapabilities(pMac, pBeacon, psessionEntry);
394 if(limGetStaHashBssidx(pMac, DPH_STA_HASH_INDEX_PEER, &bssIdx, psessionEntry) != eSIR_SUCCESS)
395 goto fail;
396 beaconParams.bssIdx = bssIdx;
397 palCopyMemory( pMac->hHdd, ( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) );
398 psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount;
399 psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod;
400 psessionEntry->currentBssBeaconCnt++;
401
402
403
Jeff Johnsone7245742012-09-05 17:12:55 -0700404 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
405 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700406
407 /* Read beacon interval session Entry */
408 bi = psessionEntry->beaconParams.beaconInterval;
409 if (bi != pBeacon->beaconInterval)
410 {
411 PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d\n"),
412 pBeacon->beaconInterval, bi);)
413
414 bi = pBeacon->beaconInterval;
415 psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
416 beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
417 beaconParams.beaconInterval = (tANI_U16)bi;
418 }
419
420 if (pBeacon->cfPresent)
421 {
422 cfgSetInt(pMac, WNI_CFG_CFP_PERIOD, pBeacon->cfParamSet.cfpPeriod);
423 limSendCFParams(pMac, bssIdx, pBeacon->cfParamSet.cfpCount, pBeacon->cfParamSet.cfpPeriod);
424 }
425
426 if (pBeacon->timPresent)
427 {
428 cfgSetInt(pMac, WNI_CFG_DTIM_PERIOD, pBeacon->tim.dtimPeriod);
429 //No need to send DTIM Period and Count to HAL/SMAC
430 //SMAC already parses TIM bit.
431 }
432
433
434 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
435
436 limDecideStaProtection(pMac, pBeacon, &beaconParams, psessionEntry);
437 if (pBeacon->erpPresent)
438 {
439#ifdef WLAN_SOFTAP_FEATURE
440 if (pBeacon->erpIEInfo.barkerPreambleMode)
441 limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
442 else
443 limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
444#else
445 if (pBeacon->erpIEInfo.barkerPreambleMode)
446 limEnableShortPreamble(pMac, false, &beaconParams);
447 else
448 limEnableShortPreamble(pMac, true, &beaconParams);
449#endif
450 }
451 limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
452
453 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
454 if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
455 (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
456 {
457 if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
458 {
459 if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
460 PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
461 else if(pStaDs != NULL)
462 {
463 // If needed, downgrade the EDCA parameters
464 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
465
466 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
467 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
468 else
469 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
470 }
471 else
472 PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
473 }
474 }
475 else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
476 (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
477 sendProbeReq = TRUE;
478 }
479
Jeff Johnsone7245742012-09-05 17:12:55 -0700480 if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700481 {
482 limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
483 }
484
485#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
486 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
487 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
488 {
489 if(pBeacon->quietIEPresent)
490 {
491 limUpdateQuietIEFromBeacon(pMac, &(pBeacon->quietIE), psessionEntry);
492 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700493 else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
494 (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 {
496 PELOG1(limLog(pMac, LOG1, FL("Received a beacon without Quiet IE\n"));)
497 limCancelDot11hQuiet(pMac, psessionEntry);
498 }
499
500 /* Channel Switch information element updated */
501 if(pBeacon->channelSwitchPresent ||
502 pBeacon->propIEinfo.propChannelSwitchPresent)
503 {
504 limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
505 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700506 else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700507 {
508 limCancelDot11hChannelSwitch(pMac, psessionEntry);
509 }
510 }
511#endif
512
Mohit Khanna4a70d262012-09-11 16:30:12 -0700513#ifdef WLAN_FEATURE_11AC
514 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
515 {
516 // check for VHT capability
517 if(psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
518 {
519 pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid, &psessionEntry->dph.dphHashTable);
520 operMode = pStaDs->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pStaDs->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
521 if( operMode != pBeacon->OperatingMode.chanWidth)
522 {
523 PELOG1(limLog(pMac, LOG1, FL(" recevied Chanwidth %d, staIdx = %d\n"),
524 pBeacon->OperatingMode.chanWidth,
525 pStaDs->staIndex);)
526 PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x\n"),
527 pMh->sa[0],
528 pMh->sa[1],
529 pMh->sa[2],
530 pMh->sa[3],
531 pMh->sa[4],
532 pMh->sa[5]);)
533
534 if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
535 {
536 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
537 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
538 }
539 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
540 {
541 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
542 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
543 }
544 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
545 {
546 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
547 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
548 }
549 limCheckVHTOpModeChange(pMac, psessionEntry, pBeacon->OperatingMode.chanWidth, pStaDs->staIndex);
550 }
551 }
552 }
553#endif
554
Jeff Johnson295189b2012-06-20 16:38:30 -0700555#if defined FEATURE_WLAN_CCX
556 if( psessionEntry->isCCXconnection )
557 {
558 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
559 if (pBeacon->ccxTxPwr.present)
560 {
561 localConstraint = pBeacon->ccxTxPwr.power_limit;
562 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700563 maxTxPower = limGetMaxTxPower(regMax, localConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700564
565 //If maxTxPower is increased or decreased
566 if( maxTxPower != psessionEntry->maxTxPower )
567 {
568 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
569 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
Jeff Johnsone7245742012-09-05 17:12:55 -0700570 if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 psessionEntry->maxTxPower = maxTxPower;
572 }
573 }
574 }
575#endif
576
577
578#if defined WLAN_FEATURE_VOWIFI
579 if( pMac->rrm.rrmPEContext.rrmEnable )
580 {
581 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
582 if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
583 {
584 localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
585 }
586 else
587 {
588 localConstraint = 0;
589 }
590 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
591 maxTxPower = VOS_MIN( regMax , (regMax - localConstraint) );
592 //If maxTxPower is increased or decreased
593 if( maxTxPower != psessionEntry->maxTxPower )
594 {
595#if defined WLAN_VOWIFI_DEBUG
596 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
597 limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
598#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700599 if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 psessionEntry->maxTxPower = maxTxPower;
601
602 }
603 }
604#endif
605
606 // Indicate to LIM that Beacon is received
607
608 if (pBeacon->HTInfo.present)
609 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
610 else
611 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
612
613 // I don't know if any additional IE is required here. Currently, not include addIE.
614 if(sendProbeReq)
615 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
616 psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
617 psessionEntry->dot11mode, 0, NULL);
618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 if(beaconParams.paramChangeBitmap)
620 {
621 PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
622 PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
623 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
624 }
625
626fail:
627 return;
628
629}
630
631
632
633/**
634 * schBeaconProcess
635 *
636 * FUNCTION:
637 * Process the received beacon frame
638 *
639 * LOGIC:
640 *
641 * ASSUMPTIONS:
642 *
643 * NOTE:
644 *
645 * @param pRxPacketInfo pointer to buffer descriptor
646 * @return None
647 */
648
649void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
650{
651 static tSchBeaconStruct beaconStruct;
652 tUpdateBeaconParams beaconParams;
653 tpPESession pAPSession = NULL;
654 beaconParams.paramChangeBitmap = 0;
655
656 pMac->sch.gSchBcnRcvCnt++;
657
658 // Convert the beacon frame into a structure
659 if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
660 {
661 PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed\n"));)
662 pMac->sch.gSchBcnParseErrorCnt++;
663 return;
664 }
665
666 if (beaconStruct.ssidPresent)
667 {
668 beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
669 }
670
671 /*
672 * First process the beacon in the context of any existing AP or BTAP session.
673 * This takes cares of following two scenarios:
674 * - psessionEntry = NULL:
675 * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
676 * - psessionEntry is non NULL:
677 * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
678 * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
679 *
680 *
681 */
682
683 if((pAPSession = limIsApSessionActive(pMac)) != NULL)
684 {
685 beaconParams.bssIdx = pAPSession->bssIdx;
686#ifdef WLAN_SOFTAP_FEATURE
687 if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
688#else
689 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
690#endif
691 ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
692
693 if (beaconParams.paramChangeBitmap)
694 {
695 //Update the beacons and apply the new settings to HAL
696 schSetFixedBeaconFields(pMac, pAPSession);
697 PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. \n"), pAPSession->peSessionId);)
698 PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
699 limSendBeaconParams(pMac, &beaconParams, pAPSession);
700 }
701 }
702
703 /*
704 * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
705 */
706 if(psessionEntry == NULL)
707 {
708 __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
709 }
710 else
711 {
712 __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
713 }
714
715}
716
717
718
719
720
721// --------------------------------------------------------------------
722/**
723 * schBeaconEdcaProcess
724 *
725 * FUNCTION:
726 * Process the EDCA parameter set in the received beacon frame
727 *
728 * LOGIC:
729 *
730 * ASSUMPTIONS:
731 *
732 * NOTE:
733 *
734 * @param edca reference to edca parameters in beacon struct
735 * @return success
736 */
737
738tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
739{
740 tANI_U8 i;
741#ifdef FEATURE_WLAN_DIAG_SUPPORT
742 vos_log_qos_edca_pkt_type *log_ptr = NULL;
743#endif //FEATURE_WLAN_DIAG_SUPPORT
744
745 PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d\n"),
746 psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
747
748 psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
749 psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
750 psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
751 psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
752 psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
753//log: LOG_WLAN_QOS_EDCA_C
754#ifdef FEATURE_WLAN_DIAG_SUPPORT
755 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
756 if(log_ptr)
757 {
758 log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
759 log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
760 psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
761 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
762 log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
763 log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
764 psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
765 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
766 log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
767 log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
768 psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
769 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
770 log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
771 log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
772 psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
773 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
774 }
775 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
776#endif //FEATURE_WLAN_DIAG_SUPPORT
777 PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
778 for(i=0; i<MAX_NUM_AC; i++)
779 {
780 PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"),
781 i,
782 psessionEntry->gLimEdcaParams[i].aci.aifsn,
783 psessionEntry->gLimEdcaParams[i].aci.acm,
784 psessionEntry->gLimEdcaParams[i].cw.min,
785 psessionEntry->gLimEdcaParams[i].cw.max,
786 psessionEntry->gLimEdcaParams[i].txoplimit);)
787 }
788
789 return eSIR_SUCCESS;
790}