Staging: rt{28,30}70: merge rt{28,30}70/*.[ch]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
d1e4861ac2
commit
9e4dab715b
File diff suppressed because it is too large
Load Diff
@ -1,61 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
aironet.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
Paul Lin 04-06-15 Initial
|
||||
*/
|
||||
|
||||
#ifndef __ACTION_H__
|
||||
#define __ACTION_H__
|
||||
|
||||
typedef struct PACKED __HT_INFO_OCTET
|
||||
{
|
||||
UCHAR Request:1;
|
||||
UCHAR Forty_MHz_Intolerant:1;
|
||||
UCHAR STA_Channel_Width:1;
|
||||
UCHAR Reserved:5;
|
||||
} HT_INFORMATION_OCTET;
|
||||
|
||||
|
||||
typedef struct PACKED __FRAME_HT_INFO
|
||||
{
|
||||
HEADER_802_11 Hdr;
|
||||
UCHAR Category;
|
||||
UCHAR Action;
|
||||
HT_INFORMATION_OCTET HT_Info;
|
||||
} FRAME_HT_INFO, *PFRAME_HT_INFO;
|
||||
|
||||
#endif /* __ACTION_H__ */
|
||||
|
||||
|
||||
#include "../rt2870/common/action.h"
|
||||
|
@ -1,210 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
aironet.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
Paul Lin 04-06-15 Initial
|
||||
*/
|
||||
|
||||
#ifndef __AIRONET_H__
|
||||
#define __AIRONET_H__
|
||||
|
||||
// Measurement Type definition
|
||||
#define MSRN_TYPE_UNUSED 0
|
||||
#define MSRN_TYPE_CHANNEL_LOAD_REQ 1
|
||||
#define MSRN_TYPE_NOISE_HIST_REQ 2
|
||||
#define MSRN_TYPE_BEACON_REQ 3
|
||||
#define MSRN_TYPE_FRAME_REQ 4
|
||||
|
||||
// Scan Mode in Beacon Request
|
||||
#define MSRN_SCAN_MODE_PASSIVE 0
|
||||
#define MSRN_SCAN_MODE_ACTIVE 1
|
||||
#define MSRN_SCAN_MODE_BEACON_TABLE 2
|
||||
|
||||
// PHY type definition for Aironet beacon report, CCX 2 table 36-9
|
||||
#define PHY_FH 1
|
||||
#define PHY_DSS 2
|
||||
#define PHY_UNUSED 3
|
||||
#define PHY_OFDM 4
|
||||
#define PHY_HR_DSS 5
|
||||
#define PHY_ERP 6
|
||||
|
||||
// RPI table in dBm
|
||||
#define RPI_0 0 // Power <= -87
|
||||
#define RPI_1 1 // -87 < Power <= -82
|
||||
#define RPI_2 2 // -82 < Power <= -77
|
||||
#define RPI_3 3 // -77 < Power <= -72
|
||||
#define RPI_4 4 // -72 < Power <= -67
|
||||
#define RPI_5 5 // -67 < Power <= -62
|
||||
#define RPI_6 6 // -62 < Power <= -57
|
||||
#define RPI_7 7 // -57 < Power
|
||||
|
||||
// Cisco Aironet IAPP definetions
|
||||
#define AIRONET_IAPP_TYPE 0x32
|
||||
#define AIRONET_IAPP_SUBTYPE_REQUEST 0x01
|
||||
#define AIRONET_IAPP_SUBTYPE_REPORT 0x81
|
||||
|
||||
// Measurement Request detail format
|
||||
typedef struct _MEASUREMENT_REQUEST {
|
||||
UCHAR Channel;
|
||||
UCHAR ScanMode; // Use only in beacon request, other requests did not use this field
|
||||
USHORT Duration;
|
||||
} MEASUREMENT_REQUEST, *PMEASUREMENT_REQUEST;
|
||||
|
||||
// Beacon Measurement Report
|
||||
// All these field might change to UCHAR, because we didn't do anything to these report.
|
||||
// We copy all these beacons and report to CCX 2 AP.
|
||||
typedef struct _BEACON_REPORT {
|
||||
UCHAR Channel;
|
||||
UCHAR Spare;
|
||||
USHORT Duration;
|
||||
UCHAR PhyType; // Definiation is listed above table 36-9
|
||||
UCHAR RxPower;
|
||||
UCHAR BSSID[6];
|
||||
UCHAR ParentTSF[4];
|
||||
UCHAR TargetTSF[8];
|
||||
USHORT BeaconInterval;
|
||||
USHORT CapabilityInfo;
|
||||
} BEACON_REPORT, *PBEACON_REPORT;
|
||||
|
||||
// Frame Measurement Report (Optional)
|
||||
typedef struct _FRAME_REPORT {
|
||||
UCHAR Channel;
|
||||
UCHAR Spare;
|
||||
USHORT Duration;
|
||||
UCHAR TA;
|
||||
UCHAR BSSID[6];
|
||||
UCHAR RSSI;
|
||||
UCHAR Count;
|
||||
} FRAME_REPORT, *PFRAME_REPORT;
|
||||
|
||||
#pragma pack(1)
|
||||
// Channel Load Report
|
||||
typedef struct _CHANNEL_LOAD_REPORT {
|
||||
UCHAR Channel;
|
||||
UCHAR Spare;
|
||||
USHORT Duration;
|
||||
UCHAR CCABusy;
|
||||
} CHANNEL_LOAD_REPORT, *PCHANNEL_LOAD_REPORT;
|
||||
#pragma pack()
|
||||
|
||||
// Nosie Histogram Report
|
||||
typedef struct _NOISE_HIST_REPORT {
|
||||
UCHAR Channel;
|
||||
UCHAR Spare;
|
||||
USHORT Duration;
|
||||
UCHAR Density[8];
|
||||
} NOISE_HIST_REPORT, *PNOISE_HIST_REPORT;
|
||||
|
||||
// Radio Management Capability element
|
||||
typedef struct _RADIO_MANAGEMENT_CAPABILITY {
|
||||
UCHAR Eid; // TODO: Why the Eid is 1 byte, not normal 2 bytes???
|
||||
UCHAR Length;
|
||||
UCHAR AironetOui[3]; // AIronet OUI (00 40 96)
|
||||
UCHAR Type; // Type / Version
|
||||
USHORT Status; // swap16 required
|
||||
} RADIO_MANAGEMENT_CAPABILITY, *PRADIO_MANAGEMENT_CAPABILITY;
|
||||
|
||||
// Measurement Mode Bit definition
|
||||
typedef struct _MEASUREMENT_MODE {
|
||||
UCHAR Rsvd:4;
|
||||
UCHAR Report:1;
|
||||
UCHAR NotUsed:1;
|
||||
UCHAR Enable:1;
|
||||
UCHAR Parallel:1;
|
||||
} MEASUREMENT_MODE, *PMEASUREMENT_MODE;
|
||||
|
||||
// Measurement Request element, This is little endian mode
|
||||
typedef struct _MEASUREMENT_REQUEST_ELEMENT {
|
||||
USHORT Eid;
|
||||
USHORT Length; // swap16 required
|
||||
USHORT Token; // non-zero unique token
|
||||
UCHAR Mode; // Measurement Mode
|
||||
UCHAR Type; // Measurement type
|
||||
} MEASUREMENT_REQUEST_ELEMENT, *PMEASUREMENT_REQUEST_ELEMENT;
|
||||
|
||||
// Measurement Report element, This is little endian mode
|
||||
typedef struct _MEASUREMENT_REPORT_ELEMENT {
|
||||
USHORT Eid;
|
||||
USHORT Length; // swap16 required
|
||||
USHORT Token; // non-zero unique token
|
||||
UCHAR Mode; // Measurement Mode
|
||||
UCHAR Type; // Measurement type
|
||||
} MEASUREMENT_REPORT_ELEMENT, *PMEASUREMENT_REPORT_ELEMENT;
|
||||
|
||||
// Cisco Aironet IAPP Frame Header, Network byte order used
|
||||
typedef struct _AIRONET_IAPP_HEADER {
|
||||
UCHAR CiscoSnapHeader[8]; // 8 bytes Cisco snap header
|
||||
USHORT Length; // IAPP ID & length, remember to swap16 in LE system
|
||||
UCHAR Type; // IAPP type
|
||||
UCHAR SubType; // IAPP subtype
|
||||
UCHAR DA[6]; // Destination MAC address
|
||||
UCHAR SA[6]; // Source MAC address
|
||||
USHORT Token; // Dialog token, no need to swap16 since it is for yoken usage only
|
||||
} AIRONET_IAPP_HEADER, *PAIRONET_IAPP_HEADER;
|
||||
|
||||
// Radio Measurement Request frame
|
||||
typedef struct _AIRONET_RM_REQUEST_FRAME {
|
||||
AIRONET_IAPP_HEADER IAPP; // Common header
|
||||
UCHAR Delay; // Activation Delay
|
||||
UCHAR Offset; // Measurement offset
|
||||
} AIRONET_RM_REQUEST_FRAME, *PAIRONET_RM_REQUEST_FRAME;
|
||||
|
||||
// Radio Measurement Report frame
|
||||
typedef struct _AIRONET_RM_REPORT_FRAME {
|
||||
AIRONET_IAPP_HEADER IAPP; // Common header
|
||||
} AIRONET_RM_REPORT_FRAME, *PAIRONET_RM_REPORT_FRAME;
|
||||
|
||||
// Saved element request actions which will saved in StaCfg.
|
||||
typedef struct _RM_REQUEST_ACTION {
|
||||
MEASUREMENT_REQUEST_ELEMENT ReqElem; // Saved request element
|
||||
MEASUREMENT_REQUEST Measurement; // Saved measurement within the request element
|
||||
} RM_REQUEST_ACTION, *PRM_REQUEST_ACTION;
|
||||
|
||||
// CCX administration control
|
||||
typedef union _CCX_CONTROL {
|
||||
struct {
|
||||
UINT32 Enable:1; // Enable CCX2
|
||||
UINT32 LeapEnable:1; // Enable LEAP at CCX2
|
||||
UINT32 RMEnable:1; // Radio Measurement Enable
|
||||
UINT32 DCRMEnable:1; // Non serving channel Radio Measurement enable
|
||||
UINT32 QOSEnable:1; // Enable QOS for CCX 2.0 support
|
||||
UINT32 FastRoamEnable:1; // Enable fast roaming
|
||||
UINT32 Rsvd:2; // Not used
|
||||
UINT32 dBmToRoam:8; // the condition to roam when receiving Rssi less than this value. It's negative value.
|
||||
UINT32 TuLimit:16; // Limit for different channel scan
|
||||
} field;
|
||||
UINT32 word;
|
||||
} CCX_CONTROL, *PCCX_CONTROL;
|
||||
|
||||
#endif // __AIRONET_H__
|
||||
#include "../rt2870/aironet.h"
|
||||
|
@ -1,532 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
ap.h
|
||||
|
||||
Abstract:
|
||||
Miniport generic portion header file
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Paul Lin 08-01-2002 created
|
||||
James Tan 09-06-2002 modified (Revise NTCRegTable)
|
||||
John Chang 12-22-2004 modified for RT2561/2661. merge with STA driver
|
||||
*/
|
||||
#ifndef __AP_H__
|
||||
#define __AP_H__
|
||||
|
||||
|
||||
|
||||
// ========================= AP RTMP.h ================================
|
||||
|
||||
|
||||
|
||||
// =============================================================
|
||||
// Function Prototypes
|
||||
// =============================================================
|
||||
|
||||
// ap_data.c
|
||||
|
||||
BOOLEAN APBridgeToWirelessSta(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pHeader,
|
||||
IN UINT HdrLen,
|
||||
IN PUCHAR pData,
|
||||
IN UINT DataLen,
|
||||
IN ULONG fromwdsidx);
|
||||
|
||||
BOOLEAN APHandleRxDoneInterrupt(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APSendPackets(
|
||||
IN NDIS_HANDLE MiniportAdapterContext,
|
||||
IN PPNDIS_PACKET ppPacketArray,
|
||||
IN UINT NumberOfPackets);
|
||||
|
||||
NDIS_STATUS APSendPacket(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PNDIS_PACKET pPacket);
|
||||
|
||||
|
||||
NDIS_STATUS APHardTransmit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN TX_BLK *pTxBlk,
|
||||
IN UCHAR QueIdx);
|
||||
|
||||
VOID APRxEAPOLFrameIndicate(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MAC_TABLE_ENTRY *pEntry,
|
||||
IN RX_BLK *pRxBlk,
|
||||
IN UCHAR FromWhichBSSID);
|
||||
|
||||
NDIS_STATUS APCheckRxError(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PRT28XX_RXD_STRUC pRxD,
|
||||
IN UCHAR Wcid);
|
||||
|
||||
BOOLEAN APCheckClass2Class3Error(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Wcid,
|
||||
IN PHEADER_802_11 pHeader);
|
||||
|
||||
VOID APHandleRxPsPoll(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN USHORT Aid,
|
||||
IN BOOLEAN isActive);
|
||||
|
||||
VOID RTMPDescriptorEndianChange(
|
||||
IN PUCHAR pData,
|
||||
IN ULONG DescriptorType);
|
||||
|
||||
VOID RTMPFrameEndianChange(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pData,
|
||||
IN ULONG Dir,
|
||||
IN BOOLEAN FromRxDoneInt);
|
||||
|
||||
// ap_assoc.c
|
||||
|
||||
VOID APAssocStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE *S,
|
||||
OUT STATE_MACHINE_FUNC Trans[]);
|
||||
|
||||
VOID APPeerAssocReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerReassocReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerDisassocReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID MbssKickOutStas(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT apidx,
|
||||
IN USHORT Reason);
|
||||
|
||||
VOID APMlmeKickOutSta(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pStaAddr,
|
||||
IN UCHAR Wcid,
|
||||
IN USHORT Reason);
|
||||
|
||||
VOID APMlmeDisassocReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APCls3errAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Wcid,
|
||||
IN PHEADER_802_11 pHeader);
|
||||
|
||||
|
||||
USHORT APBuildAssociation(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MAC_TABLE_ENTRY *pEntry,
|
||||
IN USHORT CapabilityInfo,
|
||||
IN UCHAR MaxSupportedRateIn500Kbps,
|
||||
IN UCHAR *RSN,
|
||||
IN UCHAR *pRSNLen,
|
||||
IN BOOLEAN bWmmCapable,
|
||||
IN ULONG RalinkIe,
|
||||
IN HT_CAPABILITY_IE *pHtCapability,
|
||||
IN UCHAR HtCapabilityLen,
|
||||
OUT USHORT *pAid);
|
||||
|
||||
// ap_auth.c
|
||||
|
||||
void APAuthStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE *Sm,
|
||||
OUT STATE_MACHINE_FUNC Trans[]);
|
||||
|
||||
VOID APMlmeDeauthReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APCls2errAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN ULONG Wcid,
|
||||
IN PHEADER_802_11 pHeader);
|
||||
|
||||
// ap_authrsp.c
|
||||
|
||||
VOID APAuthRspStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PSTATE_MACHINE Sm,
|
||||
IN STATE_MACHINE_FUNC Trans[]);
|
||||
|
||||
VOID APPeerAuthAtAuthRspIdleAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerDeauthReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerAuthSimpleRspGenAndSend(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PHEADER_802_11 pHdr80211,
|
||||
IN USHORT Alg,
|
||||
IN USHORT Seq,
|
||||
IN USHORT StatusCode);
|
||||
|
||||
// ap_connect.c
|
||||
|
||||
BOOLEAN BeaconTransmitRequired(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT apidx);
|
||||
|
||||
VOID APMakeBssBeacon(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT apidx);
|
||||
|
||||
VOID APUpdateBeaconFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT apidx);
|
||||
|
||||
VOID APMakeAllBssBeacon(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APUpdateAllBeaconFrame(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
// ap_sync.c
|
||||
|
||||
VOID APSyncStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE *Sm,
|
||||
OUT STATE_MACHINE_FUNC Trans[]);
|
||||
|
||||
VOID APScanTimeout(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
VOID APInvalidStateWhenScan(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APScanTimeoutAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerProbeReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerBeaconAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APMlmeScanReqAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APPeerBeaconAtScanAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID APScanCnclAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
VOID ApSiteSurvey(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID SupportRate(
|
||||
IN PUCHAR SupRate,
|
||||
IN UCHAR SupRateLen,
|
||||
IN PUCHAR ExtRate,
|
||||
IN UCHAR ExtRateLen,
|
||||
OUT PUCHAR *Rates,
|
||||
OUT PUCHAR RatesLen,
|
||||
OUT PUCHAR pMaxSupportRate);
|
||||
|
||||
|
||||
BOOLEAN ApScanRunning(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
// ap_wpa.c
|
||||
|
||||
VOID APWpaStateMachineInit(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN STATE_MACHINE *Sm,
|
||||
OUT STATE_MACHINE_FUNC Trans[]);
|
||||
|
||||
// ap_mlme.c
|
||||
|
||||
VOID APMlmePeriodicExec(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APMlmeSelectTxRateTable(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PMAC_TABLE_ENTRY pEntry,
|
||||
IN PUCHAR *ppTable,
|
||||
IN PUCHAR pTableSize,
|
||||
IN PUCHAR pInitTxRateIdx);
|
||||
|
||||
VOID APMlmeSetTxRate(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PMAC_TABLE_ENTRY pEntry,
|
||||
IN PRTMP_TX_RATE_SWITCH pTxRate);
|
||||
|
||||
VOID APMlmeDynamicTxRateSwitching(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APQuickResponeForRateUpExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
BOOLEAN APMsgTypeSubst(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PFRAME_802_11 pFrame,
|
||||
OUT INT *Machine,
|
||||
OUT INT *MsgType);
|
||||
|
||||
VOID APQuickResponeForRateUpExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
|
||||
#ifdef RT2870
|
||||
VOID BeaconUpdateExec(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
#endif // RT2870 //
|
||||
|
||||
VOID RTMPSetPiggyBack(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN BOOLEAN bPiggyBack);
|
||||
|
||||
VOID APAsicEvaluateRxAnt(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APAsicRxAntEvalTimeout(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
// ap.c
|
||||
|
||||
VOID APSwitchChannel(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN INT Channel);
|
||||
|
||||
NDIS_STATUS APInitialize(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APShutdown(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APStartUp(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APStop(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APCleanupPsQueue(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PQUEUE_HEADER pQueue);
|
||||
|
||||
VOID MacTableReset(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
MAC_TABLE_ENTRY *MacTableInsertEntry(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN UCHAR apidx,
|
||||
IN BOOLEAN CleanAll);
|
||||
|
||||
BOOLEAN MacTableDeleteEntry(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN USHORT wcid,
|
||||
IN PUCHAR pAddr);
|
||||
|
||||
MAC_TABLE_ENTRY *MacTableLookup(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr);
|
||||
|
||||
VOID MacTableMaintenance(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
UINT32 MacTableAssocStaNumGet(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
MAC_TABLE_ENTRY *APSsPsInquiry(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
OUT SST *Sst,
|
||||
OUT USHORT *Aid,
|
||||
OUT UCHAR *PsMode,
|
||||
OUT UCHAR *Rate);
|
||||
|
||||
BOOLEAN APPsIndicate(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN ULONG Wcid,
|
||||
IN UCHAR Psm);
|
||||
|
||||
VOID ApLogEvent(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN USHORT Event);
|
||||
|
||||
VOID APUpdateOperationMode(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID APUpdateCapabilityAndErpIe(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
BOOLEAN ApCheckAccessControlList(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN UCHAR Apidx);
|
||||
|
||||
VOID ApUpdateAccessControlList(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR Apidx);
|
||||
|
||||
VOID ApEnqueueNullFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN UCHAR TxRate,
|
||||
IN UCHAR PID,
|
||||
IN UCHAR apidx,
|
||||
IN BOOLEAN bQosNull,
|
||||
IN BOOLEAN bEOSP,
|
||||
IN UCHAR OldUP);
|
||||
|
||||
VOID ApSendFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PVOID pBuffer,
|
||||
IN ULONG Length,
|
||||
IN UCHAR TxRate,
|
||||
IN UCHAR PID);
|
||||
|
||||
VOID ApEnqueueAckFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pAddr,
|
||||
IN UCHAR TxRate,
|
||||
IN UCHAR apidx);
|
||||
|
||||
UCHAR APAutoSelectChannel(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN BOOLEAN Optimal);
|
||||
|
||||
// ap_sanity.c
|
||||
|
||||
|
||||
BOOLEAN PeerAssocReqCmmSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN BOOLEAN isRessoc,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT USHORT *pCapabilityInfo,
|
||||
OUT USHORT *pListenInterval,
|
||||
OUT PUCHAR pApAddr,
|
||||
OUT UCHAR *pSsidLen,
|
||||
OUT char *Ssid,
|
||||
OUT UCHAR *pRatesLen,
|
||||
OUT UCHAR Rates[],
|
||||
OUT UCHAR *RSN,
|
||||
OUT UCHAR *pRSNLen,
|
||||
OUT BOOLEAN *pbWmmCapable,
|
||||
OUT ULONG *pRalinkIe,
|
||||
OUT UCHAR *pHtCapabilityLen,
|
||||
OUT HT_CAPABILITY_IE *pHtCapability);
|
||||
|
||||
|
||||
BOOLEAN PeerDisassocReqSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT USHORT *Reason);
|
||||
|
||||
BOOLEAN PeerDeauthReqSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT USHORT *Reason);
|
||||
|
||||
BOOLEAN APPeerAuthSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr1,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT USHORT *Alg,
|
||||
OUT USHORT *Seq,
|
||||
OUT USHORT *Status,
|
||||
CHAR *ChlgText);
|
||||
|
||||
BOOLEAN APPeerProbeReqSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT CHAR Ssid[],
|
||||
OUT UCHAR *SsidLen);
|
||||
|
||||
BOOLEAN APPeerBeaconAndProbeRspSanity(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN VOID *Msg,
|
||||
IN ULONG MsgLen,
|
||||
OUT PUCHAR pAddr2,
|
||||
OUT PUCHAR pBssid,
|
||||
OUT CHAR Ssid[],
|
||||
OUT UCHAR *SsidLen,
|
||||
OUT UCHAR *BssType,
|
||||
OUT USHORT *BeaconPeriod,
|
||||
OUT UCHAR *Channel,
|
||||
OUT LARGE_INTEGER *Timestamp,
|
||||
OUT USHORT *CapabilityInfo,
|
||||
OUT UCHAR Rate[],
|
||||
OUT UCHAR *RateLen,
|
||||
OUT BOOLEAN *ExtendedRateIeExist,
|
||||
OUT UCHAR *Erp);
|
||||
|
||||
|
||||
// ================== end of AP RTMP.h ========================
|
||||
|
||||
|
||||
#endif // __AP_H__
|
||||
|
||||
#include "../rt2870/ap.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,100 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
dfs.h
|
||||
|
||||
Abstract:
|
||||
Support DFS function.
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Fonchi 03-12-2007 created
|
||||
*/
|
||||
|
||||
#define RADAR_PULSE 1
|
||||
#define RADAR_WIDTH 2
|
||||
|
||||
#define WIDTH_RD_IDLE 0
|
||||
#define WIDTH_RD_CHECK 1
|
||||
|
||||
|
||||
VOID BbpRadarDetectionStart(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID BbpRadarDetectionStop(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID RadarDetectionStart(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN BOOLEAN CTS_Protect,
|
||||
IN UINT8 CTSPeriod);
|
||||
|
||||
VOID RadarDetectionStop(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID RadarDetectPeriodic(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
BOOLEAN RadarChannelCheck(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN UCHAR Ch);
|
||||
|
||||
ULONG JapRadarType(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
ULONG RTMPBbpReadRadarDuration(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
ULONG RTMPReadRadarDuration(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID RTMPCleanRadarDuration(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID RTMPPrepareRDCTSFrame(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN ULONG Duration,
|
||||
IN UCHAR RTSRate,
|
||||
IN ULONG CTSBaseAddr,
|
||||
IN UCHAR FrameGap);
|
||||
|
||||
VOID RTMPPrepareRadarDetectParams(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
|
||||
INT Set_ChMovingTime_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR arg);
|
||||
|
||||
INT Set_LongPulseRadarTh_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR arg);
|
||||
|
||||
|
||||
#include "../rt2870/dfs.h"
|
||||
|
@ -1,134 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __LINK_LIST_H__
|
||||
#define __LINK_LIST_H__
|
||||
|
||||
typedef struct _LIST_ENTRY
|
||||
{
|
||||
struct _LIST_ENTRY *pNext;
|
||||
} LIST_ENTRY, *PLIST_ENTRY;
|
||||
|
||||
typedef struct _LIST_HEADR
|
||||
{
|
||||
PLIST_ENTRY pHead;
|
||||
PLIST_ENTRY pTail;
|
||||
UCHAR size;
|
||||
} LIST_HEADER, *PLIST_HEADER;
|
||||
|
||||
static inline VOID initList(
|
||||
IN PLIST_HEADER pList)
|
||||
{
|
||||
pList->pHead = pList->pTail = NULL;
|
||||
pList->size = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
static inline VOID insertTailList(
|
||||
IN PLIST_HEADER pList,
|
||||
IN PLIST_ENTRY pEntry)
|
||||
{
|
||||
pEntry->pNext = NULL;
|
||||
if (pList->pTail)
|
||||
pList->pTail->pNext = pEntry;
|
||||
else
|
||||
pList->pHead = pEntry;
|
||||
pList->pTail = pEntry;
|
||||
pList->size++;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static inline PLIST_ENTRY removeHeadList(
|
||||
IN PLIST_HEADER pList)
|
||||
{
|
||||
PLIST_ENTRY pNext;
|
||||
PLIST_ENTRY pEntry;
|
||||
|
||||
pEntry = pList->pHead;
|
||||
if (pList->pHead != NULL)
|
||||
{
|
||||
pNext = pList->pHead->pNext;
|
||||
pList->pHead = pNext;
|
||||
if (pNext == NULL)
|
||||
pList->pTail = NULL;
|
||||
pList->size--;
|
||||
}
|
||||
return pEntry;
|
||||
}
|
||||
|
||||
static inline int getListSize(
|
||||
IN PLIST_HEADER pList)
|
||||
{
|
||||
return pList->size;
|
||||
}
|
||||
|
||||
static inline PLIST_ENTRY delEntryList(
|
||||
IN PLIST_HEADER pList,
|
||||
IN PLIST_ENTRY pEntry)
|
||||
{
|
||||
PLIST_ENTRY pCurEntry;
|
||||
PLIST_ENTRY pPrvEntry;
|
||||
|
||||
if(pList->pHead == NULL)
|
||||
return NULL;
|
||||
|
||||
if(pEntry == pList->pHead)
|
||||
{
|
||||
pCurEntry = pList->pHead;
|
||||
pList->pHead = pCurEntry->pNext;
|
||||
|
||||
if(pList->pHead == NULL)
|
||||
pList->pTail = NULL;
|
||||
|
||||
pList->size--;
|
||||
return pCurEntry;
|
||||
}
|
||||
|
||||
pPrvEntry = pList->pHead;
|
||||
pCurEntry = pPrvEntry->pNext;
|
||||
while(pCurEntry != NULL)
|
||||
{
|
||||
if (pEntry == pCurEntry)
|
||||
{
|
||||
pPrvEntry->pNext = pCurEntry->pNext;
|
||||
|
||||
if(pEntry == pList->pTail)
|
||||
pList->pTail = pPrvEntry;
|
||||
|
||||
pList->size--;
|
||||
break;
|
||||
}
|
||||
pPrvEntry = pCurEntry;
|
||||
pCurEntry = pPrvEntry->pNext;
|
||||
}
|
||||
|
||||
return pCurEntry;
|
||||
}
|
||||
|
||||
#endif // ___LINK_LIST_H__ //
|
||||
|
||||
#include "../rt2870/link_list.h"
|
||||
|
@ -1,107 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
md5.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
jan 10-28-03 Initial
|
||||
Rita 11-23-04 Modify MD5 and SHA-1
|
||||
*/
|
||||
|
||||
#ifndef uint8
|
||||
#define uint8 unsigned char
|
||||
#endif
|
||||
|
||||
#ifndef uint32
|
||||
#define uint32 unsigned long int
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __MD5_H__
|
||||
#define __MD5_H__
|
||||
|
||||
#define MD5_MAC_LEN 16
|
||||
|
||||
typedef struct _MD5_CTX {
|
||||
UINT32 Buf[4]; // buffers of four states
|
||||
UCHAR Input[64]; // input message
|
||||
UINT32 LenInBitCount[2]; // length counter for input message, 0 up to 64 bits
|
||||
} MD5_CTX;
|
||||
|
||||
VOID MD5Init(MD5_CTX *pCtx);
|
||||
VOID MD5Update(MD5_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes);
|
||||
VOID MD5Final(UCHAR Digest[16], MD5_CTX *pCtx);
|
||||
VOID MD5Transform(UINT32 Buf[4], UINT32 Mes[16]);
|
||||
|
||||
void md5_mac(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac);
|
||||
void hmac_md5(u8 *key, size_t key_len, u8 *data, size_t data_len, u8 *mac);
|
||||
|
||||
//
|
||||
// SHA context
|
||||
//
|
||||
typedef struct _SHA_CTX
|
||||
{
|
||||
UINT32 Buf[5]; // buffers of five states
|
||||
UCHAR Input[80]; // input message
|
||||
UINT32 LenInBitCount[2]; // length counter for input message, 0 up to 64 bits
|
||||
|
||||
} SHA_CTX;
|
||||
|
||||
VOID SHAInit(SHA_CTX *pCtx);
|
||||
UCHAR SHAUpdate(SHA_CTX *pCtx, UCHAR *pData, UINT32 LenInBytes);
|
||||
VOID SHAFinal(SHA_CTX *pCtx, UCHAR Digest[20]);
|
||||
VOID SHATransform(UINT32 Buf[5], UINT32 Mes[20]);
|
||||
|
||||
#define SHA_DIGEST_LEN 20
|
||||
#endif // __MD5_H__
|
||||
|
||||
/******************************************************************************/
|
||||
#ifndef _AES_H
|
||||
#define _AES_H
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32 erk[64]; /* encryption round keys */
|
||||
uint32 drk[64]; /* decryption round keys */
|
||||
int nr; /* number of rounds */
|
||||
}
|
||||
aes_context;
|
||||
|
||||
int rtmp_aes_set_key( aes_context *ctx, uint8 *key, int nbits );
|
||||
void rtmp_aes_encrypt( aes_context *ctx, uint8 input[16], uint8 output[16] );
|
||||
void rtmp_aes_decrypt( aes_context *ctx, uint8 input[16], uint8 output[16] );
|
||||
|
||||
void F(char *password, unsigned char *ssid, int ssidlength, int iterations, int count, unsigned char *output);
|
||||
int PasswordHash(char *password, unsigned char *ssid, int ssidlength, unsigned char *output);
|
||||
|
||||
#endif /* aes.h */
|
||||
|
||||
#include "../rt2870/md5.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,940 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
oid.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
#ifndef _OID_H_
|
||||
#define _OID_H_
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
//
|
||||
// IEEE 802.11 Structures and definitions
|
||||
//
|
||||
#define MAX_TX_POWER_LEVEL 100 /* mW */
|
||||
#define MAX_RSSI_TRIGGER -10 /* dBm */
|
||||
#define MIN_RSSI_TRIGGER -200 /* dBm */
|
||||
#define MAX_FRAG_THRESHOLD 2346 /* byte count */
|
||||
#define MIN_FRAG_THRESHOLD 256 /* byte count */
|
||||
#define MAX_RTS_THRESHOLD 2347 /* byte count */
|
||||
|
||||
// new types for Media Specific Indications
|
||||
// Extension channel offset
|
||||
#define EXTCHA_NONE 0
|
||||
#define EXTCHA_ABOVE 0x1
|
||||
#define EXTCHA_BELOW 0x3
|
||||
|
||||
// BW
|
||||
#define BAND_WIDTH_20 0
|
||||
#define BAND_WIDTH_40 1
|
||||
#define BAND_WIDTH_BOTH 2
|
||||
#define BAND_WIDTH_10 3 // 802.11j has 10MHz. This definition is for internal usage. doesn't fill in the IE or other field.
|
||||
// SHORTGI
|
||||
#define GAP_INTERVAL_400 1 // only support in HT mode
|
||||
#define GAP_INTERVAL_800 0
|
||||
#define GAP_INTERVAL_BOTH 2
|
||||
|
||||
#define NdisMediaStateConnected 1
|
||||
#define NdisMediaStateDisconnected 0
|
||||
|
||||
#define NDIS_802_11_LENGTH_SSID 32
|
||||
#define NDIS_802_11_LENGTH_RATES 8
|
||||
#define NDIS_802_11_LENGTH_RATES_EX 16
|
||||
#define MAC_ADDR_LENGTH 6
|
||||
#define MAX_NUM_OF_CHS 49 // 14 channels @2.4G + 12@UNII + 4 @MMAC + 11 @HiperLAN2 + 7 @Japan + 1 as NULL terminationc
|
||||
#define MAX_NUMBER_OF_EVENT 10 // entry # in EVENT table
|
||||
#define MAX_NUMBER_OF_MAC 32 // if MAX_MBSSID_NUM is 8, this value can't be larger than 211
|
||||
#define MAX_NUMBER_OF_ACL 64
|
||||
#define MAX_LENGTH_OF_SUPPORT_RATES 12 // 1, 2, 5.5, 11, 6, 9, 12, 18, 24, 36, 48, 54
|
||||
#define MAX_NUMBER_OF_DLS_ENTRY 4
|
||||
|
||||
#define OID_GEN_MACHINE_NAME 0x0001021A
|
||||
|
||||
#define RT_QUERY_SIGNAL_CONTEXT 0x0402
|
||||
#define RT_SET_IAPP_PID 0x0404
|
||||
#define RT_SET_APD_PID 0x0405
|
||||
#define RT_SET_DEL_MAC_ENTRY 0x0406
|
||||
|
||||
//
|
||||
// IEEE 802.11 OIDs
|
||||
//
|
||||
#define OID_GET_SET_TOGGLE 0x8000
|
||||
|
||||
#define OID_802_11_NETWORK_TYPES_SUPPORTED 0x0103
|
||||
#define OID_802_11_NETWORK_TYPE_IN_USE 0x0104
|
||||
#define OID_802_11_RSSI_TRIGGER 0x0107
|
||||
#define RT_OID_802_11_RSSI 0x0108 //rt2860 only , kathy
|
||||
#define RT_OID_802_11_RSSI_1 0x0109 //rt2860 only , kathy
|
||||
#define RT_OID_802_11_RSSI_2 0x010A //rt2860 only , kathy
|
||||
#define OID_802_11_NUMBER_OF_ANTENNAS 0x010B
|
||||
#define OID_802_11_RX_ANTENNA_SELECTED 0x010C
|
||||
#define OID_802_11_TX_ANTENNA_SELECTED 0x010D
|
||||
#define OID_802_11_SUPPORTED_RATES 0x010E
|
||||
#define OID_802_11_ADD_WEP 0x0112
|
||||
#define OID_802_11_REMOVE_WEP 0x0113
|
||||
#define OID_802_11_DISASSOCIATE 0x0114
|
||||
#define OID_802_11_PRIVACY_FILTER 0x0118
|
||||
#define OID_802_11_ASSOCIATION_INFORMATION 0x011E
|
||||
#define OID_802_11_TEST 0x011F
|
||||
#define RT_OID_802_11_COUNTRY_REGION 0x0507
|
||||
#define OID_802_11_BSSID_LIST_SCAN 0x0508
|
||||
#define OID_802_11_SSID 0x0509
|
||||
#define OID_802_11_BSSID 0x050A
|
||||
#define RT_OID_802_11_RADIO 0x050B
|
||||
#define RT_OID_802_11_PHY_MODE 0x050C
|
||||
#define RT_OID_802_11_STA_CONFIG 0x050D
|
||||
#define OID_802_11_DESIRED_RATES 0x050E
|
||||
#define RT_OID_802_11_PREAMBLE 0x050F
|
||||
#define OID_802_11_WEP_STATUS 0x0510
|
||||
#define OID_802_11_AUTHENTICATION_MODE 0x0511
|
||||
#define OID_802_11_INFRASTRUCTURE_MODE 0x0512
|
||||
#define RT_OID_802_11_RESET_COUNTERS 0x0513
|
||||
#define OID_802_11_RTS_THRESHOLD 0x0514
|
||||
#define OID_802_11_FRAGMENTATION_THRESHOLD 0x0515
|
||||
#define OID_802_11_POWER_MODE 0x0516
|
||||
#define OID_802_11_TX_POWER_LEVEL 0x0517
|
||||
#define RT_OID_802_11_ADD_WPA 0x0518
|
||||
#define OID_802_11_REMOVE_KEY 0x0519
|
||||
#define OID_802_11_ADD_KEY 0x0520
|
||||
#define OID_802_11_CONFIGURATION 0x0521
|
||||
#define OID_802_11_TX_PACKET_BURST 0x0522
|
||||
#define RT_OID_802_11_QUERY_NOISE_LEVEL 0x0523
|
||||
#define RT_OID_802_11_EXTRA_INFO 0x0524
|
||||
#ifdef DBG
|
||||
#define RT_OID_802_11_HARDWARE_REGISTER 0x0525
|
||||
#endif
|
||||
#define OID_802_11_ENCRYPTION_STATUS OID_802_11_WEP_STATUS
|
||||
#define OID_802_11_DEAUTHENTICATION 0x0526
|
||||
#define OID_802_11_DROP_UNENCRYPTED 0x0527
|
||||
#define OID_802_11_MIC_FAILURE_REPORT_FRAME 0x0528
|
||||
|
||||
// For 802.1x daemin using to require current driver configuration
|
||||
#define OID_802_11_RADIUS_QUERY_SETTING 0x0540
|
||||
|
||||
#define RT_OID_DEVICE_NAME 0x0607
|
||||
#define RT_OID_VERSION_INFO 0x0608
|
||||
#define OID_802_11_BSSID_LIST 0x0609
|
||||
#define OID_802_3_CURRENT_ADDRESS 0x060A
|
||||
#define OID_GEN_MEDIA_CONNECT_STATUS 0x060B
|
||||
#define RT_OID_802_11_QUERY_LINK_STATUS 0x060C
|
||||
#define OID_802_11_RSSI 0x060D
|
||||
#define OID_802_11_STATISTICS 0x060E
|
||||
#define OID_GEN_RCV_OK 0x060F
|
||||
#define OID_GEN_RCV_NO_BUFFER 0x0610
|
||||
#define RT_OID_802_11_QUERY_EEPROM_VERSION 0x0611
|
||||
#define RT_OID_802_11_QUERY_FIRMWARE_VERSION 0x0612
|
||||
#define RT_OID_802_11_QUERY_LAST_RX_RATE 0x0613
|
||||
#define RT_OID_802_11_TX_POWER_LEVEL_1 0x0614
|
||||
#define RT_OID_802_11_QUERY_PIDVID 0x0615
|
||||
|
||||
#define OID_SET_COUNTERMEASURES 0x0616
|
||||
#define OID_802_11_SET_IEEE8021X 0x0617
|
||||
#define OID_802_11_SET_IEEE8021X_REQUIRE_KEY 0x0618
|
||||
#define OID_802_11_PMKID 0x0620
|
||||
#define RT_OID_WPA_SUPPLICANT_SUPPORT 0x0621
|
||||
#define RT_OID_WE_VERSION_COMPILED 0x0622
|
||||
#define RT_OID_NEW_DRIVER 0x0623
|
||||
|
||||
|
||||
//rt2860 , kathy
|
||||
#define RT_OID_802_11_SNR_0 0x0630
|
||||
#define RT_OID_802_11_SNR_1 0x0631
|
||||
#define RT_OID_802_11_QUERY_LAST_TX_RATE 0x0632
|
||||
#define RT_OID_802_11_QUERY_HT_PHYMODE 0x0633
|
||||
#define RT_OID_802_11_SET_HT_PHYMODE 0x0634
|
||||
#define OID_802_11_RELOAD_DEFAULTS 0x0635
|
||||
#define RT_OID_802_11_QUERY_APSD_SETTING 0x0636
|
||||
#define RT_OID_802_11_SET_APSD_SETTING 0x0637
|
||||
#define RT_OID_802_11_QUERY_APSD_PSM 0x0638
|
||||
#define RT_OID_802_11_SET_APSD_PSM 0x0639
|
||||
#define RT_OID_802_11_QUERY_DLS 0x063A
|
||||
#define RT_OID_802_11_SET_DLS 0x063B
|
||||
#define RT_OID_802_11_QUERY_DLS_PARAM 0x063C
|
||||
#define RT_OID_802_11_SET_DLS_PARAM 0x063D
|
||||
#define RT_OID_802_11_QUERY_WMM 0x063E
|
||||
#define RT_OID_802_11_SET_WMM 0x063F
|
||||
#define RT_OID_802_11_QUERY_IMME_BA_CAP 0x0640
|
||||
#define RT_OID_802_11_SET_IMME_BA_CAP 0x0641
|
||||
#define RT_OID_802_11_QUERY_BATABLE 0x0642
|
||||
#define RT_OID_802_11_ADD_IMME_BA 0x0643
|
||||
#define RT_OID_802_11_TEAR_IMME_BA 0x0644
|
||||
#define RT_OID_DRIVER_DEVICE_NAME 0x0645
|
||||
#define RT_OID_802_11_QUERY_DAT_HT_PHYMODE 0x0646
|
||||
#define RT_OID_QUERY_MULTIPLE_CARD_SUPPORT 0x0647
|
||||
|
||||
// Ralink defined OIDs
|
||||
// Dennis Lee move to platform specific
|
||||
|
||||
#define RT_OID_802_11_BSSID (OID_GET_SET_TOGGLE | OID_802_11_BSSID)
|
||||
#define RT_OID_802_11_SSID (OID_GET_SET_TOGGLE | OID_802_11_SSID)
|
||||
#define RT_OID_802_11_INFRASTRUCTURE_MODE (OID_GET_SET_TOGGLE | OID_802_11_INFRASTRUCTURE_MODE)
|
||||
#define RT_OID_802_11_ADD_WEP (OID_GET_SET_TOGGLE | OID_802_11_ADD_WEP)
|
||||
#define RT_OID_802_11_ADD_KEY (OID_GET_SET_TOGGLE | OID_802_11_ADD_KEY)
|
||||
#define RT_OID_802_11_REMOVE_WEP (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_WEP)
|
||||
#define RT_OID_802_11_REMOVE_KEY (OID_GET_SET_TOGGLE | OID_802_11_REMOVE_KEY)
|
||||
#define RT_OID_802_11_DISASSOCIATE (OID_GET_SET_TOGGLE | OID_802_11_DISASSOCIATE)
|
||||
#define RT_OID_802_11_AUTHENTICATION_MODE (OID_GET_SET_TOGGLE | OID_802_11_AUTHENTICATION_MODE)
|
||||
#define RT_OID_802_11_PRIVACY_FILTER (OID_GET_SET_TOGGLE | OID_802_11_PRIVACY_FILTER)
|
||||
#define RT_OID_802_11_BSSID_LIST_SCAN (OID_GET_SET_TOGGLE | OID_802_11_BSSID_LIST_SCAN)
|
||||
#define RT_OID_802_11_WEP_STATUS (OID_GET_SET_TOGGLE | OID_802_11_WEP_STATUS)
|
||||
#define RT_OID_802_11_RELOAD_DEFAULTS (OID_GET_SET_TOGGLE | OID_802_11_RELOAD_DEFAULTS)
|
||||
#define RT_OID_802_11_NETWORK_TYPE_IN_USE (OID_GET_SET_TOGGLE | OID_802_11_NETWORK_TYPE_IN_USE)
|
||||
#define RT_OID_802_11_TX_POWER_LEVEL (OID_GET_SET_TOGGLE | OID_802_11_TX_POWER_LEVEL)
|
||||
#define RT_OID_802_11_RSSI_TRIGGER (OID_GET_SET_TOGGLE | OID_802_11_RSSI_TRIGGER)
|
||||
#define RT_OID_802_11_FRAGMENTATION_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_FRAGMENTATION_THRESHOLD)
|
||||
#define RT_OID_802_11_RTS_THRESHOLD (OID_GET_SET_TOGGLE | OID_802_11_RTS_THRESHOLD)
|
||||
#define RT_OID_802_11_RX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_RX_ANTENNA_SELECTED)
|
||||
#define RT_OID_802_11_TX_ANTENNA_SELECTED (OID_GET_SET_TOGGLE | OID_802_11_TX_ANTENNA_SELECTED)
|
||||
#define RT_OID_802_11_SUPPORTED_RATES (OID_GET_SET_TOGGLE | OID_802_11_SUPPORTED_RATES)
|
||||
#define RT_OID_802_11_DESIRED_RATES (OID_GET_SET_TOGGLE | OID_802_11_DESIRED_RATES)
|
||||
#define RT_OID_802_11_CONFIGURATION (OID_GET_SET_TOGGLE | OID_802_11_CONFIGURATION)
|
||||
#define RT_OID_802_11_POWER_MODE (OID_GET_SET_TOGGLE | OID_802_11_POWER_MODE)
|
||||
|
||||
|
||||
|
||||
typedef enum _NDIS_802_11_STATUS_TYPE
|
||||
{
|
||||
Ndis802_11StatusType_Authentication,
|
||||
Ndis802_11StatusType_MediaStreamMode,
|
||||
Ndis802_11StatusType_PMKID_CandidateList,
|
||||
Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
|
||||
} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
|
||||
|
||||
typedef UCHAR NDIS_802_11_MAC_ADDRESS[6];
|
||||
|
||||
typedef struct _NDIS_802_11_STATUS_INDICATION
|
||||
{
|
||||
NDIS_802_11_STATUS_TYPE StatusType;
|
||||
} NDIS_802_11_STATUS_INDICATION, *PNDIS_802_11_STATUS_INDICATION;
|
||||
|
||||
// mask for authentication/integrity fields
|
||||
#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS 0x0f
|
||||
|
||||
#define NDIS_802_11_AUTH_REQUEST_REAUTH 0x01
|
||||
#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE 0x02
|
||||
#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR 0x06
|
||||
#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR 0x0E
|
||||
|
||||
typedef struct _NDIS_802_11_AUTHENTICATION_REQUEST
|
||||
{
|
||||
ULONG Length; // Length of structure
|
||||
NDIS_802_11_MAC_ADDRESS Bssid;
|
||||
ULONG Flags;
|
||||
} NDIS_802_11_AUTHENTICATION_REQUEST, *PNDIS_802_11_AUTHENTICATION_REQUEST;
|
||||
|
||||
//Added new types for PMKID Candidate lists.
|
||||
typedef struct _PMKID_CANDIDATE {
|
||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
||||
ULONG Flags;
|
||||
} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
|
||||
|
||||
typedef struct _NDIS_802_11_PMKID_CANDIDATE_LIST
|
||||
{
|
||||
ULONG Version; // Version of the structure
|
||||
ULONG NumCandidates; // No. of pmkid candidates
|
||||
PMKID_CANDIDATE CandidateList[1];
|
||||
} NDIS_802_11_PMKID_CANDIDATE_LIST, *PNDIS_802_11_PMKID_CANDIDATE_LIST;
|
||||
|
||||
//Flags for PMKID Candidate list structure
|
||||
#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
|
||||
|
||||
// Added new types for OFDM 5G and 2.4G
|
||||
typedef enum _NDIS_802_11_NETWORK_TYPE
|
||||
{
|
||||
Ndis802_11FH,
|
||||
Ndis802_11DS,
|
||||
Ndis802_11OFDM5,
|
||||
Ndis802_11OFDM5_N,
|
||||
Ndis802_11OFDM24,
|
||||
Ndis802_11OFDM24_N,
|
||||
Ndis802_11Automode,
|
||||
Ndis802_11NetworkTypeMax // not a real type, defined as an upper bound
|
||||
} NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE;
|
||||
|
||||
typedef struct _NDIS_802_11_NETWORK_TYPE_LIST
|
||||
{
|
||||
UINT NumberOfItems; // in list below, at least 1
|
||||
NDIS_802_11_NETWORK_TYPE NetworkType [1];
|
||||
} NDIS_802_11_NETWORK_TYPE_LIST, *PNDIS_802_11_NETWORK_TYPE_LIST;
|
||||
|
||||
typedef enum _NDIS_802_11_POWER_MODE
|
||||
{
|
||||
Ndis802_11PowerModeCAM,
|
||||
Ndis802_11PowerModeMAX_PSP,
|
||||
Ndis802_11PowerModeFast_PSP,
|
||||
Ndis802_11PowerModeLegacy_PSP,
|
||||
Ndis802_11PowerModeMax // not a real mode, defined as an upper bound
|
||||
} NDIS_802_11_POWER_MODE, *PNDIS_802_11_POWER_MODE;
|
||||
|
||||
typedef ULONG NDIS_802_11_TX_POWER_LEVEL; // in milliwatts
|
||||
|
||||
//
|
||||
// Received Signal Strength Indication
|
||||
//
|
||||
typedef LONG NDIS_802_11_RSSI; // in dBm
|
||||
|
||||
typedef struct _NDIS_802_11_CONFIGURATION_FH
|
||||
{
|
||||
ULONG Length; // Length of structure
|
||||
ULONG HopPattern; // As defined by 802.11, MSB set
|
||||
ULONG HopSet; // to one if non-802.11
|
||||
ULONG DwellTime; // units are Kusec
|
||||
} NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH;
|
||||
|
||||
typedef struct _NDIS_802_11_CONFIGURATION
|
||||
{
|
||||
ULONG Length; // Length of structure
|
||||
ULONG BeaconPeriod; // units are Kusec
|
||||
ULONG ATIMWindow; // units are Kusec
|
||||
ULONG DSConfig; // Frequency, units are kHz
|
||||
NDIS_802_11_CONFIGURATION_FH FHConfig;
|
||||
} NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION;
|
||||
|
||||
typedef struct _NDIS_802_11_STATISTICS
|
||||
{
|
||||
ULONG Length; // Length of structure
|
||||
LARGE_INTEGER TransmittedFragmentCount;
|
||||
LARGE_INTEGER MulticastTransmittedFrameCount;
|
||||
LARGE_INTEGER FailedCount;
|
||||
LARGE_INTEGER RetryCount;
|
||||
LARGE_INTEGER MultipleRetryCount;
|
||||
LARGE_INTEGER RTSSuccessCount;
|
||||
LARGE_INTEGER RTSFailureCount;
|
||||
LARGE_INTEGER ACKFailureCount;
|
||||
LARGE_INTEGER FrameDuplicateCount;
|
||||
LARGE_INTEGER ReceivedFragmentCount;
|
||||
LARGE_INTEGER MulticastReceivedFrameCount;
|
||||
LARGE_INTEGER FCSErrorCount;
|
||||
LARGE_INTEGER TKIPLocalMICFailures;
|
||||
LARGE_INTEGER TKIPRemoteMICErrors;
|
||||
LARGE_INTEGER TKIPICVErrors;
|
||||
LARGE_INTEGER TKIPCounterMeasuresInvoked;
|
||||
LARGE_INTEGER TKIPReplays;
|
||||
LARGE_INTEGER CCMPFormatErrors;
|
||||
LARGE_INTEGER CCMPReplays;
|
||||
LARGE_INTEGER CCMPDecryptErrors;
|
||||
LARGE_INTEGER FourWayHandshakeFailures;
|
||||
} NDIS_802_11_STATISTICS, *PNDIS_802_11_STATISTICS;
|
||||
|
||||
typedef ULONG NDIS_802_11_KEY_INDEX;
|
||||
typedef ULONGLONG NDIS_802_11_KEY_RSC;
|
||||
|
||||
#define MAX_RADIUS_SRV_NUM 2 // 802.1x failover number
|
||||
|
||||
typedef struct PACKED _RADIUS_SRV_INFO {
|
||||
UINT32 radius_ip;
|
||||
UINT32 radius_port;
|
||||
UCHAR radius_key[64];
|
||||
UCHAR radius_key_len;
|
||||
} RADIUS_SRV_INFO, *PRADIUS_SRV_INFO;
|
||||
|
||||
typedef struct PACKED _RADIUS_KEY_INFO
|
||||
{
|
||||
UCHAR radius_srv_num;
|
||||
RADIUS_SRV_INFO radius_srv_info[MAX_RADIUS_SRV_NUM];
|
||||
UCHAR ieee8021xWEP; // dynamic WEP
|
||||
UCHAR key_index;
|
||||
UCHAR key_length; // length of key in bytes
|
||||
UCHAR key_material[13];
|
||||
} RADIUS_KEY_INFO, *PRADIUS_KEY_INFO;
|
||||
|
||||
// It's used by 802.1x daemon to require relative configuration
|
||||
typedef struct PACKED _RADIUS_CONF
|
||||
{
|
||||
UINT32 Length; // Length of this structure
|
||||
UCHAR mbss_num; // indicate multiple BSS number
|
||||
UINT32 own_ip_addr;
|
||||
UINT32 retry_interval;
|
||||
UINT32 session_timeout_interval;
|
||||
UCHAR EAPifname[IFNAMSIZ];
|
||||
UCHAR EAPifname_len;
|
||||
UCHAR PreAuthifname[IFNAMSIZ];
|
||||
UCHAR PreAuthifname_len;
|
||||
RADIUS_KEY_INFO RadiusInfo[8/*MAX_MBSSID_NUM*/];
|
||||
} RADIUS_CONF, *PRADIUS_CONF;
|
||||
|
||||
// Key mapping keys require a BSSID
|
||||
typedef struct _NDIS_802_11_KEY
|
||||
{
|
||||
UINT Length; // Length of this structure
|
||||
UINT KeyIndex;
|
||||
UINT KeyLength; // length of key in bytes
|
||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
||||
NDIS_802_11_KEY_RSC KeyRSC;
|
||||
UCHAR KeyMaterial[1]; // variable length depending on above field
|
||||
} NDIS_802_11_KEY, *PNDIS_802_11_KEY;
|
||||
|
||||
typedef struct _NDIS_802_11_REMOVE_KEY
|
||||
{
|
||||
UINT Length; // Length of this structure
|
||||
UINT KeyIndex;
|
||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
||||
} NDIS_802_11_REMOVE_KEY, *PNDIS_802_11_REMOVE_KEY;
|
||||
|
||||
typedef struct _NDIS_802_11_WEP
|
||||
{
|
||||
UINT Length; // Length of this structure
|
||||
UINT KeyIndex; // 0 is the per-client key, 1-N are the
|
||||
// global keys
|
||||
UINT KeyLength; // length of key in bytes
|
||||
UCHAR KeyMaterial[1];// variable length depending on above field
|
||||
} NDIS_802_11_WEP, *PNDIS_802_11_WEP;
|
||||
|
||||
|
||||
typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE
|
||||
{
|
||||
Ndis802_11IBSS,
|
||||
Ndis802_11Infrastructure,
|
||||
Ndis802_11AutoUnknown,
|
||||
Ndis802_11Monitor,
|
||||
Ndis802_11InfrastructureMax // Not a real value, defined as upper bound
|
||||
} NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE;
|
||||
|
||||
// Add new authentication modes
|
||||
typedef enum _NDIS_802_11_AUTHENTICATION_MODE
|
||||
{
|
||||
Ndis802_11AuthModeOpen,
|
||||
Ndis802_11AuthModeShared,
|
||||
Ndis802_11AuthModeAutoSwitch,
|
||||
Ndis802_11AuthModeWPA,
|
||||
Ndis802_11AuthModeWPAPSK,
|
||||
Ndis802_11AuthModeWPANone,
|
||||
Ndis802_11AuthModeWPA2,
|
||||
Ndis802_11AuthModeWPA2PSK,
|
||||
Ndis802_11AuthModeWPA1WPA2,
|
||||
Ndis802_11AuthModeWPA1PSKWPA2PSK,
|
||||
Ndis802_11AuthModeMax // Not a real mode, defined as upper bound
|
||||
} NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE;
|
||||
|
||||
typedef UCHAR NDIS_802_11_RATES[NDIS_802_11_LENGTH_RATES]; // Set of 8 data rates
|
||||
typedef UCHAR NDIS_802_11_RATES_EX[NDIS_802_11_LENGTH_RATES_EX]; // Set of 16 data rates
|
||||
|
||||
typedef struct PACKED _NDIS_802_11_SSID
|
||||
{
|
||||
UINT SsidLength; // length of SSID field below, in bytes;
|
||||
// this can be zero.
|
||||
UCHAR Ssid[NDIS_802_11_LENGTH_SSID]; // SSID information field
|
||||
} NDIS_802_11_SSID, *PNDIS_802_11_SSID;
|
||||
|
||||
|
||||
typedef struct PACKED _NDIS_WLAN_BSSID
|
||||
{
|
||||
ULONG Length; // Length of this structure
|
||||
NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
|
||||
UCHAR Reserved[2];
|
||||
NDIS_802_11_SSID Ssid; // SSID
|
||||
ULONG Privacy; // WEP encryption requirement
|
||||
NDIS_802_11_RSSI Rssi; // receive signal strength in dBm
|
||||
NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
|
||||
NDIS_802_11_CONFIGURATION Configuration;
|
||||
NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
|
||||
NDIS_802_11_RATES SupportedRates;
|
||||
} NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID;
|
||||
|
||||
typedef struct PACKED _NDIS_802_11_BSSID_LIST
|
||||
{
|
||||
UINT NumberOfItems; // in list below, at least 1
|
||||
NDIS_WLAN_BSSID Bssid[1];
|
||||
} NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST;
|
||||
|
||||
// Added Capabilities, IELength and IEs for each BSSID
|
||||
typedef struct PACKED _NDIS_WLAN_BSSID_EX
|
||||
{
|
||||
ULONG Length; // Length of this structure
|
||||
NDIS_802_11_MAC_ADDRESS MacAddress; // BSSID
|
||||
UCHAR Reserved[2];
|
||||
NDIS_802_11_SSID Ssid; // SSID
|
||||
UINT Privacy; // WEP encryption requirement
|
||||
NDIS_802_11_RSSI Rssi; // receive signal
|
||||
// strength in dBm
|
||||
NDIS_802_11_NETWORK_TYPE NetworkTypeInUse;
|
||||
NDIS_802_11_CONFIGURATION Configuration;
|
||||
NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode;
|
||||
NDIS_802_11_RATES_EX SupportedRates;
|
||||
ULONG IELength;
|
||||
UCHAR IEs[1];
|
||||
} NDIS_WLAN_BSSID_EX, *PNDIS_WLAN_BSSID_EX;
|
||||
|
||||
typedef struct PACKED _NDIS_802_11_BSSID_LIST_EX
|
||||
{
|
||||
UINT NumberOfItems; // in list below, at least 1
|
||||
NDIS_WLAN_BSSID_EX Bssid[1];
|
||||
} NDIS_802_11_BSSID_LIST_EX, *PNDIS_802_11_BSSID_LIST_EX;
|
||||
|
||||
typedef struct PACKED _NDIS_802_11_FIXED_IEs
|
||||
{
|
||||
UCHAR Timestamp[8];
|
||||
USHORT BeaconInterval;
|
||||
USHORT Capabilities;
|
||||
} NDIS_802_11_FIXED_IEs, *PNDIS_802_11_FIXED_IEs;
|
||||
|
||||
typedef struct _NDIS_802_11_VARIABLE_IEs
|
||||
{
|
||||
UCHAR ElementID;
|
||||
UCHAR Length; // Number of bytes in data field
|
||||
UCHAR data[1];
|
||||
} NDIS_802_11_VARIABLE_IEs, *PNDIS_802_11_VARIABLE_IEs;
|
||||
|
||||
typedef ULONG NDIS_802_11_FRAGMENTATION_THRESHOLD;
|
||||
|
||||
typedef ULONG NDIS_802_11_RTS_THRESHOLD;
|
||||
|
||||
typedef ULONG NDIS_802_11_ANTENNA;
|
||||
|
||||
typedef enum _NDIS_802_11_PRIVACY_FILTER
|
||||
{
|
||||
Ndis802_11PrivFilterAcceptAll,
|
||||
Ndis802_11PrivFilter8021xWEP
|
||||
} NDIS_802_11_PRIVACY_FILTER, *PNDIS_802_11_PRIVACY_FILTER;
|
||||
|
||||
// Added new encryption types
|
||||
// Also aliased typedef to new name
|
||||
typedef enum _NDIS_802_11_WEP_STATUS
|
||||
{
|
||||
Ndis802_11WEPEnabled,
|
||||
Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
|
||||
Ndis802_11WEPDisabled,
|
||||
Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
|
||||
Ndis802_11WEPKeyAbsent,
|
||||
Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
|
||||
Ndis802_11WEPNotSupported,
|
||||
Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
|
||||
Ndis802_11Encryption2Enabled,
|
||||
Ndis802_11Encryption2KeyAbsent,
|
||||
Ndis802_11Encryption3Enabled,
|
||||
Ndis802_11Encryption3KeyAbsent,
|
||||
Ndis802_11Encryption4Enabled, // TKIP or AES mix
|
||||
Ndis802_11Encryption4KeyAbsent,
|
||||
} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
|
||||
NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
|
||||
|
||||
typedef enum _NDIS_802_11_RELOAD_DEFAULTS
|
||||
{
|
||||
Ndis802_11ReloadWEPKeys
|
||||
} NDIS_802_11_RELOAD_DEFAULTS, *PNDIS_802_11_RELOAD_DEFAULTS;
|
||||
|
||||
#define NDIS_802_11_AI_REQFI_CAPABILITIES 1
|
||||
#define NDIS_802_11_AI_REQFI_LISTENINTERVAL 2
|
||||
#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS 4
|
||||
|
||||
#define NDIS_802_11_AI_RESFI_CAPABILITIES 1
|
||||
#define NDIS_802_11_AI_RESFI_STATUSCODE 2
|
||||
#define NDIS_802_11_AI_RESFI_ASSOCIATIONID 4
|
||||
|
||||
typedef struct _NDIS_802_11_AI_REQFI
|
||||
{
|
||||
USHORT Capabilities;
|
||||
USHORT ListenInterval;
|
||||
NDIS_802_11_MAC_ADDRESS CurrentAPAddress;
|
||||
} NDIS_802_11_AI_REQFI, *PNDIS_802_11_AI_REQFI;
|
||||
|
||||
typedef struct _NDIS_802_11_AI_RESFI
|
||||
{
|
||||
USHORT Capabilities;
|
||||
USHORT StatusCode;
|
||||
USHORT AssociationId;
|
||||
} NDIS_802_11_AI_RESFI, *PNDIS_802_11_AI_RESFI;
|
||||
|
||||
typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION
|
||||
{
|
||||
ULONG Length;
|
||||
USHORT AvailableRequestFixedIEs;
|
||||
NDIS_802_11_AI_REQFI RequestFixedIEs;
|
||||
ULONG RequestIELength;
|
||||
ULONG OffsetRequestIEs;
|
||||
USHORT AvailableResponseFixedIEs;
|
||||
NDIS_802_11_AI_RESFI ResponseFixedIEs;
|
||||
ULONG ResponseIELength;
|
||||
ULONG OffsetResponseIEs;
|
||||
} NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION;
|
||||
|
||||
typedef struct _NDIS_802_11_AUTHENTICATION_EVENT
|
||||
{
|
||||
NDIS_802_11_STATUS_INDICATION Status;
|
||||
NDIS_802_11_AUTHENTICATION_REQUEST Request[1];
|
||||
} NDIS_802_11_AUTHENTICATION_EVENT, *PNDIS_802_11_AUTHENTICATION_EVENT;
|
||||
|
||||
// 802.11 Media stream constraints, associated with OID_802_11_MEDIA_STREAM_MODE
|
||||
typedef enum _NDIS_802_11_MEDIA_STREAM_MODE
|
||||
{
|
||||
Ndis802_11MediaStreamOff,
|
||||
Ndis802_11MediaStreamOn,
|
||||
} NDIS_802_11_MEDIA_STREAM_MODE, *PNDIS_802_11_MEDIA_STREAM_MODE;
|
||||
|
||||
// PMKID Structures
|
||||
typedef UCHAR NDIS_802_11_PMKID_VALUE[16];
|
||||
|
||||
typedef struct _BSSID_INFO
|
||||
{
|
||||
NDIS_802_11_MAC_ADDRESS BSSID;
|
||||
NDIS_802_11_PMKID_VALUE PMKID;
|
||||
} BSSID_INFO, *PBSSID_INFO;
|
||||
|
||||
typedef struct _NDIS_802_11_PMKID
|
||||
{
|
||||
UINT Length;
|
||||
UINT BSSIDInfoCount;
|
||||
BSSID_INFO BSSIDInfo[1];
|
||||
} NDIS_802_11_PMKID, *PNDIS_802_11_PMKID;
|
||||
|
||||
typedef struct _NDIS_802_11_AUTHENTICATION_ENCRYPTION
|
||||
{
|
||||
NDIS_802_11_AUTHENTICATION_MODE AuthModeSupported;
|
||||
NDIS_802_11_ENCRYPTION_STATUS EncryptStatusSupported;
|
||||
} NDIS_802_11_AUTHENTICATION_ENCRYPTION, *PNDIS_802_11_AUTHENTICATION_ENCRYPTION;
|
||||
|
||||
typedef struct _NDIS_802_11_CAPABILITY
|
||||
{
|
||||
ULONG Length;
|
||||
ULONG Version;
|
||||
ULONG NoOfPMKIDs;
|
||||
ULONG NoOfAuthEncryptPairsSupported;
|
||||
NDIS_802_11_AUTHENTICATION_ENCRYPTION AuthenticationEncryptionSupported[1];
|
||||
} NDIS_802_11_CAPABILITY, *PNDIS_802_11_CAPABILITY;
|
||||
|
||||
#if WIRELESS_EXT <= 11
|
||||
#ifndef SIOCDEVPRIVATE
|
||||
#define SIOCDEVPRIVATE 0x8BE0
|
||||
#endif
|
||||
#define SIOCIWFIRSTPRIV SIOCDEVPRIVATE
|
||||
#endif
|
||||
|
||||
#define RT_PRIV_IOCTL_EXT (SIOCIWFIRSTPRIV + 0x01) // Sync. with AP for wsc upnp daemon
|
||||
#define RTPRIV_IOCTL_SET (SIOCIWFIRSTPRIV + 0x02)
|
||||
|
||||
#ifdef DBG
|
||||
#define RTPRIV_IOCTL_BBP (SIOCIWFIRSTPRIV + 0x03)
|
||||
#define RTPRIV_IOCTL_MAC (SIOCIWFIRSTPRIV + 0x05)
|
||||
#define RTPRIV_IOCTL_RF (SIOCIWFIRSTPRIV + 0x13)
|
||||
#define RTPRIV_IOCTL_E2P (SIOCIWFIRSTPRIV + 0x07)
|
||||
#endif
|
||||
|
||||
#define RTPRIV_IOCTL_STATISTICS (SIOCIWFIRSTPRIV + 0x09)
|
||||
#define RTPRIV_IOCTL_ADD_PMKID_CACHE (SIOCIWFIRSTPRIV + 0x0A)
|
||||
#define RTPRIV_IOCTL_RADIUS_DATA (SIOCIWFIRSTPRIV + 0x0C)
|
||||
#define RTPRIV_IOCTL_GSITESURVEY (SIOCIWFIRSTPRIV + 0x0D)
|
||||
#define RT_PRIV_IOCTL (SIOCIWFIRSTPRIV + 0x0E) // Sync. with RT61 (for wpa_supplicant)
|
||||
#define RTPRIV_IOCTL_GET_MAC_TABLE (SIOCIWFIRSTPRIV + 0x0F)
|
||||
|
||||
#define RTPRIV_IOCTL_SHOW (SIOCIWFIRSTPRIV + 0x11)
|
||||
enum {
|
||||
SHOW_CONN_STATUS = 4,
|
||||
SHOW_DRVIER_VERION = 5,
|
||||
SHOW_BA_INFO = 6,
|
||||
SHOW_DESC_INFO = 7,
|
||||
#ifdef RT2870
|
||||
SHOW_RXBULK_INFO = 8,
|
||||
SHOW_TXBULK_INFO = 9,
|
||||
#endif // RT2870 //
|
||||
RAIO_OFF = 10,
|
||||
RAIO_ON = 11,
|
||||
SHOW_CFG_VALUE = 20,
|
||||
};
|
||||
|
||||
#define OID_802_11_BUILD_CHANNEL_EX 0x0714
|
||||
#define OID_802_11_GET_CH_LIST 0x0715
|
||||
#define OID_802_11_GET_COUNTRY_CODE 0x0716
|
||||
#define OID_802_11_GET_CHANNEL_GEOGRAPHY 0x0717
|
||||
|
||||
#define RT_OID_WSC_SET_PASSPHRASE 0x0740 // passphrase for wpa(2)-psk
|
||||
#define RT_OID_WSC_DRIVER_AUTO_CONNECT 0x0741
|
||||
#define RT_OID_WSC_QUERY_DEFAULT_PROFILE 0x0742
|
||||
#define RT_OID_WSC_SET_CONN_BY_PROFILE_INDEX 0x0743
|
||||
#define RT_OID_WSC_SET_ACTION 0x0744
|
||||
#define RT_OID_WSC_SET_SSID 0x0745
|
||||
#define RT_OID_WSC_SET_PIN_CODE 0x0746
|
||||
#define RT_OID_WSC_SET_MODE 0x0747 // PIN or PBC
|
||||
#define RT_OID_WSC_SET_CONF_MODE 0x0748 // Enrollee or Registrar
|
||||
#define RT_OID_WSC_SET_PROFILE 0x0749
|
||||
|
||||
#define RT_OID_802_11_WSC_QUERY_PROFILE 0x0750
|
||||
// for consistency with RT61
|
||||
#define RT_OID_WSC_QUERY_STATUS 0x0751
|
||||
#define RT_OID_WSC_PIN_CODE 0x0752
|
||||
#define RT_OID_WSC_UUID 0x0753
|
||||
#define RT_OID_WSC_SET_SELECTED_REGISTRAR 0x0754
|
||||
#define RT_OID_WSC_EAPMSG 0x0755
|
||||
#define RT_OID_WSC_MANUFACTURER 0x0756
|
||||
#define RT_OID_WSC_MODEL_NAME 0x0757
|
||||
#define RT_OID_WSC_MODEL_NO 0x0758
|
||||
#define RT_OID_WSC_SERIAL_NO 0x0759
|
||||
#define RT_OID_WSC_MAC_ADDRESS 0x0760
|
||||
|
||||
#ifdef LLTD_SUPPORT
|
||||
// for consistency with RT61
|
||||
#define RT_OID_GET_PHY_MODE 0x761
|
||||
#endif // LLTD_SUPPORT //
|
||||
|
||||
// New for MeetingHouse Api support
|
||||
#define OID_MH_802_1X_SUPPORTED 0xFFEDC100
|
||||
|
||||
// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
|
||||
typedef union _HTTRANSMIT_SETTING {
|
||||
struct {
|
||||
USHORT MCS:7; // MCS
|
||||
USHORT BW:1; //channel bandwidth 20MHz or 40 MHz
|
||||
USHORT ShortGI:1;
|
||||
USHORT STBC:2; //SPACE
|
||||
USHORT rsv:2;
|
||||
USHORT TxBF:1;
|
||||
USHORT MODE:2; // Use definition MODE_xxx.
|
||||
} field;
|
||||
USHORT word;
|
||||
} HTTRANSMIT_SETTING, *PHTTRANSMIT_SETTING;
|
||||
|
||||
typedef enum _RT_802_11_PREAMBLE {
|
||||
Rt802_11PreambleLong,
|
||||
Rt802_11PreambleShort,
|
||||
Rt802_11PreambleAuto
|
||||
} RT_802_11_PREAMBLE, *PRT_802_11_PREAMBLE;
|
||||
|
||||
// Only for STA, need to sync with AP
|
||||
typedef enum _RT_802_11_PHY_MODE {
|
||||
PHY_11BG_MIXED = 0,
|
||||
PHY_11B,
|
||||
PHY_11A,
|
||||
PHY_11ABG_MIXED,
|
||||
PHY_11G,
|
||||
PHY_11ABGN_MIXED, // both band 5
|
||||
PHY_11N_2_4G, // 11n-only with 2.4G band 6
|
||||
PHY_11GN_MIXED, // 2.4G band 7
|
||||
PHY_11AN_MIXED, // 5G band 8
|
||||
PHY_11BGN_MIXED, // if check 802.11b. 9
|
||||
PHY_11AGN_MIXED, // if check 802.11b. 10
|
||||
PHY_11N_5G, // 11n-only with 5G band 11
|
||||
} RT_802_11_PHY_MODE;
|
||||
|
||||
// put all proprietery for-query objects here to reduce # of Query_OID
|
||||
typedef struct _RT_802_11_LINK_STATUS {
|
||||
ULONG CurrTxRate; // in units of 0.5Mbps
|
||||
ULONG ChannelQuality; // 0..100 %
|
||||
ULONG TxByteCount; // both ok and fail
|
||||
ULONG RxByteCount; // both ok and fail
|
||||
ULONG CentralChannel; // 40MHz central channel number
|
||||
} RT_802_11_LINK_STATUS, *PRT_802_11_LINK_STATUS;
|
||||
|
||||
typedef struct _RT_802_11_EVENT_LOG {
|
||||
LARGE_INTEGER SystemTime; // timestammp via NdisGetCurrentSystemTime()
|
||||
UCHAR Addr[MAC_ADDR_LENGTH];
|
||||
USHORT Event; // EVENT_xxx
|
||||
} RT_802_11_EVENT_LOG, *PRT_802_11_EVENT_LOG;
|
||||
|
||||
typedef struct _RT_802_11_EVENT_TABLE {
|
||||
ULONG Num;
|
||||
ULONG Rsv; // to align Log[] at LARGE_INEGER boundary
|
||||
RT_802_11_EVENT_LOG Log[MAX_NUMBER_OF_EVENT];
|
||||
} RT_802_11_EVENT_TABLE, PRT_802_11_EVENT_TABLE;
|
||||
|
||||
// MIMO Tx parameter, ShortGI, MCS, STBC, etc. these are fields in TXWI. Don't change this definition!!!
|
||||
typedef union _MACHTTRANSMIT_SETTING {
|
||||
struct {
|
||||
USHORT MCS:7; // MCS
|
||||
USHORT BW:1; //channel bandwidth 20MHz or 40 MHz
|
||||
USHORT ShortGI:1;
|
||||
USHORT STBC:2; //SPACE
|
||||
USHORT rsv:3;
|
||||
USHORT MODE:2; // Use definition MODE_xxx.
|
||||
} field;
|
||||
USHORT word;
|
||||
} MACHTTRANSMIT_SETTING, *PMACHTTRANSMIT_SETTING;
|
||||
|
||||
typedef struct _RT_802_11_MAC_ENTRY {
|
||||
UCHAR Addr[MAC_ADDR_LENGTH];
|
||||
UCHAR Aid;
|
||||
UCHAR Psm; // 0:PWR_ACTIVE, 1:PWR_SAVE
|
||||
UCHAR MimoPs; // 0:MMPS_STATIC, 1:MMPS_DYNAMIC, 3:MMPS_Enabled
|
||||
CHAR AvgRssi0;
|
||||
CHAR AvgRssi1;
|
||||
CHAR AvgRssi2;
|
||||
UINT32 ConnectedTime;
|
||||
MACHTTRANSMIT_SETTING TxRate;
|
||||
} RT_802_11_MAC_ENTRY, *PRT_802_11_MAC_ENTRY;
|
||||
|
||||
typedef struct _RT_802_11_MAC_TABLE {
|
||||
ULONG Num;
|
||||
RT_802_11_MAC_ENTRY Entry[MAX_NUMBER_OF_MAC];
|
||||
} RT_802_11_MAC_TABLE, *PRT_802_11_MAC_TABLE;
|
||||
|
||||
// structure for query/set hardware register - MAC, BBP, RF register
|
||||
typedef struct _RT_802_11_HARDWARE_REGISTER {
|
||||
ULONG HardwareType; // 0:MAC, 1:BBP, 2:RF register, 3:EEPROM
|
||||
ULONG Offset; // Q/S register offset addr
|
||||
ULONG Data; // R/W data buffer
|
||||
} RT_802_11_HARDWARE_REGISTER, *PRT_802_11_HARDWARE_REGISTER;
|
||||
|
||||
typedef struct _RT_802_11_AP_CONFIG {
|
||||
ULONG EnableTxBurst; // 0-disable, 1-enable
|
||||
ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate
|
||||
ULONG IsolateInterStaTraffic; // 0-disable, 1-enable isolation
|
||||
ULONG HideSsid; // 0-disable, 1-enable hiding
|
||||
ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF
|
||||
ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time
|
||||
ULONG Rsv1; // must be 0
|
||||
ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY
|
||||
} RT_802_11_AP_CONFIG, *PRT_802_11_AP_CONFIG;
|
||||
|
||||
// structure to query/set STA_CONFIG
|
||||
typedef struct _RT_802_11_STA_CONFIG {
|
||||
ULONG EnableTxBurst; // 0-disable, 1-enable
|
||||
ULONG EnableTurboRate; // 0-disable, 1-enable 72/100mbps turbo rate
|
||||
ULONG UseBGProtection; // 0-AUTO, 1-always ON, 2-always OFF
|
||||
ULONG UseShortSlotTime; // 0-no use, 1-use 9-us short slot time when applicable
|
||||
ULONG AdhocMode; // 0-11b rates only (WIFI spec), 1 - b/g mixed, 2 - g only
|
||||
ULONG HwRadioStatus; // 0-OFF, 1-ON, default is 1, Read-Only
|
||||
ULONG Rsv1; // must be 0
|
||||
ULONG SystemErrorBitmap; // ignore upon SET, return system error upon QUERY
|
||||
} RT_802_11_STA_CONFIG, *PRT_802_11_STA_CONFIG;
|
||||
|
||||
//
|
||||
// For OID Query or Set about BA structure
|
||||
//
|
||||
typedef struct _OID_BACAP_STRUC {
|
||||
UCHAR RxBAWinLimit;
|
||||
UCHAR TxBAWinLimit;
|
||||
UCHAR Policy; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid
|
||||
UCHAR MpduDensity; // 0: DELAY_BA 1:IMMED_BA (//BA Policy subfiled value in ADDBA frame) 2:BA-not use. other value invalid
|
||||
UCHAR AmsduEnable; //Enable AMSDU transmisstion
|
||||
UCHAR AmsduSize; // 0:3839, 1:7935 bytes. UINT MSDUSizeToBytes[] = { 3839, 7935};
|
||||
UCHAR MMPSmode; // MIMO power save more, 0:static, 1:dynamic, 2:rsv, 3:mimo enable
|
||||
BOOLEAN AutoBA; // Auto BA will automatically
|
||||
} OID_BACAP_STRUC, *POID_BACAP_STRUC;
|
||||
|
||||
typedef struct _RT_802_11_ACL_ENTRY {
|
||||
UCHAR Addr[MAC_ADDR_LENGTH];
|
||||
USHORT Rsv;
|
||||
} RT_802_11_ACL_ENTRY, *PRT_802_11_ACL_ENTRY;
|
||||
|
||||
typedef struct PACKED _RT_802_11_ACL {
|
||||
ULONG Policy; // 0-disable, 1-positive list, 2-negative list
|
||||
ULONG Num;
|
||||
RT_802_11_ACL_ENTRY Entry[MAX_NUMBER_OF_ACL];
|
||||
} RT_802_11_ACL, *PRT_802_11_ACL;
|
||||
|
||||
typedef struct _RT_802_11_WDS {
|
||||
ULONG Num;
|
||||
NDIS_802_11_MAC_ADDRESS Entry[24/*MAX_NUM_OF_WDS_LINK*/];
|
||||
ULONG KeyLength;
|
||||
UCHAR KeyMaterial[32];
|
||||
} RT_802_11_WDS, *PRT_802_11_WDS;
|
||||
|
||||
typedef struct _RT_802_11_TX_RATES_ {
|
||||
UCHAR SupRateLen;
|
||||
UCHAR SupRate[MAX_LENGTH_OF_SUPPORT_RATES];
|
||||
UCHAR ExtRateLen;
|
||||
UCHAR ExtRate[MAX_LENGTH_OF_SUPPORT_RATES];
|
||||
} RT_802_11_TX_RATES, *PRT_802_11_TX_RATES;
|
||||
|
||||
|
||||
// Definition of extra information code
|
||||
#define GENERAL_LINK_UP 0x0 // Link is Up
|
||||
#define GENERAL_LINK_DOWN 0x1 // Link is Down
|
||||
#define HW_RADIO_OFF 0x2 // Hardware radio off
|
||||
#define SW_RADIO_OFF 0x3 // Software radio off
|
||||
#define AUTH_FAIL 0x4 // Open authentication fail
|
||||
#define AUTH_FAIL_KEYS 0x5 // Shared authentication fail
|
||||
#define ASSOC_FAIL 0x6 // Association failed
|
||||
#define EAP_MIC_FAILURE 0x7 // Deauthencation because MIC failure
|
||||
#define EAP_4WAY_TIMEOUT 0x8 // Deauthencation on 4-way handshake timeout
|
||||
#define EAP_GROUP_KEY_TIMEOUT 0x9 // Deauthencation on group key handshake timeout
|
||||
#define EAP_SUCCESS 0xa // EAP succeed
|
||||
#define DETECT_RADAR_SIGNAL 0xb // Radar signal occur in current channel
|
||||
#define EXTRA_INFO_MAX 0xb // Indicate Last OID
|
||||
|
||||
#define EXTRA_INFO_CLEAR 0xffffffff
|
||||
|
||||
// This is OID setting structure. So only GF or MM as Mode. This is valid when our wirelss mode has 802.11n in use.
|
||||
typedef struct {
|
||||
RT_802_11_PHY_MODE PhyMode; //
|
||||
UCHAR TransmitNo;
|
||||
UCHAR HtMode; //HTMODE_GF or HTMODE_MM
|
||||
UCHAR ExtOffset; //extension channel above or below
|
||||
UCHAR MCS;
|
||||
UCHAR BW;
|
||||
UCHAR STBC;
|
||||
UCHAR SHORTGI;
|
||||
UCHAR rsv;
|
||||
} OID_SET_HT_PHYMODE, *POID_SET_HT_PHYMODE;
|
||||
|
||||
#ifdef LLTD_SUPPORT
|
||||
typedef struct _RT_LLTD_ASSOICATION_ENTRY {
|
||||
UCHAR Addr[ETH_LENGTH_OF_ADDRESS];
|
||||
unsigned short MOR; // maximum operational rate
|
||||
UCHAR phyMode;
|
||||
} RT_LLTD_ASSOICATION_ENTRY, *PRT_LLTD_ASSOICATION_ENTRY;
|
||||
|
||||
typedef struct _RT_LLTD_ASSOICATION_TABLE {
|
||||
unsigned int Num;
|
||||
RT_LLTD_ASSOICATION_ENTRY Entry[MAX_NUMBER_OF_MAC];
|
||||
} RT_LLTD_ASSOICATION_TABLE, *PRT_LLTD_ASSOICATION_TABLE;
|
||||
#endif // LLTD_SUPPORT //
|
||||
|
||||
#define MAX_CUSTOM_LEN 128
|
||||
|
||||
typedef enum _RT_802_11_D_CLIENT_MODE
|
||||
{
|
||||
Rt802_11_D_None,
|
||||
Rt802_11_D_Flexible,
|
||||
Rt802_11_D_Strict,
|
||||
} RT_802_11_D_CLIENT_MODE, *PRT_802_11_D_CLIENT_MODE;
|
||||
|
||||
typedef struct _RT_CHANNEL_LIST_INFO
|
||||
{
|
||||
UCHAR ChannelList[MAX_NUM_OF_CHS]; // list all supported channels for site survey
|
||||
UCHAR ChannelListNum; // number of channel in ChannelList[]
|
||||
} RT_CHANNEL_LIST_INFO, *PRT_CHANNEL_LIST_INFO;
|
||||
|
||||
// WSC configured credential
|
||||
typedef struct _WSC_CREDENTIAL
|
||||
{
|
||||
NDIS_802_11_SSID SSID; // mandatory
|
||||
USHORT AuthType; // mandatory, 1: open, 2: wpa-psk, 4: shared, 8:wpa, 0x10: wpa2, 0x20: wpa2-psk
|
||||
USHORT EncrType; // mandatory, 1: none, 2: wep, 4: tkip, 8: aes
|
||||
UCHAR Key[64]; // mandatory, Maximum 64 byte
|
||||
USHORT KeyLength;
|
||||
UCHAR MacAddr[6]; // mandatory, AP MAC address
|
||||
UCHAR KeyIndex; // optional, default is 1
|
||||
UCHAR Rsvd[3]; // Make alignment
|
||||
} WSC_CREDENTIAL, *PWSC_CREDENTIAL;
|
||||
|
||||
// WSC configured profiles
|
||||
typedef struct _WSC_PROFILE
|
||||
{
|
||||
UINT ProfileCnt;
|
||||
WSC_CREDENTIAL Profile[8]; // Support up to 8 profiles
|
||||
} WSC_PROFILE, *PWSC_PROFILE;
|
||||
|
||||
|
||||
|
||||
#endif // _OID_H_
|
||||
|
||||
#include "../rt2870/oid.h"
|
||||
|
@ -1,681 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __RT2870_H__
|
||||
#define __RT2870_H__
|
||||
|
||||
//usb header files
|
||||
#include <linux/usb.h>
|
||||
|
||||
/* rtmp_def.h */
|
||||
//
|
||||
#define BULKAGGRE_ZISE 100
|
||||
#define RT28XX_DRVDATA_SET(_a) usb_set_intfdata(_a, pAd);
|
||||
#define RT28XX_PUT_DEVICE usb_put_dev
|
||||
#define RTUSB_ALLOC_URB(iso) usb_alloc_urb(iso, GFP_ATOMIC)
|
||||
#define RTUSB_SUBMIT_URB(pUrb) usb_submit_urb(pUrb, GFP_ATOMIC)
|
||||
#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr)
|
||||
#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
|
||||
|
||||
#define RXBULKAGGRE_ZISE 12
|
||||
#define MAX_TXBULK_LIMIT (LOCAL_TXBUF_SIZE*(BULKAGGRE_ZISE-1))
|
||||
#define MAX_TXBULK_SIZE (LOCAL_TXBUF_SIZE*BULKAGGRE_ZISE)
|
||||
#define MAX_RXBULK_SIZE (LOCAL_TXBUF_SIZE*RXBULKAGGRE_ZISE)
|
||||
#define MAX_MLME_HANDLER_MEMORY 20
|
||||
#define BUFFER_SIZE 2400 //2048
|
||||
#define TX_RING 0xa
|
||||
#define PRIO_RING 0xc
|
||||
|
||||
|
||||
// Flags for Bulkflags control for bulk out data
|
||||
//
|
||||
#define fRTUSB_BULK_OUT_DATA_NULL 0x00000001
|
||||
#define fRTUSB_BULK_OUT_RTS 0x00000002
|
||||
#define fRTUSB_BULK_OUT_MLME 0x00000004
|
||||
|
||||
#define fRTUSB_BULK_OUT_DATA_NORMAL 0x00010000
|
||||
#define fRTUSB_BULK_OUT_DATA_NORMAL_2 0x00020000
|
||||
#define fRTUSB_BULK_OUT_DATA_NORMAL_3 0x00040000
|
||||
#define fRTUSB_BULK_OUT_DATA_NORMAL_4 0x00080000
|
||||
#define fRTUSB_BULK_OUT_DATA_NORMAL_5 0x00100000
|
||||
|
||||
#define fRTUSB_BULK_OUT_PSPOLL 0x00000020
|
||||
#define fRTUSB_BULK_OUT_DATA_FRAG 0x00000040
|
||||
#define fRTUSB_BULK_OUT_DATA_FRAG_2 0x00000080
|
||||
#define fRTUSB_BULK_OUT_DATA_FRAG_3 0x00000100
|
||||
#define fRTUSB_BULK_OUT_DATA_FRAG_4 0x00000200
|
||||
|
||||
#define RT2870_USB_DEVICES \
|
||||
{ \
|
||||
{USB_DEVICE(0x148F,0x2770)}, /* Ralink */ \
|
||||
{USB_DEVICE(0x148F,0x2870)}, /* Ralink */ \
|
||||
{USB_DEVICE(0x148F,0x3070)}, /* Ralink 3070 */ \
|
||||
{USB_DEVICE(0x148F,0x3071)}, /* Ralink 3071 */ \
|
||||
{USB_DEVICE(0x148F,0x3072)}, /* Ralink 3072 */ \
|
||||
{USB_DEVICE(0x0B05,0x1731)}, /* Asus */ \
|
||||
{USB_DEVICE(0x0B05,0x1732)}, /* Asus */ \
|
||||
{USB_DEVICE(0x0B05,0x1742)}, /* Asus */ \
|
||||
{USB_DEVICE(0x0DF6,0x0017)}, /* Sitecom */ \
|
||||
{USB_DEVICE(0x0DF6,0x002B)}, /* Sitecom */ \
|
||||
{USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \
|
||||
{USB_DEVICE(0x0DF6,0x003E)}, /* Sitecom 3070 */ \
|
||||
{USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \
|
||||
{USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom 2770 */ \
|
||||
{USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \
|
||||
{USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \
|
||||
{USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \
|
||||
{USB_DEVICE(0x2019,0xAB25)}, /* Planex Communications, Inc. RT3070 */ \
|
||||
{USB_DEVICE(0x07D1,0x3C09)}, /* D-Link */ \
|
||||
{USB_DEVICE(0x07D1,0x3C11)}, /* D-Link */ \
|
||||
{USB_DEVICE(0x2001,0x3C09)}, /* D-Link */ \
|
||||
{USB_DEVICE(0x2001,0x3C0A)}, /* D-Link 3072*/ \
|
||||
{USB_DEVICE(0x14B2,0x3C07)}, /* AL */ \
|
||||
{USB_DEVICE(0x14B2,0x3C12)}, /* AL 3070 */ \
|
||||
{USB_DEVICE(0x050D,0x8053)}, /* Belkin */ \
|
||||
{USB_DEVICE(0x14B2,0x3C23)}, /* Airlink */ \
|
||||
{USB_DEVICE(0x14B2,0x3C27)}, /* Airlink */ \
|
||||
{USB_DEVICE(0x07AA,0x002F)}, /* Corega */ \
|
||||
{USB_DEVICE(0x07AA,0x003C)}, /* Corega */ \
|
||||
{USB_DEVICE(0x07AA,0x003F)}, /* Corega */ \
|
||||
{USB_DEVICE(0x18C5,0x0012)}, /* Corega 3070 */ \
|
||||
{USB_DEVICE(0x1044,0x800B)}, /* Gigabyte */ \
|
||||
{USB_DEVICE(0x1044,0x800D)}, /* Gigabyte GN-WB32L 3070 */ \
|
||||
{USB_DEVICE(0x15A9,0x0006)}, /* Sparklan */ \
|
||||
{USB_DEVICE(0x083A,0xB522)}, /* SMC */ \
|
||||
{USB_DEVICE(0x083A,0xA618)}, /* SMC */ \
|
||||
{USB_DEVICE(0x083A,0x8522)}, /* Arcadyan */ \
|
||||
{USB_DEVICE(0x083A,0x7512)}, /* Arcadyan 2770 */ \
|
||||
{USB_DEVICE(0x083A,0x7522)}, /* Arcadyan */ \
|
||||
{USB_DEVICE(0x083A,0x7511)}, /* Arcadyan 3070 */ \
|
||||
{USB_DEVICE(0x0CDE,0x0022)}, /* ZCOM */ \
|
||||
{USB_DEVICE(0x0586,0x3416)}, /* Zyxel */ \
|
||||
{USB_DEVICE(0x0CDE,0x0025)}, /* Zyxel */ \
|
||||
{USB_DEVICE(0x1740,0x9701)}, /* EnGenius */ \
|
||||
{USB_DEVICE(0x1740,0x9702)}, /* EnGenius */ \
|
||||
{USB_DEVICE(0x1740,0x9703)}, /* EnGenius 3070 */ \
|
||||
{USB_DEVICE(0x0471,0x200f)}, /* Philips */ \
|
||||
{USB_DEVICE(0x14B2,0x3C25)}, /* Draytek */ \
|
||||
{USB_DEVICE(0x13D3,0x3247)}, /* AzureWave */ \
|
||||
{USB_DEVICE(0x13D3,0x3273)}, /* AzureWave 3070*/ \
|
||||
{USB_DEVICE(0x083A,0x6618)}, /* Accton */ \
|
||||
{USB_DEVICE(0x15c5,0x0008)}, /* Amit */ \
|
||||
{USB_DEVICE(0x0E66,0x0001)}, /* Hawking */ \
|
||||
{USB_DEVICE(0x0E66,0x0003)}, /* Hawking */ \
|
||||
{USB_DEVICE(0x129B,0x1828)}, /* Siemens */ \
|
||||
{USB_DEVICE(0x157E,0x300E)}, /* U-Media */ \
|
||||
{USB_DEVICE(0x050d,0x805c)}, \
|
||||
{USB_DEVICE(0x1482,0x3C09)}, /* Abocom*/ \
|
||||
{USB_DEVICE(0x14B2,0x3C09)}, /* Alpha */ \
|
||||
{USB_DEVICE(0x04E8,0x2018)}, /* samsung */ \
|
||||
{USB_DEVICE(0x07B8,0x3070)}, /* AboCom 3070 */ \
|
||||
{USB_DEVICE(0x07B8,0x3071)}, /* AboCom 3071 */ \
|
||||
{USB_DEVICE(0x07B8,0x3072)}, /* Abocom 3072 */ \
|
||||
{USB_DEVICE(0x7392,0x7711)}, /* Edimax 3070 */ \
|
||||
{USB_DEVICE(0x5A57,0x0280)}, /* Zinwell */ \
|
||||
{USB_DEVICE(0x5A57,0x0282)}, /* Zinwell */ \
|
||||
{USB_DEVICE(0x1A32,0x0304)}, /* Quanta 3070 */ \
|
||||
{USB_DEVICE(0x0789,0x0162)}, /* Logitec 2870 */ \
|
||||
{USB_DEVICE(0x0789,0x0163)}, /* Logitec 2870 */ \
|
||||
{USB_DEVICE(0x0789,0x0164)}, /* Logitec 2870 */ \
|
||||
{USB_DEVICE(0x1EDA,0x2310)}, /* AirTies 3070 */ \
|
||||
{ }/* Terminating entry */ \
|
||||
}
|
||||
|
||||
#define FREE_HTTX_RING(_p, _b, _t) \
|
||||
{ \
|
||||
if ((_t)->ENextBulkOutPosition == (_t)->CurWritePosition) \
|
||||
{ \
|
||||
(_t)->bRingEmpty = TRUE; \
|
||||
} \
|
||||
/*NdisInterlockedDecrement(&(_p)->TxCount); */\
|
||||
}
|
||||
|
||||
//
|
||||
// RXINFO appends at the end of each rx packet.
|
||||
//
|
||||
typedef struct PACKED _RXINFO_STRUC {
|
||||
UINT32 BA:1;
|
||||
UINT32 DATA:1;
|
||||
UINT32 NULLDATA:1;
|
||||
UINT32 FRAG:1;
|
||||
UINT32 U2M:1; // 1: this RX frame is unicast to me
|
||||
UINT32 Mcast:1; // 1: this is a multicast frame
|
||||
UINT32 Bcast:1; // 1: this is a broadcast frame
|
||||
UINT32 MyBss:1; // 1: this frame belongs to the same BSSID
|
||||
UINT32 Crc:1; // 1: CRC error
|
||||
UINT32 CipherErr:2; // 0: decryption okay, 1:ICV error, 2:MIC error, 3:KEY not valid
|
||||
UINT32 AMSDU:1; // rx with 802.3 header, not 802.11 header.
|
||||
UINT32 HTC:1;
|
||||
UINT32 RSSI:1;
|
||||
UINT32 L2PAD:1;
|
||||
UINT32 AMPDU:1; // To be moved
|
||||
UINT32 Decrypted:1;
|
||||
UINT32 PlcpRssil:1;
|
||||
UINT32 CipherAlg:1;
|
||||
UINT32 LastAMSDU:1;
|
||||
UINT32 PlcpSignal:12;
|
||||
} RXINFO_STRUC, *PRXINFO_STRUC, RT28XX_RXD_STRUC, *PRT28XX_RXD_STRUC;
|
||||
|
||||
//
|
||||
// TXINFO
|
||||
//
|
||||
typedef struct _TXINFO_STRUC {
|
||||
// Word 0
|
||||
UINT32 USBDMATxPktLen:16; //used ONLY in USB bulk Aggregation, Total byte counts of all sub-frame.
|
||||
UINT32 rsv:8;
|
||||
UINT32 WIV:1; // Wireless Info Valid. 1 if Driver already fill WI, o if DMA needs to copy WI to correctposition
|
||||
UINT32 QSEL:2; // select on-chip FIFO ID for 2nd-stage output scheduler.0:MGMT, 1:HCCA 2:EDCA
|
||||
UINT32 SwUseLastRound:1; // Software use.
|
||||
UINT32 rsv2:2; // Software use.
|
||||
UINT32 USBDMANextVLD:1; //used ONLY in USB bulk Aggregation, NextValid
|
||||
UINT32 USBDMATxburst:1;//used ONLY in USB bulk Aggre. Force USB DMA transmit frame from current selected endpoint
|
||||
} TXINFO_STRUC, *PTXINFO_STRUC;
|
||||
|
||||
#define TXINFO_SIZE 4
|
||||
#define RXINFO_SIZE 4
|
||||
#define TXPADDING_SIZE 11
|
||||
|
||||
//
|
||||
// Management ring buffer format
|
||||
//
|
||||
typedef struct _MGMT_STRUC {
|
||||
BOOLEAN Valid;
|
||||
PUCHAR pBuffer;
|
||||
ULONG Length;
|
||||
} MGMT_STRUC, *PMGMT_STRUC;
|
||||
|
||||
|
||||
/* ----------------- EEPROM Related MACRO ----------------- */
|
||||
#ifdef RT30xx
|
||||
#define RT28xx_EEPROM_READ16(pAd, offset, var) \
|
||||
do { \
|
||||
RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2); \
|
||||
if(!pAd->bUseEfuse) \
|
||||
var = le2cpu16(var); \
|
||||
}while(0)
|
||||
|
||||
#define RT28xx_EEPROM_WRITE16(pAd, offset, var) \
|
||||
do{ \
|
||||
USHORT _tmpVar=var; \
|
||||
if(!pAd->bUseEfuse) \
|
||||
_tmpVar = cpu2le16(var); \
|
||||
RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2); \
|
||||
}while(0)
|
||||
#endif // RT30xx //
|
||||
#ifndef RT30xx
|
||||
#define RT28xx_EEPROM_READ16(pAd, offset, var) \
|
||||
do { \
|
||||
RTUSBReadEEPROM(pAd, offset, (PUCHAR)&(var), 2); \
|
||||
var = le2cpu16(var); \
|
||||
}while(0)
|
||||
|
||||
#define RT28xx_EEPROM_WRITE16(pAd, offset, var) \
|
||||
do{ \
|
||||
USHORT _tmpVar=var; \
|
||||
_tmpVar = cpu2le16(var); \
|
||||
RTUSBWriteEEPROM(pAd, offset, (PUCHAR)&(_tmpVar), 2); \
|
||||
}while(0)
|
||||
#endif // RT30xx //
|
||||
|
||||
/* ----------------- TASK/THREAD Related MACRO ----------------- */
|
||||
#define RT28XX_TASK_THREAD_INIT(pAd, Status) \
|
||||
Status = CreateThreads(net_dev);
|
||||
|
||||
|
||||
/* ----------------- Frimware Related MACRO ----------------- */
|
||||
#define RT28XX_WRITE_FIRMWARE(_pAd, _pFwImage, _FwLen) \
|
||||
RTUSBFirmwareWrite(_pAd, _pFwImage, _FwLen)
|
||||
|
||||
/* ----------------- TX Related MACRO ----------------- */
|
||||
#define RT28XX_START_DEQUEUE(pAd, QueIdx, irqFlags) \
|
||||
{ \
|
||||
RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
|
||||
if (pAd->DeQueueRunning[QueIdx]) \
|
||||
{ \
|
||||
RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
|
||||
printk("DeQueueRunning[%d]= TRUE!\n", QueIdx); \
|
||||
continue; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
pAd->DeQueueRunning[QueIdx] = TRUE; \
|
||||
RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags);\
|
||||
} \
|
||||
}
|
||||
#define RT28XX_STOP_DEQUEUE(pAd, QueIdx, irqFlags) \
|
||||
do{ \
|
||||
RTMP_IRQ_LOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
|
||||
pAd->DeQueueRunning[QueIdx] = FALSE; \
|
||||
RTMP_IRQ_UNLOCK(&pAd->DeQueueLock[QueIdx], irqFlags); \
|
||||
}while(0)
|
||||
|
||||
|
||||
#define RT28XX_HAS_ENOUGH_FREE_DESC(pAd, pTxBlk, freeNum, pPacket) \
|
||||
(RTUSBFreeDescriptorRequest(pAd, pTxBlk->QueIdx, (pTxBlk->TotalFrameLen + GET_OS_PKT_LEN(pPacket))) == NDIS_STATUS_SUCCESS)
|
||||
|
||||
#define RT28XX_RELEASE_DESC_RESOURCE(pAd, QueIdx) \
|
||||
do{}while(0)
|
||||
|
||||
#define NEED_QUEUE_BACK_FOR_AGG(_pAd, _QueIdx, _freeNum, _TxFrameType) \
|
||||
((_TxFrameType == TX_RALINK_FRAME) && (RTUSBNeedQueueBackForAgg(_pAd, _QueIdx)))
|
||||
|
||||
|
||||
|
||||
#define fRTMP_ADAPTER_NEED_STOP_TX \
|
||||
(fRTMP_ADAPTER_NIC_NOT_EXIST | fRTMP_ADAPTER_HALT_IN_PROGRESS | \
|
||||
fRTMP_ADAPTER_RESET_IN_PROGRESS | fRTMP_ADAPTER_BULKOUT_RESET | \
|
||||
fRTMP_ADAPTER_RADIO_OFF | fRTMP_ADAPTER_REMOVE_IN_PROGRESS)
|
||||
|
||||
|
||||
#define HAL_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber) \
|
||||
RtmpUSB_WriteSubTxResource(pAd, pTxBlk, bIsLast, pFreeNumber)
|
||||
|
||||
#define HAL_WriteTxResource(pAd, pTxBlk,bIsLast, pFreeNumber) \
|
||||
RtmpUSB_WriteSingleTxResource(pAd, pTxBlk,bIsLast, pFreeNumber)
|
||||
|
||||
#define HAL_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber) \
|
||||
RtmpUSB_WriteFragTxResource(pAd, pTxBlk, fragNum, pFreeNumber)
|
||||
|
||||
#define HAL_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber) \
|
||||
RtmpUSB_WriteMultiTxResource(pAd, pTxBlk,frameNum, pFreeNumber)
|
||||
|
||||
#define HAL_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx) \
|
||||
RtmpUSB_FinalWriteTxResource(pAd, pTxBlk, totalMPDUSize, TxIdx)
|
||||
|
||||
#define HAL_LastTxIdx(pAd, QueIdx,TxIdx) \
|
||||
/*RtmpUSBDataLastTxIdx(pAd, QueIdx,TxIdx)*/
|
||||
|
||||
#define HAL_KickOutTx(pAd, pTxBlk, QueIdx) \
|
||||
RtmpUSBDataKickOut(pAd, pTxBlk, QueIdx)
|
||||
|
||||
|
||||
#define HAL_KickOutMgmtTx(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen) \
|
||||
RtmpUSBMgmtKickOut(pAd, QueIdx, pPacket, pSrcBufVA, SrcBufLen)
|
||||
|
||||
#define HAL_KickOutNullFrameTx(_pAd, _QueIdx, _pNullFrame, _frameLen) \
|
||||
RtmpUSBNullFrameKickOut(_pAd, _QueIdx, _pNullFrame, _frameLen)
|
||||
|
||||
#define RTMP_PKT_TAIL_PADDING 11 // 3(max 4 byte padding) + 4 (last packet padding) + 4 (MaxBulkOutsize align padding)
|
||||
|
||||
extern UCHAR EpToQueue[6];
|
||||
|
||||
|
||||
#ifdef RT2870
|
||||
#define GET_TXRING_FREENO(_pAd, _QueIdx) (_QueIdx) //(_pAd->TxRing[_QueIdx].TxSwFreeIdx)
|
||||
#define GET_MGMTRING_FREENO(_pAd) (_pAd->MgmtRing.TxSwFreeIdx)
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
/* ----------------- RX Related MACRO ----------------- */
|
||||
//#define RT28XX_RX_ERROR_CHECK RTMPCheckRxWI
|
||||
|
||||
#define RT28XX_RV_ALL_BUF_END(bBulkReceive) \
|
||||
/* We return STATUS_MORE_PROCESSING_REQUIRED so that the completion */ \
|
||||
/* routine (IofCompleteRequest) will stop working on the irp. */ \
|
||||
if (bBulkReceive == TRUE) RTUSBBulkReceive(pAd);
|
||||
|
||||
|
||||
/* ----------------- ASIC Related MACRO ----------------- */
|
||||
// reset MAC of a station entry to 0xFFFFFFFFFFFF
|
||||
#define RT28XX_STA_ENTRY_MAC_RESET(pAd, Wcid) \
|
||||
{ RT_SET_ASIC_WCID SetAsicWcid; \
|
||||
SetAsicWcid.WCID = Wcid; \
|
||||
SetAsicWcid.SetTid = 0xffffffff; \
|
||||
SetAsicWcid.DeleteTid = 0xffffffff; \
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID, \
|
||||
&SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); }
|
||||
|
||||
// add this entry into ASIC RX WCID search table
|
||||
#define RT28XX_STA_ENTRY_ADD(pAd, pEntry) \
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_CLIENT_MAC_ENTRY, \
|
||||
pEntry, sizeof(MAC_TABLE_ENTRY));
|
||||
|
||||
// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
|
||||
// Set MAC register value according operation mode
|
||||
#define RT28XX_UPDATE_PROTECT(pAd) \
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_UPDATE_PROTECT, NULL, 0);
|
||||
// end johnli
|
||||
|
||||
// remove Pair-wise key material from ASIC
|
||||
// yet implement
|
||||
#define RT28XX_STA_ENTRY_KEY_DEL(pAd, BssIdx, Wcid)
|
||||
|
||||
// add Client security information into ASIC WCID table and IVEIV table
|
||||
#define RT28XX_STA_SECURITY_INFO_ADD(pAd, apidx, KeyID, pEntry) \
|
||||
{ RT28XX_STA_ENTRY_MAC_RESET(pAd, pEntry->Aid); \
|
||||
if (pEntry->Aid >= 1) { \
|
||||
RT_SET_ASIC_WCID_ATTRI SetAsicWcidAttri; \
|
||||
SetAsicWcidAttri.WCID = pEntry->Aid; \
|
||||
if ((pEntry->AuthMode <= Ndis802_11AuthModeAutoSwitch) && \
|
||||
(pEntry->WepStatus == Ndis802_11Encryption1Enabled)) \
|
||||
{ \
|
||||
SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \
|
||||
} \
|
||||
else if (pEntry->AuthMode == Ndis802_11AuthModeWPANone) \
|
||||
{ \
|
||||
SetAsicWcidAttri.Cipher = pAd->SharedKey[apidx][KeyID].CipherAlg; \
|
||||
} \
|
||||
else SetAsicWcidAttri.Cipher = 0; \
|
||||
DBGPRINT(RT_DEBUG_TRACE, ("aid cipher = %ld\n",SetAsicWcidAttri.Cipher)); \
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_SET_ASIC_WCID_CIPHER, \
|
||||
&SetAsicWcidAttri, sizeof(RT_SET_ASIC_WCID_ATTRI)); } }
|
||||
|
||||
// Insert the BA bitmap to ASIC for the Wcid entry
|
||||
#define RT28XX_ADD_BA_SESSION_TO_ASIC(_pAd, _Aid, _TID) \
|
||||
do{ \
|
||||
RT_SET_ASIC_WCID SetAsicWcid; \
|
||||
SetAsicWcid.WCID = (_Aid); \
|
||||
SetAsicWcid.SetTid = (0x10000<<(_TID)); \
|
||||
SetAsicWcid.DeleteTid = 0xffffffff; \
|
||||
RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \
|
||||
}while(0)
|
||||
|
||||
// Remove the BA bitmap from ASIC for the Wcid entry
|
||||
#define RT28XX_DEL_BA_SESSION_FROM_ASIC(_pAd, _Wcid, _TID) \
|
||||
do{ \
|
||||
RT_SET_ASIC_WCID SetAsicWcid; \
|
||||
SetAsicWcid.WCID = (_Wcid); \
|
||||
SetAsicWcid.SetTid = (0xffffffff); \
|
||||
SetAsicWcid.DeleteTid = (0x10000<<(_TID) ); \
|
||||
RTUSBEnqueueInternalCmd((_pAd), CMDTHREAD_SET_ASIC_WCID, &SetAsicWcid, sizeof(RT_SET_ASIC_WCID)); \
|
||||
}while(0)
|
||||
|
||||
|
||||
/* ----------------- PCI/USB Related MACRO ----------------- */
|
||||
#define RT28XX_HANDLE_DEV_ASSIGN(handle, dev_p) \
|
||||
((POS_COOKIE)handle)->pUsb_Dev = dev_p;
|
||||
|
||||
// no use
|
||||
#define RT28XX_UNMAP()
|
||||
#define RT28XX_IRQ_REQUEST(net_dev)
|
||||
#define RT28XX_IRQ_RELEASE(net_dev)
|
||||
#define RT28XX_IRQ_INIT(pAd)
|
||||
#define RT28XX_IRQ_ENABLE(pAd)
|
||||
|
||||
|
||||
/* ----------------- MLME Related MACRO ----------------- */
|
||||
#define RT28XX_MLME_HANDLER(pAd) RTUSBMlmeUp(pAd)
|
||||
|
||||
#define RT28XX_MLME_PRE_SANITY_CHECK(pAd) \
|
||||
{ if ((pAd->CommonCfg.bHardwareRadio == TRUE) && \
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_NIC_NOT_EXIST)) && \
|
||||
(!RTMP_TEST_FLAG(pAd, fRTMP_ADAPTER_HALT_IN_PROGRESS))) { \
|
||||
RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_CHECK_GPIO, NULL, 0); } }
|
||||
|
||||
#define RT28XX_MLME_STA_QUICK_RSP_WAKE_UP(pAd) \
|
||||
{ RTUSBEnqueueInternalCmd(pAd, CMDTHREAD_QKERIODIC_EXECUT, NULL, 0); \
|
||||
RTUSBMlmeUp(pAd); }
|
||||
|
||||
#define RT28XX_MLME_RESET_STATE_MACHINE(pAd) \
|
||||
MlmeEnqueue(pAd, MLME_CNTL_STATE_MACHINE, MT2_RESET_CONF, 0, NULL); \
|
||||
RTUSBMlmeUp(pAd);
|
||||
|
||||
#define RT28XX_HANDLE_COUNTER_MEASURE(_pAd, _pEntry) \
|
||||
{ RTUSBEnqueueInternalCmd(_pAd, CMDTHREAD_802_11_COUNTER_MEASURE, _pEntry, sizeof(MAC_TABLE_ENTRY)); \
|
||||
RTUSBMlmeUp(_pAd); \
|
||||
}
|
||||
|
||||
|
||||
/* ----------------- Power Save Related MACRO ----------------- */
|
||||
#define RT28XX_PS_POLL_ENQUEUE(pAd) \
|
||||
{ RTUSB_SET_BULK_FLAG(pAd, fRTUSB_BULK_OUT_PSPOLL); \
|
||||
RTUSBKickBulkOut(pAd); }
|
||||
|
||||
#define RT28xx_CHIP_NAME "RT2870"
|
||||
#define USB_CYC_CFG 0x02a4
|
||||
#define NT_SUCCESS(status) (((status) > 0) ? (1):(0))
|
||||
#define InterlockedIncrement atomic_inc
|
||||
#define NdisInterlockedIncrement atomic_inc
|
||||
#define InterlockedDecrement atomic_dec
|
||||
#define NdisInterlockedDecrement atomic_dec
|
||||
#define InterlockedExchange atomic_set
|
||||
//#define NdisMSendComplete RTMP_SendComplete
|
||||
#define NdisMCancelTimer RTMPCancelTimer
|
||||
#define NdisAllocMemory(_ptr, _size, _flag) \
|
||||
do{_ptr = kmalloc((_size),(_flag));}while(0)
|
||||
#define NdisFreeMemory(a, b, c) kfree((a))
|
||||
#define NdisMSleep RTMPusecDelay /* unit: microsecond */
|
||||
|
||||
|
||||
#define USBD_TRANSFER_DIRECTION_OUT 0
|
||||
#define USBD_TRANSFER_DIRECTION_IN 0
|
||||
#define USBD_SHORT_TRANSFER_OK 0
|
||||
#define PURB purbb_t
|
||||
|
||||
#define RTUSB_FREE_URB(pUrb) usb_free_urb(pUrb)
|
||||
|
||||
//#undef MlmeAllocateMemory
|
||||
//#undef MlmeFreeMemory
|
||||
|
||||
typedef struct usb_device * PUSB_DEV;
|
||||
|
||||
/* MACRO for linux usb */
|
||||
typedef struct urb *purbb_t;
|
||||
typedef struct usb_ctrlrequest devctrlrequest;
|
||||
#define PIRP PVOID
|
||||
#define PMDL PVOID
|
||||
#define NDIS_OID UINT
|
||||
#ifndef USB_ST_NOERROR
|
||||
#define USB_ST_NOERROR 0
|
||||
#endif
|
||||
|
||||
// vendor-specific control operations
|
||||
#define CONTROL_TIMEOUT_JIFFIES ( (100 * HZ) / 1000)
|
||||
#define UNLINK_TIMEOUT_MS 3
|
||||
|
||||
/* unlink urb */
|
||||
#define RTUSB_UNLINK_URB(pUrb) usb_kill_urb(pUrb)
|
||||
|
||||
// Prototypes of completion funuc.
|
||||
VOID RTUSBBulkOutDataPacketComplete(purbb_t purb, struct pt_regs *pt_regs);
|
||||
VOID RTUSBBulkOutMLMEPacketComplete(purbb_t pUrb, struct pt_regs *pt_regs);
|
||||
VOID RTUSBBulkOutNullFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
|
||||
VOID RTUSBBulkOutRTSFrameComplete(purbb_t pUrb, struct pt_regs *pt_regs);
|
||||
VOID RTUSBBulkOutPsPollComplete(purbb_t pUrb, struct pt_regs *pt_regs);
|
||||
VOID RTUSBBulkRxComplete(purbb_t pUrb, struct pt_regs *pt_regs);
|
||||
|
||||
|
||||
#define RTUSBMlmeUp(pAd) \
|
||||
{ \
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
|
||||
if(pObj->MLMEThr_pid>0) \
|
||||
up(&(pAd->mlme_semaphore)); \
|
||||
}
|
||||
|
||||
#define RTUSBCMDUp(pAd) \
|
||||
{ \
|
||||
POS_COOKIE pObj = (POS_COOKIE) pAd->OS_Cookie; \
|
||||
if(pObj->RTUSBCmdThr_pid>0) \
|
||||
up(&(pAd->RTUSBCmd_semaphore)); \
|
||||
}
|
||||
|
||||
|
||||
static inline NDIS_STATUS RTMPAllocateMemory(
|
||||
OUT PVOID *ptr,
|
||||
IN size_t size)
|
||||
{
|
||||
*ptr = kmalloc(size, GFP_ATOMIC);
|
||||
if(*ptr)
|
||||
return NDIS_STATUS_SUCCESS;
|
||||
else
|
||||
return NDIS_STATUS_RESOURCES;
|
||||
}
|
||||
|
||||
/* rtmp.h */
|
||||
#define BEACON_RING_SIZE 2
|
||||
#define DEVICE_VENDOR_REQUEST_OUT 0x40
|
||||
#define DEVICE_VENDOR_REQUEST_IN 0xc0
|
||||
#define INTERFACE_VENDOR_REQUEST_OUT 0x41
|
||||
#define INTERFACE_VENDOR_REQUEST_IN 0xc1
|
||||
#define MGMTPIPEIDX 0 // EP6 is highest priority
|
||||
|
||||
#define BULKOUT_MGMT_RESET_FLAG 0x80
|
||||
|
||||
#define RTUSB_SET_BULK_FLAG(_M, _F) ((_M)->BulkFlags |= (_F))
|
||||
#define RTUSB_CLEAR_BULK_FLAG(_M, _F) ((_M)->BulkFlags &= ~(_F))
|
||||
#define RTUSB_TEST_BULK_FLAG(_M, _F) (((_M)->BulkFlags & (_F)) != 0)
|
||||
|
||||
#define EnqueueCmd(cmdq, cmdqelmt) \
|
||||
{ \
|
||||
if (cmdq->size == 0) \
|
||||
cmdq->head = cmdqelmt; \
|
||||
else \
|
||||
cmdq->tail->next = cmdqelmt; \
|
||||
cmdq->tail = cmdqelmt; \
|
||||
cmdqelmt->next = NULL; \
|
||||
cmdq->size++; \
|
||||
}
|
||||
|
||||
typedef struct _RT_SET_ASIC_WCID {
|
||||
ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
|
||||
ULONG SetTid; // time-based: seconds, packet-based: kilo-packets
|
||||
ULONG DeleteTid; // time-based: seconds, packet-based: kilo-packets
|
||||
} RT_SET_ASIC_WCID,*PRT_SET_ASIC_WCID;
|
||||
|
||||
typedef struct _RT_SET_ASIC_WCID_ATTRI {
|
||||
ULONG WCID; // mechanism for rekeying: 0:disable, 1: time-based, 2: packet-based
|
||||
ULONG Cipher; // ASIC Cipher definition
|
||||
UCHAR Addr[ETH_LENGTH_OF_ADDRESS];
|
||||
} RT_SET_ASIC_WCID_ATTRI,*PRT_SET_ASIC_WCID_ATTRI;
|
||||
|
||||
typedef struct _MLME_MEMORY_STRUCT {
|
||||
PVOID AllocVa; //Pointer to the base virtual address of the allocated memory
|
||||
struct _MLME_MEMORY_STRUCT *Next; //Pointer to the next virtual address of the allocated memory
|
||||
} MLME_MEMORY_STRUCT, *PMLME_MEMORY_STRUCT;
|
||||
|
||||
typedef struct _MLME_MEMORY_HANDLER {
|
||||
BOOLEAN MemRunning; //The flag of the Mlme memory handler's status
|
||||
UINT MemoryCount; //Total nonpaged system-space memory not size
|
||||
UINT InUseCount; //Nonpaged system-space memory in used counts
|
||||
UINT UnUseCount; //Nonpaged system-space memory available counts
|
||||
INT PendingCount; //Nonpaged system-space memory for free counts
|
||||
PMLME_MEMORY_STRUCT pInUseHead; //Pointer to the first nonpaed memory not used
|
||||
PMLME_MEMORY_STRUCT pInUseTail; //Pointer to the last nonpaged memory not used
|
||||
PMLME_MEMORY_STRUCT pUnUseHead; //Pointer to the first nonpaged memory in used
|
||||
PMLME_MEMORY_STRUCT pUnUseTail; //Pointer to the last nonpaged memory in used
|
||||
PULONG MemFreePending[MAX_MLME_HANDLER_MEMORY]; //an array to keep pending free-memory's pointer (32bits)
|
||||
} MLME_MEMORY_HANDLER, *PMLME_MEMORY_HANDLER;
|
||||
|
||||
typedef struct _CmdQElmt {
|
||||
UINT command;
|
||||
PVOID buffer;
|
||||
ULONG bufferlength;
|
||||
BOOLEAN CmdFromNdis;
|
||||
BOOLEAN SetOperation;
|
||||
struct _CmdQElmt *next;
|
||||
} CmdQElmt, *PCmdQElmt;
|
||||
|
||||
typedef struct _CmdQ {
|
||||
UINT size;
|
||||
CmdQElmt *head;
|
||||
CmdQElmt *tail;
|
||||
UINT32 CmdQState;
|
||||
}CmdQ, *PCmdQ;
|
||||
|
||||
/* oid.h */
|
||||
// Cipher suite type for mixed mode group cipher, P802.11i-2004
|
||||
typedef enum _RT_802_11_CIPHER_SUITE_TYPE {
|
||||
Cipher_Type_NONE,
|
||||
Cipher_Type_WEP40,
|
||||
Cipher_Type_TKIP,
|
||||
Cipher_Type_RSVD,
|
||||
Cipher_Type_CCMP,
|
||||
Cipher_Type_WEP104
|
||||
} RT_802_11_CIPHER_SUITE_TYPE, *PRT_802_11_CIPHER_SUITE_TYPE;
|
||||
|
||||
//CMDTHREAD_MULTI_READ_MAC
|
||||
//CMDTHREAD_MULTI_WRITE_MAC
|
||||
//CMDTHREAD_VENDOR_EEPROM_READ
|
||||
//CMDTHREAD_VENDOR_EEPROM_WRITE
|
||||
typedef struct _CMDHandler_TLV {
|
||||
USHORT Offset;
|
||||
USHORT Length;
|
||||
UCHAR DataFirst;
|
||||
} CMDHandler_TLV, *PCMDHandler_TLV;
|
||||
|
||||
// New for MeetingHouse Api support
|
||||
#define CMDTHREAD_VENDOR_RESET 0x0D730101 // cmd
|
||||
#define CMDTHREAD_VENDOR_UNPLUG 0x0D730102 // cmd
|
||||
#define CMDTHREAD_VENDOR_SWITCH_FUNCTION 0x0D730103 // cmd
|
||||
#define CMDTHREAD_MULTI_WRITE_MAC 0x0D730107 // cmd
|
||||
#define CMDTHREAD_MULTI_READ_MAC 0x0D730108 // cmd
|
||||
#define CMDTHREAD_VENDOR_EEPROM_WRITE 0x0D73010A // cmd
|
||||
#define CMDTHREAD_VENDOR_EEPROM_READ 0x0D73010B // cmd
|
||||
#define CMDTHREAD_VENDOR_ENTER_TESTMODE 0x0D73010C // cmd
|
||||
#define CMDTHREAD_VENDOR_EXIT_TESTMODE 0x0D73010D // cmd
|
||||
#define CMDTHREAD_VENDOR_WRITE_BBP 0x0D730119 // cmd
|
||||
#define CMDTHREAD_VENDOR_READ_BBP 0x0D730118 // cmd
|
||||
#define CMDTHREAD_VENDOR_WRITE_RF 0x0D73011A // cmd
|
||||
#define CMDTHREAD_VENDOR_FLIP_IQ 0x0D73011D // cmd
|
||||
#define CMDTHREAD_RESET_BULK_OUT 0x0D730210 // cmd
|
||||
#define CMDTHREAD_RESET_BULK_IN 0x0D730211 // cmd
|
||||
#define CMDTHREAD_SET_PSM_BIT_SAVE 0x0D730212 // cmd
|
||||
#define CMDTHREAD_SET_RADIO 0x0D730214 // cmd
|
||||
#define CMDTHREAD_UPDATE_TX_RATE 0x0D730216 // cmd
|
||||
#define CMDTHREAD_802_11_ADD_KEY_WEP 0x0D730218 // cmd
|
||||
#define CMDTHREAD_RESET_FROM_ERROR 0x0D73021A // cmd
|
||||
#define CMDTHREAD_LINK_DOWN 0x0D73021B // cmd
|
||||
#define CMDTHREAD_RESET_FROM_NDIS 0x0D73021C // cmd
|
||||
#define CMDTHREAD_CHECK_GPIO 0x0D730215 // cmd
|
||||
#define CMDTHREAD_FORCE_WAKE_UP 0x0D730222 // cmd
|
||||
#define CMDTHREAD_SET_BW 0x0D730225 // cmd
|
||||
#define CMDTHREAD_SET_ASIC_WCID 0x0D730226 // cmd
|
||||
#define CMDTHREAD_SET_ASIC_WCID_CIPHER 0x0D730227 // cmd
|
||||
#define CMDTHREAD_QKERIODIC_EXECUT 0x0D73023D // cmd
|
||||
#define RT_CMD_SET_KEY_TABLE 0x0D730228 // cmd
|
||||
#define RT_CMD_SET_RX_WCID_TABLE 0x0D730229 // cmd
|
||||
#define CMDTHREAD_SET_CLIENT_MAC_ENTRY 0x0D73023E // cmd
|
||||
#define CMDTHREAD_802_11_QUERY_HARDWARE_REGISTER 0x0D710105 // cmd
|
||||
#define CMDTHREAD_802_11_SET_PHY_MODE 0x0D79010C // cmd
|
||||
#define CMDTHREAD_802_11_SET_STA_CONFIG 0x0D790111 // cmd
|
||||
#define CMDTHREAD_802_11_SET_PREAMBLE 0x0D790101 // cmd
|
||||
#define CMDTHREAD_802_11_COUNTER_MEASURE 0x0D790102 // cmd
|
||||
// add by johnli, fix "in_interrupt" error when call "MacTableDeleteEntry" in Rx tasklet
|
||||
#define CMDTHREAD_UPDATE_PROTECT 0x0D790103 // cmd
|
||||
// end johnli
|
||||
|
||||
#define WPA1AKMBIT 0x01
|
||||
#define WPA2AKMBIT 0x02
|
||||
#define WPA1PSKAKMBIT 0x04
|
||||
#define WPA2PSKAKMBIT 0x08
|
||||
#define TKIPBIT 0x01
|
||||
#define CCMPBIT 0x02
|
||||
|
||||
|
||||
#define RT28XX_STA_FORCE_WAKEUP(pAd, bFromTx) \
|
||||
RT28xxUsbStaAsicForceWakeup(pAd, bFromTx);
|
||||
|
||||
#define RT28XX_STA_SLEEP_THEN_AUTO_WAKEUP(pAd, TbttNumToNextWakeUp) \
|
||||
RT28xxUsbStaAsicSleepThenAutoWakeup(pAd, TbttNumToNextWakeUp);
|
||||
|
||||
#define RT28XX_MLME_RADIO_ON(pAd) \
|
||||
RT28xxUsbMlmeRadioOn(pAd);
|
||||
|
||||
#define RT28XX_MLME_RADIO_OFF(pAd) \
|
||||
RT28xxUsbMlmeRadioOFF(pAd);
|
||||
|
||||
#endif //__RT2870_H__
|
||||
#include "../rt2870/rt2870.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,74 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
rt_config.h
|
||||
|
||||
Abstract:
|
||||
Central header file to maintain all include files for all NDIS
|
||||
miniport driver routines.
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Paul Lin 08-01-2002 created
|
||||
|
||||
*/
|
||||
#ifndef __RT_CONFIG_H__
|
||||
#define __RT_CONFIG_H__
|
||||
|
||||
#include "rtmp_type.h"
|
||||
#ifdef LINUX
|
||||
#include "rt_linux.h"
|
||||
#endif
|
||||
#include "rtmp_def.h"
|
||||
#include "rt28xx.h"
|
||||
|
||||
|
||||
#ifdef RT2870
|
||||
#include "rt2870.h"
|
||||
#endif // RT2870 //
|
||||
|
||||
#include "oid.h"
|
||||
#include "mlme.h"
|
||||
#include "wpa.h"
|
||||
#include "md5.h"
|
||||
#include "rtmp.h"
|
||||
#include "ap.h"
|
||||
#include "dfs.h"
|
||||
#include "chlist.h"
|
||||
#include "spectrum.h"
|
||||
|
||||
#ifdef IGMP_SNOOP_SUPPORT
|
||||
#include "igmp_snoop.h"
|
||||
#endif // IGMP_SNOOP_SUPPORT //
|
||||
|
||||
#ifdef IKANOS_VX_1X0
|
||||
#include "vr_ikans.h"
|
||||
#endif // IKANOS_VX_1X0 //
|
||||
|
||||
#endif // __RT_CONFIG_H__
|
||||
|
||||
#include "../rt2870/rt_config.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,815 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
/***********************************************************************/
|
||||
/* */
|
||||
/* Program: rt_linux.c */
|
||||
/* Created: 4/21/2006 1:17:38 PM */
|
||||
/* Author: Wu Xi-Kun */
|
||||
/* Comments: `description` */
|
||||
/* */
|
||||
/*---------------------------------------------------------------------*/
|
||||
/* */
|
||||
/* History: */
|
||||
/* Revision 1.1 4/21/2006 1:17:38 PM xsikun */
|
||||
/* Initial revision */
|
||||
/* */
|
||||
/***********************************************************************/
|
||||
|
||||
#include "rtmp_type.h"
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/wireless.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/if_arp.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
|
||||
#include <net/iw_handler.h>
|
||||
|
||||
// load firmware
|
||||
#define __KERNEL_SYSCALLS__
|
||||
#include <linux/unistd.h>
|
||||
#include <asm/uaccess.h>
|
||||
|
||||
|
||||
#define MEM_ALLOC_FLAG (GFP_ATOMIC) //(GFP_DMA | GFP_ATOMIC)
|
||||
|
||||
#ifndef IFNAMSIZ
|
||||
#define IFNAMSIZ 16
|
||||
#endif
|
||||
|
||||
//#define CONFIG_CKIP_SUPPORT
|
||||
|
||||
#undef __inline
|
||||
#define __inline static inline
|
||||
|
||||
typedef int (*HARD_START_XMIT_FUNC)(struct sk_buff *skb, struct net_device *net_dev);
|
||||
|
||||
// add by kathy
|
||||
|
||||
#ifdef RT2870
|
||||
#define STA_PROFILE_PATH "/etc/Wireless/RT2870STA/RT2870STA.dat"
|
||||
#define STA_RT2870_IMAGE_FILE_NAME "/etc/Wireless/RT2870STA/rt2870.bin"
|
||||
#define STA_NIC_DEVICE_NAME "RT2870STA"
|
||||
#define STA_DRIVER_VERSION "2.0.1.0"
|
||||
#endif // RT2870 //
|
||||
|
||||
#define RTMP_TIME_AFTER(a,b) \
|
||||
(typecheck(unsigned long, (unsigned long)a) && \
|
||||
typecheck(unsigned long, (unsigned long)b) && \
|
||||
((long)(b) - (long)(a) < 0))
|
||||
|
||||
#define RTMP_TIME_AFTER_EQ(a,b) \
|
||||
(typecheck(unsigned long, (unsigned long)a) && \
|
||||
typecheck(unsigned long, (unsigned long)b) && \
|
||||
((long)(a) - (long)(b) >= 0))
|
||||
#define RTMP_TIME_BEFORE(a,b) RTMP_TIME_AFTER_EQ(b,a)
|
||||
|
||||
#define RT_MOD_INC_USE_COUNT() \
|
||||
if (!try_module_get(THIS_MODULE)) \
|
||||
{ \
|
||||
DBGPRINT(RT_DEBUG_ERROR, ("%s: cannot reserve module\n", __func__)); \
|
||||
return -1; \
|
||||
}
|
||||
|
||||
#define RT_MOD_DEC_USE_COUNT() module_put(THIS_MODULE);
|
||||
|
||||
#define OS_HZ HZ
|
||||
|
||||
#define ETH_LENGTH_OF_ADDRESS 6
|
||||
|
||||
#define IN
|
||||
#define OUT
|
||||
|
||||
#define NDIS_STATUS INT
|
||||
#define NDIS_STATUS_SUCCESS 0x00
|
||||
#define NDIS_STATUS_FAILURE 0x01
|
||||
#define NDIS_STATUS_INVALID_DATA 0x02
|
||||
#define NDIS_STATUS_RESOURCES 0x03
|
||||
|
||||
#define MIN_NET_DEVICE_FOR_AID 0x00 //0x00~0x3f
|
||||
#define MIN_NET_DEVICE_FOR_MBSSID 0x00 //0x00,0x10,0x20,0x30
|
||||
#define MIN_NET_DEVICE_FOR_WDS 0x10 //0x40,0x50,0x60,0x70
|
||||
#define MIN_NET_DEVICE_FOR_APCLI 0x20
|
||||
#define MIN_NET_DEVICE_FOR_MESH 0x30
|
||||
#define MIN_NET_DEVICE_FOR_DLS 0x40
|
||||
|
||||
#define NDIS_PACKET_TYPE_DIRECTED 0
|
||||
#define NDIS_PACKET_TYPE_MULTICAST 1
|
||||
#define NDIS_PACKET_TYPE_BROADCAST 2
|
||||
#define NDIS_PACKET_TYPE_ALL_MULTICAST 3
|
||||
|
||||
struct os_lock {
|
||||
spinlock_t lock;
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
|
||||
struct os_cookie {
|
||||
|
||||
#ifdef RT2870
|
||||
struct usb_device *pUsb_Dev;
|
||||
|
||||
struct pid * MLMEThr_pid;
|
||||
struct pid * RTUSBCmdThr_pid;
|
||||
struct pid * TimerQThr_pid;
|
||||
#endif // RT2870 //
|
||||
|
||||
struct tasklet_struct rx_done_task;
|
||||
struct tasklet_struct mgmt_dma_done_task;
|
||||
struct tasklet_struct ac0_dma_done_task;
|
||||
struct tasklet_struct ac1_dma_done_task;
|
||||
struct tasklet_struct ac2_dma_done_task;
|
||||
struct tasklet_struct ac3_dma_done_task;
|
||||
struct tasklet_struct hcca_dma_done_task;
|
||||
struct tasklet_struct tbtt_task;
|
||||
#ifdef RT2870
|
||||
struct tasklet_struct null_frame_complete_task;
|
||||
struct tasklet_struct rts_frame_complete_task;
|
||||
struct tasklet_struct pspoll_frame_complete_task;
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
unsigned long apd_pid; //802.1x daemon pid
|
||||
INT ioctl_if_type;
|
||||
INT ioctl_if;
|
||||
};
|
||||
|
||||
typedef struct _VIRTUAL_ADAPTER
|
||||
{
|
||||
struct net_device *RtmpDev;
|
||||
struct net_device *VirtualDev;
|
||||
} VIRTUAL_ADAPTER, PVIRTUAL_ADAPTER;
|
||||
|
||||
#undef ASSERT
|
||||
#define ASSERT(x)
|
||||
|
||||
typedef struct os_cookie * POS_COOKIE;
|
||||
typedef struct pci_dev * PPCI_DEV;
|
||||
typedef struct net_device * PNET_DEV;
|
||||
typedef void * PNDIS_PACKET;
|
||||
typedef char NDIS_PACKET;
|
||||
typedef PNDIS_PACKET * PPNDIS_PACKET;
|
||||
typedef dma_addr_t NDIS_PHYSICAL_ADDRESS;
|
||||
typedef dma_addr_t * PNDIS_PHYSICAL_ADDRESS;
|
||||
typedef spinlock_t NDIS_SPIN_LOCK;
|
||||
typedef struct timer_list NDIS_MINIPORT_TIMER;
|
||||
typedef void * NDIS_HANDLE;
|
||||
typedef char * PNDIS_BUFFER;
|
||||
|
||||
|
||||
|
||||
void hex_dump(char *str, unsigned char *pSrcBufVA, unsigned int SrcBufLen);
|
||||
|
||||
dma_addr_t linux_pci_map_single(void *handle, void *ptr, size_t size, int sd_idx, int direction);
|
||||
void linux_pci_unmap_single(void *handle, dma_addr_t dma_addr, size_t size, int direction);
|
||||
|
||||
|
||||
////////////////////////////////////////
|
||||
// MOVE TO rtmp.h ?
|
||||
/////////////////////////////////////////
|
||||
#define PKTSRC_NDIS 0x7f
|
||||
#define PKTSRC_DRIVER 0x0f
|
||||
#define PRINT_MAC(addr) \
|
||||
addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
|
||||
|
||||
#define RT2860_PCI_DEVICE_ID 0x0601
|
||||
|
||||
#ifdef RT2870
|
||||
#define PCI_MAP_SINGLE(_handle, _ptr, _size, _dir) (ULONG)0
|
||||
|
||||
#define PCI_UNMAP_SINGLE(_handle, _ptr, _size, _dir)
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
#define BEACON_FRAME_DMA_CACHE_WBACK(_ptr, _size) \
|
||||
dma_cache_wback(_ptr, _size)
|
||||
|
||||
|
||||
//////////////////////////////////////////
|
||||
//
|
||||
//////////////////////////////////////////
|
||||
|
||||
|
||||
#define NdisMIndicateStatus(_w, _x, _y, _z)
|
||||
|
||||
|
||||
typedef struct timer_list RTMP_OS_TIMER;
|
||||
|
||||
#ifdef RT2870
|
||||
/* ----------------- Timer Related MARCO ---------------*/
|
||||
// In RT2870, we have a lot of timer functions and will read/write register, it's
|
||||
// not allowed in Linux USB sub-system to do it ( because of sleep issue when submit
|
||||
// to ctrl pipe). So we need a wrapper function to take care it.
|
||||
|
||||
typedef VOID (*RT2870_TIMER_HANDLE)(
|
||||
IN PVOID SystemSpecific1,
|
||||
IN PVOID FunctionContext,
|
||||
IN PVOID SystemSpecific2,
|
||||
IN PVOID SystemSpecific3);
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
typedef struct _RALINK_TIMER_STRUCT {
|
||||
RTMP_OS_TIMER TimerObj; // Ndis Timer object
|
||||
BOOLEAN Valid; // Set to True when call RTMPInitTimer
|
||||
BOOLEAN State; // True if timer cancelled
|
||||
BOOLEAN PeriodicType; // True if timer is periodic timer
|
||||
BOOLEAN Repeat; // True if periodic timer
|
||||
ULONG TimerValue; // Timer value in milliseconds
|
||||
ULONG cookie; // os specific object
|
||||
#ifdef RT2870
|
||||
RT2870_TIMER_HANDLE handle;
|
||||
void *pAd;
|
||||
#endif // RT2870 //
|
||||
} RALINK_TIMER_STRUCT, *PRALINK_TIMER_STRUCT;
|
||||
|
||||
|
||||
#ifdef RT2870
|
||||
|
||||
typedef enum _RT2870_KERNEL_THREAD_STATUS_
|
||||
{
|
||||
RT2870_THREAD_UNKNOWN = 0,
|
||||
RT2870_THREAD_INITED = 1,
|
||||
RT2870_THREAD_RUNNING = 2,
|
||||
RT2870_THREAD_STOPED = 4,
|
||||
}RT2870_KERNEL_THREAD_STATUS;
|
||||
|
||||
#define RT2870_THREAD_CAN_DO_INSERT (RT2870_THREAD_INITED |RT2870_THREAD_RUNNING)
|
||||
|
||||
typedef struct _RT2870_TIMER_ENTRY_
|
||||
{
|
||||
RALINK_TIMER_STRUCT *pRaTimer;
|
||||
struct _RT2870_TIMER_ENTRY_ *pNext;
|
||||
}RT2870_TIMER_ENTRY;
|
||||
|
||||
|
||||
#define TIMER_QUEUE_SIZE_MAX 128
|
||||
typedef struct _RT2870_TIMER_QUEUE_
|
||||
{
|
||||
unsigned int status;
|
||||
UCHAR *pTimerQPoll;
|
||||
RT2870_TIMER_ENTRY *pQPollFreeList;
|
||||
RT2870_TIMER_ENTRY *pQHead;
|
||||
RT2870_TIMER_ENTRY *pQTail;
|
||||
}RT2870_TIMER_QUEUE;
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
//#define DBG 1
|
||||
|
||||
//
|
||||
// MACRO for debugging information
|
||||
//
|
||||
|
||||
#ifdef DBG
|
||||
extern ULONG RTDebugLevel;
|
||||
|
||||
#define DBGPRINT_RAW(Level, Fmt) \
|
||||
{ \
|
||||
if (Level <= RTDebugLevel) \
|
||||
{ \
|
||||
printk Fmt; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define DBGPRINT(Level, Fmt) DBGPRINT_RAW(Level, Fmt)
|
||||
|
||||
|
||||
#define DBGPRINT_ERR(Fmt) \
|
||||
{ \
|
||||
printk("ERROR!!! "); \
|
||||
printk Fmt; \
|
||||
}
|
||||
|
||||
#define DBGPRINT_S(Status, Fmt) \
|
||||
{ \
|
||||
printk Fmt; \
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
#define DBGPRINT(Level, Fmt)
|
||||
#define DBGPRINT_RAW(Level, Fmt)
|
||||
#define DBGPRINT_S(Status, Fmt)
|
||||
#define DBGPRINT_ERR(Fmt)
|
||||
#endif
|
||||
|
||||
|
||||
//
|
||||
// spin_lock enhanced for Nested spin lock
|
||||
//
|
||||
#define NdisAllocateSpinLock(__lock) \
|
||||
{ \
|
||||
spin_lock_init((spinlock_t *)(__lock)); \
|
||||
}
|
||||
|
||||
#define NdisFreeSpinLock(lock) \
|
||||
{ \
|
||||
}
|
||||
|
||||
|
||||
#define RTMP_SEM_LOCK(__lock) \
|
||||
{ \
|
||||
spin_lock_bh((spinlock_t *)(__lock)); \
|
||||
}
|
||||
|
||||
#define RTMP_SEM_UNLOCK(__lock) \
|
||||
{ \
|
||||
spin_unlock_bh((spinlock_t *)(__lock)); \
|
||||
}
|
||||
|
||||
// sample, use semaphore lock to replace IRQ lock, 2007/11/15
|
||||
#define RTMP_IRQ_LOCK(__lock, __irqflags) \
|
||||
{ \
|
||||
__irqflags = 0; \
|
||||
spin_lock_bh((spinlock_t *)(__lock)); \
|
||||
pAd->irq_disabled |= 1; \
|
||||
}
|
||||
|
||||
#define RTMP_IRQ_UNLOCK(__lock, __irqflag) \
|
||||
{ \
|
||||
pAd->irq_disabled &= 0; \
|
||||
spin_unlock_bh((spinlock_t *)(__lock)); \
|
||||
}
|
||||
|
||||
#define RTMP_INT_LOCK(__lock, __irqflags) \
|
||||
{ \
|
||||
spin_lock_irqsave((spinlock_t *)__lock, __irqflags); \
|
||||
}
|
||||
|
||||
#define RTMP_INT_UNLOCK(__lock, __irqflag) \
|
||||
{ \
|
||||
spin_unlock_irqrestore((spinlock_t *)(__lock), ((unsigned long)__irqflag)); \
|
||||
}
|
||||
|
||||
#ifdef RT2870
|
||||
#define RTMP_IO_READ32(_A, _R, _pV) \
|
||||
RTUSBReadMACRegister(_A, _R, _pV)
|
||||
|
||||
#define RTMP_IO_READ8(_A, _R, _pV) \
|
||||
{ \
|
||||
}
|
||||
|
||||
#define RTMP_IO_WRITE32(_A, _R, _V) \
|
||||
RTUSBWriteMACRegister(_A, _R, _V)
|
||||
|
||||
|
||||
#define RTMP_IO_WRITE8(_A, _R, _V) \
|
||||
{ \
|
||||
USHORT _Val = _V; \
|
||||
RTUSBSingleWrite(_A, _R, _Val); \
|
||||
}
|
||||
|
||||
|
||||
#define RTMP_IO_WRITE16(_A, _R, _V) \
|
||||
{ \
|
||||
RTUSBSingleWrite(_A, _R, _V); \
|
||||
}
|
||||
#endif // RT2870 //
|
||||
|
||||
#ifndef wait_event_interruptible_timeout
|
||||
#define __wait_event_interruptible_timeout(wq, condition, ret) \
|
||||
do { \
|
||||
wait_queue_t __wait; \
|
||||
init_waitqueue_entry(&__wait, current); \
|
||||
add_wait_queue(&wq, &__wait); \
|
||||
for (;;) { \
|
||||
set_current_state(TASK_INTERRUPTIBLE); \
|
||||
if (condition) \
|
||||
break; \
|
||||
if (!signal_pending(current)) { \
|
||||
ret = schedule_timeout(ret); \
|
||||
if (!ret) \
|
||||
break; \
|
||||
continue; \
|
||||
} \
|
||||
ret = -ERESTARTSYS; \
|
||||
break; \
|
||||
} \
|
||||
current->state = TASK_RUNNING; \
|
||||
remove_wait_queue(&wq, &__wait); \
|
||||
} while (0)
|
||||
|
||||
#define wait_event_interruptible_timeout(wq, condition, timeout) \
|
||||
({ \
|
||||
long __ret = timeout; \
|
||||
if (!(condition)) \
|
||||
__wait_event_interruptible_timeout(wq, condition, __ret); \
|
||||
__ret; \
|
||||
})
|
||||
#endif
|
||||
#define ONE_TICK 1
|
||||
#define OS_WAIT(_time) \
|
||||
{ int _i; \
|
||||
long _loop = ((_time)/(1000/OS_HZ)) > 0 ? ((_time)/(1000/OS_HZ)) : 1;\
|
||||
wait_queue_head_t _wait; \
|
||||
init_waitqueue_head(&_wait); \
|
||||
for (_i=0; _i<(_loop); _i++) \
|
||||
wait_event_interruptible_timeout(_wait, 0, ONE_TICK); }
|
||||
|
||||
|
||||
typedef void (*TIMER_FUNCTION)(unsigned long);
|
||||
|
||||
#define COPY_MAC_ADDR(Addr1, Addr2) memcpy((Addr1), (Addr2), MAC_ADDR_LEN)
|
||||
|
||||
#define MlmeAllocateMemory(_pAd, _ppVA) os_alloc_mem(_pAd, _ppVA, MGMT_DMA_BUFFER_SIZE)
|
||||
#define MlmeFreeMemory(_pAd, _pVA) os_free_mem(_pAd, _pVA)
|
||||
|
||||
|
||||
#ifdef RT2870
|
||||
#define BUILD_TIMER_FUNCTION(_func) \
|
||||
void linux_##_func(unsigned long data) \
|
||||
{ \
|
||||
PRALINK_TIMER_STRUCT _pTimer = (PRALINK_TIMER_STRUCT)data; \
|
||||
RT2870_TIMER_ENTRY *_pQNode; \
|
||||
RTMP_ADAPTER *_pAd; \
|
||||
\
|
||||
_pTimer->handle = _func; \
|
||||
_pAd = (RTMP_ADAPTER *)_pTimer->pAd; \
|
||||
_pQNode = RT2870_TimerQ_Insert(_pAd, _pTimer); \
|
||||
if ((_pQNode == NULL) && (_pAd->TimerQ.status & RT2870_THREAD_CAN_DO_INSERT)) \
|
||||
RTMP_OS_Add_Timer(&_pTimer->TimerObj, HZ); \
|
||||
}
|
||||
#endif // RT2870 //
|
||||
|
||||
|
||||
#define DECLARE_TIMER_FUNCTION(_func) \
|
||||
void linux_##_func(unsigned long data)
|
||||
|
||||
#define GET_TIMER_FUNCTION(_func) \
|
||||
linux_##_func
|
||||
|
||||
DECLARE_TIMER_FUNCTION(MlmePeriodicExec);
|
||||
DECLARE_TIMER_FUNCTION(MlmeRssiReportExec);
|
||||
DECLARE_TIMER_FUNCTION(AsicRxAntEvalTimeout);
|
||||
DECLARE_TIMER_FUNCTION(APSDPeriodicExec);
|
||||
DECLARE_TIMER_FUNCTION(AsicRfTuningExec);
|
||||
#ifdef RT2870
|
||||
DECLARE_TIMER_FUNCTION(BeaconUpdateExec);
|
||||
#endif // RT2870 //
|
||||
|
||||
DECLARE_TIMER_FUNCTION(BeaconTimeout);
|
||||
DECLARE_TIMER_FUNCTION(ScanTimeout);
|
||||
DECLARE_TIMER_FUNCTION(AuthTimeout);
|
||||
DECLARE_TIMER_FUNCTION(AssocTimeout);
|
||||
DECLARE_TIMER_FUNCTION(ReassocTimeout);
|
||||
DECLARE_TIMER_FUNCTION(DisassocTimeout);
|
||||
DECLARE_TIMER_FUNCTION(LinkDownExec);
|
||||
DECLARE_TIMER_FUNCTION(StaQuickResponeForRateUpExec);
|
||||
DECLARE_TIMER_FUNCTION(WpaDisassocApAndBlockAssoc);
|
||||
DECLARE_TIMER_FUNCTION(PsPollWakeExec);
|
||||
DECLARE_TIMER_FUNCTION(RadioOnExec);
|
||||
|
||||
void RTMP_GetCurrentSystemTime(LARGE_INTEGER *time);
|
||||
|
||||
|
||||
/*
|
||||
* packet helper
|
||||
* - convert internal rt packet to os packet or
|
||||
* os packet to rt packet
|
||||
*/
|
||||
#define RTPKT_TO_OSPKT(_p) ((struct sk_buff *)(_p))
|
||||
#define OSPKT_TO_RTPKT(_p) ((PNDIS_PACKET)(_p))
|
||||
|
||||
#define GET_OS_PKT_DATAPTR(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->data)
|
||||
|
||||
#define GET_OS_PKT_LEN(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->len)
|
||||
|
||||
#define GET_OS_PKT_DATATAIL(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->tail)
|
||||
|
||||
#define GET_OS_PKT_HEAD(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->head)
|
||||
|
||||
#define GET_OS_PKT_END(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->end)
|
||||
|
||||
#define GET_OS_PKT_NETDEV(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->dev)
|
||||
|
||||
#define GET_OS_PKT_TYPE(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt))
|
||||
|
||||
#define GET_OS_PKT_NEXT(_pkt) \
|
||||
(RTPKT_TO_OSPKT(_pkt)->next)
|
||||
|
||||
|
||||
#define OS_NTOHS(_Val) \
|
||||
(ntohs(_Val))
|
||||
#define OS_HTONS(_Val) \
|
||||
(htons(_Val))
|
||||
#define OS_NTOHL(_Val) \
|
||||
(ntohl(_Val))
|
||||
#define OS_HTONL(_Val) \
|
||||
(htonl(_Val))
|
||||
|
||||
/* statistics counter */
|
||||
#define STATS_INC_RX_PACKETS(_pAd, _dev)
|
||||
#define STATS_INC_TX_PACKETS(_pAd, _dev)
|
||||
|
||||
#define STATS_INC_RX_BYTESS(_pAd, _dev, len)
|
||||
#define STATS_INC_TX_BYTESS(_pAd, _dev, len)
|
||||
|
||||
#define STATS_INC_RX_ERRORS(_pAd, _dev)
|
||||
#define STATS_INC_TX_ERRORS(_pAd, _dev)
|
||||
|
||||
#define STATS_INC_RX_DROPPED(_pAd, _dev)
|
||||
#define STATS_INC_TX_DROPPED(_pAd, _dev)
|
||||
|
||||
|
||||
#define CB_OFF 10
|
||||
|
||||
|
||||
// check DDK NDIS_PACKET data structure and find out only MiniportReservedEx[0..7] can be used by our driver without
|
||||
// ambiguity. Fields after pPacket->MiniportReservedEx[8] may be used by other wrapper layer thus crashes the driver
|
||||
//
|
||||
|
||||
// User Priority
|
||||
#define RTMP_SET_PACKET_UP(_p, _prio) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0] = _prio)
|
||||
#define RTMP_GET_PACKET_UP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+0])
|
||||
|
||||
// Fragment #
|
||||
#define RTMP_SET_PACKET_FRAGMENTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1] = _num)
|
||||
#define RTMP_GET_PACKET_FRAGMENTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+1])
|
||||
|
||||
// 0x0 ~0x7f: TX to AP's own BSS which has the specified AID. if AID>127, set bit 7 in RTMP_SET_PACKET_EMACTAB too.
|
||||
//(this value also as MAC(on-chip WCID) table index)
|
||||
// 0x80~0xff: TX to a WDS link. b0~6: WDS index
|
||||
#define RTMP_SET_PACKET_WCID(_p, _wdsidx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2] = _wdsidx)
|
||||
#define RTMP_GET_PACKET_WCID(_p) ((UCHAR)(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+2]))
|
||||
|
||||
// 0xff: PKTSRC_NDIS, others: local TX buffer index. This value affects how to a packet
|
||||
#define RTMP_SET_PACKET_SOURCE(_p, _pktsrc) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3] = _pktsrc)
|
||||
#define RTMP_GET_PACKET_SOURCE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+3])
|
||||
|
||||
// RTS/CTS-to-self protection method
|
||||
#define RTMP_SET_PACKET_RTS(_p, _num) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4] = _num)
|
||||
#define RTMP_GET_PACKET_RTS(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+4])
|
||||
// see RTMP_S(G)ET_PACKET_EMACTAB
|
||||
|
||||
// TX rate index
|
||||
#define RTMP_SET_PACKET_TXRATE(_p, _rate) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5] = _rate)
|
||||
#define RTMP_GET_PACKET_TXRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+5])
|
||||
|
||||
// From which Interface
|
||||
#define RTMP_SET_PACKET_IF(_p, _ifdx) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6] = _ifdx)
|
||||
#define RTMP_GET_PACKET_IF(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+6])
|
||||
#define RTMP_SET_PACKET_NET_DEVICE_MBSSID(_p, _bss) RTMP_SET_PACKET_IF((_p), (_bss))
|
||||
#define RTMP_SET_PACKET_NET_DEVICE_WDS(_p, _bss) RTMP_SET_PACKET_IF((_p), ((_bss) + MIN_NET_DEVICE_FOR_WDS))
|
||||
#define RTMP_SET_PACKET_NET_DEVICE_APCLI(_p, _idx) RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_APCLI))
|
||||
#define RTMP_SET_PACKET_NET_DEVICE_MESH(_p, _idx) RTMP_SET_PACKET_IF((_p), ((_idx) + MIN_NET_DEVICE_FOR_MESH))
|
||||
#define RTMP_GET_PACKET_NET_DEVICE_MBSSID(_p) RTMP_GET_PACKET_IF((_p))
|
||||
#define RTMP_GET_PACKET_NET_DEVICE(_p) RTMP_GET_PACKET_IF((_p))
|
||||
|
||||
#define RTMP_SET_PACKET_MOREDATA(_p, _morebit) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7] = _morebit)
|
||||
#define RTMP_GET_PACKET_MOREDATA(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+7])
|
||||
|
||||
|
||||
//
|
||||
// Sepcific Pakcet Type definition
|
||||
//
|
||||
#define RTMP_PACKET_SPECIFIC_CB_OFFSET 11
|
||||
|
||||
#define RTMP_PACKET_SPECIFIC_DHCP 0x01
|
||||
#define RTMP_PACKET_SPECIFIC_EAPOL 0x02
|
||||
#define RTMP_PACKET_SPECIFIC_IPV4 0x04
|
||||
#define RTMP_PACKET_SPECIFIC_WAI 0x08
|
||||
#define RTMP_PACKET_SPECIFIC_VLAN 0x10
|
||||
#define RTMP_PACKET_SPECIFIC_LLCSNAP 0x20
|
||||
|
||||
//Specific
|
||||
#define RTMP_SET_PACKET_SPECIFIC(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] = _flg)
|
||||
|
||||
//DHCP
|
||||
#define RTMP_SET_PACKET_DHCP(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_DHCP); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_DHCP); \
|
||||
}while(0)
|
||||
#define RTMP_GET_PACKET_DHCP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_DHCP)
|
||||
|
||||
//EAPOL
|
||||
#define RTMP_SET_PACKET_EAPOL(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_EAPOL); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_EAPOL); \
|
||||
}while(0)
|
||||
#define RTMP_GET_PACKET_EAPOL(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_EAPOL)
|
||||
|
||||
//WAI
|
||||
#define RTMP_SET_PACKET_WAI(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_WAI); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_WAI); \
|
||||
}while(0)
|
||||
#define RTMP_GET_PACKET_WAI(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_WAI)
|
||||
|
||||
#define RTMP_GET_PACKET_LOWRATE(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & (RTMP_PACKET_SPECIFIC_EAPOL | RTMP_PACKET_SPECIFIC_DHCP | RTMP_PACKET_SPECIFIC_WAI))
|
||||
|
||||
//VLAN
|
||||
#define RTMP_SET_PACKET_VLAN(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_VLAN); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_VLAN); \
|
||||
}while(0)
|
||||
#define RTMP_GET_PACKET_VLAN(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_VLAN)
|
||||
|
||||
//LLC/SNAP
|
||||
#define RTMP_SET_PACKET_LLCSNAP(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_LLCSNAP); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_LLCSNAP); \
|
||||
}while(0)
|
||||
|
||||
#define RTMP_GET_PACKET_LLCSNAP(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_LLCSNAP)
|
||||
|
||||
// IP
|
||||
#define RTMP_SET_PACKET_IPV4(_p, _flg) \
|
||||
do{ \
|
||||
if (_flg) \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) |= (RTMP_PACKET_SPECIFIC_IPV4); \
|
||||
else \
|
||||
(RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11]) &= (!RTMP_PACKET_SPECIFIC_IPV4); \
|
||||
}while(0)
|
||||
|
||||
#define RTMP_GET_PACKET_IPV4(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+11] & RTMP_PACKET_SPECIFIC_IPV4)
|
||||
|
||||
// If this flag is set, it indicates that this EAPoL frame MUST be clear.
|
||||
#define RTMP_SET_PACKET_CLEAR_EAP_FRAME(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12] = _flg)
|
||||
#define RTMP_GET_PACKET_CLEAR_EAP_FRAME(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+12])
|
||||
|
||||
#define RTMP_SET_PACKET_5VT(_p, _flg) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22] = _flg)
|
||||
#define RTMP_GET_PACKET_5VT(_p) (RTPKT_TO_OSPKT(_p)->cb[CB_OFF+22])
|
||||
|
||||
#ifdef CONFIG_5VT_ENHANCE
|
||||
#define BRIDGE_TAG 0x35564252 // depends on 5VT define in br_input.c
|
||||
#endif
|
||||
|
||||
|
||||
#define NDIS_SET_PACKET_STATUS(_p, _status)
|
||||
|
||||
|
||||
#define GET_SG_LIST_FROM_PACKET(_p, _sc) \
|
||||
rt_get_sg_list_from_packet(_p, _sc)
|
||||
|
||||
#define NdisMoveMemory(Destination, Source, Length) memmove(Destination, Source, Length)
|
||||
#define NdisZeroMemory(Destination, Length) memset(Destination, 0, Length)
|
||||
#define NdisFillMemory(Destination, Length, Fill) memset(Destination, Fill, Length)
|
||||
#define NdisEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length))
|
||||
#define RTMPEqualMemory(Source1, Source2, Length) (!memcmp(Source1, Source2, Length))
|
||||
|
||||
|
||||
#define RTMP_INC_REF(_A) 0
|
||||
#define RTMP_DEC_REF(_A) 0
|
||||
#define RTMP_GET_REF(_A) 0
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* ULONG
|
||||
* RTMP_GetPhysicalAddressLow(
|
||||
* IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
|
||||
*/
|
||||
#define RTMP_GetPhysicalAddressLow(PhysicalAddress) (PhysicalAddress)
|
||||
|
||||
/*
|
||||
* ULONG
|
||||
* RTMP_GetPhysicalAddressHigh(
|
||||
* IN NDIS_PHYSICAL_ADDRESS PhysicalAddress);
|
||||
*/
|
||||
#define RTMP_GetPhysicalAddressHigh(PhysicalAddress) (0)
|
||||
|
||||
/*
|
||||
* VOID
|
||||
* RTMP_SetPhysicalAddressLow(
|
||||
* IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
|
||||
* IN ULONG Value);
|
||||
*/
|
||||
#define RTMP_SetPhysicalAddressLow(PhysicalAddress, Value) \
|
||||
PhysicalAddress = Value;
|
||||
|
||||
/*
|
||||
* VOID
|
||||
* RTMP_SetPhysicalAddressHigh(
|
||||
* IN NDIS_PHYSICAL_ADDRESS PhysicalAddress,
|
||||
* IN ULONG Value);
|
||||
*/
|
||||
#define RTMP_SetPhysicalAddressHigh(PhysicalAddress, Value)
|
||||
|
||||
|
||||
//CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);
|
||||
#define QUEUE_ENTRY_TO_PACKET(pEntry) \
|
||||
(PNDIS_PACKET)(pEntry)
|
||||
|
||||
#define PACKET_TO_QUEUE_ENTRY(pPacket) \
|
||||
(PQUEUE_ENTRY)(pPacket)
|
||||
|
||||
|
||||
#ifndef CONTAINING_RECORD
|
||||
#define CONTAINING_RECORD(address, type, field) \
|
||||
((type *)((PCHAR)(address) - offsetof(type, field)))
|
||||
#endif
|
||||
|
||||
|
||||
#define RELEASE_NDIS_PACKET(_pAd, _pPacket, _Status) \
|
||||
{ \
|
||||
RTMPFreeNdisPacket(_pAd, _pPacket); \
|
||||
}
|
||||
|
||||
|
||||
#define SWITCH_PhyAB(_pAA, _pBB) \
|
||||
{ \
|
||||
ULONG AABasePaHigh; \
|
||||
ULONG AABasePaLow; \
|
||||
ULONG BBBasePaHigh; \
|
||||
ULONG BBBasePaLow; \
|
||||
BBBasePaHigh = RTMP_GetPhysicalAddressHigh(_pBB); \
|
||||
BBBasePaLow = RTMP_GetPhysicalAddressLow(_pBB); \
|
||||
AABasePaHigh = RTMP_GetPhysicalAddressHigh(_pAA); \
|
||||
AABasePaLow = RTMP_GetPhysicalAddressLow(_pAA); \
|
||||
RTMP_SetPhysicalAddressHigh(_pAA, BBBasePaHigh); \
|
||||
RTMP_SetPhysicalAddressLow(_pAA, BBBasePaLow); \
|
||||
RTMP_SetPhysicalAddressHigh(_pBB, AABasePaHigh); \
|
||||
RTMP_SetPhysicalAddressLow(_pBB, AABasePaLow); \
|
||||
}
|
||||
|
||||
|
||||
#define NdisWriteErrorLogEntry(_a, _b, _c, _d)
|
||||
#define NdisMAllocateMapRegisters(_a, _b, _c, _d, _e) NDIS_STATUS_SUCCESS
|
||||
|
||||
|
||||
#define NdisAcquireSpinLock RTMP_SEM_LOCK
|
||||
#define NdisReleaseSpinLock RTMP_SEM_UNLOCK
|
||||
|
||||
static inline void NdisGetSystemUpTime(ULONG *time)
|
||||
{
|
||||
*time = jiffies;
|
||||
}
|
||||
|
||||
//pPacket = CONTAINING_RECORD(pEntry, NDIS_PACKET, MiniportReservedEx);
|
||||
#define QUEUE_ENTRY_TO_PKT(pEntry) \
|
||||
((PNDIS_PACKET) (pEntry))
|
||||
|
||||
int rt28xx_packet_xmit(struct sk_buff *skb);
|
||||
|
||||
|
||||
|
||||
void rtmp_os_thread_init(PUCHAR pThreadName, PVOID pNotify);
|
||||
|
||||
|
||||
|
||||
#include "../../rt2870/rt_linux.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,113 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
rtmp_ckipmic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
#ifndef __RTMP_CKIPMIC_H__
|
||||
#define __RTMP_CKIPMIC_H__
|
||||
|
||||
typedef struct _MIC_CONTEXT {
|
||||
/* --- MMH context */
|
||||
UCHAR CK[16]; /* the key */
|
||||
UCHAR coefficient[16]; /* current aes counter mode coefficients */
|
||||
ULONGLONG accum; /* accumulated mic, reduced to u32 in final() */
|
||||
UINT position; /* current position (byte offset) in message */
|
||||
UCHAR part[4]; /* for conversion of message to u32 for mmh */
|
||||
} MIC_CONTEXT, *PMIC_CONTEXT;
|
||||
|
||||
VOID CKIP_key_permute(
|
||||
OUT UCHAR *PK, /* output permuted key */
|
||||
IN UCHAR *CK, /* input CKIP key */
|
||||
IN UCHAR toDsFromDs, /* input toDs/FromDs bits */
|
||||
IN UCHAR *piv); /* input pointer to IV */
|
||||
|
||||
VOID RTMPCkipMicInit(
|
||||
IN PMIC_CONTEXT pContext,
|
||||
IN PUCHAR CK);
|
||||
|
||||
VOID RTMPMicUpdate(
|
||||
IN PMIC_CONTEXT pContext,
|
||||
IN PUCHAR pOctets,
|
||||
IN INT len);
|
||||
|
||||
ULONG RTMPMicGetCoefficient(
|
||||
IN PMIC_CONTEXT pContext);
|
||||
|
||||
VOID xor_128(
|
||||
IN PUCHAR a,
|
||||
IN PUCHAR b,
|
||||
OUT PUCHAR out);
|
||||
|
||||
UCHAR RTMPCkipSbox(
|
||||
IN UCHAR a);
|
||||
|
||||
VOID xor_32(
|
||||
IN PUCHAR a,
|
||||
IN PUCHAR b,
|
||||
OUT PUCHAR out);
|
||||
|
||||
VOID next_key(
|
||||
IN PUCHAR key,
|
||||
IN INT round);
|
||||
|
||||
VOID byte_sub(
|
||||
IN PUCHAR in,
|
||||
OUT PUCHAR out);
|
||||
|
||||
VOID shift_row(
|
||||
IN PUCHAR in,
|
||||
OUT PUCHAR out);
|
||||
|
||||
VOID mix_column(
|
||||
IN PUCHAR in,
|
||||
OUT PUCHAR out);
|
||||
|
||||
VOID RTMPAesEncrypt(
|
||||
IN PUCHAR key,
|
||||
IN PUCHAR data,
|
||||
IN PUCHAR ciphertext);
|
||||
|
||||
VOID RTMPMicFinal(
|
||||
IN PMIC_CONTEXT pContext,
|
||||
OUT UCHAR digest[4]);
|
||||
|
||||
VOID RTMPCkipInsertCMIC(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
OUT PUCHAR pMIC,
|
||||
IN PUCHAR p80211hdr,
|
||||
IN PNDIS_PACKET pPacket,
|
||||
IN PCIPHER_KEY pKey,
|
||||
IN PUCHAR mic_snap);
|
||||
|
||||
#endif //__RTMP_CKIPMIC_H__
|
||||
#include "../rt2870/rtmp_ckipmic.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,95 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
rtmp_type.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
Paul Lin 1-2-2004
|
||||
*/
|
||||
#ifndef __RTMP_TYPE_H__
|
||||
#define __RTMP_TYPE_H__
|
||||
|
||||
|
||||
#define PACKED __attribute__ ((packed))
|
||||
|
||||
// Put platform dependent declaration here
|
||||
// For example, linux type definition
|
||||
typedef unsigned char UINT8;
|
||||
typedef unsigned short UINT16;
|
||||
typedef unsigned int UINT32;
|
||||
typedef unsigned long long UINT64;
|
||||
typedef int INT32;
|
||||
typedef long long INT64;
|
||||
|
||||
typedef unsigned char * PUINT8;
|
||||
typedef unsigned short * PUINT16;
|
||||
typedef unsigned int * PUINT32;
|
||||
typedef unsigned long long * PUINT64;
|
||||
typedef int * PINT32;
|
||||
typedef long long * PINT64;
|
||||
|
||||
typedef signed char CHAR;
|
||||
typedef signed short SHORT;
|
||||
typedef signed int INT;
|
||||
typedef signed long LONG;
|
||||
typedef signed long long LONGLONG;
|
||||
|
||||
|
||||
typedef unsigned char UCHAR;
|
||||
typedef unsigned short USHORT;
|
||||
typedef unsigned int UINT;
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned long long ULONGLONG;
|
||||
|
||||
typedef unsigned char BOOLEAN;
|
||||
typedef void VOID;
|
||||
|
||||
typedef VOID * PVOID;
|
||||
typedef CHAR * PCHAR;
|
||||
typedef UCHAR * PUCHAR;
|
||||
typedef USHORT * PUSHORT;
|
||||
typedef LONG * PLONG;
|
||||
typedef ULONG * PULONG;
|
||||
typedef UINT * PUINT;
|
||||
|
||||
typedef unsigned int NDIS_MEDIA_STATE;
|
||||
|
||||
typedef union _LARGE_INTEGER {
|
||||
struct {
|
||||
UINT LowPart;
|
||||
INT32 HighPart;
|
||||
} u;
|
||||
INT64 QuadPart;
|
||||
} LARGE_INTEGER;
|
||||
|
||||
#endif // __RTMP_TYPE_H__
|
||||
|
||||
#include "../rt2870/rtmp_type.h"
|
||||
|
@ -1,292 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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. *
|
||||
* *
|
||||
*************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __SPECTRUM_H__
|
||||
#define __SPECTRUM_H__
|
||||
|
||||
#include "rtmp_type.h"
|
||||
#include "spectrum_def.h"
|
||||
|
||||
typedef struct PACKED _TPC_REPORT_INFO
|
||||
{
|
||||
UINT8 TxPwr;
|
||||
UINT8 LinkMargin;
|
||||
} TPC_REPORT_INFO, *PTPC_REPORT_INFO;
|
||||
|
||||
typedef struct PACKED _CH_SW_ANN_INFO
|
||||
{
|
||||
UINT8 ChSwMode;
|
||||
UINT8 Channel;
|
||||
UINT8 ChSwCnt;
|
||||
} CH_SW_ANN_INFO, *PCH_SW_ANN_INFO;
|
||||
|
||||
typedef union PACKED _MEASURE_REQ_MODE
|
||||
{
|
||||
struct PACKED
|
||||
{
|
||||
UINT8 Rev0:1;
|
||||
UINT8 Enable:1;
|
||||
UINT8 Request:1;
|
||||
UINT8 Report:1;
|
||||
UINT8 Rev1:4;
|
||||
} field;
|
||||
UINT8 word;
|
||||
} MEASURE_REQ_MODE, *PMEASURE_REQ_MODE;
|
||||
|
||||
typedef struct PACKED _MEASURE_REQ
|
||||
{
|
||||
UINT8 ChNum;
|
||||
UINT64 MeasureStartTime;
|
||||
UINT16 MeasureDuration;
|
||||
} MEASURE_REQ, *PMEASURE_REQ;
|
||||
|
||||
typedef struct PACKED _MEASURE_REQ_INFO
|
||||
{
|
||||
UINT8 Token;
|
||||
MEASURE_REQ_MODE ReqMode;
|
||||
UINT8 ReqType;
|
||||
MEASURE_REQ MeasureReq;
|
||||
} MEASURE_REQ_INFO, *PMEASURE_REQ_INFO;
|
||||
|
||||
typedef union PACKED _MEASURE_BASIC_REPORT_MAP
|
||||
{
|
||||
struct PACKED
|
||||
{
|
||||
UINT8 BSS:1;
|
||||
UINT8 OfdmPreamble:1;
|
||||
UINT8 UnidentifiedSignal:1;
|
||||
UINT8 Radar:1;
|
||||
UINT8 Unmeasure:1;
|
||||
UINT8 Rev:3;
|
||||
} field;
|
||||
UINT8 word;
|
||||
} MEASURE_BASIC_REPORT_MAP, *PMEASURE_BASIC_REPORT_MAP;
|
||||
|
||||
typedef struct PACKED _MEASURE_BASIC_REPORT
|
||||
{
|
||||
UINT8 ChNum;
|
||||
UINT64 MeasureStartTime;
|
||||
UINT16 MeasureDuration;
|
||||
MEASURE_BASIC_REPORT_MAP Map;
|
||||
} MEASURE_BASIC_REPORT, *PMEASURE_BASIC_REPORT;
|
||||
|
||||
typedef struct PACKED _MEASURE_CCA_REPORT
|
||||
{
|
||||
UINT8 ChNum;
|
||||
UINT64 MeasureStartTime;
|
||||
UINT16 MeasureDuration;
|
||||
UINT8 CCA_Busy_Fraction;
|
||||
} MEASURE_CCA_REPORT, *PMEASURE_CCA_REPORT;
|
||||
|
||||
typedef struct PACKED _MEASURE_RPI_REPORT
|
||||
{
|
||||
UINT8 ChNum;
|
||||
UINT64 MeasureStartTime;
|
||||
UINT16 MeasureDuration;
|
||||
UINT8 RPI_Density[8];
|
||||
} MEASURE_RPI_REPORT, *PMEASURE_RPI_REPORT;
|
||||
|
||||
typedef union PACKED _MEASURE_REPORT_MODE
|
||||
{
|
||||
struct PACKED
|
||||
{
|
||||
UINT8 Late:1;
|
||||
UINT8 Incapable:1;
|
||||
UINT8 Refused:1;
|
||||
UINT8 Rev:5;
|
||||
} field;
|
||||
UINT8 word;
|
||||
} MEASURE_REPORT_MODE, *PMEASURE_REPORT_MODE;
|
||||
|
||||
typedef struct PACKED _MEASURE_REPORT_INFO
|
||||
{
|
||||
UINT8 Token;
|
||||
MEASURE_REPORT_MODE ReportMode;
|
||||
UINT8 ReportType;
|
||||
UINT8 Octect[0];
|
||||
} MEASURE_REPORT_INFO, *PMEASURE_REPORT_INFO;
|
||||
|
||||
typedef struct PACKED _QUIET_INFO
|
||||
{
|
||||
UINT8 QuietCnt;
|
||||
UINT8 QuietPeriod;
|
||||
UINT8 QuietDuration;
|
||||
UINT8 QuietOffset;
|
||||
} QUIET_INFO, *PQUIET_INFO;
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Prepare Measurement request action frame and enqueue it into
|
||||
management queue waiting for transmition.
|
||||
|
||||
Parametrs:
|
||||
1. the destination mac address of the frame.
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID EnqueueMeasurementReq(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN UINT8 MeasureToken,
|
||||
IN UINT8 MeasureReqMode,
|
||||
IN UINT8 MeasureReqType,
|
||||
IN UINT8 MeasureCh,
|
||||
IN UINT16 MeasureDuration);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Prepare Measurement report action frame and enqueue it into
|
||||
management queue waiting for transmition.
|
||||
|
||||
Parametrs:
|
||||
1. the destination mac address of the frame.
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID EnqueueMeasurementRep(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN UINT8 DialogToken,
|
||||
IN UINT8 MeasureToken,
|
||||
IN UINT8 MeasureReqMode,
|
||||
IN UINT8 MeasureReqType,
|
||||
IN UINT8 ReportInfoLen,
|
||||
IN PUINT8 pReportInfo);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Prepare TPC Request action frame and enqueue it into
|
||||
management queue waiting for transmition.
|
||||
|
||||
Parametrs:
|
||||
1. the destination mac address of the frame.
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID EnqueueTPCReq(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN UCHAR DialogToken);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Prepare TPC Report action frame and enqueue it into
|
||||
management queue waiting for transmition.
|
||||
|
||||
Parametrs:
|
||||
1. the destination mac address of the frame.
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID EnqueueTPCRep(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN UINT8 DialogToken,
|
||||
IN UINT8 TxPwr,
|
||||
IN UINT8 LinkMargin);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Prepare Channel Switch Announcement action frame and enqueue it into
|
||||
management queue waiting for transmition.
|
||||
|
||||
Parametrs:
|
||||
1. the destination mac address of the frame.
|
||||
2. Channel switch announcement mode.
|
||||
2. a New selected channel.
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID EnqueueChSwAnn(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pDA,
|
||||
IN UINT8 ChSwMode,
|
||||
IN UINT8 NewCh);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
Spectrun action frames Handler such as channel switch annoucement,
|
||||
measurement report, measurement request actions frames.
|
||||
|
||||
Parametrs:
|
||||
Elme - MLME message containing the received frame
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
VOID PeerSpectrumAction(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN MLME_QUEUE_ELEM *Elem);
|
||||
|
||||
/*
|
||||
==========================================================================
|
||||
Description:
|
||||
|
||||
Parametrs:
|
||||
|
||||
Return : None.
|
||||
==========================================================================
|
||||
*/
|
||||
INT Set_MeasureReq_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR arg);
|
||||
|
||||
INT Set_TpcReq_Proc(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR arg);
|
||||
|
||||
VOID MeasureReqTabInit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID MeasureReqTabExit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID TpcReqTabInit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID TpcReqTabExit(
|
||||
IN PRTMP_ADAPTER pAd);
|
||||
|
||||
VOID NotifyChSwAnnToPeerAPs(
|
||||
IN PRTMP_ADAPTER pAd,
|
||||
IN PUCHAR pRA,
|
||||
IN PUCHAR pTA,
|
||||
IN UINT8 ChSwMode,
|
||||
IN UINT8 Channel);
|
||||
#endif // __SPECTRUM_H__ //
|
||||
|
||||
#include "../rt2870/spectrum.h"
|
||||
|
@ -1,95 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
spectrum_def.h
|
||||
|
||||
Abstract:
|
||||
Handle association related requests either from WSTA or from local MLME
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
--------- ---------- ----------------------------------------------
|
||||
Fonchi Wu 2008 created for 802.11h
|
||||
*/
|
||||
|
||||
#ifndef __SPECTRUM_DEF_H__
|
||||
#define __SPECTRUM_DEF_H__
|
||||
|
||||
#define MAX_MEASURE_REQ_TAB_SIZE 3
|
||||
#define MAX_HASH_MEASURE_REQ_TAB_SIZE MAX_MEASURE_REQ_TAB_SIZE
|
||||
|
||||
#define MAX_TPC_REQ_TAB_SIZE 3
|
||||
#define MAX_HASH_TPC_REQ_TAB_SIZE MAX_TPC_REQ_TAB_SIZE
|
||||
|
||||
#define MIN_RCV_PWR 100 /* Negative value ((dBm) */
|
||||
|
||||
#define RM_TPC_REQ 0
|
||||
#define RM_MEASURE_REQ 1
|
||||
|
||||
#define RM_BASIC 0
|
||||
#define RM_CCA 1
|
||||
#define RM_RPI_HISTOGRAM 2
|
||||
|
||||
#define TPC_REQ_AGE_OUT 500 /* ms */
|
||||
#define MQ_REQ_AGE_OUT 500 /* ms */
|
||||
|
||||
#define TPC_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_HASH_TPC_REQ_TAB_SIZE)
|
||||
#define MQ_DIALOGTOKEN_HASH_INDEX(_DialogToken) ((_DialogToken) % MAX_MEASURE_REQ_TAB_SIZE)
|
||||
|
||||
typedef struct _MEASURE_REQ_ENTRY
|
||||
{
|
||||
struct _MEASURE_REQ_ENTRY *pNext;
|
||||
ULONG lastTime;
|
||||
BOOLEAN Valid;
|
||||
UINT8 DialogToken;
|
||||
UINT8 MeasureDialogToken[3]; // 0:basic measure, 1: CCA measure, 2: RPI_Histogram measure.
|
||||
} MEASURE_REQ_ENTRY, *PMEASURE_REQ_ENTRY;
|
||||
|
||||
typedef struct _MEASURE_REQ_TAB
|
||||
{
|
||||
UCHAR Size;
|
||||
PMEASURE_REQ_ENTRY Hash[MAX_HASH_MEASURE_REQ_TAB_SIZE];
|
||||
MEASURE_REQ_ENTRY Content[MAX_MEASURE_REQ_TAB_SIZE];
|
||||
} MEASURE_REQ_TAB, *PMEASURE_REQ_TAB;
|
||||
|
||||
typedef struct _TPC_REQ_ENTRY
|
||||
{
|
||||
struct _TPC_REQ_ENTRY *pNext;
|
||||
ULONG lastTime;
|
||||
BOOLEAN Valid;
|
||||
UINT8 DialogToken;
|
||||
} TPC_REQ_ENTRY, *PTPC_REQ_ENTRY;
|
||||
|
||||
typedef struct _TPC_REQ_TAB
|
||||
{
|
||||
UCHAR Size;
|
||||
PTPC_REQ_ENTRY Hash[MAX_HASH_TPC_REQ_TAB_SIZE];
|
||||
TPC_REQ_ENTRY Content[MAX_TPC_REQ_TAB_SIZE];
|
||||
} TPC_REQ_TAB, *PTPC_REQ_TAB;
|
||||
|
||||
#endif // __SPECTRUM_DEF_H__ //
|
||||
|
||||
#include "../rt2870/spectrum_def.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,327 +1 @@
|
||||
/*
|
||||
*************************************************************************
|
||||
* 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:
|
||||
wpa.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Revision History:
|
||||
Who When What
|
||||
-------- ---------- ----------------------------------------------
|
||||
Name Date Modification logs
|
||||
*/
|
||||
|
||||
#ifndef __WPA_H__
|
||||
#define __WPA_H__
|
||||
|
||||
// EAPOL Key descripter frame format related length
|
||||
#define LEN_KEY_DESC_NONCE 32
|
||||
#define LEN_KEY_DESC_IV 16
|
||||
#define LEN_KEY_DESC_RSC 8
|
||||
#define LEN_KEY_DESC_ID 8
|
||||
#define LEN_KEY_DESC_REPLAY 8
|
||||
#define LEN_KEY_DESC_MIC 16
|
||||
|
||||
// The length is the EAPoL-Key frame except key data field.
|
||||
// Please refer to 802.11i-2004 ,Figure 43u in p.78
|
||||
#define LEN_EAPOL_KEY_MSG (sizeof(KEY_DESCRIPTER) - MAX_LEN_OF_RSNIE)
|
||||
|
||||
// EAP Code Type.
|
||||
#define EAP_CODE_REQUEST 1
|
||||
#define EAP_CODE_RESPONSE 2
|
||||
#define EAP_CODE_SUCCESS 3
|
||||
#define EAP_CODE_FAILURE 4
|
||||
|
||||
// EAPOL frame Protocol Version
|
||||
#define EAPOL_VER 1
|
||||
#define EAPOL_VER2 2
|
||||
|
||||
// EAPOL-KEY Descriptor Type
|
||||
#define WPA1_KEY_DESC 0xfe
|
||||
#define WPA2_KEY_DESC 0x02
|
||||
|
||||
// Key Descriptor Version of Key Information
|
||||
#define DESC_TYPE_TKIP 1
|
||||
#define DESC_TYPE_AES 2
|
||||
#define DESC_TYPE_MESH 3
|
||||
|
||||
#define LEN_MSG1_2WAY 0x7f
|
||||
#define MAX_LEN_OF_EAP_HS 256
|
||||
|
||||
#define LEN_MASTER_KEY 32
|
||||
|
||||
// EAPOL EK, MK
|
||||
#define LEN_EAP_EK 16
|
||||
#define LEN_EAP_MICK 16
|
||||
#define LEN_EAP_KEY ((LEN_EAP_EK)+(LEN_EAP_MICK))
|
||||
// TKIP key related
|
||||
#define LEN_PMKID 16
|
||||
#define LEN_TKIP_EK 16
|
||||
#define LEN_TKIP_RXMICK 8
|
||||
#define LEN_TKIP_TXMICK 8
|
||||
#define LEN_AES_EK 16
|
||||
#define LEN_AES_KEY LEN_AES_EK
|
||||
#define LEN_TKIP_KEY ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
|
||||
#define TKIP_AP_TXMICK_OFFSET ((LEN_EAP_KEY)+(LEN_TKIP_EK))
|
||||
#define TKIP_AP_RXMICK_OFFSET (TKIP_AP_TXMICK_OFFSET+LEN_TKIP_TXMICK)
|
||||
#define TKIP_GTK_LENGTH ((LEN_TKIP_EK)+(LEN_TKIP_RXMICK)+(LEN_TKIP_TXMICK))
|
||||
#define LEN_PTK ((LEN_EAP_KEY)+(LEN_TKIP_KEY))
|
||||
|
||||
// RSN IE Length definition
|
||||
#define MAX_LEN_OF_RSNIE 90
|
||||
#define MIN_LEN_OF_RSNIE 8
|
||||
|
||||
//EAP Packet Type
|
||||
#define EAPPacket 0
|
||||
#define EAPOLStart 1
|
||||
#define EAPOLLogoff 2
|
||||
#define EAPOLKey 3
|
||||
#define EAPOLASFAlert 4
|
||||
#define EAPTtypeMax 5
|
||||
|
||||
#define EAPOL_MSG_INVALID 0
|
||||
#define EAPOL_PAIR_MSG_1 1
|
||||
#define EAPOL_PAIR_MSG_2 2
|
||||
#define EAPOL_PAIR_MSG_3 3
|
||||
#define EAPOL_PAIR_MSG_4 4
|
||||
#define EAPOL_GROUP_MSG_1 5
|
||||
#define EAPOL_GROUP_MSG_2 6
|
||||
|
||||
#define PAIRWISEKEY 1
|
||||
#define GROUPKEY 0
|
||||
|
||||
// Retry timer counter initial value
|
||||
#define PEER_MSG1_RETRY_TIMER_CTR 0
|
||||
#define PEER_MSG3_RETRY_TIMER_CTR 10
|
||||
#define GROUP_MSG1_RETRY_TIMER_CTR 20
|
||||
|
||||
|
||||
#define EAPOL_START_DISABLE 0
|
||||
#define EAPOL_START_PSK 1
|
||||
#define EAPOL_START_1X 2
|
||||
|
||||
#define MIX_CIPHER_WPA_TKIP_ON(x) (((x) & 0x08) != 0)
|
||||
#define MIX_CIPHER_WPA_AES_ON(x) (((x) & 0x04) != 0)
|
||||
#define MIX_CIPHER_WPA2_TKIP_ON(x) (((x) & 0x02) != 0)
|
||||
#define MIX_CIPHER_WPA2_AES_ON(x) (((x) & 0x01) != 0)
|
||||
|
||||
#define ROUND_UP(__x, __y) \
|
||||
(((ULONG)((__x)+((__y)-1))) & ((ULONG)~((__y)-1)))
|
||||
|
||||
#define ADD_ONE_To_64BIT_VAR(_V) \
|
||||
{ \
|
||||
UCHAR cnt = LEN_KEY_DESC_REPLAY; \
|
||||
do \
|
||||
{ \
|
||||
cnt--; \
|
||||
_V[cnt]++; \
|
||||
if (cnt == 0) \
|
||||
break; \
|
||||
}while (_V[cnt] == 0); \
|
||||
}
|
||||
|
||||
#define IS_WPA_CAPABILITY(a) (((a) >= Ndis802_11AuthModeWPA) && ((a) <= Ndis802_11AuthModeWPA1PSKWPA2PSK))
|
||||
|
||||
// EAPOL Key Information definition within Key descriptor format
|
||||
typedef struct PACKED _KEY_INFO
|
||||
{
|
||||
UCHAR KeyMic:1;
|
||||
UCHAR Secure:1;
|
||||
UCHAR Error:1;
|
||||
UCHAR Request:1;
|
||||
UCHAR EKD_DL:1; // EKD for AP; DL for STA
|
||||
UCHAR Rsvd:3;
|
||||
UCHAR KeyDescVer:3;
|
||||
UCHAR KeyType:1;
|
||||
UCHAR KeyIndex:2;
|
||||
UCHAR Install:1;
|
||||
UCHAR KeyAck:1;
|
||||
} KEY_INFO, *PKEY_INFO;
|
||||
|
||||
// EAPOL Key descriptor format
|
||||
typedef struct PACKED _KEY_DESCRIPTER
|
||||
{
|
||||
UCHAR Type;
|
||||
KEY_INFO KeyInfo;
|
||||
UCHAR KeyLength[2];
|
||||
UCHAR ReplayCounter[LEN_KEY_DESC_REPLAY];
|
||||
UCHAR KeyNonce[LEN_KEY_DESC_NONCE];
|
||||
UCHAR KeyIv[LEN_KEY_DESC_IV];
|
||||
UCHAR KeyRsc[LEN_KEY_DESC_RSC];
|
||||
UCHAR KeyId[LEN_KEY_DESC_ID];
|
||||
UCHAR KeyMic[LEN_KEY_DESC_MIC];
|
||||
UCHAR KeyDataLen[2];
|
||||
UCHAR KeyData[MAX_LEN_OF_RSNIE];
|
||||
} KEY_DESCRIPTER, *PKEY_DESCRIPTER;
|
||||
|
||||
typedef struct PACKED _EAPOL_PACKET
|
||||
{
|
||||
UCHAR ProVer;
|
||||
UCHAR ProType;
|
||||
UCHAR Body_Len[2];
|
||||
KEY_DESCRIPTER KeyDesc;
|
||||
} EAPOL_PACKET, *PEAPOL_PACKET;
|
||||
|
||||
//802.11i D10 page 83
|
||||
typedef struct PACKED _GTK_ENCAP
|
||||
{
|
||||
UCHAR Kid:2;
|
||||
UCHAR tx:1;
|
||||
UCHAR rsv:5;
|
||||
UCHAR rsv1;
|
||||
UCHAR GTK[TKIP_GTK_LENGTH];
|
||||
} GTK_ENCAP, *PGTK_ENCAP;
|
||||
|
||||
typedef struct PACKED _KDE_ENCAP
|
||||
{
|
||||
UCHAR Type;
|
||||
UCHAR Len;
|
||||
UCHAR OUI[3];
|
||||
UCHAR DataType;
|
||||
GTK_ENCAP GTKEncap;
|
||||
} KDE_ENCAP, *PKDE_ENCAP;
|
||||
|
||||
// For WPA1
|
||||
typedef struct PACKED _RSNIE {
|
||||
UCHAR oui[4];
|
||||
USHORT version;
|
||||
UCHAR mcast[4];
|
||||
USHORT ucount;
|
||||
struct PACKED {
|
||||
UCHAR oui[4];
|
||||
}ucast[1];
|
||||
} RSNIE, *PRSNIE;
|
||||
|
||||
// For WPA2
|
||||
typedef struct PACKED _RSNIE2 {
|
||||
USHORT version;
|
||||
UCHAR mcast[4];
|
||||
USHORT ucount;
|
||||
struct PACKED {
|
||||
UCHAR oui[4];
|
||||
}ucast[1];
|
||||
} RSNIE2, *PRSNIE2;
|
||||
|
||||
// AKM Suite
|
||||
typedef struct PACKED _RSNIE_AUTH {
|
||||
USHORT acount;
|
||||
struct PACKED {
|
||||
UCHAR oui[4];
|
||||
}auth[1];
|
||||
} RSNIE_AUTH,*PRSNIE_AUTH;
|
||||
|
||||
typedef union PACKED _RSN_CAPABILITIES {
|
||||
struct PACKED {
|
||||
USHORT PreAuth:1;
|
||||
USHORT No_Pairwise:1;
|
||||
USHORT PTKSA_R_Counter:2;
|
||||
USHORT GTKSA_R_Counter:2;
|
||||
USHORT Rsvd:10;
|
||||
} field;
|
||||
USHORT word;
|
||||
} RSN_CAPABILITIES, *PRSN_CAPABILITIES;
|
||||
|
||||
typedef struct PACKED _EAP_HDR {
|
||||
UCHAR ProVer;
|
||||
UCHAR ProType;
|
||||
UCHAR Body_Len[2];
|
||||
UCHAR code;
|
||||
UCHAR identifier;
|
||||
UCHAR length[2]; // including code and identifier, followed by length-2 octets of data
|
||||
} EAP_HDR, *PEAP_HDR;
|
||||
|
||||
// For supplicant state machine states. 802.11i Draft 4.1, p. 97
|
||||
// We simplified it
|
||||
typedef enum _WpaState
|
||||
{
|
||||
SS_NOTUSE, // 0
|
||||
SS_START, // 1
|
||||
SS_WAIT_MSG_3, // 2
|
||||
SS_WAIT_GROUP, // 3
|
||||
SS_FINISH, // 4
|
||||
SS_KEYUPDATE, // 5
|
||||
} WPA_STATE;
|
||||
|
||||
//
|
||||
// The definition of the cipher combination
|
||||
//
|
||||
// bit3 bit2 bit1 bit0
|
||||
// +------------+------------+
|
||||
// | WPA | WPA2 |
|
||||
// +------+-----+------+-----+
|
||||
// | TKIP | AES | TKIP | AES |
|
||||
// | 0 | 1 | 1 | 0 | -> 0x06
|
||||
// | 0 | 1 | 1 | 1 | -> 0x07
|
||||
// | 1 | 0 | 0 | 1 | -> 0x09
|
||||
// | 1 | 0 | 1 | 1 | -> 0x0B
|
||||
// | 1 | 1 | 0 | 1 | -> 0x0D
|
||||
// | 1 | 1 | 1 | 0 | -> 0x0E
|
||||
// | 1 | 1 | 1 | 1 | -> 0x0F
|
||||
// +------+-----+------+-----+
|
||||
//
|
||||
typedef enum _WpaMixPairCipher
|
||||
{
|
||||
MIX_CIPHER_NOTUSE = 0x00,
|
||||
WPA_NONE_WPA2_TKIPAES = 0x03, // WPA2-TKIPAES
|
||||
WPA_AES_WPA2_TKIP = 0x06,
|
||||
WPA_AES_WPA2_TKIPAES = 0x07,
|
||||
WPA_TKIP_WPA2_AES = 0x09,
|
||||
WPA_TKIP_WPA2_TKIPAES = 0x0B,
|
||||
WPA_TKIPAES_WPA2_NONE = 0x0C, // WPA-TKIPAES
|
||||
WPA_TKIPAES_WPA2_AES = 0x0D,
|
||||
WPA_TKIPAES_WPA2_TKIP = 0x0E,
|
||||
WPA_TKIPAES_WPA2_TKIPAES = 0x0F,
|
||||
} WPA_MIX_PAIR_CIPHER;
|
||||
|
||||
typedef struct PACKED _RSN_IE_HEADER_STRUCT {
|
||||
UCHAR Eid;
|
||||
UCHAR Length;
|
||||
USHORT Version; // Little endian format
|
||||
} RSN_IE_HEADER_STRUCT, *PRSN_IE_HEADER_STRUCT;
|
||||
|
||||
// Cipher suite selector types
|
||||
typedef struct PACKED _CIPHER_SUITE_STRUCT {
|
||||
UCHAR Oui[3];
|
||||
UCHAR Type;
|
||||
} CIPHER_SUITE_STRUCT, *PCIPHER_SUITE_STRUCT;
|
||||
|
||||
// Authentication and Key Management suite selector
|
||||
typedef struct PACKED _AKM_SUITE_STRUCT {
|
||||
UCHAR Oui[3];
|
||||
UCHAR Type;
|
||||
} AKM_SUITE_STRUCT, *PAKM_SUITE_STRUCT;
|
||||
|
||||
// RSN capability
|
||||
typedef struct PACKED _RSN_CAPABILITY {
|
||||
USHORT Rsv:10;
|
||||
USHORT GTKSAReplayCnt:2;
|
||||
USHORT PTKSAReplayCnt:2;
|
||||
USHORT NoPairwise:1;
|
||||
USHORT PreAuth:1;
|
||||
} RSN_CAPABILITY, *PRSN_CAPABILITY;
|
||||
|
||||
#endif
|
||||
#include "../rt2870/wpa.h"
|
||||
|
Loading…
Reference in New Issue
Block a user