Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v3.14 811 lines 21 kB view raw
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: device.h 20 * 21 * Purpose: MAC Data structure 22 * 23 * Author: Tevin Chen 24 * 25 * Date: Mar 17, 1997 26 * 27 */ 28 29#ifndef __DEVICE_H__ 30#define __DEVICE_H__ 31 32#include <linux/module.h> 33#include <linux/kernel.h> 34#include <linux/slab.h> 35#include <linux/delay.h> 36#include <linux/device.h> 37#include <linux/firmware.h> 38#include <linux/etherdevice.h> 39#include <linux/suspend.h> 40#include <linux/if_arp.h> 41#include <linux/wireless.h> 42#include <net/iw_handler.h> 43#include <net/cfg80211.h> 44#include <linux/timer.h> 45#include <linux/usb.h> 46#include <linux/crc32.h> 47 48#ifdef SIOCETHTOOL 49#define DEVICE_ETHTOOL_IOCTL_SUPPORT 50#include <linux/ethtool.h> 51#else 52#undef DEVICE_ETHTOOL_IOCTL_SUPPORT 53#endif 54 55/* please copy below macro to driver_event.c for API */ 56#define RT_INSMOD_EVENT_FLAG 0x0101 57#define RT_UPDEV_EVENT_FLAG 0x0102 58#define RT_DISCONNECTED_EVENT_FLAG 0x0103 59#define RT_WPACONNECTED_EVENT_FLAG 0x0104 60#define RT_DOWNDEV_EVENT_FLAG 0x0105 61#define RT_RMMOD_EVENT_FLAG 0x0106 62 63/* 64 * device specific 65 */ 66 67#include "device_cfg.h" 68#include "80211hdr.h" 69#include "tether.h" 70#include "wmgr.h" 71#include "wcmd.h" 72#include "srom.h" 73#include "rc4.h" 74#include "desc.h" 75#include "key.h" 76#include "card.h" 77#include "rndis.h" 78 79#define VNT_USB_VENDOR_ID 0x160a 80#define VNT_USB_PRODUCT_ID 0x3184 81 82#define MAC_MAX_CONTEXT_REG (256+128) 83 84#define MAX_MULTICAST_ADDRESS_NUM 32 85#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) 86 87#define DUPLICATE_RX_CACHE_LENGTH 5 88 89#define NUM_KEY_ENTRY 11 90 91#define TX_WEP_NONE 0 92#define TX_WEP_OTF 1 93#define TX_WEP_SW 2 94#define TX_WEP_SWOTP 3 95#define TX_WEP_OTPSW 4 96#define TX_WEP_SW232 5 97 98#define KEYSEL_WEP40 0 99#define KEYSEL_WEP104 1 100#define KEYSEL_TKIP 2 101#define KEYSEL_CCMP 3 102 103#define AUTO_FB_NONE 0 104#define AUTO_FB_0 1 105#define AUTO_FB_1 2 106 107#define FB_RATE0 0 108#define FB_RATE1 1 109 110/* Antenna Mode */ 111#define ANT_A 0 112#define ANT_B 1 113#define ANT_DIVERSITY 2 114#define ANT_RXD_TXA 3 115#define ANT_RXD_TXB 4 116#define ANT_UNKNOWN 0xFF 117#define ANT_TXA 0 118#define ANT_TXB 1 119#define ANT_RXA 2 120#define ANT_RXB 3 121 122#define MAXCHECKHANGCNT 4 123 124/* Packet type */ 125#define TX_PKT_UNI 0x00 126#define TX_PKT_MULTI 0x01 127#define TX_PKT_BROAD 0x02 128 129#define BB_VGA_LEVEL 4 130#define BB_VGA_CHANGE_THRESHOLD 3 131 132#ifndef RUN_AT 133#define RUN_AT(x) (jiffies+(x)) 134#endif 135 136/* DMA related */ 137#define RESERV_AC0DMA 4 138 139#define PRIVATE_Message 0 140 141#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); } 142#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); } 143 144typedef enum __device_msg_level { 145 MSG_LEVEL_ERR = 0, /* Errors causing abnormal operation */ 146 MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */ 147 MSG_LEVEL_INFO = 2, /* Normal message. */ 148 MSG_LEVEL_VERBOSE = 3, /* Will report all trival errors. */ 149 MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */ 150} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; 151 152#define DEVICE_INIT_COLD 0x0 /* cold init */ 153#define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */ 154#define DEVICE_INIT_DXPL 0x2 /* Dx to D0 power lost init */ 155 156/* USB */ 157 158/* 159 * Enum of context types for SendPacket 160 */ 161typedef enum _CONTEXT_TYPE { 162 CONTEXT_DATA_PACKET = 1, 163 CONTEXT_MGMT_PACKET 164} CONTEXT_TYPE; 165 166/* RCB (Receive Control Block) */ 167struct vnt_rcb { 168 void *Next; 169 signed long Ref; 170 void *pDevice; 171 struct urb *pUrb; 172 struct vnt_rx_mgmt sMngPacket; 173 struct sk_buff *skb; 174 int bBoolInUse; 175}; 176 177/* used to track bulk out irps */ 178struct vnt_usb_send_context { 179 void *pDevice; 180 struct sk_buff *pPacket; 181 struct urb *pUrb; 182 unsigned int uBufLen; 183 CONTEXT_TYPE Type; 184 struct ethhdr sEthHeader; 185 void *Next; 186 bool bBoolInUse; 187 unsigned char Data[MAX_TOTAL_SIZE_WITH_ALL_HEADERS]; 188}; 189 190/* tx packet info for rxtx */ 191struct vnt_tx_pkt_info { 192 u16 fifo_ctl; 193 u8 dest_addr[ETH_ALEN]; 194}; 195 196/* structure got from configuration file as user-desired default settings */ 197typedef struct _DEFAULT_CONFIG { 198 signed int ZoneType; 199 signed int eConfigMode; 200 signed int eAuthenMode; /* open/wep/wpa */ 201 signed int bShareKeyAlgorithm; /* open-open/{open,wep}-sharekey */ 202 signed int keyidx; /* wepkey index */ 203 signed int eEncryptionStatus; 204} DEFAULT_CONFIG, *PDEFAULT_CONFIG; 205 206/* 207 * Structure to keep track of USB interrupt packets 208 */ 209typedef struct { 210 unsigned int uDataLen; 211 u8 * pDataBuf; 212 /* struct urb *pUrb; */ 213 bool bInUse; 214} INT_BUFFER, *PINT_BUFFER; 215 216/* 0:11A 1:11B 2:11G */ 217typedef enum _VIA_BB_TYPE 218{ 219 BB_TYPE_11A = 0, 220 BB_TYPE_11B, 221 BB_TYPE_11G 222} VIA_BB_TYPE, *PVIA_BB_TYPE; 223 224/* 0:11a, 1:11b, 2:11gb (only CCK in BasicRate), 3:11ga(OFDM in BasicRate) */ 225typedef enum _VIA_PKT_TYPE 226{ 227 PK_TYPE_11A = 0, 228 PK_TYPE_11B, 229 PK_TYPE_11GB, 230 PK_TYPE_11GA 231} VIA_PKT_TYPE, *PVIA_PKT_TYPE; 232 233/*++ NDIS related */ 234 235typedef enum __DEVICE_NDIS_STATUS { 236 STATUS_SUCCESS = 0, 237 STATUS_FAILURE, 238 STATUS_RESOURCES, 239 STATUS_PENDING, 240} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS; 241 242#define MAX_BSSIDINFO_4_PMKID 16 243#define MAX_PMKIDLIST 5 244/* flags for PMKID Candidate list structure */ 245#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01 246 247/* PMKID Structures */ 248typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; 249 250typedef enum _NDIS_802_11_WEP_STATUS 251{ 252 Ndis802_11WEPEnabled, 253 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled, 254 Ndis802_11WEPDisabled, 255 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled, 256 Ndis802_11WEPKeyAbsent, 257 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent, 258 Ndis802_11WEPNotSupported, 259 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported, 260 Ndis802_11Encryption2Enabled, 261 Ndis802_11Encryption2KeyAbsent, 262 Ndis802_11Encryption3Enabled, 263 Ndis802_11Encryption3KeyAbsent 264} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, 265 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; 266 267typedef enum _NDIS_802_11_STATUS_TYPE 268{ 269 Ndis802_11StatusType_Authentication, 270 Ndis802_11StatusType_MediaStreamMode, 271 Ndis802_11StatusType_PMKID_CandidateList, 272 Ndis802_11StatusTypeMax, /* not a real type, defined as upper bound */ 273} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE; 274 275/* added new types for PMKID Candidate lists */ 276typedef struct _PMKID_CANDIDATE { 277 NDIS_802_11_MAC_ADDRESS BSSID; 278 unsigned long Flags; 279} PMKID_CANDIDATE, *PPMKID_CANDIDATE; 280 281typedef struct _BSSID_INFO 282{ 283 NDIS_802_11_MAC_ADDRESS BSSID; 284 NDIS_802_11_PMKID_VALUE PMKID; 285} BSSID_INFO, *PBSSID_INFO; 286 287typedef struct tagSPMKID { 288 unsigned long Length; 289 unsigned long BSSIDInfoCount; 290 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID]; 291} SPMKID, *PSPMKID; 292 293typedef struct tagSPMKIDCandidateEvent { 294 NDIS_802_11_STATUS_TYPE StatusType; 295 unsigned long Version; /* Version of the structure */ 296 unsigned long NumCandidates; /* No. of pmkid candidates */ 297 PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST]; 298} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent; 299 300/*++ 802.11h related */ 301#define MAX_QUIET_COUNT 8 302 303typedef struct tagSQuietControl { 304 bool bEnable; 305 u32 dwStartTime; 306 u8 byPeriod; 307 u16 wDuration; 308} SQuietControl, *PSQuietControl; 309 310/* The receive duplicate detection cache entry */ 311typedef struct tagSCacheEntry{ 312 u16 wFmSequence; 313 u8 abyAddr2[ETH_ALEN]; 314 u16 wFrameCtl; 315} SCacheEntry, *PSCacheEntry; 316 317typedef struct tagSCache{ 318/* The receive cache is updated circularly. The next entry to be written is 319 * indexed by the "InPtr". 320 */ 321 unsigned int uInPtr; /* Place to use next */ 322 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH]; 323} SCache, *PSCache; 324 325#define CB_MAX_RX_FRAG 64 326/* 327 * DeFragment Control Block, used for collecting fragments prior to reassembly 328 */ 329typedef struct tagSDeFragControlBlock 330{ 331 u16 wSequence; 332 u16 wFragNum; 333 u8 abyAddr2[ETH_ALEN]; 334 unsigned int uLifetime; 335 struct sk_buff* skb; 336 u8 * pbyRxBuffer; 337 unsigned int cbFrameLength; 338 bool bInUse; 339} SDeFragControlBlock, *PSDeFragControlBlock; 340 341/* flags for options */ 342#define DEVICE_FLAGS_UNPLUG 0x00000001UL 343#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL 344#define DEVICE_FLAGS_OP_MODE 0x00000004UL 345#define DEVICE_FLAGS_PS_MODE 0x00000008UL 346#define DEVICE_FLAGS_80211h_MODE 0x00000010UL 347 348/* flags for driver status */ 349#define DEVICE_FLAGS_OPENED 0x00010000UL 350#define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL 351/* flags for capabilities */ 352#define DEVICE_FLAGS_TX_ALIGN 0x01000000UL 353#define DEVICE_FLAGS_HAVE_CAM 0x02000000UL 354#define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL 355 356/* flags for MII status */ 357#define DEVICE_LINK_FAIL 0x00000001UL 358#define DEVICE_SPEED_10 0x00000002UL 359#define DEVICE_SPEED_100 0x00000004UL 360#define DEVICE_SPEED_1000 0x00000008UL 361#define DEVICE_DUPLEX_FULL 0x00000010UL 362#define DEVICE_AUTONEG_ENABLE 0x00000020UL 363#define DEVICE_FORCED_BY_EEPROM 0x00000040UL 364/* for device_set_media_duplex */ 365#define DEVICE_LINK_CHANGE 0x00000001UL 366 367typedef struct __device_opt { 368 int nRxDescs0; /* number of RX descriptors 0 */ 369 int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ 370 int rts_thresh; /* RTS threshold */ 371 int frag_thresh; 372 int OpMode; 373 int data_rate; 374 int channel_num; 375 int short_retry; 376 int long_retry; 377 int bbp_type; 378 u32 flags; 379} OPTIONS, *POPTIONS; 380 381struct vnt_private { 382 /* netdev */ 383 struct usb_device *usb; 384 struct net_device *dev; 385 struct net_device_stats stats; 386 387 OPTIONS sOpts; 388 389 struct tasklet_struct CmdWorkItem; 390 struct tasklet_struct EventWorkItem; 391 struct work_struct read_work_item; 392 struct work_struct rx_mng_work_item; 393 394 u32 rx_buf_sz; 395 int multicast_limit; 396 u8 byRxMode; 397 398 spinlock_t lock; 399 400 u32 rx_bytes; 401 402 u8 byRevId; 403 404 u32 flags; 405 unsigned long Flags; 406 407 SCache sDupRxCache; 408 409 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG]; 410 u32 cbDFCB; 411 u32 cbFreeDFCB; 412 u32 uCurrentDFCBIdx; 413 414 /* USB */ 415 struct urb *pControlURB; 416 struct urb *pInterruptURB; 417 struct usb_ctrlrequest sUsbCtlRequest; 418 u32 int_interval; 419 420 /* Variables to track resources for the BULK In Pipe */ 421 struct vnt_rcb *pRCBMem; 422 struct vnt_rcb *apRCB[CB_MAX_RX_DESC]; 423 u32 cbRD; 424 struct vnt_rcb *FirstRecvFreeList; 425 struct vnt_rcb *LastRecvFreeList; 426 u32 NumRecvFreeList; 427 struct vnt_rcb *FirstRecvMngList; 428 struct vnt_rcb *LastRecvMngList; 429 u32 NumRecvMngList; 430 int bIsRxWorkItemQueued; 431 int bIsRxMngWorkItemQueued; 432 unsigned long ulRcvRefCount; /* packets that have not returned back */ 433 434 /* Variables to track resources for the BULK Out Pipe */ 435 struct vnt_usb_send_context *apTD[CB_MAX_TX_DESC]; 436 u32 cbTD; 437 struct vnt_tx_pkt_info pkt_info[16]; 438 439 /* Variables to track resources for the Interrupt In Pipe */ 440 INT_BUFFER intBuf; 441 int fKillEventPollingThread; 442 int bEventAvailable; 443 444 /* default config from file by user setting */ 445 DEFAULT_CONFIG config_file; 446 447 /* Statistic for USB */ 448 unsigned long ulBulkInPosted; 449 unsigned long ulBulkInError; 450 unsigned long ulBulkInContCRCError; 451 unsigned long ulBulkInBytesRead; 452 453 unsigned long ulBulkOutPosted; 454 unsigned long ulBulkOutError; 455 unsigned long ulBulkOutContCRCError; 456 unsigned long ulBulkOutBytesWrite; 457 458 unsigned long ulIntInPosted; 459 unsigned long ulIntInError; 460 unsigned long ulIntInContCRCError; 461 unsigned long ulIntInBytesRead; 462 463 /* Version control */ 464 u16 wFirmwareVersion; 465 u8 byLocalID; 466 u8 byRFType; 467 u8 byBBRxConf; 468 469 u8 byZoneType; 470 int bZoneRegExist; 471 472 u8 byOriginalZonetype; 473 474 int bLinkPass; /* link status: OK or fail */ 475 struct vnt_cmd_card_init init_command; 476 struct vnt_rsp_card_init init_response; 477 u8 abyCurrentNetAddr[ETH_ALEN]; 478 u8 abyPermanentNetAddr[ETH_ALEN]; 479 480 int bExistSWNetAddr; 481 482 /* Maintain statistical debug info. */ 483 unsigned long packetsReceived; 484 unsigned long packetsReceivedDropped; 485 unsigned long packetsReceivedOverflow; 486 unsigned long packetsSent; 487 unsigned long packetsSentDropped; 488 unsigned long SendContextsInUse; 489 unsigned long RcvBuffersInUse; 490 491 /* 802.11 management */ 492 struct vnt_manager vnt_mgmt; 493 494 u64 qwCurrTSF; 495 u32 cbBulkInMax; 496 int bPSRxBeacon; 497 498 /* 802.11 MAC specific */ 499 u32 uCurrRSSI; 500 u8 byCurrSQ; 501 502 /* Antenna Diversity */ 503 int bTxRxAntInv; 504 u32 dwRxAntennaSel; 505 u32 dwTxAntennaSel; 506 u8 byAntennaCount; 507 u8 byRxAntennaMode; 508 u8 byTxAntennaMode; 509 u8 byRadioCtl; 510 u8 bHWRadioOff; 511 512 /* SQ3 functions for antenna diversity */ 513 struct timer_list TimerSQ3Tmax1; 514 struct timer_list TimerSQ3Tmax2; 515 struct timer_list TimerSQ3Tmax3; 516 517 int bDiversityRegCtlON; 518 int bDiversityEnable; 519 unsigned long ulDiversityNValue; 520 unsigned long ulDiversityMValue; 521 u8 byTMax; 522 u8 byTMax2; 523 u8 byTMax3; 524 unsigned long ulSQ3TH; 525 526 unsigned long uDiversityCnt; 527 u8 byAntennaState; 528 unsigned long ulRatio_State0; 529 unsigned long ulRatio_State1; 530 unsigned long ulSQ3_State0; 531 unsigned long ulSQ3_State1; 532 533 unsigned long aulSQ3Val[MAX_RATE]; 534 unsigned long aulPktNum[MAX_RATE]; 535 536 /* IFS & Cw */ 537 u32 uSIFS; /* Current SIFS */ 538 u32 uDIFS; /* Current DIFS */ 539 u32 uEIFS; /* Current EIFS */ 540 u32 uSlot; /* Current SlotTime */ 541 u32 uCwMin; /* Current CwMin */ 542 u32 uCwMax; /* CwMax is fixed on 1023 */ 543 544 /* PHY parameter */ 545 u8 bySIFS; 546 u8 byDIFS; 547 u8 byEIFS; 548 u8 bySlot; 549 u8 byCWMaxMin; 550 551 /* Rate */ 552 VIA_BB_TYPE byBBType; /* 0: 11A, 1:11B, 2:11G */ 553 VIA_PKT_TYPE byPacketType; /* 0:11a 1:11b 2:11gb 3:11ga */ 554 u16 wBasicRate; 555 u8 byACKRate; 556 u8 byTopOFDMBasicRate; 557 u8 byTopCCKBasicRate; 558 559 u32 dwAotoRateTxOkCnt; 560 u32 dwAotoRateTxFailCnt; 561 u32 dwErrorRateThreshold[13]; 562 u32 dwTPTable[MAX_RATE]; 563 u8 abyEEPROM[EEP_MAX_CONTEXT_SIZE]; /*u32 alignment */ 564 565 u8 byMinChannel; 566 u8 byMaxChannel; 567 u32 uConnectionRate; 568 569 u8 byPreambleType; 570 u8 byShortPreamble; 571 /* CARD_PHY_TYPE */ 572 u8 eConfigPHYMode; 573 574 /* For RF Power table */ 575 u8 byCCKPwr; 576 u8 byOFDMPwrG; 577 u8 byOFDMPwrA; 578 u8 byCurPwr; 579 u8 abyCCKPwrTbl[14]; 580 u8 abyOFDMPwrTbl[14]; 581 u8 abyOFDMAPwrTbl[42]; 582 583 u16 wCurrentRate; 584 u16 tx_rate_fb0; 585 u16 tx_rate_fb1; 586 587 u16 wRTSThreshold; 588 u16 wFragmentationThreshold; 589 u8 byShortRetryLimit; 590 u8 byLongRetryLimit; 591 CARD_OP_MODE eOPMode; 592 int bBSSIDFilter; 593 u16 wMaxTransmitMSDULifetime; 594 u8 abyBSSID[ETH_ALEN]; 595 u8 abyDesireBSSID[ETH_ALEN]; 596 597 u32 dwMaxReceiveLifetime; /* dot11MaxReceiveLifetime */ 598 599 int bCCK; 600 int bEncryptionEnable; 601 int bShortSlotTime; 602 int bProtectMode; 603 int bNonERPPresent; 604 int bBarkerPreambleMd; 605 606 u8 byERPFlag; 607 u16 wUseProtectCntDown; 608 609 int bRadioControlOff; 610 int bRadioOff; 611 612 /* Power save */ 613 int bEnablePSMode; 614 u16 wListenInterval; 615 int bPWBitOn; 616 WMAC_POWER_MODE ePSMode; 617 unsigned long ulPSModeWaitTx; 618 int bPSModeTxBurst; 619 620 /* Beacon releated */ 621 u16 wSeqCounter; 622 int bBeaconBufReady; 623 int bBeaconSent; 624 int bFixRate; 625 u8 byCurrentCh; 626 u32 uScanTime; 627 628 CMD_STATE eCommandState; 629 630 CMD_CODE eCommand; 631 int bBeaconTx; 632 u8 byScanBBType; 633 634 int bStopBeacon; 635 int bStopDataPkt; 636 int bStopTx0Pkt; 637 u32 uAutoReConnectTime; 638 u32 uIsroamingTime; 639 640 /* 802.11 counter */ 641 642 CMD_ITEM eCmdQueue[CMD_Q_SIZE]; 643 u32 uCmdDequeueIdx; 644 u32 uCmdEnqueueIdx; 645 u32 cbFreeCmdQueue; 646 int bCmdRunning; 647 int bCmdClear; 648 int bNeedRadioOFF; 649 650 int bEnableRoaming; 651 int bIsRoaming; 652 int bFastRoaming; 653 u8 bSameBSSMaxNum; 654 u8 bSameBSSCurNum; 655 int bRoaming; 656 int b11hEable; 657 unsigned long ulTxPower; 658 659 /* Encryption */ 660 NDIS_802_11_WEP_STATUS eEncryptionStatus; 661 int bTransmitKey; 662 NDIS_802_11_WEP_STATUS eOldEncryptionStatus; 663 SKeyManagement sKey; 664 u32 dwIVCounter; 665 666 RC4Ext SBox; 667 u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; 668 u8 byKeyIndex; 669 670 u32 uKeyLength; 671 u8 abyKey[WLAN_WEP232_KEYLEN]; 672 673 /* for AP mode */ 674 u32 uAssocCount; 675 int bMoreData; 676 677 /* QoS */ 678 int bGrpAckPolicy; 679 680 u8 byAutoFBCtrl; 681 682 int bTxMICFail; 683 int bRxMICFail; 684 685 /* For Update BaseBand VGA Gain Offset */ 686 int bUpdateBBVGA; 687 u32 uBBVGADiffCount; 688 u8 byBBVGANew; 689 u8 byBBVGACurrent; 690 u8 abyBBVGA[BB_VGA_LEVEL]; 691 signed long ldBmThreshold[BB_VGA_LEVEL]; 692 693 u8 byBBPreEDRSSI; 694 u8 byBBPreEDIndex; 695 696 int bRadioCmd; 697 698 /* For FOE Tuning */ 699 u8 byFOETuning; 700 701 /* For Auto Power Tunning */ 702 u8 byAutoPwrTunning; 703 704 /* BaseBand Loopback Use */ 705 u8 byBBCR4d; 706 u8 byBBCRc9; 707 u8 byBBCR88; 708 u8 byBBCR09; 709 710 /* command timer */ 711 struct delayed_work run_command_work; 712 /* One second callback */ 713 struct delayed_work second_callback_work; 714 715 u8 tx_data_time_out; 716 bool tx_trigger; 717 int fWPA_Authened; /*is WPA/WPA-PSK or WPA2/WPA2-PSK authen?? */ 718 u8 byReAssocCount; 719 u8 byLinkWaitCount; 720 721 struct ethhdr sTxEthHeader; 722 struct ethhdr sRxEthHeader; 723 u8 abyBroadcastAddr[ETH_ALEN]; 724 u8 abySNAP_RFC1042[ETH_ALEN]; 725 u8 abySNAP_Bridgetunnel[ETH_ALEN]; 726 727 /* Pre-Authentication & PMK cache */ 728 SPMKID gsPMKID; 729 SPMKIDCandidateEvent gsPMKIDCandidate; 730 731 /* for 802.11h */ 732 int b11hEnable; 733 734 int bChannelSwitch; 735 u8 byNewChannel; 736 u8 byChannelSwitchCount; 737 738 /* WPA supplicant daemon */ 739 int bWPADEVUp; 740 int bwextstep0; 741 int bwextstep1; 742 int bwextstep2; 743 int bwextstep3; 744 int bWPASuppWextEnabled; 745 746 /* user space daemon: hostapd, is used for HOSTAP */ 747 int bEnableHostapd; 748 int bEnable8021x; 749 int bEnableHostWEP; 750 struct net_device *apdev; 751 int (*tx_80211)(struct sk_buff *skb, struct net_device *dev); 752 753 u32 uChannel; 754 755 struct iw_statistics wstats; /* wireless stats */ 756 757 int bCommit; 758 759}; 760 761#define EnqueueRCB(_Head, _Tail, _RCB) \ 762{ \ 763 if (!_Head) { \ 764 _Head = _RCB; \ 765 } \ 766 else { \ 767 _Tail->Next = _RCB; \ 768 } \ 769 _RCB->Next = NULL; \ 770 _Tail = _RCB; \ 771} 772 773#define DequeueRCB(Head, Tail) \ 774{ \ 775 struct vnt_rcb *RCB = Head; \ 776 if (!RCB->Next) { \ 777 Tail = NULL; \ 778 } \ 779 Head = RCB->Next; \ 780} 781 782#define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ 783 if ((uVar) >= ((uModulo) - 1)) \ 784 (uVar) = 0; \ 785 else \ 786 (uVar)++; \ 787} 788 789#define fMP_RESET_IN_PROGRESS 0x00000001 790#define fMP_DISCONNECTED 0x00000002 791#define fMP_HALT_IN_PROGRESS 0x00000004 792#define fMP_SURPRISE_REMOVED 0x00000008 793#define fMP_RECV_LOOKASIDE 0x00000010 794#define fMP_INIT_IN_PROGRESS 0x00000020 795#define fMP_SEND_SIDE_RESOURCE_ALLOCATED 0x00000040 796#define fMP_RECV_SIDE_RESOURCE_ALLOCATED 0x00000080 797#define fMP_POST_READS 0x00000100 798#define fMP_POST_WRITES 0x00000200 799#define fMP_CONTROL_READS 0x00000400 800#define fMP_CONTROL_WRITES 0x00000800 801 802#define MP_SET_FLAG(_M, _F) ((_M)->Flags |= (_F)) 803#define MP_CLEAR_FLAG(_M, _F) ((_M)->Flags &= ~(_F)) 804#define MP_TEST_FLAGS(_M, _F) (((_M)->Flags & (_F)) == (_F)) 805 806#define MP_IS_READY(_M) (((_M)->Flags & \ 807 (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0) 808 809int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); 810 811#endif