]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - drivers/staging/winbond/mds_s.h
atomic: use <linux/atomic.h>
[mirror_ubuntu-zesty-kernel.git] / drivers / staging / winbond / mds_s.h
CommitLineData
80aba536
PE
1#ifndef __WINBOND_MDS_H
2#define __WINBOND_MDS_H
3
4#include <linux/timer.h>
5#include <linux/types.h>
60063497 6#include <linux/atomic.h>
80aba536
PE
7
8#include "localpara.h"
9#include "mac_structures.h"
80aba536 10
4bb5a7ec
PE
11/* Preamble_Type, see <SFS-802.11G-MIB-203> */
12enum {
13 WLAN_PREAMBLE_TYPE_SHORT,
14 WLAN_PREAMBLE_TYPE_LONG,
15};
16
5ea05255
LL
17/*****************************************************************************/
18#define MAX_USB_TX_DESCRIPTOR 15 /* IS89C35 ability */
19#define MAX_USB_TX_BUFFER_NUMBER 4 /* Virtual pre-buffer number of MAX_USB_TX_BUFFER */
20#define MAX_USB_TX_BUFFER 4096 /* IS89C35 ability 4n alignment is required for hardware */
66101de1 21
5ea05255
LL
22#define AUTH_REQUEST_PAIRWISE_ERROR 0 /* _F flag setting */
23#define AUTH_REQUEST_GROUP_ERROR 1 /* _F flag setting */
66101de1 24
5ea05255
LL
25#define CURRENT_FRAGMENT_THRESHOLD (adapter->Mds.TxFragmentThreshold & ~0x1)
26#define CURRENT_PREAMBLE_MODE (psLOCAL->boShortPreamble ? WLAN_PREAMBLE_TYPE_SHORT : WLAN_PREAMBLE_TYPE_LONG)
27#define CURRENT_TX_RATE_FOR_MNG (adapter->sLocalPara.CurrentTxRateForMng)
28#define CURRENT_PROTECT_MECHANISM (psLOCAL->boProtectMechanism)
29#define CURRENT_RTS_THRESHOLD (adapter->Mds.TxRTSThreshold)
66101de1 30
5ea05255
LL
31#define MIB_GS_XMIT_OK_INC (adapter->sLocalPara.GS_XMIT_OK++)
32#define MIB_GS_RCV_OK_INC (adapter->sLocalPara.GS_RCV_OK++)
33#define MIB_GS_XMIT_ERROR_INC (adapter->sLocalPara.GS_XMIT_ERROR)
66101de1 34
5ea05255 35/* ---------- TX ----------------------------------- */
66101de1
PM
36#define ETHERNET_TX_DESCRIPTORS MAX_USB_TX_BUFFER_NUMBER
37
5ea05255
LL
38/* ---------- RX ----------------------------------- */
39#define ETHERNET_RX_DESCRIPTORS 8 /* It's not necessary to allocate more than 2 in sync indicate */
40
41/*
42 * ================================================================
43 * Configration default value
44 * ================================================================
45 */
46#define DEFAULT_MULTICASTLISTMAX 32 /* standard */
47#define DEFAULT_TX_BURSTLENGTH 3 /* 32 Longwords */
48#define DEFAULT_RX_BURSTLENGTH 3 /* 32 Longwords */
49#define DEFAULT_TX_THRESHOLD 0 /* Full Packet */
50#define DEFAULT_RX_THRESHOLD 0 /* Full Packet */
51#define DEFAULT_MAXTXRATE 6 /* 11 Mbps (Long) */
52#define DEFAULT_CHANNEL 3 /* Chennel 3 */
53#define DEFAULT_RTSThreshold 2347 /* Disable RTS */
54#define DEFAULT_PME 0 /* Disable */
55#define DEFAULT_SIFSTIME 10
56#define DEFAULT_ACKTIME_1ML 304 /* 148 + 44 + 112 */
57#define DEFAULT_ACKTIME_2ML 248 /* 148 + 44 + 56 */
58#define DEFAULT_FRAGMENT_THRESHOLD 2346 /* No fragment */
59#define DEFAULT_PREAMBLE_LENGTH 72
66101de1
PM
60#define DEFAULT_PLCPHEADERTIME_LENGTH 24
61
5ea05255
LL
62/*
63 * ------------------------------------------------------------------------
64 * 0.96 sec since time unit of the R03 for the current, W89C32 is about 60ns
65 * instead of 960 ns. This shall be fixed in the future W89C32
66 * -------------------------------------------------------------------------
67 */
68#define DEFAULT_MAX_RECEIVE_TIME 16440000
66101de1 69
5ea05255
LL
70#define RX_BUF_SIZE 2352 /* 600 - For 301 must be multiple of 8 */
71#define MAX_RX_DESCRIPTORS 18 /* Rx Layer 2 */
66101de1 72
5ea05255
LL
73/* For brand-new rx system */
74#define MDS_ID_IGNORE ETHERNET_RX_DESCRIPTORS
66101de1 75
5ea05255
LL
76/* For Tx Packet status classify */
77#define PACKET_FREE_TO_USE 0
78#define PACKET_COME_FROM_NDIS 0x08
79#define PACKET_COME_FROM_MLME 0x80
80#define PACKET_SEND_COMPLETE 0xff
66101de1 81
b7caf94f 82struct wb35_mds {
5ea05255
LL
83 /* For Tx usage */
84 u8 TxOwner[((MAX_USB_TX_BUFFER_NUMBER + 3) & ~0x03)];
8b384e0c 85 u8 *pTxBuffer;
5ea05255
LL
86 u16 TxBufferSize[((MAX_USB_TX_BUFFER_NUMBER + 1) & ~0x01)];
87 u8 TxDesFrom[((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03)];/* 1: MLME 2: NDIS control 3: NDIS data */
88 u8 TxCountInBuffer[((MAX_USB_TX_DESCRIPTOR + 3) & ~0x03)];
66101de1 89
5ea05255
LL
90 u8 TxFillIndex; /* the next index of TxBuffer can be used */
91 u8 TxDesIndex; /* The next index of TxDes can be used */
92 u8 ScanTxPause; /* data Tx pause because the scanning is progressing, but probe request Tx won't. */
93 u8 TxPause; /*For pause the Mds_Tx modult */
66101de1 94
5ea05255 95 atomic_t TxThreadCount; /* For thread counting */
66101de1 96
5ea05255 97 u16 TxResult[((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01)];/* Collect the sending result of Mpdu */
66101de1 98
5ea05255
LL
99 u8 MicRedundant[8]; /* For tmp use */
100 u8 *MicWriteAddress[2]; /* The start address to fill the Mic, use 2 point due to Mic maybe fragment */
66101de1 101
5ea05255 102 u16 MicWriteSize[2];
66101de1 103
5ea05255
LL
104 u16 MicAdd; /* If want to add the Mic, this variable equal to 8 */
105 u16 MicWriteIndex; /* The number of MicWriteAddress */
66101de1 106
5ea05255
LL
107 u8 TxRate[((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01)][2]; /* [0] current tx rate, [1] fall back rate */
108 u8 TxInfo[((MAX_USB_TX_DESCRIPTOR + 1) & ~0x01)]; /*Store information for callback function */
66101de1 109
5ea05255
LL
110 /* ---- for Tx Parameter */
111 u16 TxFragmentThreshold; /* For frame body only */
66101de1
PM
112 u16 TxRTSThreshold;
113
5ea05255 114 u32 MaxReceiveTime;
66101de1 115
5ea05255
LL
116 /* depend on OS, */
117 u32 MulticastListNo;
118 u32 PacketFilter; /* Setting by NDIS, the current packet filter in use. */
119 u8 MulticastAddressesArray[DEFAULT_MULTICASTLISTMAX][MAC_ADDR_LENGTH];
66101de1 120
5ea05255
LL
121 /* COUNTERMEASURE */
122 u8 bMICfailCount;
123 u8 boCounterMeasureBlock;
124 u8 reserved_4[2];
66101de1 125
5ea05255
LL
126 u32 TxTsc;
127 u32 TxTsc_2;
b7caf94f 128};
66101de1 129
80aba536 130#endif