+/* clear a station PS TIM bit */
+#define WLAN_MR_TIM_BIT_CLEAR(ad_p, apidx, wcid) \
+ { u8 tim_offset = wcid >> 3; \
+ u8 bit_offset = wcid & 0x7; \
+ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] &= (~BIT8[bit_offset]); }
+
+/* set a station PS TIM bit */
+#define WLAN_MR_TIM_BIT_SET(ad_p, apidx, wcid) \
+ { u8 tim_offset = wcid >> 3; \
+ u8 bit_offset = wcid & 0x7; \
+ ad_p->ApCfg.MBSSID[apidx].TimBitmaps[tim_offset] |= BIT8[bit_offset]; }
+
+/* configuration common to OPMODE_AP as well as OPMODE_STA */
+typedef struct _COMMON_CONFIG {
+
+ BOOLEAN bCountryFlag;
+ u8 CountryCode[3];
+ u8 Geography;
+ u8 CountryRegion; /* Enum of country region, 0:FCC, 1:IC, 2:ETSI, 3:SPAIN, 4:France, 5:MKK, 6:MKK1, 7:Israel */
+ u8 CountryRegionForABand; /* Enum of country region for A band */
+ u8 PhyMode; /* PHY_11A, PHY_11B, PHY_11BG_MIXED, PHY_ABG_MIXED */
+ u16 Dsifs; /* in units of usec */
+ unsigned long PacketFilter; /* Packet filter for receiving */
+ u8 RegulatoryClass;
+
+ char Ssid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */
+ u8 SsidLen; /* the actual ssid length in used */
+ u8 LastSsidLen; /* the actual ssid length in used */
+ char LastSsid[MAX_LEN_OF_SSID]; /* NOT NULL-terminated */
+ u8 LastBssid[MAC_ADDR_LEN];
+
+ u8 Bssid[MAC_ADDR_LEN];
+ u16 BeaconPeriod;
+ u8 Channel;
+ u8 CentralChannel; /* Central Channel when using 40MHz is indicating. not real channel. */
+
+ u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
+ u8 SupRateLen;
+ u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
+ u8 ExtRateLen;
+ u8 DesireRate[MAX_LEN_OF_SUPPORTED_RATES]; /* OID_802_11_DESIRED_RATES */
+ u8 MaxDesiredRate;
+ u8 ExpectedACKRate[MAX_LEN_OF_SUPPORTED_RATES];
+
+ unsigned long BasicRateBitmap; /* backup basic ratebitmap */
+
+ BOOLEAN bAPSDCapable;
+ BOOLEAN bInServicePeriod;
+ BOOLEAN bAPSDAC_BE;
+ BOOLEAN bAPSDAC_BK;
+ BOOLEAN bAPSDAC_VI;
+ BOOLEAN bAPSDAC_VO;
+
+ /* because TSPEC can modify the APSD flag, we need to keep the APSD flag
+ requested in association stage from the station;
+ we need to recover the APSD flag after the TSPEC is deleted. */
+ BOOLEAN bACMAPSDBackup[4]; /* for delivery-enabled & trigger-enabled both */
+ BOOLEAN bACMAPSDTr[4]; /* no use */
+
+ BOOLEAN bNeedSendTriggerFrame;
+ BOOLEAN bAPSDForcePowerSave; /* Force power save mode, should only use in APSD-STAUT */
+ unsigned long TriggerTimerCount;
+ u8 MaxSPLength;
+ u8 BBPCurrentBW; /* BW_10, BW_20, BW_40 */
+ /* move to MULTISSID_STRUCT for MBSS */
+ /*HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode;// For transmit phy setting in TXWI. */
+ REG_TRANSMIT_SETTING RegTransmitSetting; /*registry transmit setting. this is for reading registry setting only. not useful. */
+ /*u8 FixedTxMode; // Fixed Tx Mode (CCK, OFDM), for HT fixed tx mode (GF, MIX) , refer to RegTransmitSetting.field.HTMode */
+ u8 TxRate; /* Same value to fill in TXD. TxRate is 6-bit */
+ u8 MaxTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
+ u8 TxRateIndex; /* Tx rate index in RateSwitchTable */
+ u8 TxRateTableSize; /* Valid Tx rate table size in RateSwitchTable */
+ /*BOOLEAN bAutoTxRateSwitch; */
+ u8 MinTxRate; /* RATE_1, RATE_2, RATE_5_5, RATE_11 */
+ u8 RtsRate; /* RATE_xxx */
+ HTTRANSMIT_SETTING MlmeTransmit; /* MGMT frame PHY rate setting when operatin at Ht rate. */
+ u8 MlmeRate; /* RATE_xxx, used to send MLME frames */
+ u8 BasicMlmeRate; /* Default Rate for sending MLME frames */
+
+ u16 RtsThreshold; /* in unit of BYTE */
+ u16 FragmentThreshold; /* in unit of BYTE */
+
+ u8 TxPower; /* in unit of mW */
+ unsigned long TxPowerPercentage; /* 0~100 % */
+ unsigned long TxPowerDefault; /* keep for TxPowerPercentage */
+ u8 PwrConstraint;
+
+ BACAP_STRUC BACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
+ BACAP_STRUC REGBACapability; /* NO USE = 0XFF ; IMMED_BA =1 ; DELAY_BA=0 */
+
+ IOT_STRUC IOTestParm; /* 802.11n InterOpbility Test Parameter; */
+ unsigned long TxPreamble; /* Rt802_11PreambleLong, Rt802_11PreambleShort, Rt802_11PreambleAuto */
+ BOOLEAN bUseZeroToDisableFragment; /* Microsoft use 0 as disable */
+ unsigned long UseBGProtection; /* 0: auto, 1: always use, 2: always not use */
+ BOOLEAN bUseShortSlotTime; /* 0: disable, 1 - use short slot (9us) */
+ BOOLEAN bEnableTxBurst; /* 1: enble TX PACKET BURST (when BA is established or AP is not a legacy WMM AP), 0: disable TX PACKET BURST */
+ BOOLEAN bAggregationCapable; /* 1: enable TX aggregation when the peer supports it */
+ BOOLEAN bPiggyBackCapable; /* 1: enable TX piggy-back according MAC's version */
+ BOOLEAN bIEEE80211H; /* 1: enable IEEE802.11h spec. */
+ unsigned long DisableOLBCDetect; /* 0: enable OLBC detect; 1 disable OLBC detect */
+
+ BOOLEAN bRdg;
+
+ BOOLEAN bWmmCapable; /* 0:disable WMM, 1:enable WMM */
+ QOS_CAPABILITY_PARM APQosCapability; /* QOS capability of the current associated AP */
+ EDCA_PARM APEdcaParm; /* EDCA parameters of the current associated AP */
+ QBSS_LOAD_PARM APQbssLoad; /* QBSS load of the current associated AP */
+ u8 AckPolicy[4]; /* ACK policy of the specified AC. see ACK_xxx */
+ BOOLEAN bDLSCapable; /* 0:disable DLS, 1:enable DLS */
+ /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
+ /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
+ /* OPSTATUS_TEST_FLAG(), OPSTATUS_SET_FLAG(), OP_STATUS_CLEAR_FLAG() macros. */
+ /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition */
+ unsigned long OpStatusFlags;
+
+ BOOLEAN NdisRadioStateOff; /*For HCT 12.0, set this flag to TRUE instead of called MlmeRadioOff. */
+ ABGBAND_STATE BandState; /* For setting BBP used on B/G or A mode. */
+
+ /* IEEE802.11H--DFS. */
+ RADAR_DETECT_STRUCT RadarDetect;
+
+ /* HT */
+ u8 BASize; /* USer desired BAWindowSize. Should not exceed our max capability */
+ /*RT_HT_CAPABILITY SupportedHtPhy; */
+ RT_HT_CAPABILITY DesiredHtPhy;
+ HT_CAPABILITY_IE HtCapability;
+ ADD_HT_INFO_IE AddHTInfo; /* Useful as AP. */
+ /*This IE is used with channel switch announcement element when changing to a new 40MHz. */
+ /*This IE is included in channel switch ammouncement frames 7.4.1.5, beacons, probe Rsp. */
+ NEW_EXT_CHAN_IE NewExtChanOffset; /*7.3.2.20A, 1 if extension channel is above the control channel, 3 if below, 0 if not present */
+
+ BOOLEAN bHTProtect;
+ BOOLEAN bMIMOPSEnable;
+ BOOLEAN bBADecline;
+/*2008/11/05: KH add to support Antenna power-saving of AP<-- */
+ BOOLEAN bGreenAPEnable;
+/*2008/11/05: KH add to support Antenna power-saving of AP--> */
+ BOOLEAN bDisableReordering;
+ BOOLEAN bForty_Mhz_Intolerant;
+ BOOLEAN bExtChannelSwitchAnnouncement;
+ BOOLEAN bRcvBSSWidthTriggerEvents;
+ unsigned long LastRcvBSSWidthTriggerEventsTime;
+
+ u8 TxBASize;
+
+ /* Enable wireless event */
+ BOOLEAN bWirelessEvent;
+ BOOLEAN bWiFiTest; /* Enable this parameter for WiFi test */
+
+ /* Tx & Rx Stream number selection */
+ u8 TxStream;
+ u8 RxStream;
+
+ BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */
+
+#ifdef RTMP_MAC_USB
+ BOOLEAN bMultipleIRP; /* Multiple Bulk IN flag */
+ u8 NumOfBulkInIRP; /* if bMultipleIRP == TRUE, NumOfBulkInIRP will be 4 otherwise be 1 */
+ RT_HT_CAPABILITY SupportedHtPhy;
+ unsigned long MaxPktOneTxBulk;
+ u8 TxBulkFactor;
+ u8 RxBulkFactor;
+
+ BOOLEAN IsUpdateBeacon;
+ BEACON_SYNC_STRUCT *pBeaconSync;
+ RALINK_TIMER_STRUCT BeaconUpdateTimer;
+ u32 BeaconAdjust;
+ u32 BeaconFactor;
+ u32 BeaconRemain;
+#endif /* RTMP_MAC_USB // */
+
+ spinlock_t MeasureReqTabLock;
+ PMEASURE_REQ_TAB pMeasureReqTab;
+
+ spinlock_t TpcReqTabLock;
+ PTPC_REQ_TAB pTpcReqTab;
+
+ BOOLEAN PSPXlink; /* 0: Disable. 1: Enable */
+
+#if defined(RT305x)||defined(RT30xx)
+ /* request by Gary, for High Power issue */
+ u8 HighPowerPatchDisabled;
+#endif
+
+ BOOLEAN HT_DisallowTKIP; /* Restrict the encryption type in 11n HT mode */
+} COMMON_CONFIG, *PCOMMON_CONFIG;
+
+/* Modified by Wu Xi-Kun 4/21/2006 */
+/* STA configuration and status */
+typedef struct _STA_ADMIN_CONFIG {
+ /* GROUP 1 - */
+ /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
+ /* the user intended configuration, but not necessary fully equal to the final */
+ /* settings in ACTIVE BSS after negotiation/compromize with the BSS holder (either */
+ /* AP or IBSS holder). */
+ /* Once initialized, user configuration can only be changed via OID_xxx */
+ u8 BssType; /* BSS_INFRA or BSS_ADHOC */
+ u16 AtimWin; /* used when starting a new IBSS */
+
+ /* GROUP 2 - */
+ /* User configuration loaded from Registry, E2PROM or OID_xxx. These settings describe */
+ /* the user intended configuration, and should be always applied to the final */
+ /* settings in ACTIVE BSS without compromising with the BSS holder. */
+ /* Once initialized, user configuration can only be changed via OID_xxx */
+ u8 RssiTrigger;
+ u8 RssiTriggerMode; /* RSSI_TRIGGERED_UPON_BELOW_THRESHOLD or RSSI_TRIGGERED_UPON_EXCCEED_THRESHOLD */
+ u16 DefaultListenCount; /* default listen count; */
+ unsigned long WindowsPowerMode; /* Power mode for AC power */
+ unsigned long WindowsBatteryPowerMode; /* Power mode for battery if exists */
+ BOOLEAN bWindowsACCAMEnable; /* Enable CAM power mode when AC on */
+ BOOLEAN bAutoReconnect; /* Set to TRUE when setting OID_802_11_SSID with no matching BSSID */
+ unsigned long WindowsPowerProfile; /* Windows power profile, for NDIS5.1 PnP */
+
+ /* MIB:ieee802dot11.dot11smt(1).dot11StationConfigTable(1) */
+ u16 Psm; /* power management mode (PWR_ACTIVE|PWR_SAVE) */
+ u16 DisassocReason;
+ u8 DisassocSta[MAC_ADDR_LEN];
+ u16 DeauthReason;
+ u8 DeauthSta[MAC_ADDR_LEN];
+ u16 AuthFailReason;
+ u8 AuthFailSta[MAC_ADDR_LEN];
+
+ NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */
+ NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */
+ NDIS_802_11_WEP_STATUS WepStatus;
+ NDIS_802_11_WEP_STATUS OrigWepStatus; /* Original wep status set from OID */
+
+ /* Add to support different cipher suite for WPA2/WPA mode */
+ NDIS_802_11_ENCRYPTION_STATUS GroupCipher; /* Multicast cipher suite */
+ NDIS_802_11_ENCRYPTION_STATUS PairCipher; /* Unicast cipher suite */
+ BOOLEAN bMixCipher; /* Indicate current Pair & Group use different cipher suites */
+ u16 RsnCapability;
+
+ NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
+
+ u8 WpaPassPhrase[64]; /* WPA PSK pass phrase */
+ u32 WpaPassPhraseLen; /* the length of WPA PSK pass phrase */
+ u8 PMK[32]; /* WPA PSK mode PMK */
+ u8 PTK[64]; /* WPA PSK mode PTK */
+ u8 GTK[32]; /* GTK from authenticator */
+ BSSID_INFO SavedPMK[PMKID_NO];
+ u32 SavedPMKNum; /* Saved PMKID number */
+
+ u8 DefaultKeyId;
+
+ /* WPA 802.1x port control, WPA_802_1X_PORT_SECURED, WPA_802_1X_PORT_NOT_SECURED */
+ u8 PortSecured;
+
+ /* For WPA countermeasures */
+ unsigned long LastMicErrorTime; /* record last MIC error time */
+ unsigned long MicErrCnt; /* Should be 0, 1, 2, then reset to zero (after disassoiciation). */
+ BOOLEAN bBlockAssoc; /* Block associate attempt for 60 seconds after counter measure occurred. */
+ /* For WPA-PSK supplicant state */
+ WPA_STATE WpaState; /* Default is SS_NOTUSE and handled by microsoft 802.1x */
+ u8 ReplayCounter[8];
+ u8 ANonce[32]; /* ANonce for WPA-PSK from aurhenticator */
+ u8 SNonce[32]; /* SNonce for WPA-PSK */
+
+ u8 LastSNR0; /* last received BEACON's SNR */
+ u8 LastSNR1; /* last received BEACON's SNR for 2nd antenna */
+ RSSI_SAMPLE RssiSample;
+ unsigned long NumOfAvgRssiSample;
+
+ unsigned long LastBeaconRxTime; /* OS's timestamp of the last BEACON RX time */
+ unsigned long Last11bBeaconRxTime; /* OS's timestamp of the last 11B BEACON RX time */
+ unsigned long Last11gBeaconRxTime; /* OS's timestamp of the last 11G BEACON RX time */
+ unsigned long Last20NBeaconRxTime; /* OS's timestamp of the last 20MHz N BEACON RX time */
+
+ unsigned long LastScanTime; /* Record last scan time for issue BSSID_SCAN_LIST */
+ unsigned long ScanCnt; /* Scan counts since most recent SSID, BSSID, SCAN OID request */
+ BOOLEAN bSwRadio; /* Software controlled Radio On/Off, TRUE: On */
+ BOOLEAN bHwRadio; /* Hardware controlled Radio On/Off, TRUE: On */
+ BOOLEAN bRadio; /* Radio state, And of Sw & Hw radio state */
+ BOOLEAN bHardwareRadio; /* Hardware controlled Radio enabled */
+ BOOLEAN bShowHiddenSSID; /* Show all known SSID in SSID list get operation */
+
+ /* New for WPA, windows want us to keep association information and */
+ /* Fixed IEs from last association response */
+ NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo;
+ u16 ReqVarIELen; /* Length of next VIE include EID & Length */
+ u8 ReqVarIEs[MAX_VIE_LEN]; /* The content saved here should be little-endian format. */
+ u16 ResVarIELen; /* Length of next VIE include EID & Length */
+ u8 ResVarIEs[MAX_VIE_LEN];
+
+ u8 RSNIE_Len;
+ u8 RSN_IE[MAX_LEN_OF_RSNIE]; /* The content saved here should be little-endian format. */
+
+ unsigned long CLBusyBytes; /* Save the total bytes received durning channel load scan time */
+ u16 RPIDensity[8]; /* Array for RPI density collection */
+
+ u8 RMReqCnt; /* Number of measurement request saved. */
+ u8 CurrentRMReqIdx; /* Number of measurement request saved. */
+ BOOLEAN ParallelReq; /* Parallel measurement, only one request performed, */
+ /* It must be the same channel with maximum duration */
+ u16 ParallelDuration; /* Maximum duration for parallel measurement */
+ u8 ParallelChannel; /* Only one channel with parallel measurement */
+ u16 IAPPToken; /* IAPP dialog token */
+ /* Hack for channel load and noise histogram parameters */
+ u8 NHFactor; /* Parameter for Noise histogram */
+ u8 CLFactor; /* Parameter for channel load */
+
+ RALINK_TIMER_STRUCT StaQuickResponeForRateUpTimer;
+ BOOLEAN StaQuickResponeForRateUpTimerRunning;
+
+ u8 DtimCount; /* 0.. DtimPeriod-1 */
+ u8 DtimPeriod; /* default = 3 */
+
+ /*////////////////////////////////////////////////////////////////////////////////////// */
+ /* This is only for WHQL test. */
+ BOOLEAN WhqlTest;
+ /*////////////////////////////////////////////////////////////////////////////////////// */
+
+ RALINK_TIMER_STRUCT WpaDisassocAndBlockAssocTimer;
+ /* Fast Roaming */
+ BOOLEAN bAutoRoaming; /* 0:disable auto roaming by RSSI, 1:enable auto roaming by RSSI */
+ char dBmToRoam; /* the condition to roam when receiving Rssi less than this value. It's negative value. */
+
+ BOOLEAN IEEE8021X;
+ BOOLEAN IEEE8021x_required_keys;
+ CIPHER_KEY DesireSharedKey[4]; /* Record user desired WEP keys */
+ u8 DesireSharedKeyId;
+
+ /* 0: driver ignores wpa_supplicant */
+ /* 1: wpa_supplicant initiates scanning and AP selection */
+ /* 2: driver takes care of scanning, AP selection, and IEEE 802.11 association parameters */
+ u8 WpaSupplicantUP;
+ u8 WpaSupplicantScanCount;
+ BOOLEAN bRSN_IE_FromWpaSupplicant;
+
+ char dev_name[16];
+ u16 OriDevType;
+
+ BOOLEAN bTGnWifiTest;
+ BOOLEAN bScanReqIsFromWebUI;
+
+ HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */
+ DESIRED_TRANSMIT_SETTING DesiredTransmitSetting;
+ RT_HT_PHY_INFO DesiredHtPhyInfo;
+ BOOLEAN bAutoTxRateSwitch;
+
+#ifdef RTMP_MAC_PCI
+ u8 BBPR3;
+ /* PS Control has 2 meanings for advanced power save function. */
+ /* 1. EnablePSinIdle : When no connection, always radio off except need to do site survey. */
+ /* 2. EnableNewPS : will save more current in sleep or radio off mode. */
+ PS_CONTROL PSControl;
+#endif /* RTMP_MAC_PCI // */
+
+ BOOLEAN bAutoConnectByBssid;
+ unsigned long BeaconLostTime; /* seconds */
+ BOOLEAN bForceTxBurst; /* 1: force enble TX PACKET BURST, 0: disable */
+} STA_ADMIN_CONFIG, *PSTA_ADMIN_CONFIG;
+
+/* This data structure keep the current active BSS/IBSS's configuration that this STA */
+/* had agreed upon joining the network. Which means these parameters are usually decided */
+/* by the BSS/IBSS creator instead of user configuration. Data in this data structurre */
+/* is valid only when either ADHOC_ON(pAd) or INFRA_ON(pAd) is TRUE. */
+/* Normally, after SCAN or failed roaming attempts, we need to recover back to */
+/* the current active settings. */
+typedef struct _STA_ACTIVE_CONFIG {
+ u16 Aid;
+ u16 AtimWin; /* in kusec; IBSS parameter set element */
+ u16 CapabilityInfo;
+ u16 CfpMaxDuration;
+ u16 CfpPeriod;
+
+ /* Copy supported rate from desired AP's beacon. We are trying to match */
+ /* AP's supported and extended rate settings. */
+ u8 SupRate[MAX_LEN_OF_SUPPORTED_RATES];
+ u8 ExtRate[MAX_LEN_OF_SUPPORTED_RATES];
+ u8 SupRateLen;
+ u8 ExtRateLen;
+ /* Copy supported ht from desired AP's beacon. We are trying to match */
+ RT_HT_PHY_INFO SupportedPhyInfo;
+ RT_HT_CAPABILITY SupportedHtPhy;
+} STA_ACTIVE_CONFIG, *PSTA_ACTIVE_CONFIG;
+
+typedef struct _MAC_TABLE_ENTRY {
+ /*Choose 1 from ValidAsWDS and ValidAsCLI to validize. */
+ BOOLEAN ValidAsCLI; /* Sta mode, set this TRUE after Linkup,too. */
+ BOOLEAN ValidAsWDS; /* This is WDS Entry. only for AP mode. */
+ BOOLEAN ValidAsApCli; /*This is a AP-Client entry, only for AP mode which enable AP-Client functions. */
+ BOOLEAN ValidAsMesh;
+ BOOLEAN ValidAsDls; /* This is DLS Entry. only for STA mode. */
+ BOOLEAN isCached;
+ BOOLEAN bIAmBadAtheros; /* Flag if this is Atheros chip that has IOT problem. We need to turn on RTS/CTS protection. */
+
+ u8 EnqueueEapolStartTimerRunning; /* Enqueue EAPoL-Start for triggering EAP SM */
+ /*jan for wpa */
+ /* record which entry revoke MIC Failure , if it leaves the BSS itself, AP won't update aMICFailTime MIB */
+ u8 CMTimerRunning;
+ u8 apidx; /* MBSS number */
+ u8 RSNIE_Len;
+ u8 RSN_IE[MAX_LEN_OF_RSNIE];
+ u8 ANonce[LEN_KEY_DESC_NONCE];
+ u8 SNonce[LEN_KEY_DESC_NONCE];
+ u8 R_Counter[LEN_KEY_DESC_REPLAY];
+ u8 PTK[64];
+ u8 ReTryCounter;
+ RALINK_TIMER_STRUCT RetryTimer;
+ RALINK_TIMER_STRUCT EnqueueStartForPSKTimer; /* A timer which enqueue EAPoL-Start for triggering PSK SM */
+ NDIS_802_11_AUTHENTICATION_MODE AuthMode; /* This should match to whatever microsoft defined */
+ NDIS_802_11_WEP_STATUS WepStatus;
+ NDIS_802_11_WEP_STATUS GroupKeyWepStatus;
+ AP_WPA_STATE WpaState;
+ GTK_STATE GTKState;
+ u16 PortSecured;
+ NDIS_802_11_PRIVACY_FILTER PrivacyFilter; /* PrivacyFilter enum for 802.1X */
+ CIPHER_KEY PairwiseKey;
+ void *pAd;
+ int PMKID_CacheIdx;
+ u8 PMKID[LEN_PMKID];
+
+ u8 Addr[MAC_ADDR_LEN];
+ u8 PsMode;
+ SST Sst;
+ AUTH_STATE AuthState; /* for SHARED KEY authentication state machine used only */
+ BOOLEAN IsReassocSta; /* Indicate whether this is a reassociation procedure */
+ u16 Aid;
+ u16 CapabilityInfo;
+ u8 LastRssi;
+ unsigned long NoDataIdleCount;
+ u16 StationKeepAliveCount; /* unit: second */
+ unsigned long PsQIdleCount;
+ QUEUE_HEADER PsQueue;
+
+ u32 StaConnectTime; /* the live time of this station since associated with AP */
+
+ BOOLEAN bSendBAR;
+ u16 NoBADataCountDown;
+
+ u32 CachedBuf[16]; /* u32 (4 bytes) for alignment */
+ u32 TxBFCount; /* 3*3 */
+ u32 FIFOCount;
+ u32 DebugFIFOCount;
+ u32 DebugTxCount;
+ BOOLEAN bDlsInit;
+
+/*==================================================== */
+/*WDS entry needs these */
+/* if ValidAsWDS==TRUE, MatchWDSTabIdx is the index in WdsTab.MacTab */
+ u32 MatchWDSTabIdx;
+ u8 MaxSupportedRate;
+ u8 CurrTxRate;
+ u8 CurrTxRateIndex;
+ /* to record the each TX rate's quality. 0 is best, the bigger the worse. */
+ u16 TxQuality[MAX_STEP_OF_TX_RATE_SWITCH];
+/* u16 OneSecTxOkCount; */
+ u32 OneSecTxNoRetryOkCount;
+ u32 OneSecTxRetryOkCount;
+ u32 OneSecTxFailCount;
+ u32 ContinueTxFailCnt;
+ u32 CurrTxRateStableTime; /* # of second in current TX rate */
+ u8 TxRateUpPenalty; /* extra # of second penalty due to last unstable condition */
+/*==================================================== */
+
+ BOOLEAN fNoisyEnvironment;
+ BOOLEAN fLastSecAccordingRSSI;
+ u8 LastSecTxRateChangeAction; /* 0: no change, 1:rate UP, 2:rate down */
+ char LastTimeTxRateChangeAction; /*Keep last time value of LastSecTxRateChangeAction */
+ unsigned long LastTxOkCount;
+ u8 PER[MAX_STEP_OF_TX_RATE_SWITCH];
+
+ /* a bitmap of BOOLEAN flags. each bit represent an operation status of a particular */
+ /* BOOLEAN control, either ON or OFF. These flags should always be accessed via */
+ /* CLIENT_STATUS_TEST_FLAG(), CLIENT_STATUS_SET_FLAG(), CLIENT_STATUS_CLEAR_FLAG() macros. */
+ /* see fOP_STATUS_xxx in RTMP_DEF.C for detail bit definition. fCLIENT_STATUS_AMSDU_INUSED */
+ unsigned long ClientStatusFlags;
+
+ HTTRANSMIT_SETTING HTPhyMode, MaxHTPhyMode, MinHTPhyMode; /* For transmit phy setting in TXWI. */
+
+ /* HT EWC MIMO-N used parameters */
+ u16 RXBAbitmap; /* fill to on-chip RXWI_BA_BITMASK in 8.1.3RX attribute entry format */
+ u16 TXBAbitmap; /* This bitmap as originator, only keep in software used to mark AMPDU bit in TXWI */
+ u16 TXAutoBAbitmap;
+ u16 BADeclineBitmap;
+ u16 BARecWcidArray[NUM_OF_TID]; /* The mapping wcid of recipient session. if RXBAbitmap bit is masked */
+ u16 BAOriWcidArray[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
+ u16 BAOriSequence[NUM_OF_TID]; /* The mapping wcid of originator session. if TXBAbitmap bit is masked */
+
+ /* 802.11n features. */
+ u8 MpduDensity;
+ u8 MaxRAmpduFactor;
+ u8 AMsduSize;
+ u8 MmpsMode; /* MIMO power save more. */
+
+ HT_CAPABILITY_IE HTCapability;
+
+ BOOLEAN bAutoTxRateSwitch;
+
+ u8 RateLen;
+ struct _MAC_TABLE_ENTRY *pNext;
+ u16 TxSeq[NUM_OF_TID];
+ u16 NonQosDataSeq;
+
+ RSSI_SAMPLE RssiSample;
+
+ u32 TXMCSExpected[16];
+ u32 TXMCSSuccessful[16];
+ u32 TXMCSFailed[16];
+ u32 TXMCSAutoFallBack[16][16];
+
+ unsigned long LastBeaconRxTime;
+
+ unsigned long AssocDeadLine;
+} MAC_TABLE_ENTRY, *PMAC_TABLE_ENTRY;
+
+typedef struct _MAC_TABLE {
+ u16 Size;
+ MAC_TABLE_ENTRY *Hash[HASH_TABLE_SIZE];
+ MAC_TABLE_ENTRY Content[MAX_LEN_OF_MAC_TABLE];
+ QUEUE_HEADER McastPsQueue;
+ unsigned long PsQIdleCount;
+ BOOLEAN fAnyStationInPsm;
+ BOOLEAN fAnyStationBadAtheros; /* Check if any Station is atheros 802.11n Chip. We need to use RTS/CTS with Atheros 802,.11n chip. */
+ BOOLEAN fAnyTxOPForceDisable; /* Check if it is necessary to disable BE TxOP */
+ BOOLEAN fAllStationAsRalink; /* Check if all stations are ralink-chipset */
+ BOOLEAN fAnyStationIsLegacy; /* Check if I use legacy rate to transmit to my BSS Station/ */
+ BOOLEAN fAnyStationNonGF; /* Check if any Station can't support GF. */
+ BOOLEAN fAnyStation20Only; /* Check if any Station can't support GF. */
+ BOOLEAN fAnyStationMIMOPSDynamic; /* Check if any Station is MIMO Dynamic */
+ BOOLEAN fAnyBASession; /* Check if there is BA session. Force turn on RTS/CTS */
+/*2008/10/28: KH add to support Antenna power-saving of AP<-- */
+/*2008/10/28: KH add to support Antenna power-saving of AP--> */
+} MAC_TABLE, *PMAC_TABLE;
+
+struct wificonf {
+ BOOLEAN bShortGI;
+ BOOLEAN bGreenField;
+};
+
+typedef struct _RTMP_DEV_INFO_ {
+ u8 chipName[16];
+ RTMP_INF_TYPE infType;
+} RTMP_DEV_INFO;
+
+struct _RTMP_CHIP_OP_ {
+ /* Calibration access related callback functions */
+ int (*eeinit) (RTMP_ADAPTER * pAd); /* int (*eeinit)(RTMP_ADAPTER *pAd); */
+ int (*eeread) (RTMP_ADAPTER * pAd, u16 offset, u16 *pValue); /* int (*eeread)(RTMP_ADAPTER *pAd, int offset, u16 *pValue); */
+
+ /* MCU related callback functions */
+ int (*loadFirmware) (RTMP_ADAPTER * pAd); /* int (*loadFirmware)(RTMP_ADAPTER *pAd); */
+ int (*eraseFirmware) (RTMP_ADAPTER * pAd); /* int (*eraseFirmware)(RTMP_ADAPTER *pAd); */
+ int (*sendCommandToMcu) (RTMP_ADAPTER * pAd, u8 cmd, u8 token, u8 arg0, u8 arg1);; /* int (*sendCommandToMcu)(RTMP_ADAPTER *pAd, u8 cmd, u8 token, u8 arg0, u8 arg1); */
+
+ /* RF access related callback functions */
+ REG_PAIR *pRFRegTable;
+ void (*AsicRfInit) (RTMP_ADAPTER * pAd);
+ void (*AsicRfTurnOn) (RTMP_ADAPTER * pAd);
+ void (*AsicRfTurnOff) (RTMP_ADAPTER * pAd);
+ void (*AsicReverseRfFromSleepMode) (RTMP_ADAPTER * pAd);
+ void (*AsicHaltAction) (RTMP_ADAPTER * pAd);
+};
+
+/* */
+/* The miniport adapter structure */
+/* */
+struct _RTMP_ADAPTER {
+ void *OS_Cookie; /* save specific structure relative to OS */
+ struct net_device *net_dev;
+ unsigned long VirtualIfCnt;
+
+ RTMP_CHIP_OP chipOps;
+ u16 ThisTbttNumToNextWakeUp;
+
+#ifdef RTMP_MAC_PCI
+/*****************************************************************************************/
+/* PCI related parameters */
+/*****************************************************************************************/
+ u8 *CSRBaseAddress; /* PCI MMIO Base Address, all access will use */
+ unsigned int irq_num;
+
+ u16 LnkCtrlBitMask;
+ u16 RLnkCtrlConfiguration;
+ u16 RLnkCtrlOffset;
+ u16 HostLnkCtrlConfiguration;
+ u16 HostLnkCtrlOffset;
+ u16 PCIePowerSaveLevel;
+ unsigned long Rt3xxHostLinkCtrl; /* USed for 3090F chip */
+ unsigned long Rt3xxRalinkLinkCtrl; /* USed for 3090F chip */
+ u16 DeviceID; /* Read from PCI config */
+ unsigned long AccessBBPFailCount;
+ BOOLEAN bPCIclkOff; /* flag that indicate if the PICE power status in Configuration SPace.. */
+ BOOLEAN bPCIclkOffDisableTx; /* */
+
+ BOOLEAN brt30xxBanMcuCmd; /*when = 0xff means all commands are ok to set . */
+ BOOLEAN b3090ESpecialChip; /*3090E special chip that write EEPROM 0x24=0x9280. */
+ unsigned long CheckDmaBusyCount; /* Check Interrupt Status Register Count. */
+
+ u32 int_enable_reg;
+ u32 int_disable_mask;
+ u32 int_pending;
+
+ RTMP_DMABUF TxBufSpace[NUM_OF_TX_RING]; /* Shared memory of all 1st pre-allocated TxBuf associated with each TXD */
+ RTMP_DMABUF RxDescRing; /* Shared memory for RX descriptors */
+ RTMP_DMABUF TxDescRing[NUM_OF_TX_RING]; /* Shared memory for Tx descriptors */
+ RTMP_TX_RING TxRing[NUM_OF_TX_RING]; /* AC0~4 + HCCA */
+#endif /* RTMP_MAC_PCI // */
+
+ spinlock_t irq_lock;
+ u8 irq_disabled;
+
+#ifdef RTMP_MAC_USB
+/*****************************************************************************************/
+/* USB related parameters */
+/*****************************************************************************************/
+ struct usb_config_descriptor *config;
+ u32 BulkInEpAddr; /* bulk-in endpoint address */
+ u32 BulkOutEpAddr[6]; /* bulk-out endpoint address */
+
+ u32 NumberOfPipes;
+ u16 BulkOutMaxPacketSize;
+ u16 BulkInMaxPacketSize;
+
+ /*======Control Flags */
+ long PendingIoCount;
+ unsigned long BulkFlags;
+ BOOLEAN bUsbTxBulkAggre; /* Flags for bulk out data priority */
+
+ /*======Cmd Thread */
+ CmdQ CmdQ;
+ spinlock_t CmdQLock; /* CmdQLock spinlock */
+ RTMP_OS_TASK cmdQTask;
+
+ /*======Semaphores (event) */
+ struct semaphore UsbVendorReq_semaphore;
+ void *UsbVendorReqBuf;
+ wait_queue_head_t *wait;
+#endif /* RTMP_MAC_USB // */
+
+/*****************************************************************************************/
+/* RBUS related parameters */
+/*****************************************************************************************/
+
+/*****************************************************************************************/
+/* Both PCI/USB related parameters */
+/*****************************************************************************************/
+ /*RTMP_DEV_INFO chipInfo; */
+ RTMP_INF_TYPE infType;
+
+/*****************************************************************************************/
+/* Driver Mgmt related parameters */
+/*****************************************************************************************/
+ RTMP_OS_TASK mlmeTask;
+#ifdef RTMP_TIMER_TASK_SUPPORT
+ /* If you want use timer task to handle the timer related jobs, enable this. */
+ RTMP_TIMER_TASK_QUEUE TimerQ;
+ spinlock_t TimerQLock;
+ RTMP_OS_TASK timerTask;
+#endif /* RTMP_TIMER_TASK_SUPPORT // */
+
+/*****************************************************************************************/
+/* Tx related parameters */
+/*****************************************************************************************/
+ BOOLEAN DeQueueRunning[NUM_OF_TX_RING]; /* for ensuring RTUSBDeQueuePacket get call once */
+ spinlock_t DeQueueLock[NUM_OF_TX_RING];
+
+#ifdef RTMP_MAC_USB
+ /* Data related context and AC specified, 4 AC supported */
+ spinlock_t BulkOutLock[6]; /* BulkOut spinlock for 4 ACs */
+ spinlock_t MLMEBulkOutLock; /* MLME BulkOut lock */
+
+ HT_TX_CONTEXT TxContext[NUM_OF_TX_RING];
+ spinlock_t TxContextQueueLock[NUM_OF_TX_RING]; /* TxContextQueue spinlock */
+
+ /* 4 sets of Bulk Out index and pending flag */
+ u8 NextBulkOutIndex[4]; /* only used for 4 EDCA bulkout pipe */
+
+ BOOLEAN BulkOutPending[6]; /* used for total 6 bulkout pipe */
+ u8 bulkResetPipeid;
+ BOOLEAN MgmtBulkPending;
+ unsigned long bulkResetReq[6];
+#endif /* RTMP_MAC_USB // */
+
+ /* resource for software backlog queues */
+ QUEUE_HEADER TxSwQueue[NUM_OF_TX_RING]; /* 4 AC + 1 HCCA */
+ spinlock_t TxSwQueueLock[NUM_OF_TX_RING]; /* TxSwQueue spinlock */
+
+ RTMP_DMABUF MgmtDescRing; /* Shared memory for MGMT descriptors */
+ RTMP_MGMT_RING MgmtRing;
+ spinlock_t MgmtRingLock; /* Prio Ring spinlock */
+
+/*****************************************************************************************/
+/* Rx related parameters */
+/*****************************************************************************************/
+
+#ifdef RTMP_MAC_PCI
+ RTMP_RX_RING RxRing;
+ spinlock_t RxRingLock; /* Rx Ring spinlock */
+#ifdef RT3090
+ spinlock_t McuCmdLock; /*MCU Command Queue spinlock */
+#endif /* RT3090 // */
+#endif /* RTMP_MAC_PCI // */
+#ifdef RTMP_MAC_USB
+ RX_CONTEXT RxContext[RX_RING_SIZE]; /* 1 for redundant multiple IRP bulk in. */
+ spinlock_t BulkInLock; /* BulkIn spinlock for 4 ACs */
+ u8 PendingRx; /* The Maximum pending Rx value should be RX_RING_SIZE. */
+ u8 NextRxBulkInIndex; /* Indicate the current RxContext Index which hold by Host controller. */
+ u8 NextRxBulkInReadIndex; /* Indicate the current RxContext Index which driver can read & process it. */
+ unsigned long NextRxBulkInPosition; /* Want to contatenate 2 URB buffer while 1st is bulkin failed URB. This Position is 1st URB TransferLength. */
+ unsigned long TransferBufferLength; /* current length of the packet buffer */
+ unsigned long ReadPosition; /* current read position in a packet buffer */
+#endif /* RTMP_MAC_USB // */
+
+/*****************************************************************************************/
+/* ASIC related parameters */
+/*****************************************************************************************/
+ u32 MACVersion; /* MAC version. Record rt2860C(0x28600100) or rt2860D (0x28600101).. */
+
+ /* --------------------------- */
+ /* E2PROM */
+ /* --------------------------- */
+ unsigned long EepromVersion; /* byte 0: version, byte 1: revision, byte 2~3: unused */
+ unsigned long FirmwareVersion; /* byte 0: Minor version, byte 1: Major version, otherwise unused. */
+ u16 EEPROMDefaultValue[NUM_EEPROM_BBP_PARMS];
+ u8 EEPROMAddressNum; /* 93c46=6 93c66=8 */
+ BOOLEAN EepromAccess;
+ u8 EFuseTag;
+
+ /* --------------------------- */
+ /* BBP Control */
+ /* --------------------------- */
+ u8 BbpWriteLatch[140]; /* record last BBP register value written via BBP_IO_WRITE/BBP_IO_WRITE_VY_REG_ID */
+ char BbpRssiToDbmDelta; /* change from u8 to char for high power */
+ BBP_R66_TUNING BbpTuning;
+
+ /* ---------------------------- */
+ /* RFIC control */
+ /* ---------------------------- */
+ u8 RfIcType; /* RFIC_xxx */
+ unsigned long RfFreqOffset; /* Frequency offset for channel switching */
+ RTMP_RF_REGS LatchRfRegs; /* latch th latest RF programming value since RF IC doesn't support READ */
+
+ EEPROM_ANTENNA_STRUC Antenna; /* Since ANtenna definition is different for a & g. We need to save it for future reference. */
+ EEPROM_NIC_CONFIG2_STRUC NicConfig2;
+
+ /* This soft Rx Antenna Diversity mechanism is used only when user set */
+ /* RX Antenna = DIVERSITY ON */
+ SOFT_RX_ANT_DIVERSITY RxAnt;
+
+ u8 RFProgSeq;
+ CHANNEL_TX_POWER TxPower[MAX_NUM_OF_CHANNELS]; /* Store Tx power value for all channels. */
+ CHANNEL_TX_POWER ChannelList[MAX_NUM_OF_CHANNELS]; /* list all supported channels for site survey */
+ CHANNEL_11J_TX_POWER TxPower11J[MAX_NUM_OF_11JCHANNELS]; /* 802.11j channel and bw */
+ CHANNEL_11J_TX_POWER ChannelList11J[MAX_NUM_OF_11JCHANNELS]; /* list all supported channels for site survey */
+
+ u8 ChannelListNum; /* number of channel in ChannelList[] */
+ u8 Bbp94;
+ BOOLEAN BbpForCCK;
+ unsigned long Tx20MPwrCfgABand[5];
+ unsigned long Tx20MPwrCfgGBand[5];
+ unsigned long Tx40MPwrCfgABand[5];
+ unsigned long Tx40MPwrCfgGBand[5];
+
+ BOOLEAN bAutoTxAgcA; /* Enable driver auto Tx Agc control */
+ u8 TssiRefA; /* Store Tssi reference value as 25 temperature. */
+ u8 TssiPlusBoundaryA[5]; /* Tssi boundary for increase Tx power to compensate. */
+ u8 TssiMinusBoundaryA[5]; /* Tssi boundary for decrease Tx power to compensate. */
+ u8 TxAgcStepA; /* Store Tx TSSI delta increment / decrement value */
+ char TxAgcCompensateA; /* Store the compensation (TxAgcStep * (idx-1)) */
+
+ BOOLEAN bAutoTxAgcG; /* Enable driver auto Tx Agc control */
+ u8 TssiRefG; /* Store Tssi reference value as 25 temperature. */
+ u8 TssiPlusBoundaryG[5]; /* Tssi boundary for increase Tx power to compensate. */
+ u8 TssiMinusBoundaryG[5]; /* Tssi boundary for decrease Tx power to compensate. */
+ u8 TxAgcStepG; /* Store Tx TSSI delta increment / decrement value */
+ char TxAgcCompensateG; /* Store the compensation (TxAgcStep * (idx-1)) */
+
+ char BGRssiOffset0; /* Store B/G RSSI#0 Offset value on EEPROM 0x46h */
+ char BGRssiOffset1; /* Store B/G RSSI#1 Offset value */
+ char BGRssiOffset2; /* Store B/G RSSI#2 Offset value */
+
+ char ARssiOffset0; /* Store A RSSI#0 Offset value on EEPROM 0x4Ah */
+ char ARssiOffset1; /* Store A RSSI#1 Offset value */
+ char ARssiOffset2; /* Store A RSSI#2 Offset value */
+
+ char BLNAGain; /* Store B/G external LNA#0 value on EEPROM 0x44h */
+ char ALNAGain0; /* Store A external LNA#0 value for ch36~64 */
+ char ALNAGain1; /* Store A external LNA#1 value for ch100~128 */
+ char ALNAGain2; /* Store A external LNA#2 value for ch132~165 */
+#ifdef RT30xx
+ /* for 3572 */
+ u8 Bbp25;
+ u8 Bbp26;
+
+ u8 TxMixerGain24G; /* Tx mixer gain value from EEPROM to improve Tx EVM / Tx DAC, 2.4G */
+ u8 TxMixerGain5G;
+#endif /* RT30xx // */
+ /* ---------------------------- */
+ /* LED control */
+ /* ---------------------------- */
+ MCU_LEDCS_STRUC LedCntl;
+ u16 Led1; /* read from EEPROM 0x3c */
+ u16 Led2; /* EEPROM 0x3e */
+ u16 Led3; /* EEPROM 0x40 */
+ u8 LedIndicatorStrength;
+ u8 RssiSingalstrengthOffet;
+ BOOLEAN bLedOnScanning;
+ u8 LedStatus;
+
+/*****************************************************************************************/
+/* 802.11 related parameters */
+/*****************************************************************************************/
+ /* outgoing BEACON frame buffer and corresponding TXD */
+ TXWI_STRUC BeaconTxWI;
+ u8 *BeaconBuf;
+ u16 BeaconOffset[HW_BEACON_MAX_COUNT];
+
+ /* pre-build PS-POLL and NULL frame upon link up. for efficiency purpose. */
+ PSPOLL_FRAME PsPollFrame;
+ HEADER_802_11 NullFrame;
+
+#ifdef RTMP_MAC_USB
+ TX_CONTEXT BeaconContext[BEACON_RING_SIZE];
+ TX_CONTEXT NullContext;
+ TX_CONTEXT PsPollContext;
+ TX_CONTEXT RTSContext;
+#endif /* RTMP_MAC_USB // */
+
+/*=========AP=========== */
+
+/*=======STA=========== */
+ /* ----------------------------------------------- */
+ /* STA specific configuration & operation status */
+ /* used only when pAd->OpMode == OPMODE_STA */
+ /* ----------------------------------------------- */
+ STA_ADMIN_CONFIG StaCfg; /* user desired settings */
+ STA_ACTIVE_CONFIG StaActive; /* valid only when ADHOC_ON(pAd) || INFRA_ON(pAd) */
+ char nickname[IW_ESSID_MAX_SIZE + 1]; /* nickname, only used in the iwconfig i/f */
+ int PreMediaState;
+
+/*=======Common=========== */
+ /* OP mode: either AP or STA */
+ u8 OpMode; /* OPMODE_STA, OPMODE_AP */
+
+ int IndicateMediaState; /* Base on Indication state, default is NdisMediaStateDisConnected */
+
+ /* MAT related parameters */
+
+ /* configuration: read from Registry & E2PROM */
+ BOOLEAN bLocalAdminMAC; /* Use user changed MAC */
+ u8 PermanentAddress[MAC_ADDR_LEN]; /* Factory default MAC address */
+ u8 CurrentAddress[MAC_ADDR_LEN]; /* User changed MAC address */
+
+ /* ------------------------------------------------------ */
+ /* common configuration to both OPMODE_STA and OPMODE_AP */
+ /* ------------------------------------------------------ */
+ COMMON_CONFIG CommonCfg;
+ MLME_STRUCT Mlme;
+
+ /* AP needs those vaiables for site survey feature. */
+ MLME_AUX MlmeAux; /* temporary settings used during MLME state machine */
+ BSS_TABLE ScanTab; /* store the latest SCAN result */
+
+ /*About MacTab, the sta driver will use #0 and #1 for multicast and AP. */
+ MAC_TABLE MacTab; /* ASIC on-chip WCID entry table. At TX, ASIC always use key according to this on-chip table. */
+ spinlock_t MacTabLock;
+
+ BA_TABLE BATable;
+
+ spinlock_t BATabLock;
+ RALINK_TIMER_STRUCT RECBATimer;
+
+ /* encryption/decryption KEY tables */
+ CIPHER_KEY SharedKey[MAX_MBSSID_NUM][4]; /* STA always use SharedKey[BSS0][0..3] */
+
+ /* RX re-assembly buffer for fragmentation */
+ FRAGMENT_FRAME FragFrame; /* Frame storage for fragment frame */
+
+ /* various Counters */
+ COUNTER_802_3 Counters8023; /* 802.3 counters */
+ COUNTER_802_11 WlanCounters; /* 802.11 MIB counters */
+ COUNTER_RALINK RalinkCounters; /* Ralink propriety counters */
+ COUNTER_DRS DrsCounters; /* counters for Dynamic TX Rate Switching */
+ PRIVATE_STRUC PrivateInfo; /* Private information & counters */
+
+ /* flags, see fRTMP_ADAPTER_xxx flags */
+ unsigned long Flags; /* Represent current device status */
+ unsigned long PSFlags; /* Power Save operation flag. */
+
+ /* current TX sequence # */
+ u16 Sequence;
+
+ /* Control disconnect / connect event generation */
+ /*+++Didn't used anymore */
+ unsigned long LinkDownTime;
+ /*--- */
+ unsigned long LastRxRate;
+ unsigned long LastTxRate;
+ /*+++Used only for Station */
+ BOOLEAN bConfigChanged; /* Config Change flag for the same SSID setting */
+ /*--- */
+
+ unsigned long ExtraInfo; /* Extra information for displaying status */
+ unsigned long SystemErrorBitmap; /* b0: E2PROM version error */
+
+ /*+++Didn't used anymore */
+ unsigned long MacIcVersion; /* MAC/BBP serial interface issue solved after ver.D */
+ /*--- */
+
+ /* --------------------------- */
+ /* System event log */
+ /* --------------------------- */
+ RT_802_11_EVENT_TABLE EventTab;
+
+ BOOLEAN HTCEnable;
+
+ /*****************************************************************************************/
+ /* Statistic related parameters */
+ /*****************************************************************************************/
+#ifdef RTMP_MAC_USB
+ unsigned long BulkOutDataOneSecCount;
+ unsigned long BulkInDataOneSecCount;
+ unsigned long BulkLastOneSecCount; /* BulkOutDataOneSecCount + BulkInDataOneSecCount */
+ unsigned long watchDogRxCnt;
+ unsigned long watchDogRxOverFlowCnt;
+ unsigned long watchDogTxPendingCnt[NUM_OF_TX_RING];
+ int TransferedLength[NUM_OF_TX_RING];
+#endif /* RTMP_MAC_USB // */
+
+ BOOLEAN bUpdateBcnCntDone;
+ unsigned long watchDogMacDeadlock; /* prevent MAC/BBP into deadlock condition */
+ /* ---------------------------- */
+ /* DEBUG paramerts */
+ /* ---------------------------- */
+ /*unsigned long DebugSetting[4]; */
+ BOOLEAN bBanAllBaSetup;
+ BOOLEAN bPromiscuous;
+
+ /* ---------------------------- */
+ /* rt2860c emulation-use Parameters */
+ /* ---------------------------- */
+ /*unsigned long rtsaccu[30]; */
+ /*unsigned long ctsaccu[30]; */
+ /*unsigned long cfendaccu[30]; */
+ /*unsigned long bacontent[16]; */
+ /*unsigned long rxint[RX_RING_SIZE+1]; */
+ /*u8 rcvba[60]; */
+ BOOLEAN bLinkAdapt;
+ BOOLEAN bForcePrintTX;
+ BOOLEAN bForcePrintRX;
+ /*BOOLEAN bDisablescanning; //defined in RT2870 USB */
+ BOOLEAN bStaFifoTest;
+ BOOLEAN bProtectionTest;
+ BOOLEAN bBroadComHT;
+ /*+++Following add from RT2870 USB. */
+ unsigned long BulkOutReq;
+ unsigned long BulkOutComplete;
+ unsigned long BulkOutCompleteOther;
+ unsigned long BulkOutCompleteCancel; /* seems not use now? */
+ unsigned long BulkInReq;
+ unsigned long BulkInComplete;
+ unsigned long BulkInCompleteFail;
+ /*--- */
+
+ struct wificonf WIFItestbed;
+
+ struct reordering_mpdu_pool mpdu_blk_pool;
+
+ unsigned long OneSecondnonBEpackets; /* record non BE packets per second */
+
+#ifdef LINUX
+ struct iw_statistics iw_stats;
+
+ struct net_device_stats stats;
+#endif /* LINUX // */
+
+ unsigned long TbttTickCount;
+#ifdef PCI_MSI_SUPPORT
+ BOOLEAN HaveMsi;
+#endif /* PCI_MSI_SUPPORT // */
+
+ u8 is_on;
+
+#define TIME_BASE (1000000/OS_HZ)
+#define TIME_ONE_SECOND (1000000/TIME_BASE)
+ u8 flg_be_adjust;
+ unsigned long be_adjust_last_time;
+
+ u8 FlgCtsEnabled;
+ u8 PM_FlgSuspend;
+
+#ifdef RT30xx
+#ifdef RTMP_EFUSE_SUPPORT
+ BOOLEAN bUseEfuse;
+ u8 EEPROMImage[1024];
+#endif /* RTMP_EFUSE_SUPPORT // */
+#endif /* RT30xx // */
+};
+
+#define DELAYINTMASK 0x0003fffb
+#define INTMASK 0x0003fffb
+#define IndMask 0x0003fffc
+#define RxINT 0x00000005 /* Delayed Rx or indivi rx */
+#define TxDataInt 0x000000fa /* Delayed Tx or indivi tx */
+#define TxMgmtInt 0x00000102 /* Delayed Tx or indivi tx */
+#define TxCoherent 0x00020000 /* tx coherent */
+#define RxCoherent 0x00010000 /* rx coherent */
+#define McuCommand 0x00000200 /* mcu */
+#define PreTBTTInt 0x00001000 /* Pre-TBTT interrupt */
+#define TBTTInt 0x00000800 /* TBTT interrupt */
+#define GPTimeOutInt 0x00008000 /* GPtimeout interrupt */
+#define AutoWakeupInt 0x00004000 /* AutoWakeupInt interrupt */
+#define FifoStaFullInt 0x00002000 /* fifo statistics full interrupt */
+
+/***************************************************************************
+ * Rx Path software control block related data structures
+ **************************************************************************/
+typedef struct _RX_BLK_ {
+/* RXD_STRUC RxD; // sample */
+ RT28XX_RXD_STRUC RxD;
+ PRXWI_STRUC pRxWI;
+ PHEADER_802_11 pHeader;
+ void *pRxPacket;
+ u8 *pData;
+ u16 DataSize;
+ u16 Flags;
+ u8 UserPriority; /* for calculate TKIP MIC using */
+} RX_BLK;
+
+#define RX_BLK_SET_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags |= _flag)
+#define RX_BLK_TEST_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags & _flag)
+#define RX_BLK_CLEAR_FLAG(_pRxBlk, _flag) (_pRxBlk->Flags &= ~(_flag))
+
+#define fRX_WDS 0x0001
+#define fRX_AMSDU 0x0002
+#define fRX_ARALINK 0x0004
+#define fRX_HTC 0x0008
+#define fRX_PAD 0x0010
+#define fRX_AMPDU 0x0020
+#define fRX_QOS 0x0040
+#define fRX_INFRA 0x0080
+#define fRX_EAP 0x0100
+#define fRX_MESH 0x0200
+#define fRX_APCLI 0x0400
+#define fRX_DLS 0x0800
+#define fRX_WPI 0x1000
+
+#define LENGTH_AMSDU_SUBFRAMEHEAD 14
+#define LENGTH_ARALINK_SUBFRAMEHEAD 14
+#define LENGTH_ARALINK_HEADER_FIELD 2
+
+/***************************************************************************
+ * Tx Path software control block related data structures
+ **************************************************************************/
+#define TX_UNKOWN_FRAME 0x00
+#define TX_MCAST_FRAME 0x01
+#define TX_LEGACY_FRAME 0x02
+#define TX_AMPDU_FRAME 0x04
+#define TX_AMSDU_FRAME 0x08
+#define TX_RALINK_FRAME 0x10
+#define TX_FRAG_FRAME 0x20
+
+/* Currently the sizeof(TX_BLK) is 148 bytes. */
+typedef struct _TX_BLK_ {
+ u8 QueIdx;
+ u8 TxFrameType; /* Indicate the Transmission type of the all frames in one batch */
+ u8 TotalFrameNum; /* Total frame number want to send-out in one batch */
+ u16 TotalFragNum; /* Total frame fragments required in one batch */
+ u16 TotalFrameLen; /* Total length of all frames want to send-out in one batch */
+
+ QUEUE_HEADER TxPacketList;
+ MAC_TABLE_ENTRY *pMacEntry; /* NULL: packet with 802.11 RA field is multicast/broadcast address */
+ HTTRANSMIT_SETTING *pTransmit;
+
+ /* Following structure used for the characteristics of a specific packet. */
+ void *pPacket;
+ u8 *pSrcBufHeader; /* Reference to the head of sk_buff->data */
+ u8 *pSrcBufData; /* Reference to the sk_buff->data, will changed depends on hanlding progresss */
+ u32 SrcBufLen; /* Length of packet payload which not including Layer 2 header */
+ u8 *pExtraLlcSnapEncap; /* NULL means no extra LLC/SNAP is required */
+ u8 HeaderBuf[128]; /* TempBuffer for TX_INFO + TX_WI + 802.11 Header + padding + AMSDU SubHeader + LLC/SNAP */
+ /*RT2870 2.1.0.0 uses only 80 bytes */
+ /*RT3070 2.1.1.0 uses only 96 bytes */
+ /*RT3090 2.1.0.0 uses only 96 bytes */
+ u8 MpduHeaderLen; /* 802.11 header length NOT including the padding */
+ u8 HdrPadLen; /* recording Header Padding Length; */
+ u8 apidx; /* The interface associated to this packet */
+ u8 Wcid; /* The MAC entry associated to this packet */
+ u8 UserPriority; /* priority class of packet */
+ u8 FrameGap; /* what kind of IFS this packet use */
+ u8 MpduReqNum; /* number of fragments of this frame */
+ u8 TxRate; /* TODO: Obsoleted? Should change to MCS? */
+ u8 CipherAlg; /* cipher alogrithm */
+ PCIPHER_KEY pKey;
+
+ u16 Flags; /*See following definitions for detail. */
+
+ /*YOU SHOULD NOT TOUCH IT! Following parameters are used for hardware-depended layer. */
+ unsigned long Priv; /* Hardware specific value saved in here. */
+} TX_BLK, *PTX_BLK;
+
+#define fTX_bRtsRequired 0x0001 /* Indicate if need send RTS frame for protection. Not used in RT2860/RT2870. */
+#define fTX_bAckRequired 0x0002 /* the packet need ack response */
+#define fTX_bPiggyBack 0x0004 /* Legacy device use Piggback or not */
+#define fTX_bHTRate 0x0008 /* allow to use HT rate */
+#define fTX_bForceNonQoS 0x0010 /* force to transmit frame without WMM-QoS in HT mode */
+#define fTX_bAllowFrag 0x0020 /* allow to fragment the packet, A-MPDU, A-MSDU, A-Ralink is not allowed to fragment */
+#define fTX_bMoreData 0x0040 /* there are more data packets in PowerSave Queue */
+#define fTX_bWMM 0x0080 /* QOS Data */
+#define fTX_bClearEAPFrame 0x0100
+
+#define TX_BLK_SET_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags |= _flag)
+#define TX_BLK_TEST_FLAG(_pTxBlk, _flag) (((_pTxBlk->Flags & _flag) == _flag) ? 1 : 0)
+#define TX_BLK_CLEAR_FLAG(_pTxBlk, _flag) (_pTxBlk->Flags &= ~(_flag))
+
+/***************************************************************************
+ * Other static inline function definitions
+ **************************************************************************/
+static inline void ConvertMulticastIP2MAC(u8 *pIpAddr,
+ u8 ** ppMacAddr,
+ u16 ProtoType)
+{
+ if (pIpAddr == NULL)
+ return;
+
+ if (ppMacAddr == NULL || *ppMacAddr == NULL)
+ return;
+
+ switch (ProtoType) {
+ case ETH_P_IPV6:
+/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
+ *(*ppMacAddr) = 0x33;
+ *(*ppMacAddr + 1) = 0x33;
+ *(*ppMacAddr + 2) = pIpAddr[12];
+ *(*ppMacAddr + 3) = pIpAddr[13];
+ *(*ppMacAddr + 4) = pIpAddr[14];
+ *(*ppMacAddr + 5) = pIpAddr[15];
+ break;
+
+ case ETH_P_IP:
+ default:
+/* memset(*ppMacAddr, 0, ETH_LENGTH_OF_ADDRESS); */
+ *(*ppMacAddr) = 0x01;
+ *(*ppMacAddr + 1) = 0x00;
+ *(*ppMacAddr + 2) = 0x5e;
+ *(*ppMacAddr + 3) = pIpAddr[1] & 0x7f;
+ *(*ppMacAddr + 4) = pIpAddr[2];
+ *(*ppMacAddr + 5) = pIpAddr[3];
+ break;
+ }
+
+ return;
+}
+
+char *GetPhyMode(int Mode);
+char *GetBW(int BW);
+
+/* */
+/* Private routines in rtmp_init.c */
+/* */
+int RTMPAllocAdapterBlock(void *handle,
+ OUT PRTMP_ADAPTER * ppAdapter);
+
+int RTMPAllocTxRxRingMemory(IN PRTMP_ADAPTER pAd);
+
+void RTMPFreeAdapter(IN PRTMP_ADAPTER pAd);
+
+int NICReadRegParameters(IN PRTMP_ADAPTER pAd,
+ void *WrapperConfigurationContext);
+
+#ifdef RTMP_RF_RW_SUPPORT
+void NICInitRFRegisters(IN PRTMP_ADAPTER pAd);
+
+void RtmpChipOpsRFHook(IN RTMP_ADAPTER * pAd);
+
+int RT30xxWriteRFRegister(IN PRTMP_ADAPTER pAd,
+ u8 regID, u8 value);
+
+int RT30xxReadRFRegister(IN PRTMP_ADAPTER pAd,
+ u8 regID, u8 *pValue);
+#endif /* RTMP_RF_RW_SUPPORT // */
+
+void NICReadEEPROMParameters(IN PRTMP_ADAPTER pAd, u8 *mac_addr);
+
+void NICInitAsicFromEEPROM(IN PRTMP_ADAPTER pAd);
+
+int NICInitializeAdapter(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset);
+
+int NICInitializeAsic(IN PRTMP_ADAPTER pAd, IN BOOLEAN bHardReset);
+
+void NICIssueReset(IN PRTMP_ADAPTER pAd);
+
+void RTMPRingCleanUp(IN PRTMP_ADAPTER pAd, u8 RingType);
+
+void UserCfgInit(IN PRTMP_ADAPTER pAd);
+
+void NICResetFromError(IN PRTMP_ADAPTER pAd);
+
+int NICLoadFirmware(IN PRTMP_ADAPTER pAd);
+
+void NICEraseFirmware(IN PRTMP_ADAPTER pAd);
+
+int NICLoadRateSwitchingParams(IN PRTMP_ADAPTER pAd);
+
+BOOLEAN NICCheckForHang(IN PRTMP_ADAPTER pAd);
+
+void NICUpdateFifoStaCounters(IN PRTMP_ADAPTER pAd);
+
+void NICUpdateRawCounters(IN PRTMP_ADAPTER pAd);
+
+void RTMPZeroMemory(void *pSrc, unsigned long Length);
+
+unsigned long RTMPCompareMemory(void *pSrc1, void *pSrc2, unsigned long Length);
+
+void RTMPMoveMemory(void *pDest, void *pSrc, unsigned long Length);
+
+void AtoH(char *src, u8 *dest, int destlen);
+
+u8 BtoH(char ch);
+
+void RTMPPatchMacBbpBug(IN PRTMP_ADAPTER pAd);
+
+void RTMPInitTimer(IN PRTMP_ADAPTER pAd,
+ IN PRALINK_TIMER_STRUCT pTimer,
+ void *pTimerFunc, void *pData, IN BOOLEAN Repeat);
+
+void RTMPSetTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value);
+
+void RTMPModTimer(IN PRALINK_TIMER_STRUCT pTimer, unsigned long Value);
+
+void RTMPCancelTimer(IN PRALINK_TIMER_STRUCT pTimer, OUT BOOLEAN * pCancelled);
+
+void RTMPSetLED(IN PRTMP_ADAPTER pAd, u8 Status);
+
+void RTMPSetSignalLED(IN PRTMP_ADAPTER pAd, IN NDIS_802_11_RSSI Dbm);
+
+void RTMPEnableRxTx(IN PRTMP_ADAPTER pAd);
+
+/* */
+/* prototype in action.c */
+/* */
+void ActionStateMachineInit(IN PRTMP_ADAPTER pAd,
+ IN STATE_MACHINE * S,
+ OUT STATE_MACHINE_FUNC Trans[]);
+
+void MlmeADDBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void MlmeDELBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void MlmeDLSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void MlmeInvalidAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void MlmeQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerAddBAReqAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerAddBARspAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerDelBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerBAAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void SendPSMPAction(IN PRTMP_ADAPTER pAd, u8 Wcid, u8 Psmp);
+
+void PeerRMAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerPublicAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerHTAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void PeerQOSAction(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void RECBATimerTimeout(void *SystemSpecific1,
+ void *FunctionContext,
+ void *SystemSpecific2, void *SystemSpecific3);
+
+void ORIBATimerTimeout(IN PRTMP_ADAPTER pAd);
+
+void SendRefreshBAR(IN PRTMP_ADAPTER pAd, IN MAC_TABLE_ENTRY * pEntry);
+
+void ActHeaderInit(IN PRTMP_ADAPTER pAd,
+ IN OUT PHEADER_802_11 pHdr80211,
+ u8 *Addr1, u8 *Addr2, u8 *Addr3);
+
+void BarHeaderInit(IN PRTMP_ADAPTER pAd,
+ IN OUT PFRAME_BAR pCntlBar, u8 *pDA, u8 *pSA);
+
+void InsertActField(IN PRTMP_ADAPTER pAd,
+ u8 *pFrameBuf,
+ unsigned long *pFrameLen, u8 Category, u8 ActCode);
+
+BOOLEAN CntlEnqueueForRecv(IN PRTMP_ADAPTER pAd,
+ unsigned long Wcid,
+ unsigned long MsgLen, IN PFRAME_BA_REQ pMsg);
+
+/* */
+/* Private routines in rtmp_data.c */
+/* */
+BOOLEAN RTMPHandleRxDoneInterrupt(IN PRTMP_ADAPTER pAd);
+
+BOOLEAN RTMPHandleTxRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd,
+ INT_SOURCE_CSR_STRUC TxRingBitmap);
+
+void RTMPHandleMgmtRingDmaDoneInterrupt(IN PRTMP_ADAPTER pAd);
+
+void RTMPHandleTBTTInterrupt(IN PRTMP_ADAPTER pAd);
+
+void RTMPHandlePreTBTTInterrupt(IN PRTMP_ADAPTER pAd);
+
+void RTMPHandleTwakeupInterrupt(IN PRTMP_ADAPTER pAd);
+
+void RTMPHandleRxCoherentInterrupt(IN PRTMP_ADAPTER pAd);
+
+BOOLEAN TxFrameIsAggregatible(IN PRTMP_ADAPTER pAd,
+ u8 *pPrevAddr1, u8 *p8023hdr);
+
+BOOLEAN PeerIsAggreOn(IN PRTMP_ADAPTER pAd,
+ unsigned long TxRate, IN PMAC_TABLE_ENTRY pMacEntry);
+
+int Sniff2BytesFromNdisBuffer(char *pFirstBuffer,
+ u8 DesiredOffset,
+ u8 *pByte0, u8 *pByte1);
+
+int STASendPacket(IN PRTMP_ADAPTER pAd, void *pPacket);
+
+void STASendPackets(void *MiniportAdapterContext,
+ void **ppPacketArray, u32 NumberOfPackets);
+
+void RTMPDeQueuePacket(IN PRTMP_ADAPTER pAd,
+ IN BOOLEAN bIntContext,
+ u8 QueIdx, u8 Max_Tx_Packets);
+
+int RTMPHardTransmit(IN PRTMP_ADAPTER pAd,
+ void *pPacket,
+ u8 QueIdx, unsigned long *pFreeTXDLeft);
+
+int STAHardTransmit(IN PRTMP_ADAPTER pAd,
+ IN TX_BLK * pTxBlk, u8 QueIdx);
+
+void STARxEAPOLFrameIndicate(IN PRTMP_ADAPTER pAd,
+ IN MAC_TABLE_ENTRY * pEntry,
+ IN RX_BLK * pRxBlk, u8 FromWhichBSSID);
+
+int RTMPFreeTXDRequest(IN PRTMP_ADAPTER pAd,
+ u8 RingType,
+ u8 NumberRequired, u8 *FreeNumberIs);
+
+int MlmeHardTransmit(IN PRTMP_ADAPTER pAd,
+ u8 QueIdx, void *pPacket);
+
+int MlmeHardTransmitMgmtRing(IN PRTMP_ADAPTER pAd,
+ u8 QueIdx, void *pPacket);
+
+#ifdef RTMP_MAC_PCI
+int MlmeHardTransmitTxRing(IN PRTMP_ADAPTER pAd,
+ u8 QueIdx, void *pPacket);
+
+int MlmeDataHardTransmit(IN PRTMP_ADAPTER pAd,
+ u8 QueIdx, void *pPacket);
+
+void RTMPWriteTxDescriptor(IN PRTMP_ADAPTER pAd,
+ IN PTXD_STRUC pTxD, IN BOOLEAN bWIV, u8 QSEL);
+#endif /* RTMP_MAC_PCI // */
+
+u16 RTMPCalcDuration(IN PRTMP_ADAPTER pAd, u8 Rate, unsigned long Size);
+
+void RTMPWriteTxWI(IN PRTMP_ADAPTER pAd, IN PTXWI_STRUC pTxWI, IN BOOLEAN FRAG, IN BOOLEAN CFACK, IN BOOLEAN InsTimestamp, IN BOOLEAN AMPDU, IN BOOLEAN Ack, IN BOOLEAN NSeq, /* HW new a sequence. */
+ u8 BASize,
+ u8 WCID,
+ unsigned long Length,
+ u8 PID,
+ u8 TID,
+ u8 TxRate,
+ u8 Txopmode,
+ IN BOOLEAN CfAck, IN HTTRANSMIT_SETTING * pTransmit);
+
+void RTMPWriteTxWI_Data(IN PRTMP_ADAPTER pAd,
+ IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk);
+
+void RTMPWriteTxWI_Cache(IN PRTMP_ADAPTER pAd,
+ IN OUT PTXWI_STRUC pTxWI, IN TX_BLK * pTxBlk);
+
+void RTMPSuspendMsduTransmission(IN PRTMP_ADAPTER pAd);
+
+void RTMPResumeMsduTransmission(IN PRTMP_ADAPTER pAd);
+
+int MiniportMMRequest(IN PRTMP_ADAPTER pAd,
+ u8 QueIdx, u8 *pData, u32 Length);
+
+/*+++mark by shiang, now this function merge to MiniportMMRequest() */
+/*---mark by shiang, now this function merge to MiniportMMRequest() */
+
+void RTMPSendNullFrame(IN PRTMP_ADAPTER pAd,
+ u8 TxRate, IN BOOLEAN bQosNull);
+
+void RTMPSendDisassociationFrame(IN PRTMP_ADAPTER pAd);
+
+void RTMPSendRTSFrame(IN PRTMP_ADAPTER pAd,
+ u8 *pDA,
+ IN unsigned int NextMpduSize,
+ u8 TxRate,
+ u8 RTSRate,
+ u16 AckDuration,
+ u8 QueIdx, u8 FrameGap);
+
+PQUEUE_HEADER RTMPCheckTxSwQueue(IN PRTMP_ADAPTER pAd, u8 * QueIdx);
+
+void RTMPReportMicError(IN PRTMP_ADAPTER pAd, IN PCIPHER_KEY pWpaKey);
+
+void WpaMicFailureReportFrame(IN PRTMP_ADAPTER pAd, IN MLME_QUEUE_ELEM * Elem);
+
+void WpaDisassocApAndBlockAssoc(void *SystemSpecific1,
+ void *FunctionContext,
+ void *SystemSpecific2,
+ void *SystemSpecific3);
+
+void WpaStaPairwiseKeySetting(IN PRTMP_ADAPTER pAd);
+
+void WpaStaGroupKeySetting(IN PRTMP_ADAPTER pAd);
+
+int RTMPCloneNdisPacket(IN PRTMP_ADAPTER pAd,
+ IN BOOLEAN pInsAMSDUHdr,
+ void *pInPacket,
+ void ** ppOutPacket);
+
+int RTMPAllocateNdisPacket(IN PRTMP_ADAPTER pAd,
+ void ** pPacket,
+ u8 *pHeader,
+ u32 HeaderLen,
+ u8 *pData, u32 DataLen);
+
+void RTMPFreeNdisPacket(IN PRTMP_ADAPTER pAd, void *pPacket);
+
+BOOLEAN RTMPFreeTXDUponTxDmaDone(IN PRTMP_ADAPTER pAd, u8 QueIdx);
+
+BOOLEAN RTMPCheckDHCPFrame(IN PRTMP_ADAPTER pAd, void *pPacket);
+
+BOOLEAN RTMPCheckEtherType(IN PRTMP_ADAPTER pAd, void *pPacket);
+
+/* */
+/* Private routines in rtmp_wep.c */
+/* */
+void RTMPInitWepEngine(IN PRTMP_ADAPTER pAd,
+ u8 *pKey,
+ u8 KeyId, u8 KeyLen, u8 *pDest);
+
+void RTMPEncryptData(IN PRTMP_ADAPTER pAd,
+ u8 *pSrc, u8 *pDest, u32 Len);
+
+BOOLEAN RTMPSoftDecryptWEP(IN PRTMP_ADAPTER pAd,
+ u8 *pData,
+ unsigned long DataByteCnt, IN PCIPHER_KEY pGroupKey);
+
+void RTMPSetICV(IN PRTMP_ADAPTER pAd, u8 *pDest);
+
+void ARCFOUR_INIT(IN PARCFOURCONTEXT Ctx, u8 *pKey, u32 KeyLen);
+
+u8 ARCFOUR_BYTE(IN PARCFOURCONTEXT Ctx);
+
+void ARCFOUR_DECRYPT(IN PARCFOURCONTEXT Ctx,
+ u8 *pDest, u8 *pSrc, u32 Len);
+
+void ARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx,
+ u8 *pDest, u8 *pSrc, u32 Len);
+
+void WPAARCFOUR_ENCRYPT(IN PARCFOURCONTEXT Ctx,
+ u8 *pDest, u8 *pSrc, u32 Len);
+
+u32 RTMP_CALC_FCS32(u32 Fcs, u8 *Cp, int Len);
+
+/* */
+/* MLME routines */
+/* */
+
+/* Asic/RF/BBP related functions */
+
+void AsicAdjustTxPower(IN PRTMP_ADAPTER pAd);
+
+void AsicUpdateProtect(IN PRTMP_ADAPTER pAd,
+ u16 OperaionMode,
+ u8 SetMask,
+ IN BOOLEAN bDisableBGProtect, IN BOOLEAN bNonGFExist);
+
+void AsicSwitchChannel(IN PRTMP_ADAPTER pAd,
+ u8 Channel, IN BOOLEAN bScan);
+
+void AsicLockChannel(IN PRTMP_ADAPTER pAd, u8 Channel);
+
+void AsicRfTuningExec(void *SystemSpecific1,
+ void *FunctionContext,
+ void *SystemSpecific2, void *SystemSpecific3);
+
+void AsicResetBBPAgent(IN PRTMP_ADAPTER pAd);
+
+void AsicSleepThenAutoWakeup(IN PRTMP_ADAPTER pAd,
+ u16 TbttNumToNextWakeUp);
+
+void AsicForceSleep(IN PRTMP_ADAPTER pAd);
+
+void AsicForceWakeup(IN PRTMP_ADAPTER pAd, IN BOOLEAN bFromTx);
+
+void AsicSetBssid(IN PRTMP_ADAPTER pAd, u8 *pBssid);
+
+void AsicSetMcastWC(IN PRTMP_ADAPTER pAd);
+
+void AsicDelWcidTab(IN PRTMP_ADAPTER pAd, u8 Wcid);
+
+void AsicEnableRDG(IN PRTMP_ADAPTER pAd);
+
+void AsicDisableRDG(IN PRTMP_ADAPTER pAd);
+
+void AsicDisableSync(IN PRTMP_ADAPTER pAd);
+
+void AsicEnableBssSync(IN PRTMP_ADAPTER pAd);
+
+void AsicEnableIbssSync(IN PRTMP_ADAPTER pAd);
+
+void AsicSetEdcaParm(IN PRTMP_ADAPTER pAd, IN PEDCA_PARM pEdcaParm);
+
+void AsicSetSlotTime(IN PRTMP_ADAPTER pAd, IN BOOLEAN bUseShortSlotTime);
+
+void AsicAddSharedKeyEntry(IN PRTMP_ADAPTER pAd,
+ u8 BssIndex,
+ u8 KeyIdx,
+ u8 CipherAlg,
+ u8 *pKey, u8 *pTxMic, u8 *pRxMic);
+
+void AsicRemoveSharedKeyEntry(IN PRTMP_ADAPTER pAd,
+ u8 BssIndex, u8 KeyIdx);
+
+void AsicUpdateWCIDAttribute(IN PRTMP_ADAPTER pAd,
+ u16 WCID,
+ u8 BssIndex,
+ u8 CipherAlg,
+ IN BOOLEAN bUsePairewiseKeyTable);
+
+void AsicUpdateWCIDIVEIV(IN PRTMP_ADAPTER pAd,
+ u16 WCID, unsigned long uIV, unsigned long uEIV);
+
+void AsicUpdateRxWCIDTable(IN PRTMP_ADAPTER pAd,
+ u16 WCID, u8 *pAddr);
+
+void AsicAddKeyEntry(IN PRTMP_ADAPTER pAd,
+ u16 WCID,
+ u8 BssIndex,
+ u8 KeyIdx,
+ IN PCIPHER_KEY pCipherKey,
+ IN BOOLEAN bUsePairewiseKeyTable, IN BOOLEAN bTxKey);
+
+void AsicAddPairwiseKeyEntry(IN PRTMP_ADAPTER pAd,
+ u8 *pAddr,
+ u8 WCID, IN CIPHER_KEY * pCipherKey);
+
+void AsicRemovePairwiseKeyEntry(IN PRTMP_ADAPTER pAd,
+ u8 BssIdx, u8 Wcid);
+
+BOOLEAN AsicSendCommandToMcu(IN PRTMP_ADAPTER pAd,
+ u8 Command,
+ u8 Token, u8 Arg0, u8 Arg1);
+
+#ifdef RTMP_MAC_PCI
+BOOLEAN AsicCheckCommanOk(IN PRTMP_ADAPTER pAd, u8 Command);
+#endif /* RTMP_MAC_PCI // */
+
+void MacAddrRandomBssid(IN PRTMP_ADAPTER pAd, u8 *pAddr);
+
+void MgtMacHeaderInit(IN PRTMP_ADAPTER pAd,
+ IN OUT PHEADER_802_11 pHdr80211,
+ u8 SubType,
+ u8 ToDs, u8 *pDA, u8 *pBssid);
+
+void MlmeRadioOff(IN PRTMP_ADAPTER pAd);
+
+void MlmeRadioOn(IN PRTMP_ADAPTER pAd);
+
+void BssTableInit(IN BSS_TABLE * Tab);
+
+void BATableInit(IN PRTMP_ADAPTER pAd, IN BA_TABLE * Tab);
+
+unsigned long BssTableSearch(IN BSS_TABLE * Tab, u8 *pBssid, u8 Channel);
+
+unsigned long BssSsidTableSearch(IN BSS_TABLE * Tab,
+ u8 *pBssid,
+ u8 *pSsid, u8 SsidLen, u8 Channel);
+
+unsigned long BssTableSearchWithSSID(IN BSS_TABLE * Tab,
+ u8 *Bssid,
+ u8 *pSsid,
+ u8 SsidLen, u8 Channel);
+
+unsigned long BssSsidTableSearchBySSID(IN BSS_TABLE * Tab,
+ u8 *pSsid, u8 SsidLen);
+
+void BssTableDeleteEntry(IN OUT PBSS_TABLE pTab,
+ u8 *pBssid, u8 Channel);
+
+void BATableDeleteORIEntry(IN OUT PRTMP_ADAPTER pAd,
+ IN BA_ORI_ENTRY * pBAORIEntry);
+
+void BssEntrySet(IN PRTMP_ADAPTER pAd, OUT PBSS_ENTRY pBss, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN PCF_PARM CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */
+ u8 HtCapabilityLen,
+ u8 AddHtInfoLen,
+ u8 NewExtChanOffset,
+ u8 Channel,
+ char Rssi,
+ IN LARGE_INTEGER TimeStamp,
+ u8 CkipFlag,
+ IN PEDCA_PARM pEdcaParm,
+ IN PQOS_CAPABILITY_PARM pQosCapability,
+ IN PQBSS_LOAD_PARM pQbssLoad,
+ u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE);
+
+unsigned long BssTableSetEntry(IN PRTMP_ADAPTER pAd, OUT PBSS_TABLE pTab, u8 *pBssid, char Ssid[], u8 SsidLen, u8 BssType, u16 BeaconPeriod, IN CF_PARM * CfParm, u16 AtimWin, u16 CapabilityInfo, u8 SupRate[], u8 SupRateLen, u8 ExtRate[], u8 ExtRateLen, IN HT_CAPABILITY_IE * pHtCapability, IN ADD_HT_INFO_IE * pAddHtInfo, /* AP might use this additional ht info IE */
+ u8 HtCapabilityLen,
+ u8 AddHtInfoLen,
+ u8 NewExtChanOffset,
+ u8 Channel,
+ char Rssi,
+ IN LARGE_INTEGER TimeStamp,
+ u8 CkipFlag,
+ IN PEDCA_PARM pEdcaParm,
+ IN PQOS_CAPABILITY_PARM pQosCapability,
+ IN PQBSS_LOAD_PARM pQbssLoad,
+ u16 LengthVIE, IN PNDIS_802_11_VARIABLE_IEs pVIE);
+
+void BATableInsertEntry(IN PRTMP_ADAPTER pAd,
+ u16 Aid,
+ u16 TimeOutValue,
+ u16 StartingSeq,
+ u8 TID,
+ u8 BAWinSize,
+ u8 OriginatorStatus, IN BOOLEAN IsRecipient);
+
+void BssTableSsidSort(IN PRTMP_ADAPTER pAd,
+ OUT BSS_TABLE * OutTab, char Ssid[], u8 SsidLen);
+
+void BssTableSortByRssi(IN OUT BSS_TABLE * OutTab);
+
+void BssCipherParse(IN OUT PBSS_ENTRY pBss);
+
+int MlmeQueueInit(IN MLME_QUEUE * Queue);
+
+void MlmeQueueDestroy(IN MLME_QUEUE * Queue);