diff options
Diffstat (limited to 'drivers/net/wireless/libertas/defs.h')
-rw-r--r-- | drivers/net/wireless/libertas/defs.h | 369 |
1 files changed, 369 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h new file mode 100644 index 000000000000..fb1478c1b87d --- /dev/null +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -0,0 +1,369 @@ | |||
1 | /** | ||
2 | * This header file contains global constant/enum definitions, | ||
3 | * global variable declaration. | ||
4 | */ | ||
5 | #ifndef _WLAN_DEFS_H_ | ||
6 | #define _WLAN_DEFS_H_ | ||
7 | |||
8 | #include <linux/spinlock.h> | ||
9 | |||
10 | extern unsigned int libertas_debug; | ||
11 | |||
12 | #define DRV_NAME "usb8xxx" | ||
13 | |||
14 | #define lbs_pr_info(format, args...) \ | ||
15 | printk(KERN_INFO DRV_NAME": " format, ## args) | ||
16 | #define lbs_pr_err(format, args...) \ | ||
17 | printk(KERN_ERR DRV_NAME": " format, ## args) | ||
18 | #define lbs_pr_alert(format, args...) \ | ||
19 | printk(KERN_ALERT DRV_NAME": " format, ## args) | ||
20 | |||
21 | #ifdef DEBUG | ||
22 | #define lbs_pr_debug(level, format, args...) \ | ||
23 | do { if (libertas_debug >= level) \ | ||
24 | printk(KERN_INFO DRV_NAME": " format, ##args); } while (0) | ||
25 | #define lbs_dev_dbg(level, device, format, args...) \ | ||
26 | lbs_pr_debug(level, "%s: " format, \ | ||
27 | (device)->bus_id , ## args) | ||
28 | |||
29 | static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len) | ||
30 | { | ||
31 | int i = 0; | ||
32 | |||
33 | if (!libertas_debug) | ||
34 | return; | ||
35 | |||
36 | printk(KERN_DEBUG "%s: ", prompt); | ||
37 | for (i = 1; i <= len; i++) { | ||
38 | printk(KERN_DEBUG "%02x ", (u8) * buf); | ||
39 | buf++; | ||
40 | } | ||
41 | printk("\n"); | ||
42 | } | ||
43 | #else | ||
44 | #define lbs_pr_debug(level, format, args...) do {} while (0) | ||
45 | #define lbs_dev_dbg(level, device, format, args...) do {} while (0) | ||
46 | #define lbs_dbg_hex(x,y,z) do {} while (0) | ||
47 | #endif | ||
48 | |||
49 | #define ENTER() lbs_pr_debug(1, "Enter: %s, %s:%i\n", \ | ||
50 | __FUNCTION__, __FILE__, __LINE__) | ||
51 | #define LEAVE() lbs_pr_debug(1, "Leave: %s, %s:%i\n", \ | ||
52 | __FUNCTION__, __FILE__, __LINE__) | ||
53 | |||
54 | /** Buffer Constants */ | ||
55 | |||
56 | /* The size of SQ memory PPA, DPA are 8 DWORDs, that keep the physical | ||
57 | * addresses of TxPD buffers. Station has only 8 TxPD available, Whereas | ||
58 | * driver has more local TxPDs. Each TxPD on the host memory is associated | ||
59 | * with a Tx control node. The driver maintains 8 RxPD descriptors for | ||
60 | * station firmware to store Rx packet information. | ||
61 | * | ||
62 | * Current version of MAC has a 32x6 multicast address buffer. | ||
63 | * | ||
64 | * 802.11b can have up to 14 channels, the driver keeps the | ||
65 | * BSSID(MAC address) of each APs or Ad hoc stations it has sensed. | ||
66 | */ | ||
67 | |||
68 | #define MRVDRV_MAX_MULTICAST_LIST_SIZE 32 | ||
69 | #define MRVDRV_NUM_OF_CMD_BUFFER 10 | ||
70 | #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024) | ||
71 | #define MRVDRV_MAX_CHANNEL_SIZE 14 | ||
72 | #define MRVDRV_MAX_BSSID_LIST 64 | ||
73 | #define MRVDRV_ASSOCIATION_TIME_OUT 255 | ||
74 | #define MRVDRV_SNAP_HEADER_LEN 8 | ||
75 | |||
76 | #define WLAN_UPLD_SIZE 2312 | ||
77 | #define DEV_NAME_LEN 32 | ||
78 | |||
79 | /** Misc constants */ | ||
80 | /* This section defines 802.11 specific contants */ | ||
81 | |||
82 | #define MRVDRV_MAX_BSS_DESCRIPTS 16 | ||
83 | #define MRVDRV_MAX_REGION_CODE 6 | ||
84 | |||
85 | #define MRVDRV_IGNORE_MULTIPLE_DTIM 0xfffe | ||
86 | #define MRVDRV_MIN_MULTIPLE_DTIM 1 | ||
87 | #define MRVDRV_MAX_MULTIPLE_DTIM 5 | ||
88 | #define MRVDRV_DEFAULT_MULTIPLE_DTIM 1 | ||
89 | |||
90 | #define MRVDRV_DEFAULT_LISTEN_INTERVAL 10 | ||
91 | |||
92 | #define MRVDRV_CHANNELS_PER_SCAN 4 | ||
93 | #define MRVDRV_MAX_CHANNELS_PER_SCAN 14 | ||
94 | |||
95 | #define MRVDRV_DEBUG_RX_PATH 0x00000001 | ||
96 | #define MRVDRV_DEBUG_TX_PATH 0x00000002 | ||
97 | |||
98 | #define MRVDRV_MIN_BEACON_INTERVAL 20 | ||
99 | #define MRVDRV_MAX_BEACON_INTERVAL 1000 | ||
100 | #define MRVDRV_BEACON_INTERVAL 100 | ||
101 | |||
102 | /** TxPD status */ | ||
103 | |||
104 | /* Station firmware use TxPD status field to report final Tx transmit | ||
105 | * result, Bit masks are used to present combined situations. | ||
106 | */ | ||
107 | |||
108 | #define MRVDRV_TxPD_POWER_MGMT_NULL_PACKET 0x01 | ||
109 | #define MRVDRV_TxPD_POWER_MGMT_LAST_PACKET 0x08 | ||
110 | |||
111 | /** Tx mesh flag */ | ||
112 | /* Currently we are using normal WDS flag as mesh flag. | ||
113 | * TODO: change to proper mesh flag when MAC understands it. | ||
114 | */ | ||
115 | #define TxPD_CONTROL_WDS_FRAME (1<<17) | ||
116 | #define TxPD_MESH_FRAME TxPD_CONTROL_WDS_FRAME | ||
117 | |||
118 | /** RxPD status */ | ||
119 | |||
120 | #define MRVDRV_RXPD_STATUS_OK 0x0001 | ||
121 | |||
122 | /** RxPD status - Received packet types */ | ||
123 | /** Rx mesh flag */ | ||
124 | /* Currently we are using normal WDS flag as mesh flag. | ||
125 | * TODO: change to proper mesh flag when MAC understands it. | ||
126 | */ | ||
127 | #define RxPD_CONTROL_WDS_FRAME (0x40) | ||
128 | #define RxPD_MESH_FRAME RxPD_CONTROL_WDS_FRAME | ||
129 | |||
130 | /** RSSI-related defines */ | ||
131 | /* RSSI constants are used to implement 802.11 RSSI threshold | ||
132 | * indication. if the Rx packet signal got too weak for 5 consecutive | ||
133 | * times, miniport driver (driver) will report this event to wrapper | ||
134 | */ | ||
135 | |||
136 | #define MRVDRV_NF_DEFAULT_SCAN_VALUE (-96) | ||
137 | |||
138 | /** RTS/FRAG related defines */ | ||
139 | #define MRVDRV_RTS_MIN_VALUE 0 | ||
140 | #define MRVDRV_RTS_MAX_VALUE 2347 | ||
141 | #define MRVDRV_FRAG_MIN_VALUE 256 | ||
142 | #define MRVDRV_FRAG_MAX_VALUE 2346 | ||
143 | |||
144 | /* This is for firmware specific length */ | ||
145 | #define EXTRA_LEN 36 | ||
146 | |||
147 | #define MRVDRV_ETH_TX_PACKET_BUFFER_SIZE \ | ||
148 | (ETH_FRAME_LEN + sizeof(struct txpd) + EXTRA_LEN) | ||
149 | |||
150 | #define MRVDRV_ETH_RX_PACKET_BUFFER_SIZE \ | ||
151 | (ETH_FRAME_LEN + sizeof(struct rxpd) \ | ||
152 | + MRVDRV_SNAP_HEADER_LEN + EXTRA_LEN) | ||
153 | |||
154 | #define CMD_F_HOSTCMD (1 << 0) | ||
155 | #define FW_CAPINFO_WPA (1 << 0) | ||
156 | |||
157 | /** WPA key LENGTH*/ | ||
158 | #define MRVL_MAX_KEY_WPA_KEY_LENGTH 32 | ||
159 | |||
160 | #define KEY_LEN_WPA_AES 16 | ||
161 | #define KEY_LEN_WPA_TKIP 32 | ||
162 | #define KEY_LEN_WEP_104 13 | ||
163 | #define KEY_LEN_WEP_40 5 | ||
164 | |||
165 | #define RF_ANTENNA_1 0x1 | ||
166 | #define RF_ANTENNA_2 0x2 | ||
167 | #define RF_ANTENNA_AUTO 0xFFFF | ||
168 | |||
169 | #define BAND_B (0x01) | ||
170 | #define BAND_G (0x02) | ||
171 | #define ALL_802_11_BANDS (BAND_B | BAND_G) | ||
172 | |||
173 | /** MACRO DEFINITIONS */ | ||
174 | #define CAL_NF(NF) ((s32)(-(s32)(NF))) | ||
175 | #define CAL_RSSI(SNR, NF) ((s32)((s32)(SNR) + CAL_NF(NF))) | ||
176 | #define SCAN_RSSI(RSSI) (0x100 - ((u8)(RSSI))) | ||
177 | |||
178 | #define DEFAULT_BCN_AVG_FACTOR 8 | ||
179 | #define DEFAULT_DATA_AVG_FACTOR 8 | ||
180 | #define AVG_SCALE 100 | ||
181 | #define CAL_AVG_SNR_NF(AVG, SNRNF, N) \ | ||
182 | (((AVG) == 0) ? ((u16)(SNRNF) * AVG_SCALE) : \ | ||
183 | ((((int)(AVG) * (N -1)) + ((u16)(SNRNF) * \ | ||
184 | AVG_SCALE)) / N)) | ||
185 | |||
186 | #define B_SUPPORTED_RATES 8 | ||
187 | #define G_SUPPORTED_RATES 14 | ||
188 | |||
189 | #define WLAN_SUPPORTED_RATES 14 | ||
190 | |||
191 | #define MAX_LEDS 8 | ||
192 | |||
193 | #define IS_MESH_FRAME(x) (x->cb[6]) | ||
194 | #define SET_MESH_FRAME(x) (x->cb[6]=1) | ||
195 | #define UNSET_MESH_FRAME(x) (x->cb[6]=0) | ||
196 | |||
197 | /** Global Variable Declaration */ | ||
198 | typedef struct _wlan_private wlan_private; | ||
199 | typedef struct _wlan_adapter wlan_adapter; | ||
200 | extern const char libertas_driver_version[]; | ||
201 | extern u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE]; | ||
202 | |||
203 | extern u8 libertas_wlan_data_rates[WLAN_SUPPORTED_RATES]; | ||
204 | |||
205 | extern u8 libertas_supported_rates[G_SUPPORTED_RATES]; | ||
206 | |||
207 | extern u8 libertas_adhoc_rates_g[G_SUPPORTED_RATES]; | ||
208 | |||
209 | extern u8 libertas_adhoc_rates_b[4]; | ||
210 | |||
211 | /** ENUM definition*/ | ||
212 | /** SNRNF_TYPE */ | ||
213 | enum SNRNF_TYPE { | ||
214 | TYPE_BEACON = 0, | ||
215 | TYPE_RXPD, | ||
216 | MAX_TYPE_B | ||
217 | }; | ||
218 | |||
219 | /** SNRNF_DATA*/ | ||
220 | enum SNRNF_DATA { | ||
221 | TYPE_NOAVG = 0, | ||
222 | TYPE_AVG, | ||
223 | MAX_TYPE_AVG | ||
224 | }; | ||
225 | |||
226 | /** WLAN_802_11_AUTH_ALG*/ | ||
227 | enum WLAN_802_11_AUTH_ALG { | ||
228 | AUTH_ALG_OPEN_SYSTEM = 1, | ||
229 | AUTH_ALG_SHARED_KEY = 2, | ||
230 | AUTH_ALG_NETWORK_EAP = 8, | ||
231 | }; | ||
232 | |||
233 | /** WLAN_802_1X_AUTH_ALG */ | ||
234 | enum WLAN_802_1X_AUTH_ALG { | ||
235 | WLAN_1X_AUTH_ALG_NONE = 1, | ||
236 | WLAN_1X_AUTH_ALG_LEAP = 2, | ||
237 | WLAN_1X_AUTH_ALG_TLS = 4, | ||
238 | WLAN_1X_AUTH_ALG_TTLS = 8, | ||
239 | WLAN_1X_AUTH_ALG_MD5 = 16, | ||
240 | }; | ||
241 | |||
242 | /** WLAN_802_11_ENCRYPTION_MODE */ | ||
243 | enum WLAN_802_11_ENCRYPTION_MODE { | ||
244 | CIPHER_NONE, | ||
245 | CIPHER_WEP40, | ||
246 | CIPHER_TKIP, | ||
247 | CIPHER_CCMP, | ||
248 | CIPHER_WEP104, | ||
249 | }; | ||
250 | |||
251 | /** WLAN_802_11_POWER_MODE */ | ||
252 | enum WLAN_802_11_POWER_MODE { | ||
253 | wlan802_11powermodecam, | ||
254 | wlan802_11powermodemax_psp, | ||
255 | wlan802_11Powermodefast_psp, | ||
256 | /*not a real mode, defined as an upper bound */ | ||
257 | wlan802_11powemodemax | ||
258 | }; | ||
259 | |||
260 | /** PS_STATE */ | ||
261 | enum PS_STATE { | ||
262 | PS_STATE_FULL_POWER, | ||
263 | PS_STATE_AWAKE, | ||
264 | PS_STATE_PRE_SLEEP, | ||
265 | PS_STATE_SLEEP | ||
266 | }; | ||
267 | |||
268 | /** DNLD_STATE */ | ||
269 | enum DNLD_STATE { | ||
270 | DNLD_RES_RECEIVED, | ||
271 | DNLD_DATA_SENT, | ||
272 | DNLD_CMD_SENT | ||
273 | }; | ||
274 | |||
275 | /** WLAN_MEDIA_STATE */ | ||
276 | enum WLAN_MEDIA_STATE { | ||
277 | libertas_connected, | ||
278 | libertas_disconnected | ||
279 | }; | ||
280 | |||
281 | /** WLAN_802_11_PRIVACY_FILTER */ | ||
282 | enum WLAN_802_11_PRIVACY_FILTER { | ||
283 | wlan802_11privfilteracceptall, | ||
284 | wlan802_11privfilter8021xWEP | ||
285 | }; | ||
286 | |||
287 | /** mv_ms_type */ | ||
288 | enum mv_ms_type { | ||
289 | MVMS_DAT = 0, | ||
290 | MVMS_CMD = 1, | ||
291 | MVMS_TXDONE = 2, | ||
292 | MVMS_EVENT | ||
293 | }; | ||
294 | |||
295 | /** WLAN_802_11_NETWORK_INFRASTRUCTURE */ | ||
296 | enum WLAN_802_11_NETWORK_INFRASTRUCTURE { | ||
297 | wlan802_11ibss, | ||
298 | wlan802_11infrastructure, | ||
299 | wlan802_11autounknown, | ||
300 | /*defined as upper bound */ | ||
301 | wlan802_11infrastructuremax | ||
302 | }; | ||
303 | |||
304 | /** WLAN_802_11_AUTHENTICATION_MODE */ | ||
305 | enum WLAN_802_11_AUTHENTICATION_MODE { | ||
306 | wlan802_11authmodeopen = 0x00, | ||
307 | wlan802_11authmodeshared = 0x01, | ||
308 | wlan802_11authmodenetworkEAP = 0x80, | ||
309 | }; | ||
310 | |||
311 | /** WLAN_802_11_WEP_STATUS */ | ||
312 | enum WLAN_802_11_WEP_STATUS { | ||
313 | wlan802_11WEPenabled, | ||
314 | wlan802_11WEPdisabled, | ||
315 | }; | ||
316 | |||
317 | /** SNMP_MIB_INDEX_e */ | ||
318 | enum SNMP_MIB_INDEX_e { | ||
319 | desired_bsstype_i = 0, | ||
320 | op_rateset_i, | ||
321 | bcnperiod_i, | ||
322 | dtimperiod_i, | ||
323 | assocrsp_timeout_i, | ||
324 | rtsthresh_i, | ||
325 | short_retrylim_i, | ||
326 | long_retrylim_i, | ||
327 | fragthresh_i, | ||
328 | dot11d_i, | ||
329 | dot11h_i, | ||
330 | manufid_i, | ||
331 | prodID_i, | ||
332 | manuf_oui_i, | ||
333 | manuf_name_i, | ||
334 | manuf_prodname_i, | ||
335 | manuf_prodver_i, | ||
336 | }; | ||
337 | |||
338 | /** KEY_TYPE_ID */ | ||
339 | enum KEY_TYPE_ID { | ||
340 | KEY_TYPE_ID_WEP = 0, | ||
341 | KEY_TYPE_ID_TKIP, | ||
342 | KEY_TYPE_ID_AES | ||
343 | }; | ||
344 | |||
345 | /** KEY_INFO_WPA (applies to both TKIP and AES/CCMP) */ | ||
346 | enum KEY_INFO_WPA { | ||
347 | KEY_INFO_WPA_MCAST = 0x01, | ||
348 | KEY_INFO_WPA_UNICAST = 0x02, | ||
349 | KEY_INFO_WPA_ENABLED = 0x04 | ||
350 | }; | ||
351 | |||
352 | /** SNMP_MIB_VALUE_e */ | ||
353 | enum SNMP_MIB_VALUE_e { | ||
354 | SNMP_MIB_VALUE_INFRA = 1, | ||
355 | SNMP_MIB_VALUE_ADHOC | ||
356 | }; | ||
357 | |||
358 | /* Default values for fwt commands. */ | ||
359 | #define FWT_DEFAULT_METRIC 0 | ||
360 | #define FWT_DEFAULT_DIR 1 | ||
361 | #define FWT_DEFAULT_SSN 0xffffffff | ||
362 | #define FWT_DEFAULT_DSN 0 | ||
363 | #define FWT_DEFAULT_HOPCOUNT 0 | ||
364 | #define FWT_DEFAULT_TTL 0 | ||
365 | #define FWT_DEFAULT_EXPIRATION 0 | ||
366 | #define FWT_DEFAULT_SLEEPMODE 0 | ||
367 | #define FWT_DEFAULT_SNR 0 | ||
368 | |||
369 | #endif /* _WLAN_DEFS_H_ */ | ||