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