Staging: vt6656: code cleanup, fixed 'for' statements
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / staging / vt6656 / iocmd.h
CommitLineData
66252c3a
FB
1/*
2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
3 * All rights reserved.
4 *
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.
9 *
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.
14 *
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.
18 *
19 * File: iocmd.h
20 *
21 * Purpose: Handles the viawget ioctl private interface functions
22 *
23 * Author: Lyndon Chen
24 *
25 * Date: May 8, 2002
26 *
27 */
28
29#ifndef __IOCMD_H__
30#define __IOCMD_H__
31
66252c3a 32#include "ttype.h"
66252c3a
FB
33
34/*--------------------- Export Definitions -------------------------*/
35
36#if !defined(DEF)
37#define DEF
38#endif
39
66252c3a
FB
40// ioctl Command code
41#define MAGIC_CODE 0x3142
42#define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0)
43#define IOCTL_CMD_SET (SIOCDEVPRIVATE + 1)
44#define IOCTL_CMD_HOSTAPD (SIOCDEVPRIVATE + 2)
45#define IOCTL_CMD_WPA (SIOCDEVPRIVATE + 3)
46
66252c3a
FB
47typedef enum tagWMAC_CMD {
48
49 WLAN_CMD_BSS_SCAN,
50 WLAN_CMD_BSS_JOIN,
51 WLAN_CMD_DISASSOC,
52 WLAN_CMD_SET_WEP,
53 WLAN_CMD_GET_LINK,
54 WLAN_CMD_GET_LISTLEN,
55 WLAN_CMD_GET_LIST,
56 WLAN_CMD_GET_MIB,
57 WLAN_CMD_GET_STAT,
58 WLAN_CMD_STOP_MAC,
59 WLAN_CMD_START_MAC,
60 WLAN_CMD_AP_START,
61 WLAN_CMD_SET_HOSTAPD,
62 WLAN_CMD_SET_HOSTAPD_STA,
63 WLAN_CMD_SET_802_1X,
64 WLAN_CMD_SET_HOST_WEP,
65 WLAN_CMD_SET_WPA,
66 WLAN_CMD_GET_NODE_CNT,
67 WLAN_CMD_ZONETYPE_SET,
68 WLAN_CMD_GET_NODE_LIST
69
193a823c 70} WMAC_CMD, *PWMAC_CMD;
66252c3a
FB
71
72typedef enum tagWZONETYPE {
73 ZoneType_USA=0,
74 ZoneType_Japan=1,
75 ZoneType_Europe=2
76}WZONETYPE;
77
78#define ADHOC 0
79#define INFRA 1
80#define BOTH 2
81#define AP 3
82
83#define ADHOC_STARTED 1
84#define ADHOC_JOINTED 2
85
66252c3a
FB
86#define PHY80211a 0
87#define PHY80211b 1
88#define PHY80211g 2
89
90#define SSID_ID 0
91#define SSID_MAXLEN 32
92#define BSSID_LEN 6
93#define WEP_NKEYS 4
94#define WEP_KEYMAXLEN 29
95#define WEP_40BIT_LEN 5
96#define WEP_104BIT_LEN 13
97#define WEP_232BIT_LEN 16
98
99// Ioctl interface structure
100// Command structure
101//
102#pragma pack(1)
103typedef struct tagSCmdRequest {
442f9cb5 104 u8 name[16];
66252c3a 105 void *data;
26233e6e
AM
106 u16 wResult;
107 u16 wCmdCode;
66252c3a
FB
108} SCmdRequest, *PSCmdRequest;
109
110//
111// Scan
112//
113
114typedef struct tagSCmdScan {
115
442f9cb5 116 u8 ssid[SSID_MAXLEN + 2];
66252c3a
FB
117
118} SCmdScan, *PSCmdScan;
119
66252c3a
FB
120//
121// BSS Join
122//
123
124typedef struct tagSCmdBSSJoin {
125
26233e6e
AM
126 u16 wBSSType;
127 u16 wBBPType;
442f9cb5 128 u8 ssid[SSID_MAXLEN + 2];
659770d4 129 u32 uChannel;
66252c3a
FB
130 BOOL bPSEnable;
131 BOOL bShareKeyAuth;
132
133} SCmdBSSJoin, *PSCmdBSSJoin;
134
135//
136// Zonetype Setting
137//
138
139typedef struct tagSCmdZoneTypeSet {
140
141 BOOL bWrite;
142 WZONETYPE ZoneType;
143
144} SCmdZoneTypeSet, *PSCmdZoneTypeSet;
145
146#ifdef WPA_SM_Transtatus
147typedef struct tagSWPAResult {
148 char ifname[100];
442f9cb5
AM
149 u8 proto;
150 u8 key_mgmt;
151 u8 eap_type;
66252c3a
FB
152 BOOL authenticated;
153} SWPAResult, *PSWPAResult;
154#endif
155
156typedef struct tagSCmdStartAP {
157
26233e6e
AM
158 u16 wBSSType;
159 u16 wBBPType;
442f9cb5 160 u8 ssid[SSID_MAXLEN + 2];
659770d4
AM
161 u32 uChannel;
162 u32 uBeaconInt;
66252c3a 163 BOOL bShareKeyAuth;
442f9cb5 164 u8 byBasicRate;
66252c3a
FB
165
166} SCmdStartAP, *PSCmdStartAP;
167
66252c3a
FB
168typedef struct tagSCmdSetWEP {
169
170 BOOL bEnableWep;
442f9cb5
AM
171 u8 byKeyIndex;
172 u8 abyWepKey[WEP_NKEYS][WEP_KEYMAXLEN];
66252c3a 173 BOOL bWepKeyAvailable[WEP_NKEYS];
659770d4 174 u32 auWepKeyLength[WEP_NKEYS];
66252c3a
FB
175
176} SCmdSetWEP, *PSCmdSetWEP;
177
66252c3a
FB
178typedef struct tagSBSSIDItem {
179
659770d4 180 u32 uChannel;
442f9cb5
AM
181 u8 abyBSSID[BSSID_LEN];
182 u8 abySSID[SSID_MAXLEN + 1];
26233e6e
AM
183 u16 wBeaconInterval;
184 u16 wCapInfo;
442f9cb5 185 u8 byNetType;
66252c3a 186 BOOL bWEPOn;
659770d4 187 u32 uRSSI;
66252c3a
FB
188
189} SBSSIDItem;
190
191
192typedef struct tagSBSSIDList {
193
659770d4 194 u32 uItem;
66252c3a
FB
195 SBSSIDItem sBSSIDList[0];
196} SBSSIDList, *PSBSSIDList;
197
198
199typedef struct tagSNodeItem {
200 // STA info
26233e6e 201 u16 wAID;
442f9cb5 202 u8 abyMACAddr[6];
26233e6e
AM
203 u16 wTxDataRate;
204 u16 wInActiveCount;
205 u16 wEnQueueCnt;
206 u16 wFlags;
66252c3a 207 BOOL bPWBitOn;
442f9cb5 208 u8 byKeyIndex;
26233e6e 209 u16 wWepKeyLength;
442f9cb5 210 u8 abyWepKey[WEP_KEYMAXLEN];
66252c3a
FB
211 // Auto rate fallback vars
212 BOOL bIsInFallback;
659770d4
AM
213 u32 uTxFailures;
214 u32 uTxAttempts;
26233e6e 215 u16 wFailureRatio;
66252c3a
FB
216
217} SNodeItem;
218
219
220typedef struct tagSNodeList {
221
659770d4 222 u32 uItem;
66252c3a
FB
223 SNodeItem sNodeList[0];
224
225} SNodeList, *PSNodeList;
226
227
228typedef struct tagSCmdLinkStatus {
229
230 BOOL bLink;
26233e6e 231 u16 wBSSType;
442f9cb5
AM
232 u8 byState;
233 u8 abyBSSID[BSSID_LEN];
234 u8 abySSID[SSID_MAXLEN + 2];
659770d4
AM
235 u32 uChannel;
236 u32 uLinkRate;
66252c3a
FB
237
238} SCmdLinkStatus, *PSCmdLinkStatus;
239
240//
241// 802.11 counter
242//
243typedef struct tagSDot11MIBCount {
659770d4
AM
244 u32 TransmittedFragmentCount;
245 u32 MulticastTransmittedFrameCount;
246 u32 FailedCount;
247 u32 RetryCount;
248 u32 MultipleRetryCount;
249 u32 RTSSuccessCount;
250 u32 RTSFailureCount;
251 u32 ACKFailureCount;
252 u32 FrameDuplicateCount;
253 u32 ReceivedFragmentCount;
254 u32 MulticastReceivedFrameCount;
255 u32 FCSErrorCount;
193a823c 256} SDot11MIBCount, *PSDot11MIBCount;
66252c3a
FB
257
258
259
260//
261// statistic counter
262//
263typedef struct tagSStatMIBCount {
264 //
265 // ISR status count
266 //
659770d4
AM
267 u32 dwIsrTx0OK;
268 u32 dwIsrTx1OK;
269 u32 dwIsrBeaconTxOK;
270 u32 dwIsrRxOK;
271 u32 dwIsrTBTTInt;
272 u32 dwIsrSTIMERInt;
273 u32 dwIsrUnrecoverableError;
274 u32 dwIsrSoftInterrupt;
275 u32 dwIsrRxNoBuf;
66252c3a
FB
276 /////////////////////////////////////
277
659770d4 278 u32 dwIsrUnknown; /* unknown interrupt count */
66252c3a
FB
279
280 // RSR status count
281 //
659770d4
AM
282 u32 dwRsrFrmAlgnErr;
283 u32 dwRsrErr;
284 u32 dwRsrCRCErr;
285 u32 dwRsrCRCOk;
286 u32 dwRsrBSSIDOk;
287 u32 dwRsrADDROk;
288 u32 dwRsrICVOk;
289 u32 dwNewRsrShortPreamble;
290 u32 dwRsrLong;
291 u32 dwRsrRunt;
292
293 u32 dwRsrRxControl;
294 u32 dwRsrRxData;
295 u32 dwRsrRxManage;
296
297 u32 dwRsrRxPacket;
298 u32 dwRsrRxOctet;
299 u32 dwRsrBroadcast;
300 u32 dwRsrMulticast;
301 u32 dwRsrDirected;
66252c3a 302 // 64-bit OID
659770d4 303 u32 ullRsrOK;
66252c3a
FB
304
305 // for some optional OIDs (64 bits) and DMI support
659770d4
AM
306 u32 ullRxBroadcastBytes;
307 u32 ullRxMulticastBytes;
308 u32 ullRxDirectedBytes;
309 u32 ullRxBroadcastFrames;
310 u32 ullRxMulticastFrames;
311 u32 ullRxDirectedFrames;
312
313 u32 dwRsrRxFragment;
314 u32 dwRsrRxFrmLen64;
315 u32 dwRsrRxFrmLen65_127;
316 u32 dwRsrRxFrmLen128_255;
317 u32 dwRsrRxFrmLen256_511;
318 u32 dwRsrRxFrmLen512_1023;
319 u32 dwRsrRxFrmLen1024_1518;
66252c3a
FB
320
321 // TSR0,1 status count
322 //
659770d4
AM
323 u32 dwTsrTotalRetry[2]; /* total collision retry count */
324 u32 dwTsrOnceRetry[2]; /* this packet had one collision */
325 u32 dwTsrMoreThanOnceRetry[2]; /* this packet had many collisions */
326 u32 dwTsrRetry[2]; /* this packet has ever occur collision,
327 * that is (dwTsrOnceCollision0 plus
328 * dwTsrMoreThanOnceCollision0) */
329 u32 dwTsrACKData[2];
330 u32 dwTsrErr[2];
331 u32 dwAllTsrOK[2];
332 u32 dwTsrRetryTimeout[2];
333 u32 dwTsrTransmitTimeout[2];
334
335 u32 dwTsrTxPacket[2];
336 u32 dwTsrTxOctet[2];
337 u32 dwTsrBroadcast[2];
338 u32 dwTsrMulticast[2];
339 u32 dwTsrDirected[2];
66252c3a
FB
340
341 // RD/TD count
659770d4
AM
342 u32 dwCntRxFrmLength;
343 u32 dwCntTxBufLength;
66252c3a 344
442f9cb5
AM
345 u8 abyCntRxPattern[16];
346 u8 abyCntTxPattern[16];
66252c3a 347
659770d4
AM
348 /* Software check.... */
349 u32 dwCntRxDataErr; /* rx buffer data CRC err count */
350 u32 dwCntDecryptErr; /* rx buffer data CRC err count */
351 u32 dwCntRxICVErr; /* rx buffer data CRC err count */
352 u32 idxRxErrorDesc; /* index for rx data error RD */
66252c3a 353
659770d4
AM
354 /* 64-bit OID */
355 u32 ullTsrOK[2];
66252c3a
FB
356
357 // for some optional OIDs (64 bits) and DMI support
659770d4
AM
358 u32 ullTxBroadcastFrames[2];
359 u32 ullTxMulticastFrames[2];
360 u32 ullTxDirectedFrames[2];
361 u32 ullTxBroadcastBytes[2];
362 u32 ullTxMulticastBytes[2];
363 u32 ullTxDirectedBytes[2];
193a823c 364} SStatMIBCount, *PSStatMIBCount;
66252c3a 365
66252c3a
FB
366typedef struct tagSCmdValue {
367
659770d4 368 u32 dwValue;
66252c3a
FB
369
370} SCmdValue, *PSCmdValue;
371
66252c3a
FB
372//
373// hostapd & viawget ioctl related
374//
375
66252c3a
FB
376// VIAGWET_IOCTL_HOSTAPD ioctl() cmd:
377enum {
378 VIAWGET_HOSTAPD_FLUSH = 1,
379 VIAWGET_HOSTAPD_ADD_STA = 2,
380 VIAWGET_HOSTAPD_REMOVE_STA = 3,
381 VIAWGET_HOSTAPD_GET_INFO_STA = 4,
382 VIAWGET_HOSTAPD_SET_ENCRYPTION = 5,
383 VIAWGET_HOSTAPD_GET_ENCRYPTION = 6,
384 VIAWGET_HOSTAPD_SET_FLAGS_STA = 7,
385 VIAWGET_HOSTAPD_SET_ASSOC_AP_ADDR = 8,
386 VIAWGET_HOSTAPD_SET_GENERIC_ELEMENT = 9,
387 VIAWGET_HOSTAPD_MLME = 10,
388 VIAWGET_HOSTAPD_SCAN_REQ = 11,
389 VIAWGET_HOSTAPD_STA_CLEAR_STATS = 12,
390};
391
66252c3a
FB
392#define VIAWGET_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
393((int) (&((struct viawget_hostapd_param *) 0)->u.generic_elem.data))
394
395// Maximum length for algorithm names (-1 for nul termination) used in ioctl()
396
66252c3a 397struct viawget_hostapd_param {
659770d4 398 u32 cmd;
442f9cb5 399 u8 sta_addr[6];
66252c3a
FB
400 union {
401 struct {
26233e6e
AM
402 u16 aid;
403 u16 capability;
442f9cb5 404 u8 tx_supp_rates;
66252c3a
FB
405 } add_sta;
406 struct {
659770d4 407 u32 inactive_sec;
66252c3a
FB
408 } get_info_sta;
409 struct {
442f9cb5 410 u8 alg;
659770d4
AM
411 u32 flags;
412 u32 err;
442f9cb5
AM
413 u8 idx;
414 u8 seq[8];
26233e6e 415 u16 key_len;
442f9cb5 416 u8 key[0];
66252c3a
FB
417 } crypt;
418 struct {
659770d4
AM
419 u32 flags_and;
420 u32 flags_or;
66252c3a
FB
421 } set_flags_sta;
422 struct {
26233e6e
AM
423 u16 rid;
424 u16 len;
442f9cb5 425 u8 data[0];
66252c3a
FB
426 } rid;
427 struct {
442f9cb5
AM
428 u8 len;
429 u8 data[0];
66252c3a
FB
430 } generic_elem;
431 struct {
26233e6e
AM
432 u16 cmd;
433 u16 reason_code;
66252c3a
FB
434 } mlme;
435 struct {
442f9cb5
AM
436 u8 ssid_len;
437 u8 ssid[32];
66252c3a
FB
438 } scan_req;
439 } u;
440};
441
66252c3a
FB
442/*--------------------- Export Classes ----------------------------*/
443
444/*--------------------- Export Variables --------------------------*/
445
66252c3a
FB
446/*--------------------- Export Types ------------------------------*/
447
66252c3a
FB
448/*--------------------- Export Functions --------------------------*/
449
e7b07d1d 450#endif /* __IOCMD_H__ */