32 #include <linux/version.h>
33 #include <linux/init.h>
34 #include <linux/types.h>
35 #include <linux/errno.h>
36 #include <linux/module.h>
37 #include <linux/pci.h>
38 #include <linux/netdevice.h>
39 #include <linux/etherdevice.h>
40 #include <linux/skbuff.h>
41 #include <linux/ioport.h>
42 #include <linux/slab.h>
43 #include <linux/list.h>
44 #include <linux/delay.h>
45 #include <linux/sched.h>
48 #include <linux/udp.h>
49 #include <linux/mii.h>
52 #include <rtnet_port.h>
57 #ifdef CONFIG_E1000_NAPI
74 #ifdef CONFIG_IXGB_NAPI
88 #define adapter_struct e1000_adapter
98 #undef NETIF_F_HW_VLAN_TX
99 #undef CONFIG_NET_POLL_CONTROLLER
100 #ifdef ETHTOOL_GPERMADDR
101 #undef ETHTOOL_GPERMADDR
107 #ifndef CONFIG_E1000_NAPI
108 #define CONFIG_E1000_NAPI
110 #ifndef CONFIG_IXGB_NAPI
111 #define CONFIG_IXGB_NAPI
114 #undef CONFIG_E1000_NAPI
115 #undef CONFIG_IXGB_NAPI
119 #ifdef DISABLE_PACKET_SPLIT
120 #undef CONFIG_E1000_DISABLE_PACKET_SPLIT
121 #define CONFIG_E1000_DISABLE_PACKET_SPLIT
125 #ifdef DISABLE_PCI_MSI
126 #undef CONFIG_PCI_MSI
133 #ifdef DISABLE_NET_POLL_CONTROLLER
134 #undef CONFIG_NET_POLL_CONTROLLER
138 #define PMSG_SUSPEND 3
147 #if ( GCC_VERSION < 3000 )
159 #define module_param(v,t,p) MODULE_PARM(v, "i");
162 #ifndef DMA_64BIT_MASK
163 #define DMA_64BIT_MASK 0xffffffffffffffffULL
166 #ifndef DMA_32BIT_MASK
167 #define DMA_32BIT_MASK 0x00000000ffffffffULL
170 #ifndef PCI_CAP_ID_EXP
171 #define PCI_CAP_ID_EXP 0x10
176 #define mmiowb() asm volatile ("mf.a" ::: "memory")
182 #ifndef SET_NETDEV_DEV
183 #define SET_NETDEV_DEV(net, pdev)
186 #ifndef HAVE_FREE_NETDEV
187 #define free_netdev(x) kfree(x)
190 #ifdef HAVE_POLL_CONTROLLER
191 #define CONFIG_NET_POLL_CONTROLLER
195 #define NETDEV_TX_OK 0
198 #ifndef NETDEV_TX_BUSY
199 #define NETDEV_TX_BUSY 1
202 #ifndef NETDEV_TX_LOCKED
203 #define NETDEV_TX_LOCKED -1
206 #ifndef SKB_DATAREF_SHIFT
209 #define skb_header_cloned(x) 0
213 #define gso_size tso_size
214 #define gso_segs tso_segs
217 #ifndef CHECKSUM_PARTIAL
218 #define CHECKSUM_PARTIAL CHECKSUM_HW
219 #define CHECKSUM_COMPLETE CHECKSUM_HW
222 #ifndef __read_mostly
223 #define __read_mostly
227 #define MII_RESV1 0x17
231 #define unlikely(_x) _x
232 #define likely(_x) _x
240 #define PCI_DEVICE(vend,dev) \
241 .vendor = (vend), .device = (dev), \
242 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
245 #ifndef num_online_cpus
246 #define num_online_cpus() smp_num_cpus
249 #ifndef _LINUX_RANDOM_H
250 #include <linux/random.h>
253 #ifndef DECLARE_BITMAP
254 #ifndef BITS_TO_LONGS
255 #define BITS_TO_LONGS(bits) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
257 #define DECLARE_BITMAP(name,bits) long name[BITS_TO_LONGS(bits)]
264 #ifndef VLAN_ETH_HLEN
265 #define VLAN_ETH_HLEN 18
268 #ifndef VLAN_ETH_FRAME_LEN
269 #define VLAN_ETH_FRAME_LEN 1518
277 #ifndef ETH_GSTRING_LEN
278 #define ETH_GSTRING_LEN 32
281 #ifndef ETHTOOL_GSTATS
282 #define ETHTOOL_GSTATS 0x1d
283 #undef ethtool_drvinfo
284 #define ethtool_drvinfo k_ethtool_drvinfo
285 struct k_ethtool_drvinfo {
299 struct ethtool_stats {
306 #ifndef ETHTOOL_PHYS_ID
307 #define ETHTOOL_PHYS_ID 0x1c
310 #ifndef ETHTOOL_GSTRINGS
311 #define ETHTOOL_GSTRINGS 0x1b
312 enum ethtool_stringset {
316 struct ethtool_gstrings {
325 #define ETHTOOL_TEST 0x1a
326 enum ethtool_test_flags {
327 ETH_TEST_FL_OFFLINE = (1 << 0),
328 ETH_TEST_FL_FAILED = (1 << 1),
330 struct ethtool_test {
339 #ifndef ETHTOOL_GEEPROM
340 #define ETHTOOL_GEEPROM 0xb
342 struct ethtool_eeprom {
350 struct ethtool_value {
356 #ifndef ETHTOOL_GLINK
357 #define ETHTOOL_GLINK 0xa
360 #ifndef ETHTOOL_GREGS
361 #define ETHTOOL_GREGS 0x00000004
362 #define ethtool_regs _kc_ethtool_regs
364 struct _kc_ethtool_regs {
372 #ifndef ETHTOOL_GMSGLVL
373 #define ETHTOOL_GMSGLVL 0x00000007
375 #ifndef ETHTOOL_SMSGLVL
376 #define ETHTOOL_SMSGLVL 0x00000008
378 #ifndef ETHTOOL_NWAY_RST
379 #define ETHTOOL_NWAY_RST 0x00000009
381 #ifndef ETHTOOL_GLINK
382 #define ETHTOOL_GLINK 0x0000000a
384 #ifndef ETHTOOL_GEEPROM
385 #define ETHTOOL_GEEPROM 0x0000000b
387 #ifndef ETHTOOL_SEEPROM
388 #define ETHTOOL_SEEPROM 0x0000000c
390 #ifndef ETHTOOL_GCOALESCE
391 #define ETHTOOL_GCOALESCE 0x0000000e
393 #define ethtool_coalesce _kc_ethtool_coalesce
394 struct _kc_ethtool_coalesce {
401 u32 rx_coalesce_usecs;
409 u32 rx_max_coalesced_frames;
416 u32 rx_coalesce_usecs_irq;
417 u32 rx_max_coalesced_frames_irq;
423 u32 tx_coalesce_usecs;
431 u32 tx_max_coalesced_frames;
438 u32 tx_coalesce_usecs_irq;
439 u32 tx_max_coalesced_frames_irq;
446 u32 stats_block_coalesce_usecs;
455 u32 use_adaptive_rx_coalesce;
456 u32 use_adaptive_tx_coalesce;
463 u32 rx_coalesce_usecs_low;
464 u32 rx_max_coalesced_frames_low;
465 u32 tx_coalesce_usecs_low;
466 u32 tx_max_coalesced_frames_low;
478 u32 rx_coalesce_usecs_high;
479 u32 rx_max_coalesced_frames_high;
480 u32 tx_coalesce_usecs_high;
481 u32 tx_max_coalesced_frames_high;
486 u32 rate_sample_interval;
490 #ifndef ETHTOOL_SCOALESCE
491 #define ETHTOOL_SCOALESCE 0x0000000f
493 #ifndef ETHTOOL_GRINGPARAM
494 #define ETHTOOL_GRINGPARAM 0x00000010
496 #define ethtool_ringparam _kc_ethtool_ringparam
497 struct _kc_ethtool_ringparam {
505 u32 rx_mini_max_pending;
506 u32 rx_jumbo_max_pending;
514 u32 rx_jumbo_pending;
519 #ifndef ETHTOOL_SRINGPARAM
520 #define ETHTOOL_SRINGPARAM 0x00000011
522 #ifndef ETHTOOL_GPAUSEPARAM
523 #define ETHTOOL_GPAUSEPARAM 0x00000012
525 #define ethtool_pauseparam _kc_ethtool_pauseparam
526 struct _kc_ethtool_pauseparam {
545 #ifndef ETHTOOL_SPAUSEPARAM
546 #define ETHTOOL_SPAUSEPARAM 0x00000013
548 #ifndef ETHTOOL_GRXCSUM
549 #define ETHTOOL_GRXCSUM 0x00000014
551 #ifndef ETHTOOL_SRXCSUM
552 #define ETHTOOL_SRXCSUM 0x00000015
554 #ifndef ETHTOOL_GTXCSUM
555 #define ETHTOOL_GTXCSUM 0x00000016
557 #ifndef ETHTOOL_STXCSUM
558 #define ETHTOOL_STXCSUM 0x00000017
561 #define ETHTOOL_GSG 0x00000018
565 #define ETHTOOL_SSG 0x00000019
569 #define ETHTOOL_TEST 0x0000001a
571 #ifndef ETHTOOL_GSTRINGS
572 #define ETHTOOL_GSTRINGS 0x0000001b
574 #ifndef ETHTOOL_PHYS_ID
575 #define ETHTOOL_PHYS_ID 0x0000001c
577 #ifndef ETHTOOL_GSTATS
578 #define ETHTOOL_GSTATS 0x0000001d
581 #define ETHTOOL_GTSO 0x0000001e
584 #define ETHTOOL_STSO 0x0000001f
587 #ifndef ETHTOOL_BUSINFO_LEN
588 #define ETHTOOL_BUSINFO_LEN 32
591 #ifndef HAVE_PCI_SET_MWI
592 #define pci_set_mwi(X) pci_write_config_word(X, \
593 PCI_COMMAND, adapter->hw.bus.pci_cmd_word | \
594 PCI_COMMAND_INVALIDATE);
595 #define pci_clear_mwi(X) pci_write_config_word(X, \
596 PCI_COMMAND, adapter->hw.bus.pci_cmd_word & \
597 ~PCI_COMMAND_INVALIDATE);