Staging: w35und: #include cleanup
[firefly-linux-kernel-4.4.55.git] / drivers / staging / winbond / mds_s.h
1 #ifndef __WINBOND_MDS_H
2 #define __WINBOND_MDS_H
3
4 #include <linux/timer.h>
5 #include <linux/types.h>
6 #include <asm/atomic.h>
7
8 #include "localpara.h"
9 #include "mac_structures.h"
10 #include "scan_s.h"
11
12 ////////////////////////////////////////////////////////////////////////////////////////////////////////
13 #define MAX_USB_TX_DESCRIPTOR           15              // IS89C35 ability
14 #define MAX_USB_TX_BUFFER_NUMBER        4               // Virtual pre-buffer number of MAX_USB_TX_BUFFER
15 #define MAX_USB_TX_BUFFER                       4096    // IS89C35 ability 4n alignment is required for hardware
16
17 #define MDS_EVENT_INDICATE( _A, _B, _F )        OS_EVENT_INDICATE( _A, _B, _F )
18 #define AUTH_REQUEST_PAIRWISE_ERROR                     0               // _F flag setting
19 #define AUTH_REQUEST_GROUP_ERROR                        1               // _F flag setting
20
21 // For variable setting
22 #define CURRENT_BSS_TYPE                                psBSS(psLOCAL->wConnectedSTAindex)->bBssType
23 #define CURRENT_WEP_MODE                                psSME->_dot11PrivacyInvoked
24 #define CURRENT_BSSID                                   psBSS(psLOCAL->wConnectedSTAindex)->abBssID
25 #define CURRENT_DESIRED_WPA_ENABLE              ((psSME->bDesiredAuthMode==WPA_AUTH)||(psSME->bDesiredAuthMode==WPAPSK_AUTH))
26 #ifdef _WPA2_
27 #define CURRENT_DESIRED_WPA2_ENABLE             ((psSME->bDesiredAuthMode==WPA2_AUTH)||(psSME->bDesiredAuthMode==WPA2PSK_AUTH))
28 #endif //end def _WPA2_
29 #define CURRENT_PAIRWISE_KEY_OK                 psSME->pairwise_key_ok
30 //[20040712 WS]
31 #define CURRENT_GROUP_KEY_OK                    psSME->group_key_ok
32 #define CURRENT_PAIRWISE_KEY                    psSME->tx_mic_key
33 #define CURRENT_GROUP_KEY                               psSME->group_tx_mic_key
34 #define CURRENT_ENCRYPT_STATUS                  psSME->encrypt_status
35 #define CURRENT_WEP_ID                                  adapter->sSmePara._dot11WEPDefaultKeyID
36 #define CURRENT_CONTROL_PORT_BLOCK              ( psSME->wpa_ok!=1 || (adapter->Mds.boCounterMeasureBlock==1 && (CURRENT_ENCRYPT_STATUS==ENCRYPT_TKIP)) )
37 #define CURRENT_FRAGMENT_THRESHOLD              (adapter->Mds.TxFragmentThreshold & ~0x1)
38 #define CURRENT_PREAMBLE_MODE                   psLOCAL->boShortPreamble?WLAN_PREAMBLE_TYPE_SHORT:WLAN_PREAMBLE_TYPE_LONG
39 #define CURRENT_TX_RATE                                 adapter->sLocalPara.CurrentTxRate
40 #define CURRENT_FALL_BACK_TX_RATE               adapter->sLocalPara.CurrentTxFallbackRate
41 #define CURRENT_TX_RATE_FOR_MNG                 adapter->sLocalPara.CurrentTxRateForMng
42 #define CURRENT_PROTECT_MECHANISM               psLOCAL->boProtectMechanism
43 #define CURRENT_RTS_THRESHOLD                   adapter->Mds.TxRTSThreshold
44
45 #define MIB_GS_XMIT_OK_INC                              adapter->sLocalPara.GS_XMIT_OK++
46 #define MIB_GS_RCV_OK_INC                               adapter->sLocalPara.GS_RCV_OK++
47 #define MIB_GS_XMIT_ERROR_INC                   adapter->sLocalPara.GS_XMIT_ERROR
48
49 //---------- TX -----------------------------------
50 #define ETHERNET_TX_DESCRIPTORS         MAX_USB_TX_BUFFER_NUMBER
51
52 //---------- RX ------------------------------------
53 #define ETHERNET_RX_DESCRIPTORS                 8       //It's not necessary to allocate more than 2 in sync indicate
54
55 //================================================================
56 // Configration default value
57 //================================================================
58 #define DEFAULT_MULTICASTLISTMAX                32              // standard
59 #define DEFAULT_TX_BURSTLENGTH                  3               // 32 Longwords
60 #define DEFAULT_RX_BURSTLENGTH                  3               // 32 Longwords
61 #define DEFAULT_TX_THRESHOLD                    0               // Full Packet
62 #define DEFAULT_RX_THRESHOLD                    0               // Full Packet
63 #define DEFAULT_MAXTXRATE                               6               // 11 Mbps (Long)
64 #define DEFAULT_CHANNEL                                 3               // Chennel 3
65 #define DEFAULT_RTSThreshold                    2347    // Disable RTS
66 //#define DEFAULT_PME                                           1               // Enable
67 #define DEFAULT_PME                                             0               // Disable
68 #define DEFAULT_SIFSTIME                                10
69 #define DEFAULT_ACKTIME_1ML             304     // 148+44+112 911220 by LCC
70 #define DEFAULT_ACKTIME_2ML             248     // 148+44+56 911220 by LCC
71 #define DEFAULT_FRAGMENT_THRESHOLD      2346    // No fragment
72 #define DEFAULT_PREAMBLE_LENGTH                 72
73 #define DEFAULT_PLCPHEADERTIME_LENGTH   24
74
75 /*------------------------------------------------------------------------
76  0.96 sec since time unit of the R03 for the current, W89C32 is about 60ns
77  instead of 960 ns. This shall be fixed in the future W89C32
78  -------------------------------------------------------------------------*/
79 #define DEFAULT_MAX_RECEIVE_TIME        16440000
80
81 #define RX_BUF_SIZE                                             2352        // 600      // For 301 must be multiple of 8
82 #define MAX_RX_DESCRIPTORS              18         // Rx Layer 2
83 #define MAX_BUFFER_QUEUE        8 // The value is always equal 8 due to NDIS_PACKET's MiniportReserved field size
84
85
86 // For brand-new rx system
87 #define MDS_ID_IGNORE                           ETHERNET_RX_DESCRIPTORS
88
89 // For Tx Packet status classify
90 #define PACKET_FREE_TO_USE                                              0
91 #define PACKET_COME_FROM_NDIS                                   0x08
92 #define PACKET_COME_FROM_MLME                                   0x80
93 #define PACKET_SEND_COMPLETE                                    0xff
94
95 typedef struct _MDS
96 {
97         // For Tx usage
98         u8      TxOwner[ ((MAX_USB_TX_BUFFER_NUMBER + 3) & ~0x03) ];
99         u8      *pTxBuffer;
100         u16     TxBufferSize[ ((MAX_USB_TX_BUFFER_NUMBER + 1) & ~0x01) ];
101         u8      TxDesFrom[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ];//931130.4.u // 1: MLME 2: NDIS control 3: NDIS data
102         u8      TxCountInBuffer[ ((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03) ]; // 20060928
103
104         u8      TxFillIndex;//the next index of TxBuffer can be used
105         u8      TxDesIndex;//The next index of TxDes can be used
106         u8      ScanTxPause;    //data Tx pause because the scanning is progressing, but probe request Tx won't.
107         u8      TxPause;//For pause the Mds_Tx modult
108
109         atomic_t        TxThreadCount;//For thread counting 931130.4.v
110 //950301 delete due to HW
111 //      atomic_t        TxConcurrentCount;//931130.4.w
112
113         u16     TxResult[ ((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01) ];//Collect the sending result of Mpdu
114
115         u8      MicRedundant[8]; // For tmp use
116         u8      *MicWriteAddress[2]; //The start address to fill the Mic, use 2 point due to Mic maybe fragment
117
118         u16     MicWriteSize[2]; //931130.4.x
119
120         u16     MicAdd; // If want to add the Mic, this variable equal to 8
121         u16     MicWriteIndex;//The number of MicWriteAddress 931130.4.y
122
123         u8      TxRate[ ((MAX_USB_TX_DESCRIPTOR+1)&~0x01) ][2]; // [0] current tx rate, [1] fall back rate
124         u8      TxInfo[ ((MAX_USB_TX_DESCRIPTOR+1)&~0x01) ];    //Store information for callback function
125
126         //WKCHEN added for scanning mechanism
127         u8      TxToggle;               //It is TRUE if there are tx activities in some time interval
128         u8      Reserved_[3];
129
130         //---------- for Tx Parameter
131         u16     TxFragmentThreshold;            // For frame body only
132         u16     TxRTSThreshold;
133
134         u32             MaxReceiveTime;//911220.3 Add
135
136         // depend on OS,
137         u32                                     MulticastListNo;
138         u32                                     PacketFilter; // Setting by NDIS, the current packet filter in use.
139         u8                                      MulticastAddressesArray[DEFAULT_MULTICASTLISTMAX][MAC_ADDR_LENGTH];
140
141         //COUNTERMEASURE
142         u8              bMICfailCount;
143         u8              boCounterMeasureBlock;
144         u8              reserved_4[2];
145
146         struct timer_list timer;
147
148         u32     TxTsc; // 20060214
149         u32     TxTsc_2; // 20060214
150
151 } MDS, *PMDS;
152
153
154 typedef struct _RxBuffer
155 {
156     u8 * pBufferAddress;     // Pointer the received data buffer.
157         u16     BufferSize;
158         u8      RESERVED;
159         u8      BufferIndex;// Only 1 byte
160 } RXBUFFER, *PRXBUFFER;
161
162 //
163 // Reveive Layer 1 Format.
164 //----------------------------
165 typedef struct _RXLAYER1
166 {
167     u16  SequenceNumber;     // The sequence number of the last received packet.
168         u16     BufferTotalSize;
169
170         u32     InUsed;
171     u32   DecryptionMethod;   // The desired defragment number of the next incoming packet.
172
173         u8      DeFragmentNumber;
174         u8      FrameType;
175     u8  TypeEncapsulated;
176         u8      BufferNumber;
177
178         u32     FirstFrameArrivedTime;
179
180         RXBUFFER        BufferQueue[ MAX_BUFFER_QUEUE ];
181
182         u8              LastFrameType; // 20061004 for fix intel 3945 's bug
183         u8              RESERVED[3];  //@@ anson
184
185         /////////////////////////////////////////////////////////////////////////////////////////////
186         // For brand-new Rx system
187         u8      ReservedBuffer[ 2400 ];//If Buffer ID is reserved one, it must copy the data into this area
188         u8      *ReservedBufferPoint;// Point to the next availabe address of reserved buffer
189
190 }RXLAYER1, * PRXLAYER1;
191
192 #endif