📄 mlme.h
字号:
/* ************************************************************************* * Ralink Tech Inc. * 5F., No.36, Taiyuan St., Jhubei City, * Hsinchu County 302, * Taiwan, R.O.C. * * (c) Copyright 2002-2007, Ralink Technology, Inc. * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * * ************************************************************************* Module Name: mlme.h Abstract: Revision History: Who When What -------- ---------- ---------------------------------------------- John Chang 2003-08-28 Created John Chang 2004-09-06 modified for RT2600 */#ifndef __MLME_H__#define __MLME_H__#include "rtmp_dot11.h"#ifdef CONFIG_STA_SUPPORT#endif // CONFIG_STA_SUPPORT //// maximum supported capability information - // ESS, IBSS, Privacy, Short Preamble, Spectrum mgmt, Short Slot#define SUPPORTED_CAPABILITY_INFO 0x0533#define END_OF_ARGS -1#define LFSR_MASK 0x80000057#define MLME_TASK_EXEC_INTV 100/*200*/ // #define LEAD_TIME 5#define MLME_TASK_EXEC_MULTIPLE 10 /*5*/ // MLME_TASK_EXEC_MULTIPLE * MLME_TASK_EXEC_INTV = 1 sec#define REORDER_EXEC_INTV 100 // 0.1 sec//#define TBTT_PRELOAD_TIME 384 // usec. LomgPreamble + 24-byte at 1Mbps// The definition of Radar detection duration region#define CE 0#define FCC 1#define JAP 2#define JAP_W53 3#define JAP_W56 4#define MAX_RD_REGION 5#define BEACON_LOST_TIME 4 * OS_HZ // 2048 msec = 2 sec#define DLS_TIMEOUT 1200 // unit: msec#define AUTH_TIMEOUT 300 // unit: msec#define ASSOC_TIMEOUT 300 // unit: msec#define JOIN_TIMEOUT 2000 // unit: msec#define SHORT_CHANNEL_TIME 90 // unit: msec#define MIN_CHANNEL_TIME 110 // unit: msec, for dual band scan#define MAX_CHANNEL_TIME 140 // unit: msec, for single band scan#define FAST_ACTIVE_SCAN_TIME 30 // Active scan waiting for probe response time#define CW_MIN_IN_BITS 4 // actual CwMin = 2^CW_MIN_IN_BITS - 1#define LINK_DOWN_TIMEOUT 20000 //unit: msec#define AUTO_WAKEUP_TIMEOUT 70 //unit: msec#ifdef CONFIG_STA_SUPPORT#define CW_MAX_IN_BITS 10 // actual CwMax = 2^CW_MAX_IN_BITS - 1#endif // CONFIG_STA_SUPPORT //#ifdef CONFIG_APSTA_MIXED_SUPPORTextern UINT32 CW_MAX_IN_BITS;#endif // CONFIG_APSTA_MIXED_SUPPORT //// Note: RSSI_TO_DBM_OFFSET has been changed to variable for new RF (2004-0720).// SHould not refer to this constant anymore//#define RSSI_TO_DBM_OFFSET 120 // for RT2530 RSSI-115 = dBm#define RSSI_FOR_MID_TX_POWER -55 // -55 db is considered mid-distance#define RSSI_FOR_LOW_TX_POWER -45 // -45 db is considered very short distance and // eligible to use a lower TX power#define RSSI_FOR_LOWEST_TX_POWER -30//#define MID_TX_POWER_DELTA 0 // 0 db from full TX power upon mid-distance to AP#define LOW_TX_POWER_DELTA 6 // -3 db from full TX power upon very short distance. 1 grade is 0.5 db#define LOWEST_TX_POWER_DELTA 16 // -8 db from full TX power upon shortest distance. 1 grade is 0.5 db#define RSSI_TRIGGERED_UPON_BELOW_THRESHOLD 0#define RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD 1#define RSSI_THRESHOLD_FOR_ROAMING 25#define RSSI_DELTA 5// Channel Quality Indication#define CQI_IS_GOOD(cqi) ((cqi) >= 50)//#define CQI_IS_FAIR(cqi) (((cqi) >= 20) && ((cqi) < 50))#define CQI_IS_POOR(cqi) (cqi < 50) //(((cqi) >= 5) && ((cqi) < 20))#define CQI_IS_BAD(cqi) (cqi < 5)#define CQI_IS_DEAD(cqi) (cqi == 0)// weighting factor to calculate Channel quality, total should be 100%#define RSSI_WEIGHTING 50#define TX_WEIGHTING 30#define RX_WEIGHTING 20//#define PEER_KEY_NOT_USED 0//#define PEER_KEY_64_BIT 64//#define PEER_KEY_128_BIT 128//#define PEER_KEY_64BIT_LEN 8//#define PEER_KEY_128BIT_LEN 16#define BSS_NOT_FOUND 0xFFFFFFFF#ifdef CONFIG_STA_SUPPORT#define MAX_LEN_OF_MLME_QUEUE 40 //10#endif // CONFIG_STA_SUPPORT //#define SCAN_PASSIVE 18 // scan with no probe request, only wait beacon and probe response#define SCAN_ACTIVE 19 // scan with probe request, and wait beacon and probe response#define SCAN_CISCO_PASSIVE 20 // Single channel passive scan#define SCAN_CISCO_ACTIVE 21 // Single channel active scan#define SCAN_CISCO_NOISE 22 // Single channel passive scan for noise histogram collection#define SCAN_CISCO_CHANNEL_LOAD 23 // Single channel passive scan for channel load collection#define FAST_SCAN_ACTIVE 24 // scan with probe request, and wait beacon and probe response#ifdef DOT11N_DRAFT3#define SCAN_2040_BSS_COEXIST 26#endif // DOT11N_DRAFT3 ////#define BSS_TABLE_EMPTY(x) ((x).BssNr == 0)#define MAC_ADDR_IS_GROUP(Addr) (((Addr[0]) & 0x01))#define MAC_ADDR_HASH(Addr) (Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])#define MAC_ADDR_HASH_INDEX(Addr) (MAC_ADDR_HASH(Addr) % HASH_TABLE_SIZE)#define TID_MAC_HASH(Addr,TID) (TID^Addr[0] ^ Addr[1] ^ Addr[2] ^ Addr[3] ^ Addr[4] ^ Addr[5])#define TID_MAC_HASH_INDEX(Addr,TID) (TID_MAC_HASH(Addr,TID) % HASH_TABLE_SIZE)// LED Control// assoiation ON. one LED ON. another blinking when TX, OFF when idle// no association, both LED off#define ASIC_LED_ACT_ON(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00031e46)#define ASIC_LED_ACT_OFF(pAd) RTMP_IO_WRITE32(pAd, MAC_CSR14, 0x00001e46)// bit definition of the 2-byte pBEACON->Capability field#define CAP_IS_ESS_ON(x) (((x) & 0x0001) != 0)#define CAP_IS_IBSS_ON(x) (((x) & 0x0002) != 0)#define CAP_IS_CF_POLLABLE_ON(x) (((x) & 0x0004) != 0)#define CAP_IS_CF_POLL_REQ_ON(x) (((x) & 0x0008) != 0)#define CAP_IS_PRIVACY_ON(x) (((x) & 0x0010) != 0)#define CAP_IS_SHORT_PREAMBLE_ON(x) (((x) & 0x0020) != 0)#define CAP_IS_PBCC_ON(x) (((x) & 0x0040) != 0)#define CAP_IS_AGILITY_ON(x) (((x) & 0x0080) != 0)#define CAP_IS_SPECTRUM_MGMT(x) (((x) & 0x0100) != 0) // 802.11e d9#define CAP_IS_QOS(x) (((x) & 0x0200) != 0) // 802.11e d9#define CAP_IS_SHORT_SLOT(x) (((x) & 0x0400) != 0)#define CAP_IS_APSD(x) (((x) & 0x0800) != 0) // 802.11e d9#define CAP_IS_IMMED_BA(x) (((x) & 0x1000) != 0) // 802.11e d9#define CAP_IS_DSSS_OFDM(x) (((x) & 0x2000) != 0)#define CAP_IS_DELAY_BA(x) (((x) & 0x4000) != 0) // 802.11e d9#define CAP_GENERATE(ess,ibss,priv,s_pre,s_slot,spectrum) (((ess) ? 0x0001 : 0x0000) | ((ibss) ? 0x0002 : 0x0000) | ((priv) ? 0x0010 : 0x0000) | ((s_pre) ? 0x0020 : 0x0000) | ((s_slot) ? 0x0400 : 0x0000) | ((spectrum) ? 0x0100 : 0x0000))//#define STA_QOS_CAPABILITY 0 // 1-byte. see 802.11e d9.0 for bit definition#define ERP_IS_NON_ERP_PRESENT(x) (((x) & 0x01) != 0) // 802.11g#define ERP_IS_USE_PROTECTION(x) (((x) & 0x02) != 0) // 802.11g#define ERP_IS_USE_BARKER_PREAMBLE(x) (((x) & 0x04) != 0) // 802.11g#define DRS_TX_QUALITY_WORST_BOUND 8// 3 // just test by gary#define DRS_PENALTY 8#define BA_NOTUSE 2//BA Policy subfiled value in ADDBA frame#define IMMED_BA 1#define DELAY_BA 0// BA Initiator subfield in DELBA frame#define ORIGINATOR 1#define RECIPIENT 0// ADDBA Status Code#define ADDBA_RESULTCODE_SUCCESS 0#define ADDBA_RESULTCODE_REFUSED 37#define ADDBA_RESULTCODE_INVALID_PARAMETERS 38// DELBA Reason Code#define DELBA_REASONCODE_QSTA_LEAVING 36#define DELBA_REASONCODE_END_BA 37#define DELBA_REASONCODE_UNKNOWN_BA 38#define DELBA_REASONCODE_TIMEOUT 39// reset all OneSecTx counters#define RESET_ONE_SEC_TX_CNT(__pEntry) \if (((__pEntry)) != NULL) \{ \ (__pEntry)->OneSecTxRetryOkCount = 0; \ (__pEntry)->OneSecTxFailCount = 0; \ (__pEntry)->OneSecTxNoRetryOkCount = 0; \}//// 802.11 frame formats//// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef RT_BIG_ENDIAN USHORT LSIGTxopProSup:1; USHORT Forty_Mhz_Intolerant:1; USHORT PSMP:1; USHORT CCKmodein40:1; USHORT AMsduSize:1; USHORT DelayedBA:1; //rt2860c not support USHORT RxSTBC:2; USHORT TxSTBC:1; USHORT ShortGIfor40:1; //for40MHz USHORT ShortGIfor20:1; USHORT GF:1; //green field USHORT MimoPs:2;//momi power safe USHORT ChannelWidth:1; USHORT AdvCoding:1;#else USHORT AdvCoding:1; USHORT ChannelWidth:1; USHORT MimoPs:2;//momi power safe USHORT GF:1; //green field USHORT ShortGIfor20:1; USHORT ShortGIfor40:1; //for40MHz USHORT TxSTBC:1; USHORT RxSTBC:2; USHORT DelayedBA:1; //rt2860c not support USHORT AMsduSize:1; // only support as zero USHORT CCKmodein40:1; USHORT PSMP:1; USHORT Forty_Mhz_Intolerant:1; USHORT LSIGTxopProSup:1;#endif /* !RT_BIG_ENDIAN */} HT_CAP_INFO, *PHT_CAP_INFO;// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef RT_BIG_ENDIAN UCHAR rsv:3;//momi power safe UCHAR MpduDensity:3; UCHAR MaxRAmpduFactor:2;#else UCHAR MaxRAmpduFactor:2; UCHAR MpduDensity:3; UCHAR rsv:3;//momi power safe#endif /* !RT_BIG_ENDIAN */} HT_CAP_PARM, *PHT_CAP_PARM;// HT Capability INFO field in HT Cap IE . typedef struct PACKED { UCHAR MCSSet[10]; UCHAR SupRate[2]; // unit : 1Mbps#ifdef RT_BIG_ENDIAN UCHAR rsv:3; UCHAR MpduDensity:1; UCHAR TxStream:2; UCHAR TxRxNotEqual:1; UCHAR TxMCSSetDefined:1; #else UCHAR TxMCSSetDefined:1; UCHAR TxRxNotEqual:1; UCHAR TxStream:2; UCHAR MpduDensity:1; UCHAR rsv:3;#endif // RT_BIG_ENDIAN // UCHAR rsv3[3]; } HT_MCS_SET, *PHT_MCS_SET;// HT Capability INFO field in HT Cap IE . typedef struct PACKED {#ifdef RT_BIG_ENDIAN USHORT rsv2:4; USHORT RDGSupport:1; //reverse Direction Grant support USHORT PlusHTC:1; //+HTC control field support USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. USHORT rsv:5;//momi power safe USHORT TranTime:2; USHORT Pco:1;#else USHORT Pco:1; USHORT TranTime:2; USHORT rsv:5;//momi power safe USHORT MCSFeedback:2; //0:no MCS feedback, 2:unsolicited MCS feedback, 3:Full MCS feedback, 1:rsv. USHORT PlusHTC:1; //+HTC control field support USHORT RDGSupport:1; //reverse Direction Grant support USHORT rsv2:4;#endif /* RT_BIG_ENDIAN */} EXT_HT_CAP_INFO, *PEXT_HT_CAP_INFO;// HT Beamforming field in HT Cap IE . typedef struct PACKED _HT_BF_CAP{#ifdef RT_BIG_ENDIAN ULONG rsv:3; ULONG ChanEstimation:2; ULONG CSIRowBFSup:2; ULONG ComSteerBFAntSup:2; ULONG NoComSteerBFAntSup:2; ULONG CSIBFAntSup:2; ULONG MinGrouping:2; ULONG ExpComBF:2; ULONG ExpNoComBF:2; ULONG ExpCSIFbk:2; ULONG ExpComSteerCapable:1; ULONG ExpNoComSteerCapable:1; ULONG ExpCSICapable:1; ULONG Calibration:2; ULONG ImpTxBFCapable:1; ULONG TxNDPCapable:1; ULONG RxNDPCapable:1; ULONG TxSoundCapable:1; ULONG RxSoundCapable:1; ULONG TxBFRecCapable:1;#else ULONG TxBFRecCapable:1; ULONG RxSoundCapable:1; ULONG TxSoundCapable:1; ULONG RxNDPCapable:1; ULONG TxNDPCapable:1; ULONG ImpTxBFCapable:1; ULONG Calibration:2; ULONG ExpCSICapable:1; ULONG ExpNoComSteerCapable:1; ULONG ExpComSteerCapable:1; ULONG ExpCSIFbk:2; ULONG ExpNoComBF:2; ULONG ExpComBF:2; ULONG MinGrouping:2; ULONG CSIBFAntSup:2; ULONG NoComSteerBFAntSup:2; ULONG ComSteerBFAntSup:2; ULONG CSIRowBFSup:2; ULONG ChanEstimation:2; ULONG rsv:3;#endif // RT_BIG_ENDIAN //} HT_BF_CAP, *PHT_BF_CAP;// HT antenna selection field in HT Cap IE . typedef struct PACKED _HT_AS_CAP{#ifdef RT_BIG_ENDIAN UCHAR rsv:1; UCHAR TxSoundPPDU:1; UCHAR RxASel:1; UCHAR AntIndFbk:1; UCHAR ExpCSIFbk:1; UCHAR AntIndFbkTxASEL:1; UCHAR ExpCSIFbkTxASEL:1; UCHAR AntSelect:1; #else UCHAR AntSelect:1; UCHAR ExpCSIFbkTxASEL:1; UCHAR AntIndFbkTxASEL:1; UCHAR ExpCSIFbk:1; UCHAR AntIndFbk:1; UCHAR RxASel:1; UCHAR TxSoundPPDU:1; UCHAR rsv:1;#endif // RT_BIG_ENDIAN //} HT_AS_CAP, *PHT_AS_CAP;// Draft 1.0 set IE length 26, but is extensible..#define SIZE_HT_CAP_IE 26// The structure for HT Capability IE.typedef struct PACKED _HT_CAPABILITY_IE{ HT_CAP_INFO HtCapInfo; HT_CAP_PARM HtCapParm;// HT_MCS_SET HtMCSSet; UCHAR MCSSet[16]; EXT_HT_CAP_INFO ExtHtCapInfo; HT_BF_CAP TxBFCap; // beamforming cap. rt2860c not support beamforming. HT_AS_CAP ASCap; //antenna selection.} HT_CAPABILITY_IE, *PHT_CAPABILITY_IE;// 802.11n draft3 related structure definitions.// 7.3.2.60#define dot11OBSSScanPassiveDwell 20 // in TU. min amount of time that the STA continously scans each channel when performing an active OBSS scan.#define dot11OBSSScanActiveDwell 10 // in TU.min amount of time that the STA continously scans each channel when performing an passive OBSS scan.#define dot11BSSWidthTriggerScanInterval 300 // in sec. max interval between scan operations to be performed to detect BSS channel width trigger events.#define dot11OBSSScanPassiveTotalPerChannel 200 // in TU. min total amount of time that the STA scans each channel when performing a passive OBSS scan.#define dot11OBSSScanActiveTotalPerChannel 20 //in TU. min total amount of time that the STA scans each channel when performing a active OBSS scan#define dot11BSSWidthChannelTransactionDelayFactor 5 // min ratio between the delay time in performing a switch from 20MHz BSS to 20/40 BSS operation and the maximum // interval between overlapping BSS scan operations.#define dot11BSSScanActivityThreshold 25 // in %%, max total time that a STA may be active on the medium during a period of // (dot11BSSWidthChannelTransactionDelayFactor * dot11BSSWidthTriggerScanInterval) seconds without // being obligated to perform OBSS Scan operations. default is 25(== 0.25%)typedef struct PACKED _OVERLAP_BSS_SCAN_IE{ USHORT ScanPassiveDwell; USHORT ScanActiveDwell; USHORT TriggerScanInt; // Trigger scan interval USHORT PassiveTalPerChannel; // passive total per channel USHORT ActiveTalPerChannel; // active total per channel USHORT DelayFactor; // BSS width channel transition delay factor USHORT ScanActThre; // Scan Activity threshold}OVERLAP_BSS_SCAN_IE, *POVERLAP_BSS_SCAN_IE;// 7.3.2.56. 20/40 Coexistence element used in Element ID = 72 = IE_2040_BSS_COEXISTtypedef union PACKED _BSS_2040_COEXIST_IE{ struct PACKED { #ifdef RT_BIG_ENDIAN UCHAR rsv:5; UCHAR BSS20WidthReq:1; UCHAR Intolerant40:1; UCHAR InfoReq:1; #else UCHAR InfoReq:1; UCHAR Intolerant40:1; // Inter-BSS. set 1 when prohibits a receiving BSS from operating as a 20/40 Mhz BSS. UCHAR BSS20WidthReq:1; // Intra-BSS set 1 when prohibits a receiving AP from operating its BSS as a 20/40MHz BSS. UCHAR rsv:5;#endif // RT_BIG_ENDIAN // } field; UCHAR word;} BSS_2040_COEXIST_IE, *PBSS_2040_COEXIST_IE;typedef struct _TRIGGER_EVENTA{ BOOLEAN bValid; UCHAR BSSID[6]; UCHAR RegClass; // Regulatory Class USHORT Channel; ULONG CDCounter; // Maintain a seperate count down counter for each Event A.} TRIGGER_EVENTA, *PTRIGGER_EVENTA;// 20/40 trigger event table// If one Event A delete or created, or if Event B is detected or not detected, STA should send 2040BSSCoexistence to AP.#define MAX_TRIGGER_EVENT 64typedef struct _TRIGGER_EVENT_TAB{ UCHAR EventANo; TRIGGER_EVENTA EventA[MAX_TRIGGER_EVENT]; ULONG EventBCountDown; // Count down counter for Event B. } TRIGGER_EVENT_TAB, *PTRIGGER_EVENT_TAB;// 7.3.27 20/40 Bss Coexistence Mgmt capability used in extended capabilities information IE( ID = 127 = IE_EXT_CAPABILITY). // This is the first octet and was defined in 802.11n D3.03 and 802.11yD9.0typedef struct PACKED _EXT_CAP_INFO_ELEMENT{#ifdef RT_BIG_ENDIAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -