usb/isp1760: Clear TT buffer on interrupted low & full speed transfers
[zen-stable.git] / drivers / staging / vt6655 / iocmd.h
blob166351bb71a6bb857a974136f5d5547ef604d544
1 /*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * File: iocmd.h
21 * Purpose: Handles the viawget ioctl private interface functions
23 * Author: Lyndon Chen
25 * Date: May 8, 2002
29 #ifndef __IOCMD_H__
30 #define __IOCMD_H__
32 #include "ttype.h"
34 /*--------------------- Export Definitions -------------------------*/
36 //typedef uint32_t u32;
37 //typedef uint16_t u16;
38 //typedef uint8_t u8;
41 // ioctl Command code
42 #define MAGIC_CODE 0x3142
43 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
44 #define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
45 #define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
46 #define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
49 typedef enum tagWMAC_CMD {
51 WLAN_CMD_BSS_SCAN,
52 WLAN_CMD_BSS_JOIN,
53 WLAN_CMD_DISASSOC,
54 WLAN_CMD_SET_WEP,
55 WLAN_CMD_GET_LINK,
56 WLAN_CMD_GET_LISTLEN,
57 WLAN_CMD_GET_LIST,
58 WLAN_CMD_GET_MIB,
59 WLAN_CMD_GET_STAT,
60 WLAN_CMD_STOP_MAC,
61 WLAN_CMD_START_MAC,
62 WLAN_CMD_AP_START,
63 WLAN_CMD_SET_HOSTAPD,
64 WLAN_CMD_SET_HOSTAPD_STA,
65 WLAN_CMD_SET_802_1X,
66 WLAN_CMD_SET_HOST_WEP,
67 WLAN_CMD_SET_WPA,
68 WLAN_CMD_GET_NODE_CNT,
69 WLAN_CMD_ZONETYPE_SET,
70 WLAN_CMD_GET_NODE_LIST
72 } WMAC_CMD, *PWMAC_CMD;
74 typedef enum tagWZONETYPE {
75 ZoneType_USA=0,
76 ZoneType_Japan=1,
77 ZoneType_Europe=2
78 }WZONETYPE;
80 #define ADHOC 0
81 #define INFRA 1
82 #define BOTH 2
83 #define AP 3
85 #define ADHOC_STARTED 1
86 #define ADHOC_JOINTED 2
89 #define PHY80211a 0
90 #define PHY80211b 1
91 #define PHY80211g 2
93 #define SSID_ID 0
94 #define SSID_MAXLEN 32
95 #define BSSID_LEN 6
96 #define WEP_NKEYS 4
97 #define WEP_KEYMAXLEN 29
98 #define WEP_40BIT_LEN 5
99 #define WEP_104BIT_LEN 13
100 #define WEP_232BIT_LEN 16
102 // Ioctl interface structure
103 // Command structure
105 #pragma pack(1)
106 typedef struct tagSCmdRequest {
107 u8 name[16];
108 void *data;
109 u16 wResult;
110 u16 wCmdCode;
111 } SCmdRequest, *PSCmdRequest;
114 // Scan
117 typedef struct tagSCmdScan {
119 u8 ssid[SSID_MAXLEN + 2];
121 } SCmdScan, *PSCmdScan;
125 // BSS Join
128 typedef struct tagSCmdBSSJoin {
130 u16 wBSSType;
131 u16 wBBPType;
132 u8 ssid[SSID_MAXLEN + 2];
133 u32 uChannel;
134 bool bPSEnable;
135 bool bShareKeyAuth;
137 } SCmdBSSJoin, *PSCmdBSSJoin;
140 // Zonetype Setting
143 typedef struct tagSCmdZoneTypeSet {
145 bool bWrite;
146 WZONETYPE ZoneType;
148 } SCmdZoneTypeSet, *PSCmdZoneTypeSet;
150 #ifdef WPA_SM_Transtatus
151 typedef struct tagSWPAResult {
152 char ifname[100];
153 u8 proto;
154 u8 key_mgmt;
155 u8 eap_type;
156 bool authenticated;
157 } SWPAResult, *PSWPAResult;
158 #endif
160 typedef struct tagSCmdStartAP {
162 u16 wBSSType;
163 u16 wBBPType;
164 u8 ssid[SSID_MAXLEN + 2];
165 u32 uChannel;
166 u32 uBeaconInt;
167 bool bShareKeyAuth;
168 u8 byBasicRate;
170 } SCmdStartAP, *PSCmdStartAP;
173 typedef struct tagSCmdSetWEP {
175 bool bEnableWep;
176 u8 byKeyIndex;
177 u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
178 bool bWepKeyAvailable[WEP_NKEYS];
179 u32 auWepKeyLength[WEP_NKEYS];
181 } SCmdSetWEP, *PSCmdSetWEP;
185 typedef struct tagSBSSIDItem {
187 u32 uChannel;
188 u8 abyBSSID[BSSID_LEN];
189 u8 abySSID[SSID_MAXLEN + 1];
190 //2006-1116-01,<Modify> by NomadZhao
191 //u16 wBeaconInterval;
192 //u16 wCapInfo;
193 //u8 byNetType;
194 u8 byNetType;
195 u16 wBeaconInterval;
196 u16 wCapInfo; // for address of byNetType at align 4
198 bool bWEPOn;
199 u32 uRSSI;
201 } SBSSIDItem;
204 typedef struct tagSBSSIDList {
206 u32 uItem;
207 SBSSIDItem sBSSIDList[0];
208 } SBSSIDList, *PSBSSIDList;
211 typedef struct tagSCmdLinkStatus {
213 bool bLink;
214 u16 wBSSType;
215 u8 byState;
216 u8 abyBSSID[BSSID_LEN];
217 u8 abySSID[SSID_MAXLEN + 2];
218 u32 uChannel;
219 u32 uLinkRate;
221 } SCmdLinkStatus, *PSCmdLinkStatus;
224 // 802.11 counter
226 typedef struct tagSDot11MIBCount {
227 u32 TransmittedFragmentCount;
228 u32 MulticastTransmittedFrameCount;
229 u32 FailedCount;
230 u32 RetryCount;
231 u32 MultipleRetryCount;
232 u32 RTSSuccessCount;
233 u32 RTSFailureCount;
234 u32 ACKFailureCount;
235 u32 FrameDuplicateCount;
236 u32 ReceivedFragmentCount;
237 u32 MulticastReceivedFrameCount;
238 u32 FCSErrorCount;
239 } SDot11MIBCount, *PSDot11MIBCount;
244 // statistic counter
246 typedef struct tagSStatMIBCount {
248 // ISR status count
250 u32 dwIsrTx0OK;
251 u32 dwIsrTx1OK;
252 u32 dwIsrBeaconTxOK;
253 u32 dwIsrRxOK;
254 u32 dwIsrTBTTInt;
255 u32 dwIsrSTIMERInt;
256 u32 dwIsrUnrecoverableError;
257 u32 dwIsrSoftInterrupt;
258 u32 dwIsrRxNoBuf;
259 /////////////////////////////////////
261 u32 dwIsrUnknown; // unknown interrupt count
263 // RSR status count
265 u32 dwRsrFrmAlgnErr;
266 u32 dwRsrErr;
267 u32 dwRsrCRCErr;
268 u32 dwRsrCRCOk;
269 u32 dwRsrBSSIDOk;
270 u32 dwRsrADDROk;
271 u32 dwRsrICVOk;
272 u32 dwNewRsrShortPreamble;
273 u32 dwRsrLong;
274 u32 dwRsrRunt;
276 u32 dwRsrRxControl;
277 u32 dwRsrRxData;
278 u32 dwRsrRxManage;
280 u32 dwRsrRxPacket;
281 u32 dwRsrRxOctet;
282 u32 dwRsrBroadcast;
283 u32 dwRsrMulticast;
284 u32 dwRsrDirected;
285 // 64-bit OID
286 u32 ullRsrOK;
288 // for some optional OIDs (64 bits) and DMI support
289 u32 ullRxBroadcastBytes;
290 u32 ullRxMulticastBytes;
291 u32 ullRxDirectedBytes;
292 u32 ullRxBroadcastFrames;
293 u32 ullRxMulticastFrames;
294 u32 ullRxDirectedFrames;
296 u32 dwRsrRxFragment;
297 u32 dwRsrRxFrmLen64;
298 u32 dwRsrRxFrmLen65_127;
299 u32 dwRsrRxFrmLen128_255;
300 u32 dwRsrRxFrmLen256_511;
301 u32 dwRsrRxFrmLen512_1023;
302 u32 dwRsrRxFrmLen1024_1518;
304 // TSR0,1 status count
306 u32 dwTsrTotalRetry[2]; // total collision retry count
307 u32 dwTsrOnceRetry[2]; // this packet only occur one collision
308 u32 dwTsrMoreThanOnceRetry[2]; // this packet occur more than one collision
309 u32 dwTsrRetry[2]; // this packet has ever occur collision,
310 // that is (dwTsrOnceCollision0 + dwTsrMoreThanOnceCollision0)
311 u32 dwTsrACKData[2];
312 u32 dwTsrErr[2];
313 u32 dwAllTsrOK[2];
314 u32 dwTsrRetryTimeout[2];
315 u32 dwTsrTransmitTimeout[2];
317 u32 dwTsrTxPacket[2];
318 u32 dwTsrTxOctet[2];
319 u32 dwTsrBroadcast[2];
320 u32 dwTsrMulticast[2];
321 u32 dwTsrDirected[2];
323 // RD/TD count
324 u32 dwCntRxFrmLength;
325 u32 dwCntTxBufLength;
327 u8 abyCntRxPattern[16];
328 u8 abyCntTxPattern[16];
330 // Software check....
331 u32 dwCntRxDataErr; // rx buffer data software compare CRC err count
332 u32 dwCntDecryptErr; // rx buffer data software compare CRC err count
333 u32 dwCntRxICVErr; // rx buffer data software compare CRC err count
334 u32 idxRxErrorDesc; // index for rx data error RD
336 // 64-bit OID
337 u32 ullTsrOK[2];
339 // for some optional OIDs (64 bits) and DMI support
340 u32 ullTxBroadcastFrames[2];
341 u32 ullTxMulticastFrames[2];
342 u32 ullTxDirectedFrames[2];
343 u32 ullTxBroadcastBytes[2];
344 u32 ullTxMulticastBytes[2];
345 u32 ullTxDirectedBytes[2];
346 } SStatMIBCount, *PSStatMIBCount;
349 typedef struct tagSNodeItem {
350 // STA info
351 u16 wAID;
352 u8 abyMACAddr[6];
353 u16 wTxDataRate;
354 u16 wInActiveCount;
355 u16 wEnQueueCnt;
356 u16 wFlags;
357 bool bPWBitOn;
358 u8 byKeyIndex;
359 u16 wWepKeyLength;
360 u8 abyWepKey[WEP_KEYMAXLEN];
361 // Auto rate fallback vars
362 bool bIsInFallback;
363 u32 uTxFailures;
364 u32 uTxAttempts;
365 u16 wFailureRatio;
367 } SNodeItem;
370 typedef struct tagSNodeList {
372 u32 uItem;
373 SNodeItem sNodeList[0];
375 } SNodeList, *PSNodeList;
379 typedef struct tagSCmdValue {
381 u32 dwValue;
383 } SCmdValue, *PSCmdValue;
387 // hostapd & viawget ioctl related
391 // VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
392 enum {
393 VIAWGET_HOSTAPD_FLUSH = 1,
394 VIAWGET_HOSTAPD_ADD_STA = 2,
395 VIAWGET_HOSTAPD_REMOVE_STA = 3,
396 VIAWGET_HOSTAPD_GET_INFO_STA = 4,
397 VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
398 VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
399 VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
400 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
401 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
402 VIAWGET_HOSTAPD_MLME = 10,
403 VIAWGET_HOSTAPD_SCAN_REQ = 11,
404 VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
408 #define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
409 ((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
411 // Maximum length for algorithm names (-1 for nul termination) used in ioctl()
415 struct viawget_hostapd_param {
416 u32 cmd;
417 u8 sta_addr[6];
418 union {
419 struct {
420 u16 aid;
421 u16 capability;
422 u8 tx_supp_rates;
423 } add_sta;
424 struct {
425 u32 inactive_sec;
426 } get_info_sta;
427 struct {
428 u8 alg;
429 u32 flags;
430 u32 err;
431 u8 idx;
432 u8 seq[8];
433 u16 key_len;
434 u8 key[0];
435 } crypt;
436 struct {
437 u32 flags_and;
438 u32 flags_or;
439 } set_flags_sta;
440 struct {
441 u16 rid;
442 u16 len;
443 u8 data[0];
444 } rid;
445 struct {
446 u8 len;
447 u8 data[0];
448 } generic_elem;
449 struct {
450 u16 cmd;
451 u16 reason_code;
452 } mlme;
453 struct {
454 u8 ssid_len;
455 u8 ssid[32];
456 } scan_req;
457 } u;
460 //2006-1116-01,<Add> by NomadZhao
461 #pragma pack()
463 /*--------------------- Export Classes ----------------------------*/
465 /*--------------------- Export Variables --------------------------*/
468 /*--------------------- Export Types ------------------------------*/
471 /*--------------------- Export Functions --------------------------*/
475 #endif //__IOCMD_H__