blob: ca1b8578cf79f9f5d252b624c36a2b1081ad2aa7 [file] [log] [blame]
Forest Bond5449c682009-04-25 10:30:44 -04001/*
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
Forest Bond5449c682009-04-25 10:30:44 -040032#include <linux/module.h>
Forest Bond5449c682009-04-25 10:30:44 -040033#include <linux/types.h>
34#include <linux/init.h>
35#include <linux/mm.h>
36#include <linux/errno.h>
37#include <linux/ioport.h>
38#include <linux/pci.h>
39#include <linux/kernel.h>
40#include <linux/netdevice.h>
41#include <linux/etherdevice.h>
42#include <linux/skbuff.h>
43#include <linux/delay.h>
44#include <linux/timer.h>
45#include <linux/slab.h>
46#include <linux/interrupt.h>
Forest Bond5449c682009-04-25 10:30:44 -040047#include <linux/string.h>
48#include <linux/wait.h>
49#include <linux/if_arp.h>
50#include <linux/sched.h>
Charles Clémentcf160bc2010-06-03 09:15:54 -070051#include <linux/io.h>
Forest Bond5449c682009-04-25 10:30:44 -040052#include <linux/if.h>
53//#include <linux/config.h>
Charles Clémentcf160bc2010-06-03 09:15:54 -070054#include <linux/uaccess.h>
Forest Bond5449c682009-04-25 10:30:44 -040055#include <linux/proc_fs.h>
56#include <linux/inetdevice.h>
57#include <linux/reboot.h>
58#ifdef SIOCETHTOOL
59#define DEVICE_ETHTOOL_IOCTL_SUPPORT
60#include <linux/ethtool.h>
61#else
62#undef DEVICE_ETHTOOL_IOCTL_SUPPORT
63#endif
64/* Include Wireless Extension definition and check version - Jean II */
65#include <linux/wireless.h>
Forest Bond5449c682009-04-25 10:30:44 -040066#include <net/iw_handler.h> // New driver API
Forest Bond5449c682009-04-25 10:30:44 -040067
68//2008-0409-07, <Add> by Einsn Liu
Forest Bond5449c682009-04-25 10:30:44 -040069#ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
70#define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
71#endif
Forest Bond5449c682009-04-25 10:30:44 -040072
Forest Bond5449c682009-04-25 10:30:44 -040073//
Jim Lieb612822f2009-08-12 14:54:03 -070074// device specific
75//
76
Forest Bond5449c682009-04-25 10:30:44 -040077#include "device_cfg.h"
Forest Bond5449c682009-04-25 10:30:44 -040078#include "ttype.h"
Forest Bond5449c682009-04-25 10:30:44 -040079#include "80211hdr.h"
Forest Bond5449c682009-04-25 10:30:44 -040080#include "tether.h"
Forest Bond5449c682009-04-25 10:30:44 -040081#include "wmgr.h"
Forest Bond5449c682009-04-25 10:30:44 -040082#include "wcmd.h"
Forest Bond5449c682009-04-25 10:30:44 -040083#include "mib.h"
Forest Bond5449c682009-04-25 10:30:44 -040084#include "srom.h"
Forest Bond5449c682009-04-25 10:30:44 -040085#include "rc4.h"
Forest Bond5449c682009-04-25 10:30:44 -040086#include "desc.h"
Forest Bond5449c682009-04-25 10:30:44 -040087#include "key.h"
Forest Bond5449c682009-04-25 10:30:44 -040088#include "mac.h"
Forest Bond5449c682009-04-25 10:30:44 -040089
Forest Bond5449c682009-04-25 10:30:44 -040090/*--------------------- Export Definitions -------------------------*/
91
92#define MAC_MAX_CONTEXT_REG (256+128)
93
94#define MAX_MULTICAST_ADDRESS_NUM 32
Charles Clément078b0782010-05-14 19:37:32 -070095#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
Forest Bond5449c682009-04-25 10:30:44 -040096
Forest Bond5449c682009-04-25 10:30:44 -040097#define DUPLICATE_RX_CACHE_LENGTH 5
98
99#define NUM_KEY_ENTRY 11
100
101#define TX_WEP_NONE 0
102#define TX_WEP_OTF 1
103#define TX_WEP_SW 2
104#define TX_WEP_SWOTP 3
105#define TX_WEP_OTPSW 4
106#define TX_WEP_SW232 5
107
108#define KEYSEL_WEP40 0
109#define KEYSEL_WEP104 1
110#define KEYSEL_TKIP 2
111#define KEYSEL_CCMP 3
112
Forest Bond5449c682009-04-25 10:30:44 -0400113#define AUTO_FB_NONE 0
114#define AUTO_FB_0 1
115#define AUTO_FB_1 2
116
117#define FB_RATE0 0
118#define FB_RATE1 1
119
120// Antenna Mode
121#define ANT_A 0
122#define ANT_B 1
123#define ANT_DIVERSITY 2
124#define ANT_RXD_TXA 3
125#define ANT_RXD_TXB 4
126#define ANT_UNKNOWN 0xFF
127
128#define MAXCHECKHANGCNT 4
129
130#define BB_VGA_LEVEL 4
131#define BB_VGA_CHANGE_THRESHOLD 16
132
Forest Bond5449c682009-04-25 10:30:44 -0400133#ifndef RUN_AT
134#define RUN_AT(x) (jiffies+(x))
135#endif
136
137// DMA related
138#define RESERV_AC0DMA 4
139
Forest Bond5449c682009-04-25 10:30:44 -0400140// BUILD OBJ mode
Forest Bond5449c682009-04-25 10:30:44 -0400141
Joe Perches4ec4aa42013-03-18 10:44:45 -0700142#define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
Forest Bond5449c682009-04-25 10:30:44 -0400143
144//PLICE_DEBUG ->
145#define NUM 64
146//PLICE_DEUBG <-
147
Jim Lieb7e809a92009-07-30 10:27:21 -0700148#define PRIVATE_Message 0
149
Forest Bond5449c682009-04-25 10:30:44 -0400150/*--------------------- Export Types ------------------------------*/
151
Joe Perches4ec4aa42013-03-18 10:44:45 -0700152#define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
153#define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
Jim Lieb7e809a92009-07-30 10:27:21 -0700154
Forest Bond5449c682009-04-25 10:30:44 -0400155//0:11A 1:11B 2:11G
156typedef enum _VIA_BB_TYPE
157{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700158 BB_TYPE_11A = 0,
159 BB_TYPE_11B,
160 BB_TYPE_11G
Forest Bond5449c682009-04-25 10:30:44 -0400161} VIA_BB_TYPE, *PVIA_BB_TYPE;
162
163//0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
164typedef enum _VIA_PKT_TYPE
165{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700166 PK_TYPE_11A = 0,
167 PK_TYPE_11B,
168 PK_TYPE_11GB,
169 PK_TYPE_11GA
Forest Bond5449c682009-04-25 10:30:44 -0400170} VIA_PKT_TYPE, *PVIA_PKT_TYPE;
171
Forest Bond5449c682009-04-25 10:30:44 -0400172typedef enum __device_msg_level {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700173 MSG_LEVEL_ERR = 0, //Errors that will cause abnormal operation.
174 MSG_LEVEL_NOTICE = 1, //Some errors need users to be notified.
175 MSG_LEVEL_INFO = 2, //Normal message.
176 MSG_LEVEL_VERBOSE = 3, //Will report all trival errors.
177 MSG_LEVEL_DEBUG = 4 //Only for debug purpose.
Forest Bond5449c682009-04-25 10:30:44 -0400178} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL;
179
180typedef enum __device_init_type {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700181 DEVICE_INIT_COLD = 0, // cold init
182 DEVICE_INIT_RESET, // reset init or Dx to D0 power remain init
183 DEVICE_INIT_DXPL // Dx to D0 power lost init
Forest Bond5449c682009-04-25 10:30:44 -0400184} DEVICE_INIT_TYPE, *PDEVICE_INIT_TYPE;
185
Forest Bond5449c682009-04-25 10:30:44 -0400186//++ NDIS related
187
188#define MAX_BSSIDINFO_4_PMKID 16
189#define MAX_PMKIDLIST 5
190//Flags for PMKID Candidate list structure
191#define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
192
193// PMKID Structures
Charles Clément5c9824e2010-06-02 09:51:59 -0700194typedef unsigned char NDIS_802_11_PMKID_VALUE[16];
Forest Bond5449c682009-04-25 10:30:44 -0400195
Forest Bond5449c682009-04-25 10:30:44 -0400196typedef enum _NDIS_802_11_WEP_STATUS
197{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700198 Ndis802_11WEPEnabled,
199 Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
200 Ndis802_11WEPDisabled,
201 Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
202 Ndis802_11WEPKeyAbsent,
203 Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
204 Ndis802_11WEPNotSupported,
205 Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
206 Ndis802_11Encryption2Enabled,
207 Ndis802_11Encryption2KeyAbsent,
208 Ndis802_11Encryption3Enabled,
209 Ndis802_11Encryption3KeyAbsent
Forest Bond5449c682009-04-25 10:30:44 -0400210} NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS,
Joe Perches4ec4aa42013-03-18 10:44:45 -0700211 NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS;
Forest Bond5449c682009-04-25 10:30:44 -0400212
Forest Bond5449c682009-04-25 10:30:44 -0400213typedef enum _NDIS_802_11_STATUS_TYPE
214{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700215 Ndis802_11StatusType_Authentication,
216 Ndis802_11StatusType_MediaStreamMode,
217 Ndis802_11StatusType_PMKID_CandidateList,
218 Ndis802_11StatusTypeMax // not a real type, defined as an upper bound
Forest Bond5449c682009-04-25 10:30:44 -0400219} NDIS_802_11_STATUS_TYPE, *PNDIS_802_11_STATUS_TYPE;
220
221//Added new types for PMKID Candidate lists.
222typedef struct _PMKID_CANDIDATE {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700223 NDIS_802_11_MAC_ADDRESS BSSID;
224 unsigned long Flags;
Forest Bond5449c682009-04-25 10:30:44 -0400225} PMKID_CANDIDATE, *PPMKID_CANDIDATE;
226
Forest Bond5449c682009-04-25 10:30:44 -0400227typedef struct _BSSID_INFO
228{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700229 NDIS_802_11_MAC_ADDRESS BSSID;
230 NDIS_802_11_PMKID_VALUE PMKID;
Forest Bond5449c682009-04-25 10:30:44 -0400231} BSSID_INFO, *PBSSID_INFO;
232
233typedef struct tagSPMKID {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700234 unsigned long Length;
235 unsigned long BSSIDInfoCount;
236 BSSID_INFO BSSIDInfo[MAX_BSSIDINFO_4_PMKID];
Forest Bond5449c682009-04-25 10:30:44 -0400237} SPMKID, *PSPMKID;
238
239typedef struct tagSPMKIDCandidateEvent {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700240 NDIS_802_11_STATUS_TYPE StatusType;
241 unsigned long Version; // Version of the structure
242 unsigned long NumCandidates; // No. of pmkid candidates
243 PMKID_CANDIDATE CandidateList[MAX_PMKIDLIST];
Jim Lieba8848472009-08-12 14:54:07 -0700244} SPMKIDCandidateEvent, *PSPMKIDCandidateEvent;
Forest Bond5449c682009-04-25 10:30:44 -0400245
Forest Bond5449c682009-04-25 10:30:44 -0400246//--
247
248//++ 802.11h related
249#define MAX_QUIET_COUNT 8
250
251typedef struct tagSQuietControl {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700252 bool bEnable;
253 unsigned long dwStartTime;
254 unsigned char byPeriod;
255 unsigned short wDuration;
Jim Lieba8848472009-08-12 14:54:07 -0700256} SQuietControl, *PSQuietControl;
Forest Bond5449c682009-04-25 10:30:44 -0400257
258//--
Joe Perches4ec4aa42013-03-18 10:44:45 -0700259typedef struct __chip_info_tbl {
260 CHIP_TYPE chip_id;
261 char *name;
262 int io_size;
263 int nTxQueue;
264 u32 flags;
Forest Bond5449c682009-04-25 10:30:44 -0400265} CHIP_INFO, *PCHIP_INFO;
266
Forest Bond5449c682009-04-25 10:30:44 -0400267typedef enum {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700268 OWNED_BY_HOST = 0,
269 OWNED_BY_NIC = 1
Forest Bond5449c682009-04-25 10:30:44 -0400270} DEVICE_OWNER_TYPE, *PDEVICE_OWNER_TYPE;
271
Forest Bond5449c682009-04-25 10:30:44 -0400272// The receive duplicate detection cache entry
Joe Perches4ec4aa42013-03-18 10:44:45 -0700273typedef struct tagSCacheEntry {
274 unsigned short wFmSequence;
275 unsigned char abyAddr2[ETH_ALEN];
Forest Bond5449c682009-04-25 10:30:44 -0400276} SCacheEntry, *PSCacheEntry;
277
Joe Perches4ec4aa42013-03-18 10:44:45 -0700278typedef struct tagSCache {
Forest Bond5449c682009-04-25 10:30:44 -0400279/* The receive cache is updated circularly. The next entry to be written is
280 * indexed by the "InPtr".
Joe Perches4ec4aa42013-03-18 10:44:45 -0700281 */
282 unsigned int uInPtr; // Place to use next
283 SCacheEntry asCacheEntry[DUPLICATE_RX_CACHE_LENGTH];
Forest Bond5449c682009-04-25 10:30:44 -0400284} SCache, *PSCache;
285
286#define CB_MAX_RX_FRAG 64
287// DeFragment Control Block, used for collecting fragments prior to reassembly
288typedef struct tagSDeFragControlBlock
289{
Joe Perches4ec4aa42013-03-18 10:44:45 -0700290 unsigned short wSequence;
291 unsigned short wFragNum;
292 unsigned char abyAddr2[ETH_ALEN];
293 unsigned int uLifetime;
294 struct sk_buff *skb;
295 unsigned char *pbyRxBuffer;
296 unsigned int cbFrameLength;
297 bool bInUse;
Jim Lieba8848472009-08-12 14:54:07 -0700298} SDeFragControlBlock, *PSDeFragControlBlock;
Forest Bond5449c682009-04-25 10:30:44 -0400299
Forest Bond5449c682009-04-25 10:30:44 -0400300//flags for options
301#define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
302#define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
303#define DEVICE_FLAGS_OP_MODE 0x00000004UL
304#define DEVICE_FLAGS_PS_MODE 0x00000008UL
305#define DEVICE_FLAGS_80211h_MODE 0x00000010UL
306#define DEVICE_FLAGS_DiversityANT 0x00000020UL
307
308//flags for driver status
309#define DEVICE_FLAGS_OPENED 0x00010000UL
310#define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
Justin P. Mattock789d1ae2012-08-20 08:43:13 -0700311//flags for capabilities
Forest Bond5449c682009-04-25 10:30:44 -0400312#define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
313#define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
314#define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
315
316//flags for MII status
317#define DEVICE_LINK_FAIL 0x00000001UL
318#define DEVICE_SPEED_10 0x00000002UL
319#define DEVICE_SPEED_100 0x00000004UL
320#define DEVICE_SPEED_1000 0x00000008UL
321#define DEVICE_DUPLEX_FULL 0x00000010UL
322#define DEVICE_AUTONEG_ENABLE 0x00000020UL
323#define DEVICE_FORCED_BY_EEPROM 0x00000040UL
324//for device_set_media_duplex
325#define DEVICE_LINK_CHANGE 0x00000001UL
326
Forest Bond5449c682009-04-25 10:30:44 -0400327//PLICE_DEBUG->
328
Forest Bond5449c682009-04-25 10:30:44 -0400329typedef struct _RxManagementQueue
330{
331 int packet_num;
Joe Perches4ec4aa42013-03-18 10:44:45 -0700332 int head, tail;
Forest Bond5449c682009-04-25 10:30:44 -0400333 PSRxMgmtPacket Q[NUM];
Joe Perches4ec4aa42013-03-18 10:44:45 -0700334} RxManagementQueue, *PSRxManagementQueue;
Forest Bond5449c682009-04-25 10:30:44 -0400335
Forest Bond5449c682009-04-25 10:30:44 -0400336//PLICE_DEBUG<-
337
Forest Bond5449c682009-04-25 10:30:44 -0400338typedef struct __device_opt {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700339 int nRxDescs0; //Number of RX descriptors0
340 int nRxDescs1; //Number of RX descriptors1
341 int nTxDescs[2]; //Number of TX descriptors 0, 1
342 int int_works; //interrupt limits
343 int rts_thresh; //rts threshold
344 int frag_thresh;
345 int data_rate;
346 int channel_num;
347 int short_retry;
348 int long_retry;
349 int bbp_type;
350 u32 flags;
Forest Bond5449c682009-04-25 10:30:44 -0400351} OPTIONS, *POPTIONS;
352
Forest Bond5449c682009-04-25 10:30:44 -0400353typedef struct __device_info {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700354 struct __device_info *next;
355 struct __device_info *prev;
Forest Bond5449c682009-04-25 10:30:44 -0400356
Joe Perches4ec4aa42013-03-18 10:44:45 -0700357 struct pci_dev *pcid;
Forest Bond5449c682009-04-25 10:30:44 -0400358
Larry Finger9fada0a2011-05-05 18:52:56 -0500359#ifdef CONFIG_PM
Joe Perches4ec4aa42013-03-18 10:44:45 -0700360 u32 pci_state[16];
Forest Bond5449c682009-04-25 10:30:44 -0400361#endif
362
363// netdev
Joe Perches4ec4aa42013-03-18 10:44:45 -0700364 struct net_device *dev;
365 struct net_device *next_module;
366 struct net_device_stats stats;
Forest Bond5449c682009-04-25 10:30:44 -0400367
368//dma addr, rx/tx pool
Joe Perches4ec4aa42013-03-18 10:44:45 -0700369 dma_addr_t pool_dma;
370 dma_addr_t rd0_pool_dma;
371 dma_addr_t rd1_pool_dma;
Forest Bond5449c682009-04-25 10:30:44 -0400372
Joe Perches4ec4aa42013-03-18 10:44:45 -0700373 dma_addr_t td0_pool_dma;
374 dma_addr_t td1_pool_dma;
Forest Bond5449c682009-04-25 10:30:44 -0400375
Joe Perches4ec4aa42013-03-18 10:44:45 -0700376 dma_addr_t tx_bufs_dma0;
377 dma_addr_t tx_bufs_dma1;
378 dma_addr_t tx_beacon_dma;
Forest Bond5449c682009-04-25 10:30:44 -0400379
Joe Perches4ec4aa42013-03-18 10:44:45 -0700380 unsigned char *tx0_bufs;
381 unsigned char *tx1_bufs;
382 unsigned char *tx_beacon_bufs;
Forest Bond5449c682009-04-25 10:30:44 -0400383
Joe Perches4ec4aa42013-03-18 10:44:45 -0700384 CHIP_TYPE chip_id;
Forest Bond5449c682009-04-25 10:30:44 -0400385
Joe Perches4ec4aa42013-03-18 10:44:45 -0700386 unsigned long PortOffset;
387 unsigned long dwIsr;
388 u32 memaddr;
389 u32 ioaddr;
390 u32 io_size;
Forest Bond5449c682009-04-25 10:30:44 -0400391
Joe Perches4ec4aa42013-03-18 10:44:45 -0700392 unsigned char byRevId;
393 unsigned short SubSystemID;
394 unsigned short SubVendorID;
Forest Bond5449c682009-04-25 10:30:44 -0400395
Joe Perches4ec4aa42013-03-18 10:44:45 -0700396 int nTxQueues;
397 volatile int iTDUsed[TYPE_MAXTD];
Forest Bond5449c682009-04-25 10:30:44 -0400398
Joe Perches4ec4aa42013-03-18 10:44:45 -0700399 volatile PSTxDesc apCurrTD[TYPE_MAXTD];
400 volatile PSTxDesc apTailTD[TYPE_MAXTD];
Forest Bond5449c682009-04-25 10:30:44 -0400401
Joe Perches4ec4aa42013-03-18 10:44:45 -0700402 volatile PSTxDesc apTD0Rings;
403 volatile PSTxDesc apTD1Rings;
Forest Bond5449c682009-04-25 10:30:44 -0400404
Joe Perches4ec4aa42013-03-18 10:44:45 -0700405 volatile PSRxDesc aRD0Ring;
406 volatile PSRxDesc aRD1Ring;
407 volatile PSRxDesc pCurrRD[TYPE_MAXRD];
408 SCache sDupRxCache;
Forest Bond5449c682009-04-25 10:30:44 -0400409
Joe Perches4ec4aa42013-03-18 10:44:45 -0700410 SDeFragControlBlock sRxDFCB[CB_MAX_RX_FRAG];
411 unsigned int cbDFCB;
412 unsigned int cbFreeDFCB;
413 unsigned int uCurrentDFCBIdx;
Forest Bond5449c682009-04-25 10:30:44 -0400414
Joe Perches4ec4aa42013-03-18 10:44:45 -0700415 OPTIONS sOpts;
Forest Bond5449c682009-04-25 10:30:44 -0400416
Joe Perches4ec4aa42013-03-18 10:44:45 -0700417 u32 flags;
Forest Bond5449c682009-04-25 10:30:44 -0400418
Joe Perches4ec4aa42013-03-18 10:44:45 -0700419 u32 rx_buf_sz;
420 int multicast_limit;
421 unsigned char byRxMode;
Forest Bond5449c682009-04-25 10:30:44 -0400422
Joe Perches4ec4aa42013-03-18 10:44:45 -0700423 spinlock_t lock;
Forest Bond5449c682009-04-25 10:30:44 -0400424//PLICE_DEBUG->
Joe Perches4ec4aa42013-03-18 10:44:45 -0700425 struct tasklet_struct RxMngWorkItem;
Forest Bond5449c682009-04-25 10:30:44 -0400426 RxManagementQueue rxManeQueue;
427//PLICE_DEBUG<-
428//PLICE_DEBUG ->
Joe Perches4ec4aa42013-03-18 10:44:45 -0700429 pid_t MLMEThr_pid;
430 struct completion notify;
431 struct semaphore mlme_semaphore;
Forest Bond5449c682009-04-25 10:30:44 -0400432//PLICE_DEBUG <-
433
Joe Perches4ec4aa42013-03-18 10:44:45 -0700434 u32 rx_bytes;
Forest Bond5449c682009-04-25 10:30:44 -0400435
Joe Perches4ec4aa42013-03-18 10:44:45 -0700436 // Version control
437 unsigned char byLocalID;
438 unsigned char byRFType;
Forest Bond5449c682009-04-25 10:30:44 -0400439
Joe Perches4ec4aa42013-03-18 10:44:45 -0700440 unsigned char byMaxPwrLevel;
441 unsigned char byZoneType;
442 bool bZoneRegExist;
443 unsigned char byOriginalZonetype;
444 unsigned char abyMacContext[MAC_MAX_CONTEXT_REG];
445 bool bLinkPass; // link status: OK or fail
446 unsigned char abyCurrentNetAddr[ETH_ALEN];
Forest Bond5449c682009-04-25 10:30:44 -0400447
Joe Perches4ec4aa42013-03-18 10:44:45 -0700448 // Adapter statistics
449 SStatCounter scStatistic;
450 // 802.11 counter
451 SDot11Counters s802_11Counter;
Forest Bond5449c682009-04-25 10:30:44 -0400452
Joe Perches4ec4aa42013-03-18 10:44:45 -0700453 // 802.11 management
454 PSMgmtObject pMgmt;
455 SMgmtObject sMgmtObj;
Forest Bond5449c682009-04-25 10:30:44 -0400456
Joe Perches4ec4aa42013-03-18 10:44:45 -0700457 // 802.11 MAC specific
458 unsigned int uCurrRSSI;
459 unsigned char byCurrSQ;
Forest Bond5449c682009-04-25 10:30:44 -0400460
Joe Perches4ec4aa42013-03-18 10:44:45 -0700461 unsigned long dwTxAntennaSel;
462 unsigned long dwRxAntennaSel;
463 unsigned char byAntennaCount;
464 unsigned char byRxAntennaMode;
465 unsigned char byTxAntennaMode;
466 bool bTxRxAntInv;
Forest Bond5449c682009-04-25 10:30:44 -0400467
Joe Perches4ec4aa42013-03-18 10:44:45 -0700468 unsigned char *pbyTmpBuff;
469 unsigned int uSIFS; //Current SIFS
470 unsigned int uDIFS; //Current DIFS
471 unsigned int uEIFS; //Current EIFS
472 unsigned int uSlot; //Current SlotTime
473 unsigned int uCwMin; //Current CwMin
474 unsigned int uCwMax; //CwMax is fixed on 1023.
475 // PHY parameter
476 unsigned char bySIFS;
477 unsigned char byDIFS;
478 unsigned char byEIFS;
479 unsigned char bySlot;
480 unsigned char byCWMaxMin;
481 CARD_PHY_TYPE eCurrentPHYType;
Forest Bond5449c682009-04-25 10:30:44 -0400482
Joe Perches4ec4aa42013-03-18 10:44:45 -0700483 VIA_BB_TYPE byBBType; //0: 11A, 1:11B, 2:11G
484 VIA_PKT_TYPE byPacketType; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
485 unsigned short wBasicRate;
486 unsigned char byACKRate;
487 unsigned char byTopOFDMBasicRate;
488 unsigned char byTopCCKBasicRate;
Forest Bond5449c682009-04-25 10:30:44 -0400489
Joe Perches4ec4aa42013-03-18 10:44:45 -0700490 unsigned char byMinChannel;
491 unsigned char byMaxChannel;
492 unsigned int uConnectionRate;
Forest Bond5449c682009-04-25 10:30:44 -0400493
Joe Perches4ec4aa42013-03-18 10:44:45 -0700494 unsigned char byPreambleType;
495 unsigned char byShortPreamble;
Forest Bond5449c682009-04-25 10:30:44 -0400496
Joe Perches4ec4aa42013-03-18 10:44:45 -0700497 unsigned short wCurrentRate;
498 unsigned short wRTSThreshold;
499 unsigned short wFragmentationThreshold;
500 unsigned char byShortRetryLimit;
501 unsigned char byLongRetryLimit;
502 CARD_OP_MODE eOPMode;
503 unsigned char byOpMode;
504 bool bBSSIDFilter;
505 unsigned short wMaxTransmitMSDULifetime;
506 unsigned char abyBSSID[ETH_ALEN];
507 unsigned char abyDesireBSSID[ETH_ALEN];
508 unsigned short wCTSDuration; // update while speed change
509 unsigned short wACKDuration; // update while speed change
510 unsigned short wRTSTransmitLen; // update while speed change
511 unsigned char byRTSServiceField; // update while speed change
512 unsigned char byRTSSignalField; // update while speed change
Forest Bond5449c682009-04-25 10:30:44 -0400513
Joe Perches4ec4aa42013-03-18 10:44:45 -0700514 unsigned long dwMaxReceiveLifetime; // dot11MaxReceiveLifetime
Forest Bond5449c682009-04-25 10:30:44 -0400515
Joe Perches4ec4aa42013-03-18 10:44:45 -0700516 bool bCCK;
517 bool bEncryptionEnable;
518 bool bLongHeader;
519 bool bShortSlotTime;
520 bool bProtectMode;
521 bool bNonERPPresent;
522 bool bBarkerPreambleMd;
Forest Bond5449c682009-04-25 10:30:44 -0400523
Joe Perches4ec4aa42013-03-18 10:44:45 -0700524 unsigned char byERPFlag;
525 unsigned short wUseProtectCntDown;
Forest Bond5449c682009-04-25 10:30:44 -0400526
Joe Perches4ec4aa42013-03-18 10:44:45 -0700527 bool bRadioControlOff;
528 bool bRadioOff;
529 bool bEnablePSMode;
530 unsigned short wListenInterval;
531 bool bPWBitOn;
532 WMAC_POWER_MODE ePSMode;
Forest Bond5449c682009-04-25 10:30:44 -0400533
Joe Perches4ec4aa42013-03-18 10:44:45 -0700534 // GPIO Radio Control
535 unsigned char byRadioCtl;
536 unsigned char byGPIO;
537 bool bHWRadioOff;
538 bool bPrvActive4RadioOFF;
539 bool bGPIOBlockRead;
Forest Bond5449c682009-04-25 10:30:44 -0400540
Joe Perches4ec4aa42013-03-18 10:44:45 -0700541 // Beacon related
542 unsigned short wSeqCounter;
543 unsigned short wBCNBufLen;
544 bool bBeaconBufReady;
545 bool bBeaconSent;
546 bool bIsBeaconBufReadySet;
547 unsigned int cbBeaconBufReadySetCnt;
548 bool bFixRate;
549 unsigned char byCurrentCh;
550 unsigned int uScanTime;
Forest Bond5449c682009-04-25 10:30:44 -0400551
Joe Perches4ec4aa42013-03-18 10:44:45 -0700552 CMD_STATE eCommandState;
Forest Bond5449c682009-04-25 10:30:44 -0400553
Joe Perches4ec4aa42013-03-18 10:44:45 -0700554 CMD_CODE eCommand;
555 bool bBeaconTx;
Forest Bond5449c682009-04-25 10:30:44 -0400556
Joe Perches4ec4aa42013-03-18 10:44:45 -0700557 bool bStopBeacon;
558 bool bStopDataPkt;
559 bool bStopTx0Pkt;
560 unsigned int uAutoReConnectTime;
Forest Bond5449c682009-04-25 10:30:44 -0400561
Joe Perches4ec4aa42013-03-18 10:44:45 -0700562 // 802.11 counter
Forest Bond5449c682009-04-25 10:30:44 -0400563
Joe Perches4ec4aa42013-03-18 10:44:45 -0700564 CMD_ITEM eCmdQueue[CMD_Q_SIZE];
565 unsigned int uCmdDequeueIdx;
566 unsigned int uCmdEnqueueIdx;
567 unsigned int cbFreeCmdQueue;
568 bool bCmdRunning;
569 bool bCmdClear;
Forest Bond5449c682009-04-25 10:30:44 -0400570
Joe Perches4ec4aa42013-03-18 10:44:45 -0700571 bool bRoaming;
572 //WOW
573 unsigned char abyIPAddr[4];
Forest Bond5449c682009-04-25 10:30:44 -0400574
Joe Perches4ec4aa42013-03-18 10:44:45 -0700575 unsigned long ulTxPower;
576 NDIS_802_11_WEP_STATUS eEncryptionStatus;
577 bool bTransmitKey;
Forest Bond5449c682009-04-25 10:30:44 -0400578//2007-0925-01<Add>by MikeLiu
579//mike add :save old Encryption
Joe Perches4ec4aa42013-03-18 10:44:45 -0700580 NDIS_802_11_WEP_STATUS eOldEncryptionStatus;
Jim Lieb612822f2009-08-12 14:54:03 -0700581
Joe Perches4ec4aa42013-03-18 10:44:45 -0700582 SKeyManagement sKey;
583 unsigned long dwIVCounter;
Forest Bond5449c682009-04-25 10:30:44 -0400584
Joe Perches4ec4aa42013-03-18 10:44:45 -0700585 QWORD qwPacketNumber; //For CCMP and TKIP as TSC(6 bytes)
586 unsigned int uCurrentWEPMode;
Forest Bond5449c682009-04-25 10:30:44 -0400587
Joe Perches4ec4aa42013-03-18 10:44:45 -0700588 RC4Ext SBox;
589 unsigned char abyPRNG[WLAN_WEPMAX_KEYLEN+3];
590 unsigned char byKeyIndex;
591 unsigned int uKeyLength;
592 unsigned char abyKey[WLAN_WEP232_KEYLEN];
Forest Bond5449c682009-04-25 10:30:44 -0400593
Joe Perches4ec4aa42013-03-18 10:44:45 -0700594 bool bAES;
595 unsigned char byCntMeasure;
Forest Bond5449c682009-04-25 10:30:44 -0400596
Joe Perches4ec4aa42013-03-18 10:44:45 -0700597 // for AP mode
598 unsigned int uAssocCount;
599 bool bMoreData;
Forest Bond5449c682009-04-25 10:30:44 -0400600
Joe Perches4ec4aa42013-03-18 10:44:45 -0700601 // QoS
602 bool bGrpAckPolicy;
Forest Bond5449c682009-04-25 10:30:44 -0400603
Joe Perches4ec4aa42013-03-18 10:44:45 -0700604 // for OID_802_11_ASSOCIATION_INFORMATION
605 bool bAssocInfoSet;
Forest Bond5449c682009-04-25 10:30:44 -0400606
Joe Perches4ec4aa42013-03-18 10:44:45 -0700607 unsigned char byAutoFBCtrl;
Forest Bond5449c682009-04-25 10:30:44 -0400608
Joe Perches4ec4aa42013-03-18 10:44:45 -0700609 bool bTxMICFail;
610 bool bRxMICFail;
Forest Bond5449c682009-04-25 10:30:44 -0400611
Joe Perches4ec4aa42013-03-18 10:44:45 -0700612 unsigned int uRATEIdx;
Forest Bond5449c682009-04-25 10:30:44 -0400613
Joe Perches4ec4aa42013-03-18 10:44:45 -0700614 // For Update BaseBand VGA Gain Offset
615 bool bUpdateBBVGA;
616 unsigned int uBBVGADiffCount;
617 unsigned char byBBVGANew;
618 unsigned char byBBVGACurrent;
619 unsigned char abyBBVGA[BB_VGA_LEVEL];
620 long ldBmThreshold[BB_VGA_LEVEL];
Forest Bond5449c682009-04-25 10:30:44 -0400621
Joe Perches4ec4aa42013-03-18 10:44:45 -0700622 unsigned char byBBPreEDRSSI;
623 unsigned char byBBPreEDIndex;
Forest Bond5449c682009-04-25 10:30:44 -0400624
Joe Perches4ec4aa42013-03-18 10:44:45 -0700625 bool bRadioCmd;
626 unsigned long dwDiagRefCount;
Forest Bond5449c682009-04-25 10:30:44 -0400627
Joe Perches4ec4aa42013-03-18 10:44:45 -0700628 // For FOE Tuning
629 unsigned char byFOETuning;
Forest Bond5449c682009-04-25 10:30:44 -0400630
Joe Perches4ec4aa42013-03-18 10:44:45 -0700631 // For Auto Power Tunning
Forest Bond5449c682009-04-25 10:30:44 -0400632
Joe Perches4ec4aa42013-03-18 10:44:45 -0700633 unsigned char byAutoPwrTunning;
634 short sPSetPointCCK;
635 short sPSetPointOFDMG;
636 short sPSetPointOFDMA;
637 long lPFormulaOffset;
638 short sPThreshold;
639 char cAdjustStep;
640 char cMinTxAGC;
Forest Bond5449c682009-04-25 10:30:44 -0400641
Joe Perches4ec4aa42013-03-18 10:44:45 -0700642 // For RF Power table
643 unsigned char byCCKPwr;
644 unsigned char byOFDMPwrG;
645 unsigned char byCurPwr;
646 char byCurPwrdBm;
647 unsigned char abyCCKPwrTbl[CB_MAX_CHANNEL_24G+1];
648 unsigned char abyOFDMPwrTbl[CB_MAX_CHANNEL+1];
649 char abyCCKDefaultPwr[CB_MAX_CHANNEL_24G+1];
650 char abyOFDMDefaultPwr[CB_MAX_CHANNEL+1];
651 char abyRegPwr[CB_MAX_CHANNEL+1];
652 char abyLocalPwr[CB_MAX_CHANNEL+1];
Forest Bond5449c682009-04-25 10:30:44 -0400653
Joe Perches4ec4aa42013-03-18 10:44:45 -0700654 // BaseBand Loopback Use
655 unsigned char byBBCR4d;
656 unsigned char byBBCRc9;
657 unsigned char byBBCR88;
658 unsigned char byBBCR09;
Forest Bond5449c682009-04-25 10:30:44 -0400659
Joe Perches4ec4aa42013-03-18 10:44:45 -0700660 // command timer
661 struct timer_list sTimerCommand;
Forest Bond5449c682009-04-25 10:30:44 -0400662#ifdef TxInSleep
Joe Perches4ec4aa42013-03-18 10:44:45 -0700663 struct timer_list sTimerTxData;
664 unsigned long nTxDataTimeCout;
665 bool fTxDataInSleep;
666 bool IsTxDataTrigger;
Forest Bond5449c682009-04-25 10:30:44 -0400667#endif
668
669#ifdef WPA_SM_Transtatus
Joe Perches4ec4aa42013-03-18 10:44:45 -0700670 bool fWPA_Authened; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
Forest Bond5449c682009-04-25 10:30:44 -0400671#endif
Joe Perches4ec4aa42013-03-18 10:44:45 -0700672 unsigned char byReAssocCount; //mike add:re-association retry times!
673 unsigned char byLinkWaitCount;
Forest Bond5449c682009-04-25 10:30:44 -0400674
Joe Perches4ec4aa42013-03-18 10:44:45 -0700675 unsigned char abyNodeName[17];
Forest Bond5449c682009-04-25 10:30:44 -0400676
Joe Perches4ec4aa42013-03-18 10:44:45 -0700677 bool bDiversityRegCtlON;
678 bool bDiversityEnable;
679 unsigned long ulDiversityNValue;
680 unsigned long ulDiversityMValue;
681 unsigned char byTMax;
682 unsigned char byTMax2;
683 unsigned char byTMax3;
684 unsigned long ulSQ3TH;
Forest Bond5449c682009-04-25 10:30:44 -0400685
686// ANT diversity
Joe Perches4ec4aa42013-03-18 10:44:45 -0700687 unsigned long uDiversityCnt;
688 unsigned char byAntennaState;
689 unsigned long ulRatio_State0;
690 unsigned long ulRatio_State1;
Forest Bond5449c682009-04-25 10:30:44 -0400691
Joe Perches4ec4aa42013-03-18 10:44:45 -0700692 //SQ3 functions for antenna diversity
693 struct timer_list TimerSQ3Tmax1;
694 struct timer_list TimerSQ3Tmax2;
695 struct timer_list TimerSQ3Tmax3;
Forest Bond5449c682009-04-25 10:30:44 -0400696
Joe Perches4ec4aa42013-03-18 10:44:45 -0700697 unsigned long uNumSQ3[MAX_RATE];
698 unsigned short wAntDiversityMaxRate;
Forest Bond5449c682009-04-25 10:30:44 -0400699
Joe Perches4ec4aa42013-03-18 10:44:45 -0700700 SEthernetHeader sTxEthHeader;
701 SEthernetHeader sRxEthHeader;
702 unsigned char abyBroadcastAddr[ETH_ALEN];
703 unsigned char abySNAP_RFC1042[ETH_ALEN];
704 unsigned char abySNAP_Bridgetunnel[ETH_ALEN];
705 unsigned char abyEEPROM[EEP_MAX_CONTEXT_SIZE]; //unsigned long alignment
706 // Pre-Authentication & PMK cache
707 SPMKID gsPMKID;
708 SPMKIDCandidateEvent gsPMKIDCandidate;
Forest Bond5449c682009-04-25 10:30:44 -0400709
Joe Perches4ec4aa42013-03-18 10:44:45 -0700710 // for 802.11h
711 bool b11hEnable;
712 unsigned char abyCountryCode[3];
713 // for 802.11h DFS
714 unsigned int uNumOfMeasureEIDs;
715 PWLAN_IE_MEASURE_REQ pCurrMeasureEID;
716 bool bMeasureInProgress;
717 unsigned char byOrgChannel;
718 unsigned char byOrgRCR;
719 unsigned long dwOrgMAR0;
720 unsigned long dwOrgMAR4;
721 unsigned char byBasicMap;
722 unsigned char byCCAFraction;
723 unsigned char abyRPIs[8];
724 unsigned long dwRPIs[8];
725 bool bChannelSwitch;
726 unsigned char byNewChannel;
727 unsigned char byChannelSwitchCount;
728 bool bQuietEnable;
729 bool bEnableFirstQuiet;
730 unsigned char byQuietStartCount;
731 unsigned int uQuietEnqueue;
732 unsigned long dwCurrentQuietEndTime;
733 SQuietControl sQuiet[MAX_QUIET_COUNT];
734 // for 802.11h TPC
735 bool bCountryInfo5G;
736 bool bCountryInfo24G;
Forest Bond5449c682009-04-25 10:30:44 -0400737
Joe Perches4ec4aa42013-03-18 10:44:45 -0700738 unsigned short wBeaconInterval;
Forest Bond5449c682009-04-25 10:30:44 -0400739
Joe Perches4ec4aa42013-03-18 10:44:45 -0700740 //WPA supplicant deamon
Forest Bond5449c682009-04-25 10:30:44 -0400741 struct net_device *wpadev;
Charles Clément7b6a0012010-08-01 17:15:50 +0200742 bool bWPADEVUp;
Joe Perches4ec4aa42013-03-18 10:44:45 -0700743 struct sk_buff *skb;
Forest Bond5449c682009-04-25 10:30:44 -0400744#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
745/*
Joe Perches4ec4aa42013-03-18 10:44:45 -0700746 bool bwextstep0;
747 bool bwextstep1;
748 bool bwextstep2;
749 bool bwextstep3;
750*/
751 unsigned int bwextcount;
752 bool bWPASuppWextEnabled;
Forest Bond5449c682009-04-25 10:30:44 -0400753#endif
754
Joe Perches4ec4aa42013-03-18 10:44:45 -0700755 //--
Forest Bond5449c682009-04-25 10:30:44 -0400756#ifdef HOSTAP
Joe Perches4ec4aa42013-03-18 10:44:45 -0700757 // user space daemon: hostapd, is used for HOSTAP
Charles Clément7b6a0012010-08-01 17:15:50 +0200758 bool bEnableHostapd;
759 bool bEnable8021x;
760 bool bEnableHostWEP;
Forest Bond5449c682009-04-25 10:30:44 -0400761 struct net_device *apdev;
762 int (*tx_80211)(struct sk_buff *skb, struct net_device *dev);
763#endif
Joe Perches4ec4aa42013-03-18 10:44:45 -0700764 unsigned int uChannel;
765 bool bMACSuspend;
Forest Bond5449c682009-04-25 10:30:44 -0400766
Forest Bond5449c682009-04-25 10:30:44 -0400767 struct iw_statistics wstats; // wireless stats
Joe Perches4ec4aa42013-03-18 10:44:45 -0700768 bool bCommit;
Forest Bond5449c682009-04-25 10:30:44 -0400769} DEVICE_INFO, *PSDevice;
770
Forest Bond5449c682009-04-25 10:30:44 -0400771//PLICE_DEBUG->
772
Joe Perches4ec4aa42013-03-18 10:44:45 -0700773inline static void EnQueue(PSDevice pDevice, PSRxMgmtPacket pRxMgmtPacket)
Forest Bond5449c682009-04-25 10:30:44 -0400774{
Joe Perches5e0cc8a2013-03-18 20:55:37 -0700775 if ((pDevice->rxManeQueue.tail+1) % NUM == pDevice->rxManeQueue.head) {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700776 return;
Joe Perches5e0cc8a2013-03-18 20:55:37 -0700777 } else {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700778 pDevice->rxManeQueue.tail = (pDevice->rxManeQueue.tail + 1) % NUM;
Forest Bond5449c682009-04-25 10:30:44 -0400779 pDevice->rxManeQueue.Q[pDevice->rxManeQueue.tail] = pRxMgmtPacket;
780 pDevice->rxManeQueue.packet_num++;
Forest Bond5449c682009-04-25 10:30:44 -0400781 }
782}
783
Joe Perches4ec4aa42013-03-18 10:44:45 -0700784inline static PSRxMgmtPacket DeQueue(PSDevice pDevice)
Forest Bond5449c682009-04-25 10:30:44 -0400785{
786 PSRxMgmtPacket pRxMgmtPacket;
Joe Perches5e0cc8a2013-03-18 20:55:37 -0700787 if (pDevice->rxManeQueue.tail == pDevice->rxManeQueue.head) {
Forest Bond5449c682009-04-25 10:30:44 -0400788 printk("Queue is Empty\n");
789 return NULL;
Joe Perches5e0cc8a2013-03-18 20:55:37 -0700790 } else {
Forest Bond5449c682009-04-25 10:30:44 -0400791 int x;
792 //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
793 pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
794 x = pDevice->rxManeQueue.head;
Forest Bond5449c682009-04-25 10:30:44 -0400795 pRxMgmtPacket = pDevice->rxManeQueue.Q[x];
796 pDevice->rxManeQueue.packet_num--;
797 return pRxMgmtPacket;
798 }
799}
800
Charles Clément6b35b7b2010-05-07 12:30:19 -0700801void InitRxManagementQueue(PSDevice pDevice);
Forest Bond5449c682009-04-25 10:30:44 -0400802
Forest Bond5449c682009-04-25 10:30:44 -0400803//PLICE_DEBUG<-
804
Charles Clément7b6a0012010-08-01 17:15:50 +0200805inline static bool device_get_ip(PSDevice pInfo) {
Joe Perches4ec4aa42013-03-18 10:44:45 -0700806 struct in_device *in_dev = (struct in_device *)pInfo->dev->ip_ptr;
807 struct in_ifaddr *ifa;
Forest Bond5449c682009-04-25 10:30:44 -0400808
Joe Perches4ec4aa42013-03-18 10:44:45 -0700809 if (in_dev != NULL) {
810 ifa = (struct in_ifaddr *)in_dev->ifa_list;
811 if (ifa != NULL) {
812 memcpy(pInfo->abyIPAddr, &ifa->ifa_address, 4);
813 return true;
814 }
815 }
816 return false;
Forest Bond5449c682009-04-25 10:30:44 -0400817}
818
Devendra Naga8473f652013-01-08 12:52:33 -0500819static inline PDEVICE_RD_INFO alloc_rd_info(void)
820{
821 return kzalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC);
Forest Bond5449c682009-04-25 10:30:44 -0400822}
823
Devendra Nagad1b46e72013-01-08 12:52:34 -0500824static inline PDEVICE_TD_INFO alloc_td_info(void)
825{
826 return kzalloc(sizeof(DEVICE_TD_INFO), GFP_ATOMIC);
Forest Bond5449c682009-04-25 10:30:44 -0400827}
828
829/*--------------------- Export Functions --------------------------*/
830
Charles Clément7b6a0012010-08-01 17:15:50 +0200831bool device_dma0_xmit(PSDevice pDevice, struct sk_buff *skb, unsigned int uNodeIndex);
832bool device_alloc_frag_buf(PSDevice pDevice, PSDeFragControlBlock pDeF);
833int Config_FileOperation(PSDevice pDevice, bool fwrite, unsigned char *Parameter);
Forest Bond5449c682009-04-25 10:30:44 -0400834#endif