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
34 #include <linux/modversions.h>
35 #endif /* MODVERSIONS */
36 #include <linux/module.h>
39 #include <linux/types.h>
40 #include <linux/init.h>
42 #include <linux/errno.h>
43 #include <linux/ioport.h>
44 #include <linux/pci.h>
45 #include <linux/kernel.h>
46 #include <linux/netdevice.h>
47 #include <linux/etherdevice.h>
48 #include <linux/skbuff.h>
49 #include <linux/delay.h>
50 #include <linux/timer.h>
51 #include <linux/slab.h>
52 #include <linux/interrupt.h>
53 #include <linux/version.h>
54 #include <linux/string.h>
55 #include <linux/wait.h>
56 #include <linux/if_arp.h>
57 #include <linux/sched.h>
60 //#include <linux/config.h>
61 #include <asm/uaccess.h>
62 #include <linux/proc_fs.h>
63 #include <linux/inetdevice.h>
64 #include <linux/reboot.h>
66 #define DEVICE_ETHTOOL_IOCTL_SUPPORT
67 #include <linux/ethtool.h>
69 #undef DEVICE_ETHTOOL_IOCTL_SUPPORT
71 /* Include Wireless Extension definition and check version - Jean II */
72 #include <linux/wireless.h>
74 #include <net/iw_handler.h> // New driver API
75 #endif /* WIRELESS_EXT > 12 */
77 //2008-0409-07, <Add> by Einsn Liu
79 #ifndef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
80 #define WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
83 //2008-4-14<add> by chester for led issue
84 //#define FOR_LED_ON_NOTEBOOK
91 #if !defined(_KCOMPAT_H)
95 #if !defined(__DEVICE_CONFIG_H)
96 #include "device_cfg.h"
99 #if !defined(__TTYPE_H__)
102 #if !defined(__80211HDR_H__)
103 #include "80211hdr.h"
105 #if !defined(__TETHER_H__)
108 #if !defined(__WMGR_H__)
111 #if !defined(__WCMD_H__)
114 #if !defined(__MIB_H__)
117 #if !defined(__SROM_H__)
120 #if !defined(__RC4_H__)
123 #if !defined(__TPCI_H__)
126 #if !defined(__DESC_H__)
130 #if !defined(__KEY_H__)
134 #if !defined(__MAC_H__)
144 // #ifdef PRIVATE_OBJ
145 //#if !defined(__DEVICE_MODULE_H)
146 //#include "device_module.h"
150 /*--------------------- Export Definitions -------------------------*/
152 #define MAC_MAX_CONTEXT_REG (256+128)
154 #define MAX_MULTICAST_ADDRESS_NUM 32
155 #define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN)
158 //#define OP_MODE_INFRASTRUCTURE 0
159 //#define OP_MODE_ADHOC 1
160 //#define OP_MODE_AP 2
162 #define DUPLICATE_RX_CACHE_LENGTH 5
164 #define NUM_KEY_ENTRY 11
166 #define TX_WEP_NONE 0
169 #define TX_WEP_SWOTP 3
170 #define TX_WEP_OTPSW 4
171 #define TX_WEP_SW232 5
173 #define KEYSEL_WEP40 0
174 #define KEYSEL_WEP104 1
175 #define KEYSEL_TKIP 2
176 #define KEYSEL_CCMP 3
180 #define AUTO_FB_NONE 0
190 #define ANT_DIVERSITY 2
191 #define ANT_RXD_TXA 3
192 #define ANT_RXD_TXB 4
193 #define ANT_UNKNOWN 0xFF
195 #define MAXCHECKHANGCNT 4
197 #define BB_VGA_LEVEL 4
198 #define BB_VGA_CHANGE_THRESHOLD 16
202 #define RUN_AT(x) (jiffies+(x))
206 #define RESERV_AC0DMA 4
213 #undef dev_kfree_skb_irq
220 #undef netif_stop_queue
221 #undef netif_start_queue
222 #undef netif_wake_queue
223 #undef netif_queue_stopped
228 #undef eth_type_trans
232 #undef pci_alloc_consistent
233 #undef pci_free_consistent
234 #undef register_netdevice
235 #undef register_netdev
236 #undef unregister_netdevice
237 #undef unregister_netdev
238 #undef skb_queue_head_init
239 #undef skb_queue_tail
240 #undef skb_queue_empty
242 #undef copy_from_user
244 #undef spin_lock_init
245 #undef pci_map_single
246 #undef pci_unmap_single
248 // redefine kernel dependent fucntion
249 #define dev_kfree_skb ref_dev_kfree_skb
250 #define dev_kfree_skb_irq ref_dev_kfree_skb_irq
251 #define dev_alloc_skb ref_dev_alloc_skb
252 #define kfree ref_kfree
253 #define del_timer ref_del_timer
254 #define init_timer ref_init_timer
255 #define add_timer ref_add_timer
256 #define kmalloc ref_kmalloc
257 #define netif_stop_queue ref_netif_stop_queue
258 #define netif_start_queue ref_netif_start_queue
259 #define netif_wake_queue ref_netif_wake_queue
260 #define netif_queue_stopped ref_netif_queue_stopped
261 #define netif_rx ref_netif_rx
262 #define netif_running ref_netif_running
263 #define udelay ref_udelay
264 #define mdelay ref_mdelay
265 #define get_jiffies() ref_get_jiffies()
266 #define RUN_AT(x) (get_jiffies()+(x))
267 #define HZ ref_HZ_tick()
268 #define eth_type_trans ref_eth_type_trans
269 #define skb_put ref_skb_put
270 #define skb_queue_head_init ref_skb_queue_head_init
271 #define skb_queue_tail ref_skb_queue_tail
272 #define skb_queue_empty ref_skb_queue_empty
274 #define pci_alloc_consistent ref_pci_alloc_consistent
275 #define pci_free_consistent ref_pci_free_consistent
276 #define register_netdevice ref_register_netdevice
277 #define register_netdev ref_register_netdev
278 #define unregister_netdevice ref_unregister_netdevice
279 #define unregister_netdev ref_unregister_netdev
281 #define free_irq ref_free_irq
282 #define copy_from_user ref_copy_from_user
283 #define copy_to_user ref_copy_to_user
284 #define spin_lock_init ref_spin_lock_init
285 #define pci_map_single ref_pci_map_single
286 #define pci_unmap_single ref_pci_unmap_single
292 #define DEVICE_PRT(l, p, args...) {if (l<=msglevel) do {} while (0);}
293 //#define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
295 #define DEVICE_PRT(l, p, args...) {if (l<=msglevel) printk( p ,##args);}
299 #define AVAIL_TD(p,q) ((p)->sOpts.nTxDescs[(q)]-((p)->iTDUsed[(q)]))
307 /*--------------------- Export Types ------------------------------*/
311 typedef enum _VIA_BB_TYPE
316 } VIA_BB_TYPE
, *PVIA_BB_TYPE
;
318 //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
319 typedef enum _VIA_PKT_TYPE
325 } VIA_PKT_TYPE
, *PVIA_PKT_TYPE
;
328 typedef enum __device_msg_level
{
329 MSG_LEVEL_ERR
=0, //Errors that will cause abnormal operation.
330 MSG_LEVEL_NOTICE
=1, //Some errors need users to be notified.
331 MSG_LEVEL_INFO
=2, //Normal message.
332 MSG_LEVEL_VERBOSE
=3, //Will report all trival errors.
333 MSG_LEVEL_DEBUG
=4 //Only for debug purpose.
334 } DEVICE_MSG_LEVEL
, *PDEVICE_MSG_LEVEL
;
336 typedef enum __device_init_type
{
337 DEVICE_INIT_COLD
=0, // cold init
338 DEVICE_INIT_RESET
, // reset init or Dx to D0 power remain init
339 DEVICE_INIT_DXPL
// Dx to D0 power lost init
340 } DEVICE_INIT_TYPE
, *PDEVICE_INIT_TYPE
;
345 #define MAX_BSSIDINFO_4_PMKID 16
346 #define MAX_PMKIDLIST 5
347 //Flags for PMKID Candidate list structure
348 #define NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED 0x01
351 typedef UCHAR NDIS_802_11_PMKID_VALUE
[16];
354 typedef enum _NDIS_802_11_WEP_STATUS
356 Ndis802_11WEPEnabled
,
357 Ndis802_11Encryption1Enabled
= Ndis802_11WEPEnabled
,
358 Ndis802_11WEPDisabled
,
359 Ndis802_11EncryptionDisabled
= Ndis802_11WEPDisabled
,
360 Ndis802_11WEPKeyAbsent
,
361 Ndis802_11Encryption1KeyAbsent
= Ndis802_11WEPKeyAbsent
,
362 Ndis802_11WEPNotSupported
,
363 Ndis802_11EncryptionNotSupported
= Ndis802_11WEPNotSupported
,
364 Ndis802_11Encryption2Enabled
,
365 Ndis802_11Encryption2KeyAbsent
,
366 Ndis802_11Encryption3Enabled
,
367 Ndis802_11Encryption3KeyAbsent
368 } NDIS_802_11_WEP_STATUS
, *PNDIS_802_11_WEP_STATUS
,
369 NDIS_802_11_ENCRYPTION_STATUS
, *PNDIS_802_11_ENCRYPTION_STATUS
;
372 typedef enum _NDIS_802_11_STATUS_TYPE
374 Ndis802_11StatusType_Authentication
,
375 Ndis802_11StatusType_MediaStreamMode
,
376 Ndis802_11StatusType_PMKID_CandidateList
,
377 Ndis802_11StatusTypeMax
// not a real type, defined as an upper bound
378 } NDIS_802_11_STATUS_TYPE
, *PNDIS_802_11_STATUS_TYPE
;
380 //Added new types for PMKID Candidate lists.
381 typedef struct _PMKID_CANDIDATE
{
382 NDIS_802_11_MAC_ADDRESS BSSID
;
384 } PMKID_CANDIDATE
, *PPMKID_CANDIDATE
;
387 typedef struct _BSSID_INFO
389 NDIS_802_11_MAC_ADDRESS BSSID
;
390 NDIS_802_11_PMKID_VALUE PMKID
;
391 } BSSID_INFO
, *PBSSID_INFO
;
393 typedef struct tagSPMKID
{
395 ULONG BSSIDInfoCount
;
396 BSSID_INFO BSSIDInfo
[MAX_BSSIDINFO_4_PMKID
];
399 typedef struct tagSPMKIDCandidateEvent
{
400 NDIS_802_11_STATUS_TYPE StatusType
;
401 ULONG Version
; // Version of the structure
402 ULONG NumCandidates
; // No. of pmkid candidates
403 PMKID_CANDIDATE CandidateList
[MAX_PMKIDLIST
];
404 } SPMKIDCandidateEvent
, DEF
* PSPMKIDCandidateEvent
;
410 #define MAX_QUIET_COUNT 8
412 typedef struct tagSQuietControl
{
417 } SQuietControl
, DEF
* PSQuietControl
;
420 typedef struct __chip_info_tbl
{
426 } CHIP_INFO
, *PCHIP_INFO
;
432 } DEVICE_OWNER_TYPE
, *PDEVICE_OWNER_TYPE
;
435 // The receive duplicate detection cache entry
436 typedef struct tagSCacheEntry
{
438 BYTE abyAddr2
[U_ETHER_ADDR_LEN
];
439 } SCacheEntry
, *PSCacheEntry
;
442 typedef struct tagSCache
{
443 /* The receive cache is updated circularly. The next entry to be written is
444 * indexed by the "InPtr".
446 UINT uInPtr
; // Place to use next
447 SCacheEntry asCacheEntry
[DUPLICATE_RX_CACHE_LENGTH
];
450 #define CB_MAX_RX_FRAG 64
451 // DeFragment Control Block, used for collecting fragments prior to reassembly
452 typedef struct tagSDeFragControlBlock
456 BYTE abyAddr2
[U_ETHER_ADDR_LEN
];
465 } SDeFragControlBlock
, DEF
* PSDeFragControlBlock
;
471 #define DEVICE_FLAGS_IP_ALIGN 0x00000001UL
472 #define DEVICE_FLAGS_PREAMBLE_TYPE 0x00000002UL
473 #define DEVICE_FLAGS_OP_MODE 0x00000004UL
474 #define DEVICE_FLAGS_PS_MODE 0x00000008UL
475 #define DEVICE_FLAGS_80211h_MODE 0x00000010UL
476 #define DEVICE_FLAGS_DiversityANT 0x00000020UL
478 //flags for driver status
479 #define DEVICE_FLAGS_OPENED 0x00010000UL
480 #define DEVICE_FLAGS_WOL_ENABLED 0x00080000UL
481 //flags for capbilities
482 #define DEVICE_FLAGS_TX_ALIGN 0x01000000UL
483 #define DEVICE_FLAGS_HAVE_CAM 0x02000000UL
484 #define DEVICE_FLAGS_FLOW_CTRL 0x04000000UL
486 //flags for MII status
487 #define DEVICE_LINK_FAIL 0x00000001UL
488 #define DEVICE_SPEED_10 0x00000002UL
489 #define DEVICE_SPEED_100 0x00000004UL
490 #define DEVICE_SPEED_1000 0x00000008UL
491 #define DEVICE_DUPLEX_FULL 0x00000010UL
492 #define DEVICE_AUTONEG_ENABLE 0x00000020UL
493 #define DEVICE_FORCED_BY_EEPROM 0x00000040UL
494 //for device_set_media_duplex
495 #define DEVICE_LINK_CHANGE 0x00000001UL
501 typedef struct _RxManagementQueue
505 PSRxMgmtPacket Q
[NUM
];
506 } RxManagementQueue
,*PSRxManagementQueue
;
513 typedef struct __device_opt
{
514 int nRxDescs0
; //Number of RX descriptors0
515 int nRxDescs1
; //Number of RX descriptors1
516 int nTxDescs
[2]; //Number of TX descriptors 0, 1
517 int int_works
; //interrupt limits
518 int rts_thresh
; //rts threshold
526 } OPTIONS
, *POPTIONS
;
529 typedef struct __device_info
{
530 struct __device_info
* next
;
531 struct __device_info
* prev
;
533 struct pci_dev
* pcid
;
540 struct net_device
* dev
;
541 struct net_device
* next_module
;
542 struct net_device_stats stats
;
544 //dma addr, rx/tx pool
546 dma_addr_t rd0_pool_dma
;
547 dma_addr_t rd1_pool_dma
;
549 dma_addr_t td0_pool_dma
;
550 dma_addr_t td1_pool_dma
;
552 dma_addr_t tx_bufs_dma0
;
553 dma_addr_t tx_bufs_dma1
;
554 dma_addr_t tx_beacon_dma
;
558 PBYTE tx_beacon_bufs
;
573 volatile int iTDUsed
[TYPE_MAXTD
];
575 volatile PSTxDesc apCurrTD
[TYPE_MAXTD
];
576 volatile PSTxDesc apTailTD
[TYPE_MAXTD
];
578 volatile PSTxDesc apTD0Rings
;
579 volatile PSTxDesc apTD1Rings
;
581 volatile PSRxDesc aRD0Ring
;
582 volatile PSRxDesc aRD1Ring
;
583 volatile PSRxDesc pCurrRD
[TYPE_MAXRD
];
586 SDeFragControlBlock sRxDFCB
[CB_MAX_RX_FRAG
];
589 UINT uCurrentDFCBIdx
;
601 struct tasklet_struct RxMngWorkItem
;
602 RxManagementQueue rxManeQueue
;
606 struct completion notify
;
607 struct semaphore mlme_semaphore
;
620 BYTE byOriginalZonetype
;
621 BYTE abyMacContext
[MAC_MAX_CONTEXT_REG
];
622 BOOL bLinkPass
; // link status: OK or fail
623 BYTE abyCurrentNetAddr
[U_ETHER_ADDR_LEN
];
625 // Adapter statistics
626 SStatCounter scStatistic
;
628 SDot11Counters s802_11Counter
;
633 SMgmtObject sMgmtObj
;
635 // 802.11 MAC specific
639 DWORD dwTxAntennaSel
;
640 DWORD dwRxAntennaSel
;
642 BYTE byRxAntennaMode
;
643 BYTE byTxAntennaMode
;
647 UINT uSIFS
; //Current SIFS
648 UINT uDIFS
; //Current DIFS
649 UINT uEIFS
; //Current EIFS
650 UINT uSlot
; //Current SlotTime
651 UINT uCwMin
; //Current CwMin
652 UINT uCwMax
; //CwMax is fixed on 1023.
659 CARD_PHY_TYPE eCurrentPHYType
;
662 VIA_BB_TYPE byBBType
; //0: 11A, 1:11B, 2:11G
663 VIA_PKT_TYPE byPacketType
; //0:11a,1:11b,2:11gb(only CCK in BasicRate),3:11ga(OFDM in Basic Rate)
666 BYTE byTopOFDMBasicRate
;
667 BYTE byTopCCKBasicRate
;
671 UINT uConnectionRate
;
674 BYTE byShortPreamble
;
678 WORD wFragmentationThreshold
;
679 BYTE byShortRetryLimit
;
680 BYTE byLongRetryLimit
;
681 CARD_OP_MODE eOPMode
;
684 WORD wMaxTransmitMSDULifetime
;
685 BYTE abyBSSID
[U_ETHER_ADDR_LEN
];
686 BYTE abyDesireBSSID
[U_ETHER_ADDR_LEN
];
687 WORD wCTSDuration
; // update while speed change
688 WORD wACKDuration
; // update while speed change
689 WORD wRTSTransmitLen
; // update while speed change
690 BYTE byRTSServiceField
; // update while speed change
691 BYTE byRTSSignalField
; // update while speed change
693 DWORD dwMaxReceiveLifetime
; // dot11MaxReceiveLifetime
696 BOOL bEncryptionEnable
;
701 BOOL bBarkerPreambleMd
;
704 WORD wUseProtectCntDown
;
706 BOOL bRadioControlOff
;
709 WORD wListenInterval
;
711 WMAC_POWER_MODE ePSMode
;
714 // GPIO Radio Control
718 BOOL bPrvActive4RadioOFF
;
724 BOOL bBeaconBufReady
;
726 BOOL bIsBeaconBufReadySet
;
727 UINT cbBeaconBufReadySetCnt
;
732 CMD_STATE eCommandState
;
740 UINT uAutoReConnectTime
;
744 CMD_ITEM eCmdQueue
[CMD_Q_SIZE
];
758 NDIS_802_11_WEP_STATUS eEncryptionStatus
;
760 //2007-0925-01<Add>by MikeLiu
761 //mike add :save old Encryption
762 NDIS_802_11_WEP_STATUS eOldEncryptionStatus
;
766 QWORD qwPacketNumber
; //For CCMP and TKIP as TSC(6 bytes)
767 UINT uCurrentWEPMode
;
770 BYTE abyPRNG
[WLAN_WEPMAX_KEYLEN
+3];
774 BYTE abyKey
[WLAN_WEP232_KEYLEN
];
786 // for OID_802_11_ASSOCIATION_INFORMATION
799 // For Update BaseBand VGA Gain Offset
801 UINT uBBVGADiffCount
;
804 BYTE abyBBVGA
[BB_VGA_LEVEL
];
805 LONG ldBmThreshold
[BB_VGA_LEVEL
];
811 DWORD dwDiagRefCount
;
816 // For Auto Power Tunning
818 BYTE byAutoPwrTunning
;
820 SHORT sPSetPointOFDMG
;
821 SHORT sPSetPointOFDMA
;
822 LONG lPFormulaOffset
;
827 // For RF Power table
832 BYTE abyCCKPwrTbl
[CB_MAX_CHANNEL_24G
+1];
833 BYTE abyOFDMPwrTbl
[CB_MAX_CHANNEL
+1];
834 I8 abyCCKDefaultPwr
[CB_MAX_CHANNEL_24G
+1];
835 I8 abyOFDMDefaultPwr
[CB_MAX_CHANNEL
+1];
836 I8 abyRegPwr
[CB_MAX_CHANNEL
+1];
837 I8 abyLocalPwr
[CB_MAX_CHANNEL
+1];
840 // BaseBand Loopback Use
847 struct timer_list sTimerCommand
;
849 struct timer_list sTimerTxData
;
850 ULONG nTxDataTimeCout
;
852 BOOL IsTxDataTrigger
;
855 #ifdef WPA_SM_Transtatus
856 BOOL fWPA_Authened
; //is WPA/WPA-PSK or WPA2/WPA2-PSK authen??
858 BYTE byReAssocCount
; //mike add:re-association retry times!
859 BYTE byLinkWaitCount
;
862 BYTE abyNodeName
[17];
864 BOOL bDiversityRegCtlON
;
865 BOOL bDiversityEnable
;
866 ULONG ulDiversityNValue
;
867 ULONG ulDiversityMValue
;
876 ULONG ulRatio_State0
;
877 ULONG ulRatio_State1
;
879 //SQ3 functions for antenna diversity
880 struct timer_list TimerSQ3Tmax1
;
881 struct timer_list TimerSQ3Tmax2
;
882 struct timer_list TimerSQ3Tmax3
;
885 ULONG uNumSQ3
[MAX_RATE
];
886 WORD wAntDiversityMaxRate
;
889 SEthernetHeader sTxEthHeader
;
890 SEthernetHeader sRxEthHeader
;
891 BYTE abyBroadcastAddr
[U_ETHER_ADDR_LEN
];
892 BYTE abySNAP_RFC1042
[U_ETHER_ADDR_LEN
];
893 BYTE abySNAP_Bridgetunnel
[U_ETHER_ADDR_LEN
];
894 BYTE abyEEPROM
[EEP_MAX_CONTEXT_SIZE
]; //DWORD alignment
895 // Pre-Authentication & PMK cache
897 SPMKIDCandidateEvent gsPMKIDCandidate
;
902 BYTE abyCountryCode
[3];
904 UINT uNumOfMeasureEIDs
;
905 PWLAN_IE_MEASURE_REQ pCurrMeasureEID
;
906 BOOL bMeasureInProgress
;
917 BYTE byChannelSwitchCount
;
919 BOOL bEnableFirstQuiet
;
920 BYTE byQuietStartCount
;
922 DWORD dwCurrentQuietEndTime
;
923 SQuietControl sQuiet
[MAX_QUIET_COUNT
];
926 BOOL bCountryInfo24G
;
928 WORD wBeaconInterval
;
930 //WPA supplicant deamon
931 struct net_device
*wpadev
;
934 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
942 BOOL bWPASuppWextEnabled
;
947 // user space daemon: hostapd, is used for HOSTAP
951 struct net_device
*apdev
;
952 int (*tx_80211
)(struct sk_buff
*skb
, struct net_device
*dev
);
958 struct iw_statistics wstats
; // wireless stats
959 #endif /* WIRELESS_EXT */
962 } DEVICE_INFO
, *PSDevice
;
968 inline static VOID
EnQueue (PSDevice pDevice
,PSRxMgmtPacket pRxMgmtPacket
)
970 //printk("Enter EnQueue:tail is %d\n",pDevice->rxManeQueue.tail);
971 if ((pDevice
->rxManeQueue
.tail
+1) % NUM
== pDevice
->rxManeQueue
.head
)
973 //printk("Queue is Full,tail is %d\n",pDevice->rxManeQueue.tail);
978 pDevice
->rxManeQueue
.tail
= (pDevice
->rxManeQueue
.tail
+1)% NUM
;
979 pDevice
->rxManeQueue
.Q
[pDevice
->rxManeQueue
.tail
] = pRxMgmtPacket
;
980 pDevice
->rxManeQueue
.packet_num
++;
981 //printk("packet num is %d\n",pDevice->rxManeQueue.packet_num);
988 inline static PSRxMgmtPacket
DeQueue (PSDevice pDevice
)
990 PSRxMgmtPacket pRxMgmtPacket
;
991 if (pDevice
->rxManeQueue
.tail
== pDevice
->rxManeQueue
.head
)
993 printk("Queue is Empty\n");
999 //x=pDevice->rxManeQueue.head = (pDevice->rxManeQueue.head+1)%NUM;
1000 pDevice
->rxManeQueue
.head
= (pDevice
->rxManeQueue
.head
+1)%NUM
;
1001 x
= pDevice
->rxManeQueue
.head
;
1002 //printk("Enter DeQueue:head is %d\n",x);
1003 pRxMgmtPacket
= pDevice
->rxManeQueue
.Q
[x
];
1004 pDevice
->rxManeQueue
.packet_num
--;
1005 return pRxMgmtPacket
;
1009 VOID
InitRxManagementQueue(PSDevice pDevice
);
1020 inline static BOOL
device_get_ip(PSDevice pInfo
) {
1021 struct in_device
* in_dev
=(struct in_device
*) pInfo
->dev
->ip_ptr
;
1022 struct in_ifaddr
* ifa
;
1025 ifa
=(struct in_ifaddr
*) in_dev
->ifa_list
;
1027 memcpy(pInfo
->abyIPAddr
,&ifa
->ifa_address
,4);
1036 static inline PDEVICE_RD_INFO
alloc_rd_info(void) {
1037 PDEVICE_RD_INFO ptr
;
1038 if ((ptr
= (PDEVICE_RD_INFO
)kmalloc((int)sizeof(DEVICE_RD_INFO
), (int)GFP_ATOMIC
)) == NULL
)
1041 memset(ptr
,0,sizeof(DEVICE_RD_INFO
));
1046 static inline PDEVICE_TD_INFO
alloc_td_info(void) {
1047 PDEVICE_TD_INFO ptr
;
1048 if ((ptr
= (PDEVICE_TD_INFO
)kmalloc((int)sizeof(DEVICE_TD_INFO
), (int)GFP_ATOMIC
))==NULL
)
1051 memset(ptr
,0,sizeof(DEVICE_TD_INFO
));
1056 /*--------------------- Export Functions --------------------------*/
1058 BOOL
device_dma0_xmit(PSDevice pDevice
, struct sk_buff
*skb
, UINT uNodeIndex
);
1059 BOOL
device_alloc_frag_buf(PSDevice pDevice
, PSDeFragControlBlock pDeF
);
1060 int Config_FileOperation(PSDevice pDevice
,BOOL fwrite
,unsigned char *Parameter
);