blob: a34de28f5c0970d43de9a6e9b4081dbff837be16 [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 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file schBeaconProcess.cc contains beacon processing related
44 * functions
45 *
46 * Author: Sandesh Goel
47 * Date: 02/25/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53
54#include "palTypes.h"
Jeff Johnson487b4022013-02-27 17:53:55 -080055#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57#include "cfgApi.h"
58#include "pmmApi.h"
59#include "limApi.h"
60#include "utilsApi.h"
61#include "schDebug.h"
62#include "schApi.h"
63
Jeff Johnson295189b2012-06-20 16:38:30 -070064
65#include "limUtils.h"
66#include "limSendMessages.h"
67#include "limStaHashApi.h"
68
69#if defined WLAN_FEATURE_VOWIFI
70#include "rrmApi.h"
71#endif
72
73#ifdef FEATURE_WLAN_DIAG_SUPPORT
74#include "vos_diag_core_log.h"
75#endif //FEATURE_WLAN_DIAG_SUPPORT
76
77/**
78 * Number of bytes of variation in beacon length from the last beacon
79 * to trigger reprogramming of rx delay register
80 */
81#define SCH_BEACON_LEN_DELTA 3
82
83// calculate 2^cw - 1
84#define CW_GET(cw) (((cw) == 0) ? 1 : ((1 << (cw)) - 1))
85
86static void
87ap_beacon_process(
88 tpAniSirGlobal pMac,
89 tANI_U8* pRxPacketInfo,
90 tpSchBeaconStruct pBcnStruct,
91 tpUpdateBeaconParams pBeaconParams,
92 tpPESession psessionEntry)
93{
94 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
95 tANI_U32 phyMode;
96 tSirRFBand rfBand = SIR_BAND_UNKNOWN;
97 //Get RF band from psessionEntry
98 rfBand = psessionEntry->limRFBand;
99
100 limGetPhyMode(pMac, &phyMode, psessionEntry);
101
102 if(SIR_BAND_5_GHZ == rfBand)
103 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700104 if (psessionEntry->htCapability)
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 {
106 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
107 {
108 //11a (non HT) AP overlaps or
109 //HT AP with HT op mode as mixed overlaps.
110 //HT AP with HT op mode as overlap legacy overlaps.
111 if ((!pBcnStruct->HTInfo.present) ||
112 (eSIR_HT_OP_MODE_MIXED == pBcnStruct->HTInfo.opMode) ||
113 (eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode))
114 {
115 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlap11aParams));
116
117 if (pMac->lim.gLimOverlap11aParams.numSta &&
118 !pMac->lim.gLimOverlap11aParams.protectionEnabled)
119 {
120 limEnable11aProtection(pMac, true, true, pBeaconParams,psessionEntry);
121 }
122 }
123 //HT AP with HT20 op mode overlaps.
124 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
125 {
126 limUpdateOverlapStaParam(pMac, pMh->bssId, &(pMac->lim.gLimOverlapHt20Params));
127
128 if (pMac->lim.gLimOverlapHt20Params.numSta &&
129 !pMac->lim.gLimOverlapHt20Params.protectionEnabled)
130 {
131 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
132 }
133 }
134 }
135 }
136 }
137 else if(SIR_BAND_2_4_GHZ == rfBand)
138 {
139 //We are 11G AP.
140 if ((phyMode == WNI_CFG_PHY_MODE_11G) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700141 (false == psessionEntry->htCapability))
Jeff Johnson295189b2012-06-20 16:38:30 -0700142 {
143 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
144 {
145 if (((!(pBcnStruct->erpPresent)) &&
146 !(pBcnStruct->HTInfo.present))||
147 //if erp not present then 11B AP overlapping
148 (pBcnStruct->erpPresent &&
149 (pBcnStruct->erpIEInfo.useProtection ||
150 pBcnStruct->erpIEInfo.nonErpPresent)))
151 {
152#ifdef FEATURE_WLAN_CCX
153 if( psessionEntry->isCCXconnection )
154 {
155 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
156 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
157 pBcnStruct->erpPresent,
158 pBcnStruct->erpIEInfo.useProtection,
159 pBcnStruct->erpIEInfo.nonErpPresent);
160 }
161#endif
162 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
163 }
164
165 }
166 }
167 // handling the case when HT AP has overlapping legacy BSS.
Jeff Johnsone7245742012-09-05 17:12:55 -0700168 else if(psessionEntry->htCapability)
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700169 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 if (pBcnStruct->channelNumber == psessionEntry->currentOperChannel)
171 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700172 if (((!(pBcnStruct->erpPresent)) &&
173 !(pBcnStruct->HTInfo.present))||
174 //if erp not present then 11B AP overlapping
175 (pBcnStruct->erpPresent &&
176 (pBcnStruct->erpIEInfo.useProtection ||
177 pBcnStruct->erpIEInfo.nonErpPresent)))
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 {
179#ifdef FEATURE_WLAN_CCX
180 if( psessionEntry->isCCXconnection )
181 {
182 VOS_TRACE (VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
183 "%s: [INFOLOG]CCX 11g erpPresent=%d useProtection=%d nonErpPresent=%d\n", __func__,
184 pBcnStruct->erpPresent,
185 pBcnStruct->erpIEInfo.useProtection,
186 pBcnStruct->erpIEInfo.nonErpPresent);
187 }
188#endif
189 limEnableOverlap11gProtection(pMac, pBeaconParams, pMh,psessionEntry);
190 }
191
192 //11g device overlaps
193 if (pBcnStruct->erpPresent &&
194 !(pBcnStruct->erpIEInfo.useProtection ||
195 pBcnStruct->erpIEInfo.nonErpPresent) && !(pBcnStruct->HTInfo.present))
196 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700197 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
198
199 if (psessionEntry->gLimOverlap11gParams.numSta &&
200 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 {
202 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
203 }
204 }
205
206 //ht device overlaps.
207 //here we will check for HT related devices only which might need protection.
208 //check for 11b and 11g is already done in the previous blocks.
209 //so we will not check for HT operating mode as MIXED.
210 if (pBcnStruct->HTInfo.present)
211 {
212 //if we are not already in mixed mode or legacy mode as HT operating mode
213 //and received beacon has HT operating mode as legacy
214 //then we need to enable protection from 11g station.
215 //we don't need protection from 11b because if that's needed then our operating
216 //mode would have already been set to legacy in the previous blocks.
217 if(eSIR_HT_OP_MODE_OVERLAP_LEGACY == pBcnStruct->HTInfo.opMode)
218 {
219 if((eSIR_HT_OP_MODE_MIXED != pMac->lim.gHTOperMode) &&
220 (eSIR_HT_OP_MODE_OVERLAP_LEGACY != pMac->lim.gHTOperMode))
221 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlap11gParams));
223 if (psessionEntry->gLimOverlap11gParams.numSta &&
224 !psessionEntry->gLimOverlap11gParams.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700225 {
226 limEnableHtProtectionFrom11g(pMac, true, true, pBeaconParams,psessionEntry);
227 }
228 }
229 }
230 else if(eSIR_HT_OP_MODE_NO_LEGACY_20MHZ_HT == pBcnStruct->HTInfo.opMode)
231 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700232 limUpdateOverlapStaParam(pMac, pMh->bssId, &(psessionEntry->gLimOverlapHt20Params));
233 if (psessionEntry->gLimOverlapHt20Params.numSta &&
234 !psessionEntry->gLimOverlapHt20Params.protectionEnabled)
Jeff Johnson295189b2012-06-20 16:38:30 -0700235 {
236 limEnableHT20Protection(pMac, true, true, pBeaconParams,psessionEntry);
237 }
238 }
239 }
240
241 }
242 }
243 }
244 pMac->sch.gSchBcnIgnored++;
245}
246// --------------------------------------------------------------------
247
248
249
250
251/**
252 * __schBeaconProcessNoSession
253 *
254 * FUNCTION:
255 * Process the received beacon frame when
256 * -- Station is not scanning
257 * -- No corresponding session is found
258 *
259 * LOGIC:
260 * Following scenarios exist when Session Does not exist:
261 * * IBSS Beacons, when IBSS session already exists with same SSID,
262 * but from STA which has not yet joined and has a different BSSID.
263 * - invoke limHandleIBSScoalescing with the session context of existing IBSS session.
264 *
265 * * IBSS Beacons when IBSS session does not exist, only Infra or BT-AMP session exists,
266 * then save the beacon in the scan results and throw it away.
267 *
268 * * Infra Beacons
269 * - beacons received when no session active
270 * should not come here, it should be handled as part of scanning,
271 * else they should not be getting received, should update scan results and drop it if that happens.
272 * - beacons received when IBSS session active:
273 * update scan results and drop it.
274 * - beacons received when Infra session(STA) is active:
275 * update scan results and drop it
276 * - beacons received when BT-STA session is active:
277 * update scan results and drop it.
278 * - beacons received when Infra/BT-STA or Infra/IBSS is active.
279 * update scan results and drop it.
280 *
281
282 */
283static void __schBeaconProcessNoSession(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon,tANI_U8* pRxPacketInfo)
284{
285 tpPESession psessionEntry = NULL;
286
287 if( (psessionEntry = limIsIBSSSessionActive(pMac)) != NULL)
288 {
289 limHandleIBSScoalescing(pMac, pBeacon, pRxPacketInfo, psessionEntry);
290 }
291
292 //If station(STA/BT-STA/BT-AP/IBSS) mode, Always save the beacon in the scan results, if atleast one session is active
293 //schBeaconProcessNoSession will be called only when there is atleast one session active, so not checking
294 //it again here.
295 limCheckAndAddBssDescription(pMac, pBeacon, pRxPacketInfo, eANI_BOOLEAN_FALSE, eANI_BOOLEAN_FALSE);
296 return;
297}
298
299
300
301/*
302 * __schBeaconProcessForSession
303 *
304 * FUNCTION:
305 * Process the received beacon frame when
306 * -- Station is not scanning
307 * -- Corresponding session is found
308 *
309 * LOGIC:
310 * Following scenarios exist when Session exists
311 * * IBSS STA receving beacons from IBSS Peers, who are part of IBSS.
312 * - call limHandleIBSScoalescing with that session context.
313 * * Infra STA receving beacons from AP to which it is connected
314 * - call schBeaconProcessFromAP with that session's context.
315 * * BTAMP STA receving beacons from BTAMP AP
316 * - call schBeaconProcessFromAP with that session's context.
317 * * BTAMP AP receiving beacons from BTAMP STA
318 * (here need to make sure BTAP creates session entry for BT STA)
319 * - just update the beacon count for heart beat purposes for now,
320 * for now, don't process the beacon.
321 * * Infra/IBSS both active and receives IBSS beacon:
322 * - call limHandleIBSScoalescing with that session context.
323 * * Infra/IBSS both active and receives Infra beacon:
324 * - call schBeaconProcessFromAP with that session's context.
325 * any updates to EDCA parameters will be effective for IBSS as well,
326 * even though no WMM for IBSS ?? Need to figure out how to handle this scenario.
327 * * Infra/BTSTA both active and receive Infra beacon.
328 * - change in EDCA parameters on Infra affect the BTSTA link.
329 * Update the same parameters on BT link
330 * * Infra/BTSTA both active and receive BT-AP beacon.
331 * -update beacon cnt for heartbeat
332 * * Infra/BTAP both active and receive Infra beacon.
333 * - BT-AP starts advertising BE parameters from Infra AP, if they get changed.
334 *
335 * * Infra/BTAP both active and receive BTSTA beacon.
336 * - update beacon cnt for heartbeat
337 */
338
339static void __schBeaconProcessForSession( tpAniSirGlobal pMac,
340 tpSchBeaconStruct pBeacon,
341 tANI_U8* pRxPacketInfo,
342 tpPESession psessionEntry)
343{
344 tANI_U32 bi;
345 tANI_U8 bssIdx = 0;
346 //tpSirMacMgmtHdr pMh = SIR_MAC_BD_TO_MPDUHEADER(pRxPacketInfo);
347 //tANI_U8 bssid[sizeof(tSirMacAddr)];
348 tUpdateBeaconParams beaconParams;
349 tANI_U8 sendProbeReq = FALSE;
350 tpDphHashNode pStaDs = NULL;
Mohit Khanna4a70d262012-09-11 16:30:12 -0700351#ifdef WLAN_FEATURE_11AC
352 tpSirMacMgmtHdr pMh = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
353 tANI_U16 aid;
354 tANI_U8 operMode;
355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
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 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 if (pBeacon->erpIEInfo.barkerPreambleMode)
435 limEnableShortPreamble(pMac, false, &beaconParams, psessionEntry);
436 else
437 limEnableShortPreamble(pMac, true, &beaconParams, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
439 limUpdateShortSlot(pMac, pBeacon, &beaconParams,psessionEntry);
440
441 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
442 if ((pBeacon->wmeEdcaPresent && (psessionEntry->limWmeEnabled)) ||
443 (pBeacon->edcaPresent && (psessionEntry->limQosEnabled)))
444 {
445 if(pBeacon->edcaParams.qosInfo.count != psessionEntry->gLimEdcaParamSetCount)
446 {
447 if (schBeaconEdcaProcess(pMac, &pBeacon->edcaParams, psessionEntry) != eSIR_SUCCESS)
448 PELOGE(schLog(pMac, LOGE, FL("EDCA parameter processing error\n"));)
449 else if(pStaDs != NULL)
450 {
451 // If needed, downgrade the EDCA parameters
452 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
453
454 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
455 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
456 else
457 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
458 }
459 else
460 PELOGE(limLog(pMac, LOGE, FL("Self Entry missing in Hash Table\n"));)
461 }
462 }
463 else if( (pBeacon->qosCapabilityPresent && psessionEntry->limQosEnabled) &&
464 (pBeacon->qosCapability.qosInfo.count != psessionEntry->gLimEdcaParamSetCount))
465 sendProbeReq = TRUE;
466 }
467
Jeff Johnsone7245742012-09-05 17:12:55 -0700468 if ( psessionEntry->htCapability && pBeacon->HTInfo.present )
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 {
470 limUpdateStaRunTimeHTSwitchChnlParams( pMac, &pBeacon->HTInfo, bssIdx,psessionEntry);
471 }
472
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) ||
474 (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
475 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 /* Channel Switch information element updated */
477 if(pBeacon->channelSwitchPresent ||
478 pBeacon->propIEinfo.propChannelSwitchPresent)
479 {
480 limUpdateChannelSwitch(pMac, pBeacon, psessionEntry);
481 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700482 else if (psessionEntry->gLimSpecMgmt.dot11hChanSwState == eLIM_11H_CHANSW_RUNNING)
Jeff Johnson295189b2012-06-20 16:38:30 -0700483 {
484 limCancelDot11hChannelSwitch(pMac, psessionEntry);
485 }
486 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700487
Mohit Khanna4a70d262012-09-11 16:30:12 -0700488#ifdef WLAN_FEATURE_11AC
489 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) ||(psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) )
490 {
491 // check for VHT capability
492 if(psessionEntry->vhtCapability && pBeacon->OperatingMode.present)
493 {
494 pStaDs = dphLookupHashEntry(pMac, pMh->sa, &aid, &psessionEntry->dph.dphHashTable);
495 operMode = pStaDs->vhtSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_80MHZ : pStaDs->htSupportedChannelWidthSet ? eHT_CHANNEL_WIDTH_40MHZ: eHT_CHANNEL_WIDTH_20MHZ;
496 if( operMode != pBeacon->OperatingMode.chanWidth)
497 {
Jeff Johnson3d710ea2012-12-10 14:31:52 -0800498 PELOG1(limLog(pMac, LOG1, FL(" received Chanwidth %d, staIdx = %d\n"),
Mohit Khanna4a70d262012-09-11 16:30:12 -0700499 pBeacon->OperatingMode.chanWidth,
500 pStaDs->staIndex);)
501 PELOG1(limLog(pMac, LOG1, FL(" MAC - %0x:%0x:%0x:%0x:%0x:%0x\n"),
502 pMh->sa[0],
503 pMh->sa[1],
504 pMh->sa[2],
505 pMh->sa[3],
506 pMh->sa[4],
507 pMh->sa[5]);)
508
509 if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
510 {
511 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ;
512 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ ;
513 }
514 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
515 {
516 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
517 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_40MHZ;
518 }
519 else if(pBeacon->OperatingMode.chanWidth == eHT_CHANNEL_WIDTH_20MHZ)
520 {
521 pStaDs->vhtSupportedChannelWidthSet = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
522 pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ;
523 }
524 limCheckVHTOpModeChange(pMac, psessionEntry, pBeacon->OperatingMode.chanWidth, pStaDs->staIndex);
525 }
526 }
527 }
528#endif
529
Jeff Johnson295189b2012-06-20 16:38:30 -0700530#if defined FEATURE_WLAN_CCX
531 if( psessionEntry->isCCXconnection )
532 {
533 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
534 if (pBeacon->ccxTxPwr.present)
535 {
536 localConstraint = pBeacon->ccxTxPwr.power_limit;
537 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnson04dd8a82012-06-29 20:41:40 -0700538 maxTxPower = limGetMaxTxPower(regMax, localConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -0700539
540 //If maxTxPower is increased or decreased
541 if( maxTxPower != psessionEntry->maxTxPower )
542 {
543 limLog( pMac, LOG1, "RegMax = %d, lpc = %d, MaxTx = %d", regMax, localConstraint, maxTxPower );
544 limLog( pMac, LOG1, "Local power constraint change..updating new maxTx power to HAL");
Jeff Johnsone7245742012-09-05 17:12:55 -0700545 if( limSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 psessionEntry->maxTxPower = maxTxPower;
547 }
548 }
549 }
550#endif
551
552
553#if defined WLAN_FEATURE_VOWIFI
554 if( pMac->rrm.rrmPEContext.rrmEnable )
555 {
556 tPowerdBm localConstraint = 0, regMax = 0, maxTxPower = 0;
557 if (pBeacon->powerConstraintPresent && pMac->rrm.rrmPEContext.rrmEnable)
558 {
559 localConstraint = pBeacon->localPowerConstraint.localPowerConstraints;
560 }
561 else
562 {
563 localConstraint = 0;
564 }
Gopichand Nakkalaaa340d72013-02-28 15:26:52 +0530565 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
566 //Get the maxTxPower in the range of 13 to 19
567 maxTxPower = rrmGetMinOfMaxTxPower(regMax, (regMax - localConstraint));
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 //If maxTxPower is increased or decreased
569 if( maxTxPower != psessionEntry->maxTxPower )
570 {
571#if defined WLAN_VOWIFI_DEBUG
572 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localConstraint, maxTxPower );
573 limLog( pMac, LOGE, "Local power constraint change..updating mew maxTx power to HAL");
574#endif
Jeff Johnson43971f52012-07-17 12:26:56 -0700575 if( rrmSendSetMaxTxPowerReq ( pMac, maxTxPower, psessionEntry ) == eSIR_SUCCESS )
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 psessionEntry->maxTxPower = maxTxPower;
577
578 }
579 }
580#endif
581
582 // Indicate to LIM that Beacon is received
583
584 if (pBeacon->HTInfo.present)
585 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->HTInfo.primaryChannel, psessionEntry);
586 else
587 limReceivedHBHandler(pMac, (tANI_U8)pBeacon->channelNumber, psessionEntry);
588
589 // I don't know if any additional IE is required here. Currently, not include addIE.
590 if(sendProbeReq)
591 limSendProbeReqMgmtFrame(pMac, &psessionEntry->ssId,
592 psessionEntry->bssId, psessionEntry->currentOperChannel,psessionEntry->selfMacAddr,
593 psessionEntry->dot11mode, 0, NULL);
594
Jeff Johnson295189b2012-06-20 16:38:30 -0700595 if(beaconParams.paramChangeBitmap)
596 {
597 PELOGW(schLog(pMac, LOGW, FL("Beacon for session[%d] got changed. \n"), psessionEntry->peSessionId);)
598 PELOGW(schLog(pMac, LOGW, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
599 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
600 }
601
602fail:
603 return;
604
605}
606
607
608
609/**
610 * schBeaconProcess
611 *
612 * FUNCTION:
613 * Process the received beacon frame
614 *
615 * LOGIC:
616 *
617 * ASSUMPTIONS:
618 *
619 * NOTE:
620 *
621 * @param pRxPacketInfo pointer to buffer descriptor
622 * @return None
623 */
624
625void schBeaconProcess(tpAniSirGlobal pMac, tANI_U8* pRxPacketInfo, tpPESession psessionEntry)
626{
627 static tSchBeaconStruct beaconStruct;
628 tUpdateBeaconParams beaconParams;
629 tpPESession pAPSession = NULL;
630 beaconParams.paramChangeBitmap = 0;
631
632 pMac->sch.gSchBcnRcvCnt++;
633
634 // Convert the beacon frame into a structure
635 if (sirConvertBeaconFrame2Struct(pMac, (tANI_U8 *) pRxPacketInfo, &beaconStruct)!= eSIR_SUCCESS)
636 {
637 PELOGE(schLog(pMac, LOGE, FL("beacon parsing failed\n"));)
638 pMac->sch.gSchBcnParseErrorCnt++;
639 return;
640 }
641
642 if (beaconStruct.ssidPresent)
643 {
644 beaconStruct.ssId.ssId[beaconStruct.ssId.length] = 0;
645 }
646
647 /*
648 * First process the beacon in the context of any existing AP or BTAP session.
649 * This takes cares of following two scenarios:
650 * - psessionEntry = NULL:
651 * e.g. beacon received from a neighboring BSS, you want to apply the protection settings to BTAP/InfraAP beacons
652 * - psessionEntry is non NULL:
653 * e.g. beacon received is from the INFRA AP to which you are connected on another concurrent link.
654 * In this case also, we want to apply the protection settings(as advertised by Infra AP) to BTAP beacons
655 *
656 *
657 */
658
659 if((pAPSession = limIsApSessionActive(pMac)) != NULL)
660 {
661 beaconParams.bssIdx = pAPSession->bssIdx;
Jeff Johnson295189b2012-06-20 16:38:30 -0700662 if (pAPSession->gLimProtectionControl != WNI_CFG_FORCE_POLICY_PROTECTION_DISABLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 ap_beacon_process(pMac, pRxPacketInfo, &beaconStruct, &beaconParams, pAPSession);
664
665 if (beaconParams.paramChangeBitmap)
666 {
667 //Update the beacons and apply the new settings to HAL
668 schSetFixedBeaconFields(pMac, pAPSession);
669 PELOG1(schLog(pMac, LOG1, FL("Beacon for PE session[%d] got changed. \n"), pAPSession->peSessionId);)
670 PELOG1(schLog(pMac, LOG1, FL("sending beacon param change bitmap: 0x%x \n"), beaconParams.paramChangeBitmap);)
671 limSendBeaconParams(pMac, &beaconParams, pAPSession);
672 }
673 }
674
675 /*
676 * Now process the beacon in the context of the BSS which is transmitting the beacons, if one is found
677 */
678 if(psessionEntry == NULL)
679 {
680 __schBeaconProcessNoSession(pMac, &beaconStruct, pRxPacketInfo );
681 }
682 else
683 {
684 __schBeaconProcessForSession(pMac, &beaconStruct, pRxPacketInfo, psessionEntry );
685 }
686
687}
688
689
690
691
692
693// --------------------------------------------------------------------
694/**
695 * schBeaconEdcaProcess
696 *
697 * FUNCTION:
698 * Process the EDCA parameter set in the received beacon frame
699 *
700 * LOGIC:
701 *
702 * ASSUMPTIONS:
703 *
704 * NOTE:
705 *
706 * @param edca reference to edca parameters in beacon struct
707 * @return success
708 */
709
710tSirRetStatus schBeaconEdcaProcess(tpAniSirGlobal pMac, tSirMacEdcaParamSetIE *edca, tpPESession psessionEntry)
711{
712 tANI_U8 i;
713#ifdef FEATURE_WLAN_DIAG_SUPPORT
714 vos_log_qos_edca_pkt_type *log_ptr = NULL;
715#endif //FEATURE_WLAN_DIAG_SUPPORT
716
717 PELOG1(schLog(pMac, LOG1, FL("Updating parameter set count: Old %d ---> new %d\n"),
718 psessionEntry->gLimEdcaParamSetCount, edca->qosInfo.count);)
719
720 psessionEntry->gLimEdcaParamSetCount = edca->qosInfo.count;
721 psessionEntry->gLimEdcaParams[EDCA_AC_BE] = edca->acbe;
722 psessionEntry->gLimEdcaParams[EDCA_AC_BK] = edca->acbk;
723 psessionEntry->gLimEdcaParams[EDCA_AC_VI] = edca->acvi;
724 psessionEntry->gLimEdcaParams[EDCA_AC_VO] = edca->acvo;
725//log: LOG_WLAN_QOS_EDCA_C
726#ifdef FEATURE_WLAN_DIAG_SUPPORT
727 WLAN_VOS_DIAG_LOG_ALLOC(log_ptr, vos_log_qos_edca_pkt_type, LOG_WLAN_QOS_EDCA_C);
728 if(log_ptr)
729 {
730 log_ptr->aci_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].aci.aci;
731 log_ptr->cw_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.max << 4 |
732 psessionEntry->gLimEdcaParams[EDCA_AC_BE].cw.min;
733 log_ptr->txoplimit_be = psessionEntry->gLimEdcaParams[EDCA_AC_BE].txoplimit;
734 log_ptr->aci_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].aci.aci;
735 log_ptr->cw_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.max << 4 |
736 psessionEntry->gLimEdcaParams[EDCA_AC_BK].cw.min;
737 log_ptr->txoplimit_bk = psessionEntry->gLimEdcaParams[EDCA_AC_BK].txoplimit;
738 log_ptr->aci_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].aci.aci;
739 log_ptr->cw_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.max << 4 |
740 psessionEntry->gLimEdcaParams[EDCA_AC_VI].cw.min;
741 log_ptr->txoplimit_vi = psessionEntry->gLimEdcaParams[EDCA_AC_VI].txoplimit;
742 log_ptr->aci_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].aci.aci;
743 log_ptr->cw_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.max << 4 |
744 psessionEntry->gLimEdcaParams[EDCA_AC_VO].cw.min;
745 log_ptr->txoplimit_vo = psessionEntry->gLimEdcaParams[EDCA_AC_VO].txoplimit;
746 }
747 WLAN_VOS_DIAG_LOG_REPORT(log_ptr);
748#endif //FEATURE_WLAN_DIAG_SUPPORT
749 PELOG1(schLog(pMac, LOGE, FL("Updating Local EDCA Params(gLimEdcaParams) to: "));)
750 for(i=0; i<MAX_NUM_AC; i++)
751 {
752 PELOG1(schLog(pMac, LOG1, FL("AC[%d]: AIFSN: %d, ACM %d, CWmin %d, CWmax %d, TxOp %d\n"),
753 i,
754 psessionEntry->gLimEdcaParams[i].aci.aifsn,
755 psessionEntry->gLimEdcaParams[i].aci.acm,
756 psessionEntry->gLimEdcaParams[i].cw.min,
757 psessionEntry->gLimEdcaParams[i].cw.max,
758 psessionEntry->gLimEdcaParams[i].txoplimit);)
759 }
760
761 return eSIR_SUCCESS;
762}