2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
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.
21 * Purpose: MAC Data structure
32 #include <linux/module.h>
33 #include <linux/types.h>
34 #include <linux/init.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>
47 #include <linux/string.h>
48 #include <linux/wait.h>
49 #include <linux/if_arp.h>
50 #include <linux/sched.h>
53 //#include <linux/config.h>
54 #include <linux/uaccess.h>
55 #include <linux/proc_fs.h>
56 #include <linux/inetdevice.h>
57 #include <linux/reboot.h>
59 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
60 #include <linux/ethtool.h>
62 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
64 /* Include Wireless Extension definition and check version - Jean II */
65 #include <linux/wireless.h>
66 #include <net/iw_handler.h> // New driver API
68 //2008-0409-07, <Add> by Einsn Liu
69 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
70 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
77 #include "device_cfg.h"
90 /*--------------------- Export Definitions -------------------------*/
92 #define MAC_MAX_CONTEXT_REG (256+128)
94 #define MAX_MULTICAST_ADDRESS_NUM 32
95 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN)
97 #define DUPLICATE_RX_CACHE_LENGTH 5
99 #define NUM_KEY_ENTRY 11
101 #define TX_WEP_NONE 0
104 #define TX_WEP_SWOTP 3
105 #define TX_WEP_OTPSW 4
106 #define TX_WEP_SW232 5
108 #define KEYSEL_WEP40 0
109 #define KEYSEL_WEP104 1
110 #define KEYSEL_TKIP 2
111 #define KEYSEL_CCMP 3
113 #define AUTO_FB_NONE 0
123 #define ANT_DIVERSITY 2
124 #define ANT_RXD_TXA 3
125 #define ANT_RXD_TXB 4
126 #define ANT_UNKNOWN 0xFF
128 #define MAXCHECKHANGCNT 4
130 #define BB_VGA_LEVEL 4
131 #define BB_VGA_CHANGE_THRESHOLD 16
134 #define RUN_AT(x) (jiffies+(x))
138 #define RESERV_AC0DMA 4
142 #define AVAIL_TD(p, q) ((p)->sOpts.nTxDescs[(q)] - ((p)->iTDUsed[(q)]))
148 #define PRIVATE_Message 0
150 /*--------------------- Export Types ------------------------------*/
152 #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); }
153 #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); }
156 typedef enum _VIA_BB_TYPE
161 } VIA_BB_TYPE
, *PVIA_BB_TYPE
;
163 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
164 typedef enum _VIA_PKT_TYPE
170 } VIA_PKT_TYPE
, *PVIA_PKT_TYPE
;
172 typedef enum __device_msg_level
{
173 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.
178 } DEVICE_MSG_LEVEL
, *PDEVICE_MSG_LEVEL
;
180 typedef enum __device_init_type
{
181 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
184 } DEVICE_INIT_TYPE
, *PDEVICE_INIT_TYPE
;
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
194 typedef unsigned char NDIS_802_11_PMKID_VALUE
[16];
196 typedef enum _NDIS_802_11_WEP_STATUS
198 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
210 } NDIS_802_11_WEP_STATUS
, *PNDIS_802_11_WEP_STATUS
,
211 NDIS_802_11_ENCRYPTION_STATUS
, *PNDIS_802_11_ENCRYPTION_STATUS
;
213 typedef enum _NDIS_802_11_STATUS_TYPE
215 Ndis802_11StatusType_Authentication
,
216 Ndis802_11StatusType_MediaStreamMode
,
217 Ndis802_11StatusType_PMKID_CandidateList
,
218 Ndis802_11StatusTypeMax
// not a real type, defined as an upper bound
219 } NDIS_802_11_STATUS_TYPE
, *PNDIS_802_11_STATUS_TYPE
;
221 //Added new types for PMKID Candidate lists.
222 typedef struct _PMKID_CANDIDATE
{
223 NDIS_802_11_MAC_ADDRESS BSSID
;
225 } PMKID_CANDIDATE
, *PPMKID_CANDIDATE
;
227 typedef struct _BSSID_INFO
229 NDIS_802_11_MAC_ADDRESS BSSID
;
230 NDIS_802_11_PMKID_VALUE PMKID
;
231 } BSSID_INFO
, *PBSSID_INFO
;
233 typedef struct tagSPMKID
{
234 unsigned long Length
;
235 unsigned long BSSIDInfoCount
;
236 BSSID_INFO BSSIDInfo
[MAX_BSSIDINFO_4_PMKID
];
239 typedef struct tagSPMKIDCandidateEvent
{
240 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
];
244 } SPMKIDCandidateEvent
, *PSPMKIDCandidateEvent
;
249 #define MAX_QUIET_COUNT 8
251 typedef struct tagSQuietControl
{
253 unsigned long dwStartTime
;
254 unsigned char byPeriod
;
255 unsigned short wDuration
;
256 } SQuietControl
, *PSQuietControl
;
259 typedef struct __chip_info_tbl
{
265 } CHIP_INFO
, *PCHIP_INFO
;
270 } DEVICE_OWNER_TYPE
, *PDEVICE_OWNER_TYPE
;
272 // The receive duplicate detection cache entry
273 typedef struct tagSCacheEntry
{
274 unsigned short wFmSequence
;
275 unsigned char abyAddr2
[ETH_ALEN
];
276 } SCacheEntry
, *PSCacheEntry
;
278 typedef struct tagSCache
{
279 /* The receive cache is updated circularly. The next entry to be written is
280 * indexed by the "InPtr".
282 unsigned int uInPtr
; // Place to use next
283 SCacheEntry asCacheEntry
[DUPLICATE_RX_CACHE_LENGTH
];
286 #define CB_MAX_RX_FRAG 64
287 // DeFragment Control Block, used for collecting fragments prior to reassembly
288 typedef struct tagSDeFragControlBlock
290 unsigned short wSequence
;
291 unsigned short wFragNum
;
292 unsigned char abyAddr2
[ETH_ALEN
];
293 unsigned int uLifetime
;
295 unsigned char *pbyRxBuffer
;
296 unsigned int cbFrameLength
;
298 } SDeFragControlBlock
, *PSDeFragControlBlock
;
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
308 //flags for driver status
309 #define DEVICE_FLAGS_OPENED 0x00010000UL
310 #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
311 //flags for capabilities
312 #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
313 #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
314 #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
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
329 typedef struct _RxManagementQueue
333 PSRxMgmtPacket Q
[NUM
];
334 } RxManagementQueue
, *PSRxManagementQueue
;
338 typedef struct __device_opt
{
339 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
351 } OPTIONS
, *POPTIONS
;
353 typedef struct __device_info
{
354 struct __device_info
*next
;
355 struct __device_info
*prev
;
357 struct pci_dev
*pcid
;
364 struct net_device
*dev
;
365 struct net_device
*next_module
;
366 struct net_device_stats stats
;
368 //dma addr, rx/tx pool
370 dma_addr_t rd0_pool_dma
;
371 dma_addr_t rd1_pool_dma
;
373 dma_addr_t td0_pool_dma
;
374 dma_addr_t td1_pool_dma
;
376 dma_addr_t tx_bufs_dma0
;
377 dma_addr_t tx_bufs_dma1
;
378 dma_addr_t tx_beacon_dma
;
380 unsigned char *tx0_bufs
;
381 unsigned char *tx1_bufs
;
382 unsigned char *tx_beacon_bufs
;
386 unsigned long PortOffset
;
392 unsigned char byRevId
;
393 unsigned short SubSystemID
;
394 unsigned short SubVendorID
;
397 volatile int iTDUsed
[TYPE_MAXTD
];
399 volatile PSTxDesc apCurrTD
[TYPE_MAXTD
];
400 volatile PSTxDesc apTailTD
[TYPE_MAXTD
];
402 volatile PSTxDesc apTD0Rings
;
403 volatile PSTxDesc apTD1Rings
;
405 volatile PSRxDesc aRD0Ring
;
406 volatile PSRxDesc aRD1Ring
;
407 volatile PSRxDesc pCurrRD
[TYPE_MAXRD
];
410 SDeFragControlBlock sRxDFCB
[CB_MAX_RX_FRAG
];
412 unsigned int cbFreeDFCB
;
413 unsigned int uCurrentDFCBIdx
;
421 unsigned char byRxMode
;
425 struct tasklet_struct RxMngWorkItem
;
426 RxManagementQueue rxManeQueue
;
430 struct completion notify
;
431 struct semaphore mlme_semaphore
;
437 unsigned char byLocalID
;
438 unsigned char byRFType
;
440 unsigned char byMaxPwrLevel
;
441 unsigned char byZoneType
;
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
];
448 // Adapter statistics
449 SStatCounter scStatistic
;
451 SDot11Counters s802_11Counter
;
455 SMgmtObject sMgmtObj
;
457 // 802.11 MAC specific
458 unsigned int uCurrRSSI
;
459 unsigned char byCurrSQ
;
461 unsigned long dwTxAntennaSel
;
462 unsigned long dwRxAntennaSel
;
463 unsigned char byAntennaCount
;
464 unsigned char byRxAntennaMode
;
465 unsigned char byTxAntennaMode
;
468 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.
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
;
483 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
;
490 unsigned char byMinChannel
;
491 unsigned char byMaxChannel
;
492 unsigned int uConnectionRate
;
494 unsigned char byPreambleType
;
495 unsigned char byShortPreamble
;
497 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
;
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
514 unsigned long dwMaxReceiveLifetime
; // dot11MaxReceiveLifetime
517 bool bEncryptionEnable
;
522 bool bBarkerPreambleMd
;
524 unsigned char byERPFlag
;
525 unsigned short wUseProtectCntDown
;
527 bool bRadioControlOff
;
530 unsigned short wListenInterval
;
532 WMAC_POWER_MODE ePSMode
;
534 // GPIO Radio Control
535 unsigned char byRadioCtl
;
536 unsigned char byGPIO
;
538 bool bPrvActive4RadioOFF
;
542 unsigned short wSeqCounter
;
543 unsigned short wBCNBufLen
;
544 bool bBeaconBufReady
;
546 bool bIsBeaconBufReadySet
;
547 unsigned int cbBeaconBufReadySetCnt
;
549 unsigned char byCurrentCh
;
550 unsigned int uScanTime
;
552 CMD_STATE eCommandState
;
560 unsigned int uAutoReConnectTime
;
564 CMD_ITEM eCmdQueue
[CMD_Q_SIZE
];
565 unsigned int uCmdDequeueIdx
;
566 unsigned int uCmdEnqueueIdx
;
567 unsigned int cbFreeCmdQueue
;
573 unsigned char abyIPAddr
[4];
575 unsigned long ulTxPower
;
576 NDIS_802_11_WEP_STATUS eEncryptionStatus
;
578 //2007-0925-01<Add>by MikeLiu
579 //mike add :save old Encryption
580 NDIS_802_11_WEP_STATUS eOldEncryptionStatus
;
583 unsigned long dwIVCounter
;
585 QWORD qwPacketNumber
; //For CCMP and TKIP as TSC(6 bytes)
586 unsigned int uCurrentWEPMode
;
589 unsigned char abyPRNG
[WLAN_WEPMAX_KEYLEN
+3];
590 unsigned char byKeyIndex
;
591 unsigned int uKeyLength
;
592 unsigned char abyKey
[WLAN_WEP232_KEYLEN
];
595 unsigned char byCntMeasure
;
598 unsigned int uAssocCount
;
604 // for OID_802_11_ASSOCIATION_INFORMATION
607 unsigned char byAutoFBCtrl
;
612 unsigned int uRATEIdx
;
614 // For Update BaseBand VGA Gain Offset
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
];
622 unsigned char byBBPreEDRSSI
;
623 unsigned char byBBPreEDIndex
;
626 unsigned long dwDiagRefCount
;
629 unsigned char byFOETuning
;
631 // For Auto Power Tunning
633 unsigned char byAutoPwrTunning
;
635 short sPSetPointOFDMG
;
636 short sPSetPointOFDMA
;
637 long lPFormulaOffset
;
642 // For RF Power table
643 unsigned char byCCKPwr
;
644 unsigned char byOFDMPwrG
;
645 unsigned char byCurPwr
;
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];
654 // BaseBand Loopback Use
655 unsigned char byBBCR4d
;
656 unsigned char byBBCRc9
;
657 unsigned char byBBCR88
;
658 unsigned char byBBCR09
;
661 struct timer_list sTimerCommand
;
663 struct timer_list sTimerTxData
;
664 unsigned long nTxDataTimeCout
;
666 bool IsTxDataTrigger
;
669 #ifdef WPA_SM_Transtatus
670 bool fWPA_Authened
; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
672 unsigned char byReAssocCount
; //mike add:re-association retry times!
673 unsigned char byLinkWaitCount
;
675 unsigned char abyNodeName
[17];
677 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
;
687 unsigned long uDiversityCnt
;
688 unsigned char byAntennaState
;
689 unsigned long ulRatio_State0
;
690 unsigned long ulRatio_State1
;
692 //SQ3 functions for antenna diversity
693 struct timer_list TimerSQ3Tmax1
;
694 struct timer_list TimerSQ3Tmax2
;
695 struct timer_list TimerSQ3Tmax3
;
697 unsigned long uNumSQ3
[MAX_RATE
];
698 unsigned short wAntDiversityMaxRate
;
700 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
708 SPMKIDCandidateEvent gsPMKIDCandidate
;
712 unsigned char abyCountryCode
[3];
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];
726 unsigned char byNewChannel
;
727 unsigned char byChannelSwitchCount
;
729 bool bEnableFirstQuiet
;
730 unsigned char byQuietStartCount
;
731 unsigned int uQuietEnqueue
;
732 unsigned long dwCurrentQuietEndTime
;
733 SQuietControl sQuiet
[MAX_QUIET_COUNT
];
736 bool bCountryInfo24G
;
738 unsigned short wBeaconInterval
;
740 //WPA supplicant deamon
741 struct net_device
*wpadev
;
744 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
751 unsigned int bwextcount
;
752 bool bWPASuppWextEnabled
;
757 // user space daemon: hostapd, is used for HOSTAP
761 struct net_device
*apdev
;
762 int (*tx_80211
)(struct sk_buff
*skb
, struct net_device
*dev
);
764 unsigned int uChannel
;
767 struct iw_statistics wstats
; // wireless stats
769 } DEVICE_INFO
, *PSDevice
;
773 inline static void EnQueue(PSDevice pDevice
, PSRxMgmtPacket pRxMgmtPacket
)
775 if ((pDevice
->rxManeQueue
.tail
+1) % NUM
== pDevice
->rxManeQueue
.head
) {
778 pDevice
->rxManeQueue
.tail
= (pDevice
->rxManeQueue
.tail
+ 1) % NUM
;
779 pDevice
->rxManeQueue
.Q
[pDevice
->rxManeQueue
.tail
] = pRxMgmtPacket
;
780 pDevice
->rxManeQueue
.packet_num
++;
784 inline static PSRxMgmtPacket
DeQueue(PSDevice pDevice
)
786 PSRxMgmtPacket pRxMgmtPacket
;
787 if (pDevice
->rxManeQueue
.tail
== pDevice
->rxManeQueue
.head
) {
788 printk("Queue is Empty\n");
792 //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
793 pDevice
->rxManeQueue
.head
= (pDevice
->rxManeQueue
.head
+1)%NUM
;
794 x
= pDevice
->rxManeQueue
.head
;
795 pRxMgmtPacket
= pDevice
->rxManeQueue
.Q
[x
];
796 pDevice
->rxManeQueue
.packet_num
--;
797 return pRxMgmtPacket
;
801 void InitRxManagementQueue(PSDevice pDevice
);
805 inline static bool device_get_ip(PSDevice pInfo
) {
806 struct in_device
*in_dev
= (struct in_device
*)pInfo
->dev
->ip_ptr
;
807 struct in_ifaddr
*ifa
;
809 if (in_dev
!= NULL
) {
810 ifa
= (struct in_ifaddr
*)in_dev
->ifa_list
;
812 memcpy(pInfo
->abyIPAddr
, &ifa
->ifa_address
, 4);
819 static inline PDEVICE_RD_INFO
alloc_rd_info(void)
821 return kzalloc(sizeof(DEVICE_RD_INFO
), GFP_ATOMIC
);
824 static inline PDEVICE_TD_INFO
alloc_td_info(void)
826 return kzalloc(sizeof(DEVICE_TD_INFO
), GFP_ATOMIC
);
829 /*--------------------- Export Functions --------------------------*/
831 bool device_dma0_xmit(PSDevice pDevice
, struct sk_buff
*skb
, unsigned int uNodeIndex
);
832 bool device_alloc_frag_buf(PSDevice pDevice
, PSDeFragControlBlock pDeF
);
833 int Config_FileOperation(PSDevice pDevice
, bool fwrite
, unsigned char *Parameter
);