Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 2 | * Copyright (c) 2012-2014 The Linux Foundation. All rights reserved. |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 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. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 20 | */ |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 21 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 22 | /* |
Kiet Lam | 842dad0 | 2014-02-18 18:44:02 -0800 | [diff] [blame] | 23 | * This file was originally distributed by Qualcomm Atheros, Inc. |
| 24 | * under proprietary terms before Copyright ownership was assigned |
| 25 | * to the Linux Foundation. |
| 26 | */ |
| 27 | |
| 28 | /* |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 29 | * This file limUtils.h contains the utility definitions |
| 30 | * LIM uses. |
| 31 | * Author: Chandra Modumudi |
| 32 | * Date: 02/13/02 |
| 33 | * History:- |
| 34 | * Date Modified by Modification Information |
| 35 | * -------------------------------------------------------------------- |
| 36 | */ |
| 37 | #ifndef __LIM_UTILS_H |
| 38 | #define __LIM_UTILS_H |
| 39 | |
| 40 | #include "sirApi.h" |
| 41 | #include "sirDebug.h" |
| 42 | #include "cfgApi.h" |
| 43 | |
| 44 | #include "limTypes.h" |
| 45 | #include "limScanResultUtils.h" |
| 46 | #include "limTimerUtils.h" |
| 47 | #include "limTrace.h" |
| 48 | typedef enum |
| 49 | { |
| 50 | ONE_BYTE = 1, |
| 51 | TWO_BYTE = 2 |
| 52 | } eSizeOfLenField; |
| 53 | |
| 54 | #define LIM_STA_ID_MASK 0x00FF |
| 55 | #define LIM_AID_MASK 0xC000 |
| 56 | #define LIM_SPECTRUM_MANAGEMENT_BIT_MASK 0x0100 |
Hema Aparna Medicharla | fa1d2bb | 2013-12-23 02:28:09 +0530 | [diff] [blame] | 57 | #define LIM_RRM_BIT_MASK 0x1000 |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 58 | #if defined (WLAN_FEATURE_VOWIFI_11R) || defined (FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR) |
Madan Mohan Koyyalamudi | 61bc566 | 2012-11-02 14:33:10 -0700 | [diff] [blame] | 59 | #define LIM_MAX_REASSOC_RETRY_LIMIT 2 |
| 60 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 61 | |
| 62 | // classifier ID is coded as 0-3: tsid, 4-5:direction |
| 63 | #define LIM_MAKE_CLSID(tsid, dir) (((tsid) & 0x0F) | (((dir) & 0x03) << 4)) |
| 64 | |
| 65 | #define LIM_SET_STA_BA_STATE(pSta, tid, newVal) \ |
| 66 | {\ |
| 67 | pSta->baState = ((pSta->baState | (0x3 << tid*2)) & ((newVal << tid*2) | ~(0x3 << tid*2)));\ |
| 68 | } |
| 69 | |
| 70 | #define LIM_GET_STA_BA_STATE(pSta, tid, pCurVal)\ |
| 71 | {\ |
| 72 | *pCurVal = (tLimBAState)(((pSta->baState >> tid*2) & 0x3));\ |
| 73 | } |
| 74 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 75 | typedef struct sAddBaInfo |
| 76 | { |
| 77 | tANI_U16 fBaEnable : 1; |
| 78 | tANI_U16 startingSeqNum: 12; |
| 79 | tANI_U16 reserved : 3; |
| 80 | }tAddBaInfo, *tpAddBaInfo; |
| 81 | |
| 82 | typedef struct sAddBaCandidate |
| 83 | { |
| 84 | tSirMacAddr staAddr; |
| 85 | tAddBaInfo baInfo[STACFG_MAX_TC]; |
| 86 | }tAddBaCandidate, *tpAddBaCandidate; |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 87 | |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 88 | #ifdef WLAN_FEATURE_11W |
| 89 | typedef union uPmfSaQueryTimerId |
| 90 | { |
| 91 | struct |
| 92 | { |
| 93 | tANI_U8 sessionId; |
| 94 | tANI_U16 peerIdx; |
| 95 | } fields; |
| 96 | tANI_U32 value; |
| 97 | } tPmfSaQueryTimerId, *tpPmfSaQueryTimerId; |
| 98 | #endif |
| 99 | |
Jeff Johnson | 1250df4 | 2012-12-10 14:31:52 -0800 | [diff] [blame] | 100 | // LIM utility functions |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 101 | void limGetBssidFromPkt(tpAniSirGlobal, tANI_U8 *, tANI_U8 *, tANI_U32 *); |
| 102 | char * limMlmStateStr(tLimMlmStates state); |
| 103 | char * limSmeStateStr(tLimSmeStates state); |
| 104 | char * limMsgStr(tANI_U32 msgType); |
| 105 | char * limResultCodeStr(tSirResultCodes resultCode); |
| 106 | char* limDot11ModeStr(tpAniSirGlobal pMac, tANI_U8 dot11Mode); |
| 107 | char* limStaOpRateModeStr(tStaRateMode opRateMode); |
| 108 | void limPrintMlmState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimMlmStates state); |
| 109 | void limPrintSmeState(tpAniSirGlobal pMac, tANI_U16 logLevel, tLimSmeStates state); |
| 110 | void limPrintMsgName(tpAniSirGlobal pMac, tANI_U16 logLevel, tANI_U32 msgType); |
| 111 | void limPrintMsgInfo(tpAniSirGlobal pMac, tANI_U16 logLevel, tSirMsgQ *msg); |
| 112 | char* limBssTypeStr(tSirBssType bssType); |
| 113 | |
Varun Reddy Yeturu | 5d5e2c6 | 2014-02-27 13:31:29 -0800 | [diff] [blame] | 114 | #if defined FEATURE_WLAN_ESE || defined WLAN_FEATURE_VOWIFI |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | extern tSirRetStatus limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, |
| 116 | tPowerdBm txPower, |
| 117 | tpPESession pSessionEntry ); |
Madan Mohan Koyyalamudi | 3282c57 | 2012-11-09 17:01:41 -0800 | [diff] [blame] | 118 | extern tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 119 | #endif |
| 120 | |
| 121 | tANI_U32 limPostMsgApiNoWait(tpAniSirGlobal, tSirMsgQ *); |
| 122 | tANI_U8 limIsAddrBC(tSirMacAddr); |
| 123 | tANI_U8 limIsGroupAddr(tSirMacAddr); |
| 124 | |
| 125 | // check for type of scan allowed |
| 126 | tANI_U8 limActiveScanAllowed(tpAniSirGlobal, tANI_U8); |
| 127 | |
| 128 | // AID pool management functions |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 129 | void limInitPeerIdxpool(tpAniSirGlobal,tpPESession); |
| 130 | tANI_U16 limAssignPeerIdx(tpAniSirGlobal,tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 131 | |
| 132 | void limEnableOverlap11gProtection(tpAniSirGlobal pMac, tpUpdateBeaconParams pBeaconParams, tpSirMacMgmtHdr pMh,tpPESession psessionEntry); |
| 133 | void limUpdateOverlapStaParam(tpAniSirGlobal pMac, tSirMacAddr bssId, tpLimProtStaParams pStaParams); |
| 134 | void limUpdateShortPreamble(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); |
| 135 | void limUpdateShortSlotTime(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); |
| 136 | |
| 137 | /* |
| 138 | * The below 'product' check tobe removed if 'Association' is |
| 139 | * allowed in IBSS. |
| 140 | */ |
Gopichand Nakkala | 777e603 | 2012-12-31 16:39:21 -0800 | [diff] [blame] | 141 | void limReleasePeerIdx(tpAniSirGlobal, tANI_U16, tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 142 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 143 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 144 | void limDecideApProtection(tpAniSirGlobal pMac, tSirMacAddr peerMacAddr, tpUpdateBeaconParams pBeaconParams,tpPESession); |
| 145 | void |
| 146 | limDecideApProtectionOnDelete(tpAniSirGlobal pMac, |
| 147 | tpDphHashNode pStaDs, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 148 | |
| 149 | extern tSirRetStatus limEnable11aProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession); |
| 150 | extern tSirRetStatus limEnable11gProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry); |
| 151 | extern tSirRetStatus limEnableHtProtectionFrom11g(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry); |
| 152 | extern tSirRetStatus limEnableHT20Protection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession sessionEntry); |
| 153 | extern tSirRetStatus limEnableHTNonGfProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession); |
| 154 | extern tSirRetStatus limEnableHtRifsProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession psessionEntry); |
| 155 | extern tSirRetStatus limEnableHTLsigTxopProtection(tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams,tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 156 | extern tSirRetStatus limEnableShortPreamble(tpAniSirGlobal pMac, tANI_U8 enable, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 157 | extern tSirRetStatus limEnableHtOBSSProtection (tpAniSirGlobal pMac, tANI_U8 enable, tANI_U8 overlap, tpUpdateBeaconParams pBeaconParams, tpPESession); |
| 158 | void limDecideStaProtection(tpAniSirGlobal pMac, tpSchBeaconStruct pBeaconStruct, tpUpdateBeaconParams pBeaconParams, tpPESession psessionEntry); |
| 159 | void limDecideStaProtectionOnAssoc(tpAniSirGlobal pMac, tpSchBeaconStruct pBeaconStruct, tpPESession psessionEntry); |
| 160 | void limUpdateStaRunTimeHTSwitchChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo * pHTInfo, tANI_U8 bssIdx, tpPESession psessionEntry); |
| 161 | // Print MAC address utility function |
| 162 | void limPrintMacAddr(tpAniSirGlobal, tSirMacAddr, tANI_U8); |
| 163 | |
| 164 | |
| 165 | |
| 166 | // Deferred Message Queue read/write |
| 167 | tANI_U8 limWriteDeferredMsgQ(tpAniSirGlobal pMac, tpSirMsgQ limMsg); |
| 168 | tSirMsgQ* limReadDeferredMsgQ(tpAniSirGlobal pMac); |
| 169 | void limHandleDeferMsgError(tpAniSirGlobal pMac, tpSirMsgQ pLimMsg); |
| 170 | |
| 171 | // Deferred Message Queue Reset |
| 172 | void limResetDeferredMsgQ(tpAniSirGlobal pMac); |
| 173 | |
| 174 | tSirRetStatus limSysProcessMmhMsgApi(tpAniSirGlobal, tSirMsgQ*, tANI_U8); |
| 175 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | void limHandleUpdateOlbcCache(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 177 | |
| 178 | tANI_U8 limIsNullSsid( tSirMacSSid *pSsid ); |
| 179 | |
| 180 | void limProcessAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param); |
| 181 | |
| 182 | // 11h Support |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 183 | void limStopTxAndSwitchChannel(tpAniSirGlobal pMac, tANI_U8 sessionId); |
| 184 | void limProcessChannelSwitchTimeout(tpAniSirGlobal); |
| 185 | tSirRetStatus limStartChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 186 | void limUpdateChannelSwitch(tpAniSirGlobal, tpSirProbeRespBeacon, tpPESession psessionEntry); |
| 187 | void limProcessQuietTimeout(tpAniSirGlobal); |
| 188 | void limProcessQuietBssTimeout(tpAniSirGlobal); |
| 189 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 190 | #if 0 |
| 191 | void limProcessWPSOverlapTimeout(tpAniSirGlobal pMac); |
| 192 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 193 | |
| 194 | void limStartQuietTimer(tpAniSirGlobal pMac, tANI_U8 sessionId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 195 | void limSwitchPrimaryChannel(tpAniSirGlobal, tANI_U8,tpPESession); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 196 | void limSwitchPrimarySecondaryChannel(tpAniSirGlobal, tpPESession, tANI_U8, ePhyChanBondState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 197 | tAniBool limTriggerBackgroundScanDuringQuietBss(tpAniSirGlobal); |
| 198 | void limUpdateStaRunTimeHTSwtichChnlParams(tpAniSirGlobal pMac, tDot11fIEHTInfo *pRcvdHTInfo, tANI_U8 bssIdx); |
| 199 | void limUpdateStaRunTimeHTCapability(tpAniSirGlobal pMac, tDot11fIEHTCaps *pHTCaps); |
| 200 | void limUpdateStaRunTimeHTInfo(struct sAniSirGlobal *pMac, tDot11fIEHTInfo *pRcvdHTInfo, tpPESession psessionEntry); |
| 201 | void limCancelDot11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 202 | void limCancelDot11hQuiet(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 203 | tAniBool limIsChannelValidForChannelSwitch(tpAniSirGlobal pMac, tANI_U8 channel); |
| 204 | void limFrameTransmissionControl(tpAniSirGlobal pMac, tLimQuietTxMode type, tLimControlTx mode); |
| 205 | tSirRetStatus limRestorePreChannelSwitchState(tpAniSirGlobal pMac, tpPESession psessionEntry); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 206 | tSirRetStatus limRestorePreQuietState(tpAniSirGlobal pMac, tpPESession psessionEntry); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 207 | |
| 208 | void limPrepareFor11hChannelSwitch(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 209 | void limSwitchChannelCback(tpAniSirGlobal pMac, eHalStatus status, |
| 210 | tANI_U32 *data, tpPESession psessionEntry); |
| 211 | |
| 212 | static inline tSirRFBand limGetRFBand(tANI_U8 channel) |
| 213 | { |
| 214 | if ((channel >= SIR_11A_CHANNEL_BEGIN) && |
| 215 | (channel <= SIR_11A_CHANNEL_END)) |
| 216 | return SIR_BAND_5_GHZ; |
| 217 | |
| 218 | if ((channel >= SIR_11B_CHANNEL_BEGIN) && |
| 219 | (channel <= SIR_11B_CHANNEL_END)) |
| 220 | return SIR_BAND_2_4_GHZ; |
| 221 | |
| 222 | return SIR_BAND_UNKNOWN; |
| 223 | } |
| 224 | |
| 225 | |
| 226 | static inline tSirRetStatus |
| 227 | limGetMgmtStaid(tpAniSirGlobal pMac, tANI_U16 *staid, tpPESession psessionEntry) |
| 228 | { |
| 229 | if (psessionEntry->limSystemRole == eLIM_AP_ROLE) |
| 230 | *staid = 1; |
| 231 | else if (psessionEntry->limSystemRole == eLIM_STA_ROLE) |
| 232 | *staid = 0; |
| 233 | else |
| 234 | return eSIR_FAILURE; |
| 235 | |
| 236 | return eSIR_SUCCESS; |
| 237 | } |
| 238 | |
| 239 | static inline tANI_U8 |
| 240 | limIsSystemInSetMimopsState(tpAniSirGlobal pMac) |
| 241 | { |
| 242 | if (pMac->lim.gLimMlmState == eLIM_MLM_WT_SET_MIMOPS_STATE) |
| 243 | return true; |
| 244 | return false; |
| 245 | } |
| 246 | |
| 247 | static inline tANI_U8 |
| 248 | isEnteringMimoPS(tSirMacHTMIMOPowerSaveState curState, tSirMacHTMIMOPowerSaveState newState) |
| 249 | { |
| 250 | if (curState == eSIR_HT_MIMO_PS_NO_LIMIT && |
| 251 | (newState == eSIR_HT_MIMO_PS_DYNAMIC ||newState == eSIR_HT_MIMO_PS_STATIC)) |
| 252 | return TRUE; |
| 253 | return FALSE; |
| 254 | } |
| 255 | |
| 256 | /// ANI peer station count management and associated actions |
| 257 | void limUtilCountStaAdd(tpAniSirGlobal pMac, tpDphHashNode pSta, tpPESession psessionEntry); |
| 258 | void limUtilCountStaDel(tpAniSirGlobal pMac, tpDphHashNode pSta, tpPESession psessionEntry); |
| 259 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 260 | tANI_U8 limGetHTCapability( tpAniSirGlobal, tANI_U32, tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 261 | void limTxComplete( tHalHandle hHal, void *pData ); |
| 262 | |
| 263 | /**********Admit Control***************************************/ |
| 264 | |
| 265 | //callback function for HAL to issue DelTS request to PE. |
| 266 | //This function will be registered with HAL for callback when TSPEC inactivity timer fires. |
| 267 | |
| 268 | void limProcessDelTsInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg); |
| 269 | tSirRetStatus limProcessHalIndMessages(tpAniSirGlobal pMac, tANI_U32 mesgId, void *mesgParam ); |
| 270 | tSirRetStatus limValidateDeltsReq(tpAniSirGlobal pMac, tpSirDeltsReq pDeltsReq, tSirMacAddr peerMacAddr,tpPESession psessionEntry); |
| 271 | /**********************************************************/ |
| 272 | |
| 273 | //callback function registration to HAL for any indication. |
| 274 | void limRegisterHalIndCallBack(tpAniSirGlobal pMac); |
| 275 | void limPktFree ( |
| 276 | tpAniSirGlobal pMac, |
| 277 | eFrameType frmType, |
| 278 | tANI_U8 *pBD, |
| 279 | void *body); |
| 280 | |
| 281 | |
| 282 | |
| 283 | void limGetBDfromRxPacket(tpAniSirGlobal pMac, void *body, tANI_U32 **pBD); |
| 284 | |
| 285 | /** |
| 286 | * \brief Given a base(X) and power(Y), this API will return |
| 287 | * the result of base raised to power - (X ^ Y) |
| 288 | * |
| 289 | * \sa utilsPowerXY |
| 290 | * |
| 291 | * \param base Base value |
| 292 | * |
| 293 | * \param power Base raised to this Power value |
| 294 | * |
| 295 | * \return Result of X^Y |
| 296 | * |
| 297 | */ |
| 298 | static inline tANI_U32 utilsPowerXY( tANI_U16 base, tANI_U16 power ) |
| 299 | { |
| 300 | tANI_U32 result = 1, i; |
| 301 | |
| 302 | for( i = 0; i < power; i++ ) |
| 303 | result *= base; |
| 304 | |
| 305 | return result; |
| 306 | } |
| 307 | |
| 308 | |
| 309 | |
| 310 | tSirRetStatus limPostMlmAddBAReq( tpAniSirGlobal pMac, |
| 311 | tpDphHashNode pStaDs, |
| 312 | tANI_U8 tid, tANI_U16 startingSeqNum,tpPESession psessionEntry); |
| 313 | tSirRetStatus limPostMlmAddBARsp( tpAniSirGlobal pMac, |
| 314 | tSirMacAddr peerMacAddr, |
| 315 | tSirMacStatusCodes baStatusCode, |
| 316 | tANI_U8 baDialogToken, |
| 317 | tANI_U8 baTID, |
| 318 | tANI_U8 baPolicy, |
| 319 | tANI_U16 baBufferSize, |
| 320 | tANI_U16 baTimeout, |
| 321 | tpPESession psessionEntry); |
| 322 | tSirRetStatus limPostMlmDelBAReq( tpAniSirGlobal pMac, |
| 323 | tpDphHashNode pSta, |
| 324 | tANI_U8 baDirection, |
| 325 | tANI_U8 baTID, |
| 326 | tSirMacReasonCodes baReasonCode , |
| 327 | tpPESession psessionEntry); |
| 328 | tSirRetStatus limPostMsgAddBAReq( tpAniSirGlobal pMac, |
| 329 | tpDphHashNode pSta, |
| 330 | tANI_U8 baDialogToken, |
| 331 | tANI_U8 baTID, |
| 332 | tANI_U8 baPolicy, |
| 333 | tANI_U16 baBufferSize, |
| 334 | tANI_U16 baTimeout, |
| 335 | tANI_U16 baSSN, |
| 336 | tANI_U8 baDirection, |
| 337 | tpPESession psessionEntry); |
| 338 | tSirRetStatus limPostMsgDelBAInd( tpAniSirGlobal pMac, |
| 339 | tpDphHashNode pSta, |
| 340 | tANI_U8 baTID, |
| 341 | tANI_U8 baDirection, |
| 342 | tpPESession psessionEntry); |
| 343 | |
| 344 | tSirRetStatus limPostSMStateUpdate(tpAniSirGlobal pMac, |
| 345 | tANI_U16 StaIdx, |
| 346 | tSirMacHTMIMOPowerSaveState MIMOPSState); |
| 347 | |
| 348 | void limDeleteStaContext(tpAniSirGlobal pMac, tpSirMsgQ limMsg); |
| 349 | void limProcessAddBaInd(tpAniSirGlobal pMac, tpSirMsgQ limMsg); |
Kiran Kumar Lokere | 458d732 | 2013-05-29 14:29:43 -0700 | [diff] [blame] | 350 | void limDeleteBASessions(tpAniSirGlobal pMac, tpPESession pSessionEntry, tANI_U32 baDirection); |
Leela Venkata Kiran Kumar Reddy Chirala | b8dadc2 | 2013-11-05 12:34:32 -0800 | [diff] [blame] | 351 | void limDelPerBssBASessionsBtc(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 352 | void limDelAllBASessions(tpAniSirGlobal pMac); |
| 353 | void limDeleteDialogueTokenList(tpAniSirGlobal pMac); |
| 354 | tSirRetStatus limSearchAndDeleteDialogueToken(tpAniSirGlobal pMac, tANI_U8 token, tANI_U16 assocId, tANI_U16 tid); |
| 355 | void limRessetScanChannelInfo(tpAniSirGlobal pMac); |
| 356 | void limAddScanChannelInfo(tpAniSirGlobal pMac, tANI_U8 channelId); |
| 357 | |
| 358 | tANI_U8 limGetChannelFromBeacon(tpAniSirGlobal pMac, tpSchBeaconStruct pBeacon); |
| 359 | tSirNwType limGetNwType(tpAniSirGlobal pMac, tANI_U8 channelNum, tANI_U32 type, tpSchBeaconStruct pBeacon); |
| 360 | void limSetTspecUapsdMask(tpAniSirGlobal pMac, tSirMacTSInfo *pTsInfo, tANI_U32 action); |
| 361 | void limHandleHeartBeatTimeout(tpAniSirGlobal pMac); |
Leela Venkata Kiran Kumar Reddy Chirala | 3ca1790 | 2013-02-27 19:50:05 -0800 | [diff] [blame] | 362 | void limHandleHeartBeatTimeoutForSession(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 363 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 364 | //void limProcessBtampAddBssRsp(tpAniSirGlobal pMac,tpSirMsgQ pMsgQ,tpPESession peSession); |
| 365 | void limProcessAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ pMsgQ); |
| 366 | |
| 367 | void limUpdateBeacon(tpAniSirGlobal pMac); |
| 368 | |
| 369 | void limProcessBtAmpApMlmAddStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ, tpPESession psessionEntry); |
| 370 | void limProcessBtAmpApMlmDelBssRsp( tpAniSirGlobal pMac, tpSirMsgQ limMsgQ,tpPESession psessionEntry); |
| 371 | |
| 372 | void limProcessBtAmpApMlmDelStaRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ,tpPESession psessionEntry); |
| 373 | tpPESession limIsIBSSSessionActive(tpAniSirGlobal pMac); |
| 374 | tpPESession limIsApSessionActive(tpAniSirGlobal pMac); |
| 375 | void limHandleHeartBeatFailureTimeout(tpAniSirGlobal pMac); |
| 376 | |
| 377 | void limProcessDelStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ); |
| 378 | void limProcessAddStaSelfRsp(tpAniSirGlobal pMac,tpSirMsgQ limMsgQ); |
| 379 | v_U8_t* limGetIEPtr(tpAniSirGlobal pMac, v_U8_t *pIes, int length, v_U8_t eid,eSizeOfLenField size_of_len_field); |
| 380 | |
| 381 | tANI_U8 limUnmapChannel(tANI_U8 mapChannel); |
| 382 | |
| 383 | #define limGetWscIEPtr(pMac, ie, ie_len) \ |
| 384 | limGetVendorIEOuiPtr(pMac, SIR_MAC_WSC_OUI, SIR_MAC_WSC_OUI_SIZE, ie, ie_len) |
| 385 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 386 | #define limGetP2pIEPtr(pMac, ie, ie_len) \ |
| 387 | limGetVendorIEOuiPtr(pMac, SIR_MAC_P2P_OUI, SIR_MAC_P2P_OUI_SIZE, ie, ie_len) |
| 388 | |
| 389 | v_U8_t limGetNoaAttrStreamInMultP2pIes(tpAniSirGlobal pMac,v_U8_t* noaStream,v_U8_t noaLen,v_U8_t overFlowLen); |
| 390 | v_U8_t limGetNoaAttrStream(tpAniSirGlobal pMac, v_U8_t*pNoaStream,tpPESession psessionEntry); |
| 391 | |
| 392 | v_U8_t limBuildP2pIe(tpAniSirGlobal pMac, tANI_U8 *ie, tANI_U8 *data, tANI_U8 ie_len); |
Viral Modi | d86bde2 | 2012-12-10 13:09:21 -0800 | [diff] [blame] | 393 | tANI_BOOLEAN limIsNOAInsertReqd(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 394 | v_U8_t* limGetVendorIEOuiPtr(tpAniSirGlobal pMac, tANI_U8 *oui, tANI_U8 oui_size, tANI_U8 *ie, tANI_U16 ie_len); |
| 395 | tANI_BOOLEAN limIsconnectedOnDFSChannel(tANI_U8 currentChannel); |
| 396 | tANI_U8 limGetCurrentOperatingChannel(tpAniSirGlobal pMac); |
| 397 | |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 398 | #ifdef WLAN_FEATURE_11AC |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 399 | tANI_BOOLEAN limCheckVHTOpModeChange( tpAniSirGlobal pMac, |
Madan Mohan Koyyalamudi | 1bed598 | 2012-10-22 14:38:06 -0700 | [diff] [blame] | 400 | tpPESession psessionEntry, tANI_U8 chanWidth, tANI_U8 staId); |
Mohit Khanna | 4a70d26 | 2012-09-11 16:30:12 -0700 | [diff] [blame] | 401 | #endif |
Sandeep Puligilla | 6034276 | 2014-01-30 21:05:37 +0530 | [diff] [blame] | 402 | tANI_BOOLEAN limCheckHTChanBondModeChange(tpAniSirGlobal pMac, |
| 403 | tpPESession psessionEntry, |
| 404 | tANI_U8 beaconSecChanWidth, |
| 405 | tANI_U8 currentSecChanWidth, |
| 406 | tANI_U8 staId); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 407 | #ifdef FEATURE_WLAN_DIAG_SUPPORT |
| 408 | |
| 409 | typedef enum |
| 410 | { |
| 411 | WLAN_PE_DIAG_SCAN_REQ_EVENT = 0, |
| 412 | WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, |
| 413 | WLAN_PE_DIAG_SCAN_RSP_EVENT, |
| 414 | WLAN_PE_DIAG_JOIN_REQ_EVENT, |
| 415 | WLAN_PE_DIAG_JOIN_RSP_EVENT, |
| 416 | WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, |
| 417 | WLAN_PE_DIAG_SETCONTEXT_RSP_EVENT, |
| 418 | WLAN_PE_DIAG_REASSOC_REQ_EVENT, |
| 419 | WLAN_PE_DIAG_REASSOC_RSP_EVENT, |
| 420 | WLAN_PE_DIAG_AUTH_REQ_EVENT, |
| 421 | WLAN_PE_DIAG_AUTH_RSP_EVENT, |
| 422 | WLAN_PE_DIAG_DISASSOC_REQ_EVENT, |
| 423 | WLAN_PE_DIAG_DISASSOC_RSP_EVENT, |
| 424 | WLAN_PE_DIAG_DISASSOC_IND_EVENT, |
| 425 | WLAN_PE_DIAG_DISASSOC_CNF_EVENT, |
| 426 | WLAN_PE_DIAG_DEAUTH_REQ_EVENT, |
| 427 | WLAN_PE_DIAG_DEAUTH_RSP_EVENT, |
| 428 | WLAN_PE_DIAG_DEAUTH_IND_EVENT, |
| 429 | WLAN_PE_DIAG_START_BSS_REQ_EVENT, |
| 430 | WLAN_PE_DIAG_START_BSS_RSP_EVENT, |
| 431 | WLAN_PE_DIAG_AUTH_IND_EVENT, |
| 432 | WLAN_PE_DIAG_ASSOC_IND_EVENT, |
| 433 | WLAN_PE_DIAG_ASSOC_CNF_EVENT, |
| 434 | WLAN_PE_DIAG_REASSOC_IND_EVENT, |
| 435 | WLAN_PE_DIAG_SWITCH_CHL_REQ_EVENT, |
| 436 | WLAN_PE_DIAG_SWITCH_CHL_RSP_EVENT, |
| 437 | WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, |
| 438 | WLAN_PE_DIAG_STOP_BSS_RSP_EVENT, |
| 439 | WLAN_PE_DIAG_DEAUTH_CNF_EVENT, |
| 440 | WLAN_PE_DIAG_ADDTS_REQ_EVENT, |
| 441 | WLAN_PE_DIAG_ADDTS_RSP_EVENT, |
| 442 | WLAN_PE_DIAG_DELTS_REQ_EVENT, |
| 443 | WLAN_PE_DIAG_DELTS_RSP_EVENT, |
| 444 | WLAN_PE_DIAG_DELTS_IND_EVENT, |
| 445 | WLAN_PE_DIAG_ENTER_BMPS_REQ_EVENT, |
| 446 | WLAN_PE_DIAG_ENTER_BMPS_RSP_EVENT, |
| 447 | WLAN_PE_DIAG_EXIT_BMPS_REQ_EVENT, |
| 448 | WLAN_PE_DIAG_EXIT_BMPS_RSP_EVENT, |
| 449 | WLAN_PE_DIAG_EXIT_BMPS_IND_EVENT, |
| 450 | WLAN_PE_DIAG_ENTER_IMPS_REQ_EVENT, |
| 451 | WLAN_PE_DIAG_ENTER_IMPS_RSP_EVENT, |
| 452 | WLAN_PE_DIAG_EXIT_IMPS_REQ_EVENT, |
| 453 | WLAN_PE_DIAG_EXIT_IMPS_RSP_EVENT, |
| 454 | WLAN_PE_DIAG_ENTER_UAPSD_REQ_EVENT, |
| 455 | WLAN_PE_DIAG_ENTER_UAPSD_RSP_EVENT, |
| 456 | WLAN_PE_DIAG_EXIT_UAPSD_REQ_EVENT, |
| 457 | WLAN_PE_DIAG_EXIT_UAPSD_RSP_EVENT, |
| 458 | WLAN_PE_DIAG_WOWL_ADD_BCAST_PTRN_EVENT, |
| 459 | WLAN_PE_DIAG_WOWL_DEL_BCAST_PTRN_EVENT, |
| 460 | WLAN_PE_DIAG_ENTER_WOWL_REQ_EVENT, |
| 461 | WLAN_PE_DIAG_ENTER_WOWL_RSP_EVENT, |
| 462 | WLAN_PE_DIAG_EXIT_WOWL_REQ_EVENT, |
| 463 | WLAN_PE_DIAG_EXIT_WOWL_RSP_EVENT, |
| 464 | WLAN_PE_DIAG_HAL_ADDBA_REQ_EVENT, |
| 465 | WLAN_PE_DIAG_HAL_ADDBA_RSP_EVENT, |
| 466 | WLAN_PE_DIAG_HAL_DELBA_IND_EVENT, |
Leela Venkata Kiran Kumar Reddy Chirala | 2365ee6 | 2013-05-09 17:30:12 -0700 | [diff] [blame] | 467 | WLAN_PE_DIAG_HB_FAILURE_TIMEOUT, |
| 468 | WLAN_PE_DIAG_PRE_AUTH_REQ_EVENT, |
| 469 | WLAN_PE_DIAG_PRE_AUTH_RSP_EVENT, |
| 470 | WLAN_PE_DIAG_PREAUTH_DONE, |
| 471 | WLAN_PE_DIAG_REASSOCIATING, |
| 472 | WLAN_PE_DIAG_CONNECTED, |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 473 | }WLAN_PE_DIAG_EVENT_TYPE; |
| 474 | |
| 475 | void limDiagEventReport(tpAniSirGlobal pMac, tANI_U16 eventType, tpPESession pSessionEntry, tANI_U16 status, tANI_U16 reasonCode); |
| 476 | #endif /* FEATURE_WLAN_DIAG_SUPPORT */ |
| 477 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 478 | void peSetResumeChannel(tpAniSirGlobal pMac, tANI_U16 channel, ePhyChanBondState cbState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 479 | /*-------------------------------------------------------------------------- |
| 480 | |
| 481 | \brief peGetResumeChannel() - Returns the channel number for scanning, from a valid session. |
| 482 | |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 483 | This function returns the channel to resume to during link resume. channel id of 0 means HAL will |
| 484 | resume to previous channel before link suspend |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 485 | |
| 486 | \param pMac - pointer to global adapter context |
| 487 | \return - channel to scan from valid session else zero. |
| 488 | |
| 489 | \sa |
| 490 | |
| 491 | --------------------------------------------------------------------------*/ |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 492 | void peGetResumeChannel(tpAniSirGlobal pMac, tANI_U8* resumeChannel, ePhyChanBondState* resumePhyCbState); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 493 | |
Mohit Khanna | 698ba2a | 2012-12-04 15:08:18 -0800 | [diff] [blame] | 494 | #ifdef FEATURE_WLAN_TDLS_INTERNAL |
| 495 | tANI_U8 limTdlsFindLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac, tLimTdlsLinkSetupPeer **setupPeer); |
| 496 | void limTdlsDelLinkPeer(tpAniSirGlobal pMac, tSirMacAddr peerMac); |
| 497 | void limStartTdlsTimer(tpAniSirGlobal pMac, tANI_U8 sessionId, TX_TIMER *timer, tANI_U32 timerId, |
| 498 | tANI_U16 timerType, tANI_U32 timerMsg); |
| 499 | #endif |
krunal soni | 45b9eb6 | 2014-03-26 12:54:25 -0700 | [diff] [blame^] | 500 | void limGetShortSlotFromPhyMode(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U32 phyMode, |
| 501 | tANI_U8 *pShortSlotEnable); |
Madan Mohan Koyyalamudi | 6db7ad1 | 2012-10-29 16:14:41 -0700 | [diff] [blame] | 502 | |
Madan Mohan Koyyalamudi | a67d433 | 2012-11-29 11:35:23 -0800 | [diff] [blame] | 503 | void limCleanUpDisassocDeauthReq(tpAniSirGlobal pMac, tANI_U8 *staMac, tANI_BOOLEAN cleanRxPath); |
| 504 | |
Madan Mohan Koyyalamudi | 25b6f8b | 2012-12-04 16:17:31 -0800 | [diff] [blame] | 505 | tANI_BOOLEAN limCheckDisassocDeauthAckPending(tpAniSirGlobal pMac, tANI_U8 *staMac); |
Kalikinkar dhara | 205da78 | 2014-03-21 15:49:32 -0700 | [diff] [blame] | 506 | |
| 507 | |
| 508 | void limUtilsframeshtons(tpAniSirGlobal pCtx, |
| 509 | tANI_U8 *pOut, |
| 510 | tANI_U16 pIn, |
| 511 | tANI_U8 fMsb); |
| 512 | |
| 513 | void limUtilsframeshtonl(tpAniSirGlobal pCtx, |
| 514 | tANI_U8 *pOut, |
| 515 | tANI_U32 pIn, |
| 516 | tANI_U8 fMsb); |
| 517 | |
Sandeep Puligilla | 11d49a6 | 2014-01-30 12:05:16 +0530 | [diff] [blame] | 518 | void limUpdateOBSSScanParams(tpPESession psessionEntry , |
| 519 | tDot11fIEOBSSScanParameters *pOBSSScanParameters); |
Chet Lanctot | 8cecea2 | 2014-02-11 19:09:36 -0800 | [diff] [blame] | 520 | |
| 521 | #ifdef WLAN_FEATURE_11W |
| 522 | void limPmfSaQueryTimerHandler(void *pMacGlobal, tANI_U32 param); |
| 523 | #endif |
| 524 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 525 | #endif /* __LIM_UTILS_H */ |