blob: 3997d9560a87118b50a9af825494f1e65025cce3 [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;
356
357
358 beaconParams.paramChangeBitmap = 0;
359
360 if(eLIM_STA_IN_IBSS_ROLE == psessionEntry->limSystemRole )
361 {
362 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
363 }
364 else if( (eLIM_STA_ROLE == psessionEntry->limSystemRole) ||
365 (eLIM_BT_AMP_STA_ROLE == psessionEntry->limSystemRole))
366 {
367 /*
368 * This handles two cases:
369 * -- Infra STA receving beacons from AP
370 * -- BTAMP_STA receving beacons from BTAMP_AP
371 */
372
373
374 //Always save the beacon into LIM's cached scan results
375 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
376
377 /**
378 * This is the Beacon received from the AP we're currently associated with. Check
379 * if there are any changes in AP's capabilities
380 */
381 if((tANI_U8) pBeacon->channelNumber != psessionEntry->currentOperChannel)
382 {
383 PELOGE(limLog(pMac, LOGE, FL("Channel Change from %d --> %d - "
384 "Ignoring beacon!\n"),
385 psessionEntry->currentOperChannel, pBeacon->channelNumber);)
386 goto fail;
387 }
388 limDetectChangeInApCapabilities(pMac, pBeacon, psessionEntry);
389 if(limGetStaHashBssidx(pMac, DPH_STA_HASH_INDEX_PEER, &bssIdx, psessionEntry) != eSIR_SUCCESS)
390 goto fail;
391 beaconParams.bssIdx = bssIdx;
392 palCopyMemory( pMac->hHdd, ( tANI_U8* )&psessionEntry->lastBeaconTimeStamp, ( tANI_U8* )pBeacon->timeStamp, sizeof(tANI_U64) );
393 psessionEntry->lastBeaconDtimCount = pBeacon->tim.dtimCount;
394 psessionEntry->lastBeaconDtimPeriod= pBeacon->tim.dtimPeriod;
395 psessionEntry->currentBssBeaconCnt++;
396
397
398
Jeff Johnsone7245742012-09-05 17:12:55 -0700399 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[0]);)
400 MTRACE(macTrace(pMac, TRACE_CODE_RX_MGMT_TSF, psessionEntry->peSessionId, pBeacon->timeStamp[1]);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700401
402 /* Read beacon interval session Entry */
403 bi = psessionEntry->beaconParams.beaconInterval;
404 if (bi != pBeacon->beaconInterval)
405 {
406 PELOG1(schLog(pMac, LOG1, FL("Beacon interval changed from %d to %d\n"),
407 pBeacon->beaconInterval, bi);)
408
409 bi = pBeacon->beaconInterval;
410 psessionEntry->beaconParams.beaconInterval = (tANI_U16) bi;
411 beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
412 beaconParams.beaconInterval = (tANI_U16)bi;
413 }
414
415 if (pBeacon->cfPresent)
416 {
417 cfgSetInt(pMac, WNI_CFG_CFP_PERIOD, pBeacon->cfParamSet.cfpPeriod);
418 limSendCFParams(pMac, bssIdx, pBeacon->cfParamSet.cfpCount, pBeacon->cfParamSet.cfpPeriod);
419 }
420
421 if (pBeacon->timPresent)
422 {
423 cfgSetInt(pMac, WNI_CFG_DTIM_PERIOD, pBeacon->tim.dtimPeriod);
424 //No need to send DTIM Period and Count to HAL/SMAC
425 //SMAC already parses TIM bit.
426 }
427
428
429 if(pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
430
431 limDecideStaProtection(pMac, pBeacon, &beaconParams, psessionEntry);
432 if (pBeacon->erpPresent)
433 {
434#ifdef WLAN_SOFTAP_FEATURE
435 if (pBeacon->erpIEInfo.barkerPreambleMode)
436 limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
437 else
438 limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
439#else
440 if (pBeacon->erpIEInfo.barkerPreambleMode)
441 limEnableShortPreamble(pMac, false, &beaconParams);
442 else
443 limEnableShortPreamble(pMac, true, &beaconParams);
444#endif
445 }
446 limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
447
448 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
449 if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
450 (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
451 {
452 if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
453 {
454 if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
455 PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
456 else if(pStaDs != NULL)
457 {
458 // If needed, downgrade the EDCA parameters
459 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
460
461 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
462 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
463 else
464 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
465 }
466 else
467 PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
468 }
469 }
470 else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
471 (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
472 sendProbeReq = TRUE;
473 }
474
Jeff Johnsone7245742012-09-05 17:12:55 -0700475 if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 {
477 limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
478 }
479
480#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
481 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
482 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
483 {
484 if(pBeacon->quietIEPresent)
485 {
486 limUpdateQuietIEFromBeacon(pMac, &(pBeacon->quietIE), psessionEntry);
487 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700488 else if ((psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_BEGIN) ||
489 (psessionEntry->gLimSpecMgmt.quietState == eLIM_QUIET_RUNNING))
Jeff Johnson295189b2012-06-20 16:38:30 -0700490 {
491 PELOG1(limLog(pMac, LOG1, FL("Received a beacon without Quiet IE\n"));)
492 limCancelDot11hQuiet(pMac, psessionEntry);
493 }
494
495 /* Channel Switch information element updated */
496 if(pBeacon->channelSwitchPresent ||
497 pBeacon->propIEinfo.propChannelSwitchPresent)
498 {
499 limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
500 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700501 else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700502 {
503 limCancelDot11hChannelSwitch(pMac, psessionEntry);
504 }
505 }
506#endif
507
508#if defined FEATURE_WLAN_CCX
509 if( psessionEntry->isCCXconnection )
510 {
511 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
512 if (pBeacon->ccxTxPwr.present)
513 {
514 localConstraint = pBeacon->ccxTxPwr.power_limit;
515 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700516 maxTxPower = limGetMaxTxPower(regMax, localConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700517
518 //If maxTxPower is increased or decreased
519 if( maxTxPower != psessionEntry->maxTxPower )
520 {
521 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
522 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
Jeff Johnsone7245742012-09-05 17:12:55 -0700523 if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 psessionEntry->maxTxPower = maxTxPower;
525 }
526 }
527 }
528#endif
529
530
531#if defined WLAN_FEATURE_VOWIFI
532 if( pMac->rrm.rrmPEContext.rrmEnable )
533 {
534 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
535 if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
536 {
537 localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
538 }
539 else
540 {
541 localConstraint = 0;
542 }
543 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
544 maxTxPower = VOS_MIN( regMax , (regMax - localConstraint) );
545 //If maxTxPower is increased or decreased
546 if( maxTxPower != psessionEntry->maxTxPower )
547 {
548#if defined WLAN_VOWIFI_DEBUG
549 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
550 limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
551#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700552 if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 psessionEntry->maxTxPower = maxTxPower;
554
555 }
556 }
557#endif
558
559 // Indicate to LIM that Beacon is received
560
561 if (pBeacon->HTInfo.present)
562 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
563 else
564 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
565
566 // I don't know if any additional IE is required here. Currently, not include addIE.
567 if(sendProbeReq)
568 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
569 psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
570 psessionEntry->dot11mode, 0, NULL);
571
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 if(beaconParams.paramChangeBitmap)
573 {
574 PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
575 PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
576 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
577 }
578
579fail:
580 return;
581
582}
583
584
585
586/**
587 * schBeaconProcess
588 *
589 * FUNCTION:
590 * Process the received beacon frame
591 *
592 * LOGIC:
593 *
594 * ASSUMPTIONS:
595 *
596 * NOTE:
597 *
598 * @param pRxPacketInfo pointer to buffer descriptor
599 * @return None
600 */
601
602void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
603{
604 static tSchBeaconStruct beaconStruct;
605 tUpdateBeaconParams beaconParams;
606 tpPESession pAPSession = NULL;
607 beaconParams.paramChangeBitmap = 0;
608
609 pMac->sch.gSchBcnRcvCnt++;
610
611 // Convert the beacon frame into a structure
612 if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
613 {
614 PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed\n"));)
615 pMac->sch.gSchBcnParseErrorCnt++;
616 return;
617 }
618
619 if (beaconStruct.ssidPresent)
620 {
621 beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
622 }
623
624 /*
625 * First process the beacon in the context of any existing AP or BTAP session.
626 * This takes cares of following two scenarios:
627 * - psessionEntry = NULL:
628 * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
629 * - psessionEntry is non NULL:
630 * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
631 * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
632 *
633 *
634 */
635
636 if((pAPSession = limIsApSessionActive(pMac)) != NULL)
637 {
638 beaconParams.bssIdx = pAPSession->bssIdx;
639#ifdef WLAN_SOFTAP_FEATURE
640 if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
641#else
642 if (pMac->lim.gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
643#endif
644 ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
645
646 if (beaconParams.paramChangeBitmap)
647 {
648 //Update the beacons and apply the new settings to HAL
649 schSetFixedBeaconFields(pMac, pAPSession);
650 PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. \n"), pAPSession->peSessionId);)
651 PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
652 limSendBeaconParams(pMac, &beaconParams, pAPSession);
653 }
654 }
655
656 /*
657 * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
658 */
659 if(psessionEntry == NULL)
660 {
661 __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
662 }
663 else
664 {
665 __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
666 }
667
668}
669
670
671
672
673
674// --------------------------------------------------------------------
675/**
676 * schBeaconEdcaProcess
677 *
678 * FUNCTION:
679 * Process the EDCA parameter set in the received beacon frame
680 *
681 * LOGIC:
682 *
683 * ASSUMPTIONS:
684 *
685 * NOTE:
686 *
687 * @param edca reference to edca parameters in beacon struct
688 * @return success
689 */
690
691tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
692{
693 tANI_U8 i;
694#ifdef FEATURE_WLAN_DIAG_SUPPORT
695 vos_log_qos_edca_pkt_type *log_ptr = NULL;
696#endif //FEATURE_WLAN_DIAG_SUPPORT
697
698 PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d\n"),
699 psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
700
701 psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
702 psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
703 psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
704 psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
705 psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
706//log: LOG_WLAN_QOS_EDCA_C
707#ifdef FEATURE_WLAN_DIAG_SUPPORT
708 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
709 if(log_ptr)
710 {
711 log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
712 log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
713 psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
714 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
715 log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
716 log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
717 psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
718 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
719 log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
720 log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
721 psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
722 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
723 log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
724 log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
725 psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
726 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
727 }
728 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
729#endif //FEATURE_WLAN_DIAG_SUPPORT
730 PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
731 for(i=0; i<MAX_NUM_AC; i++)
732 {
733 PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"),
734 i,
735 psessionEntry->gLimEdcaParams[i].aci.aifsn,
736 psessionEntry->gLimEdcaParams[i].aci.acm,
737 psessionEntry->gLimEdcaParams[i].cw.min,
738 psessionEntry->gLimEdcaParams[i].cw.max,
739 psessionEntry->gLimEdcaParams[i].txoplimit);)
740 }
741
742 return eSIR_SUCCESS;
743}