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
128 #ifndef CONFIG_PCI_MSI
129 #define pci_enable_msi(a) -ENOTSUPP
130 #define pci_disable_msi(a) do {} while (0)
131 #define pci_enable_msix(a, b, c) -ENOTSUPP
132 #define pci_disable_msix(a) do {} while (0)
133 #define msi_remove_pci_irq_vectors(a) do {} while (0)
139 #ifdef DISABLE_NET_POLL_CONTROLLER
140 #undef CONFIG_NET_POLL_CONTROLLER
144 #define PMSG_SUSPEND 3
153 #if ( GCC_VERSION < 3000 )
165 #define module_param(v,t,p) MODULE_PARM(v, "i");
168 #ifndef DMA_64BIT_MASK
169 #define DMA_64BIT_MASK 0xffffffffffffffffULL
172 #ifndef DMA_32BIT_MASK
173 #define DMA_32BIT_MASK 0x00000000ffffffffULL
176 #ifndef PCI_CAP_ID_EXP
177 #define PCI_CAP_ID_EXP 0x10
182 #define mmiowb() asm volatile ("mf.a" ::: "memory")
188 #ifndef SET_NETDEV_DEV
189 #define SET_NETDEV_DEV(net, pdev)
192 #ifndef HAVE_FREE_NETDEV
193 #define free_netdev(x) kfree(x)
196 #ifdef HAVE_POLL_CONTROLLER
197 #define CONFIG_NET_POLL_CONTROLLER
201 #define NETDEV_TX_OK 0
204 #ifndef NETDEV_TX_BUSY
205 #define NETDEV_TX_BUSY 1
208 #ifndef NETDEV_TX_LOCKED
209 #define NETDEV_TX_LOCKED -1
212 #ifndef SKB_DATAREF_SHIFT
215 #define skb_header_cloned(x) 0
219 #define gso_size tso_size
220 #define gso_segs tso_segs
223 #ifndef CHECKSUM_PARTIAL
224 #define CHECKSUM_PARTIAL CHECKSUM_HW
225 #define CHECKSUM_COMPLETE CHECKSUM_HW
228 #ifndef __read_mostly
229 #define __read_mostly
233 #define MII_RESV1 0x17
237 #define unlikely(_x) _x
238 #define likely(_x) _x
246 #define PCI_DEVICE(vend,dev) \
247 .vendor = (vend), .device = (dev), \
248 .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID
251 #ifndef num_online_cpus
252 #define num_online_cpus() smp_num_cpus
255 #ifndef _LINUX_RANDOM_H
256 #include <linux/random.h>
259 #ifndef DECLARE_BITMAP
260 #ifndef BITS_TO_LONGS
261 #define BITS_TO_LONGS(bits) (((bits)+BITS_PER_LONG-1)/BITS_PER_LONG)
263 #define DECLARE_BITMAP(name,bits) long name[BITS_TO_LONGS(bits)]
270 #ifndef VLAN_ETH_HLEN
271 #define VLAN_ETH_HLEN 18
274 #ifndef VLAN_ETH_FRAME_LEN
275 #define VLAN_ETH_FRAME_LEN 1518
283 #ifndef ETH_GSTRING_LEN
284 #define ETH_GSTRING_LEN 32
287 #ifndef ETHTOOL_GSTATS
288 #define ETHTOOL_GSTATS 0x1d
289 #undef ethtool_drvinfo
290 #define ethtool_drvinfo k_ethtool_drvinfo
291 struct k_ethtool_drvinfo {
305 struct ethtool_stats {
312 #ifndef ETHTOOL_PHYS_ID
313 #define ETHTOOL_PHYS_ID 0x1c
316 #ifndef ETHTOOL_GSTRINGS
317 #define ETHTOOL_GSTRINGS 0x1b
318 enum ethtool_stringset {
322 struct ethtool_gstrings {
331 #define ETHTOOL_TEST 0x1a
332 enum ethtool_test_flags {
333 ETH_TEST_FL_OFFLINE = (1 << 0),
334 ETH_TEST_FL_FAILED = (1 << 1),
336 struct ethtool_test {
345 #ifndef ETHTOOL_GEEPROM
346 #define ETHTOOL_GEEPROM 0xb
348 struct ethtool_eeprom {
356 struct ethtool_value {
362 #ifndef ETHTOOL_GLINK
363 #define ETHTOOL_GLINK 0xa
366 #ifndef ETHTOOL_GREGS
367 #define ETHTOOL_GREGS 0x00000004
368 #define ethtool_regs _kc_ethtool_regs
370 struct _kc_ethtool_regs {
378 #ifndef ETHTOOL_GMSGLVL
379 #define ETHTOOL_GMSGLVL 0x00000007
381 #ifndef ETHTOOL_SMSGLVL
382 #define ETHTOOL_SMSGLVL 0x00000008
384 #ifndef ETHTOOL_NWAY_RST
385 #define ETHTOOL_NWAY_RST 0x00000009
387 #ifndef ETHTOOL_GLINK
388 #define ETHTOOL_GLINK 0x0000000a
390 #ifndef ETHTOOL_GEEPROM
391 #define ETHTOOL_GEEPROM 0x0000000b
393 #ifndef ETHTOOL_SEEPROM
394 #define ETHTOOL_SEEPROM 0x0000000c
396 #ifndef ETHTOOL_GCOALESCE
397 #define ETHTOOL_GCOALESCE 0x0000000e
399 #define ethtool_coalesce _kc_ethtool_coalesce
400 struct _kc_ethtool_coalesce {
407 u32 rx_coalesce_usecs;
415 u32 rx_max_coalesced_frames;
422 u32 rx_coalesce_usecs_irq;
423 u32 rx_max_coalesced_frames_irq;
429 u32 tx_coalesce_usecs;
437 u32 tx_max_coalesced_frames;
444 u32 tx_coalesce_usecs_irq;
445 u32 tx_max_coalesced_frames_irq;
452 u32 stats_block_coalesce_usecs;
461 u32 use_adaptive_rx_coalesce;
462 u32 use_adaptive_tx_coalesce;
469 u32 rx_coalesce_usecs_low;
470 u32 rx_max_coalesced_frames_low;
471 u32 tx_coalesce_usecs_low;
472 u32 tx_max_coalesced_frames_low;
484 u32 rx_coalesce_usecs_high;
485 u32 rx_max_coalesced_frames_high;
486 u32 tx_coalesce_usecs_high;
487 u32 tx_max_coalesced_frames_high;
492 u32 rate_sample_interval;
496 #ifndef ETHTOOL_SCOALESCE
497 #define ETHTOOL_SCOALESCE 0x0000000f
499 #ifndef ETHTOOL_GRINGPARAM
500 #define ETHTOOL_GRINGPARAM 0x00000010
502 #define ethtool_ringparam _kc_ethtool_ringparam
503 struct _kc_ethtool_ringparam {
511 u32 rx_mini_max_pending;
512 u32 rx_jumbo_max_pending;
520 u32 rx_jumbo_pending;
525 #ifndef ETHTOOL_SRINGPARAM
526 #define ETHTOOL_SRINGPARAM 0x00000011
528 #ifndef ETHTOOL_GPAUSEPARAM
529 #define ETHTOOL_GPAUSEPARAM 0x00000012
531 #define ethtool_pauseparam _kc_ethtool_pauseparam
532 struct _kc_ethtool_pauseparam {
551 #ifndef ETHTOOL_SPAUSEPARAM
552 #define ETHTOOL_SPAUSEPARAM 0x00000013
554 #ifndef ETHTOOL_GRXCSUM
555 #define ETHTOOL_GRXCSUM 0x00000014
557 #ifndef ETHTOOL_SRXCSUM
558 #define ETHTOOL_SRXCSUM 0x00000015
560 #ifndef ETHTOOL_GTXCSUM
561 #define ETHTOOL_GTXCSUM 0x00000016
563 #ifndef ETHTOOL_STXCSUM
564 #define ETHTOOL_STXCSUM 0x00000017
567 #define ETHTOOL_GSG 0x00000018
571 #define ETHTOOL_SSG 0x00000019
575 #define ETHTOOL_TEST 0x0000001a
577 #ifndef ETHTOOL_GSTRINGS
578 #define ETHTOOL_GSTRINGS 0x0000001b
580 #ifndef ETHTOOL_PHYS_ID
581 #define ETHTOOL_PHYS_ID 0x0000001c
583 #ifndef ETHTOOL_GSTATS
584 #define ETHTOOL_GSTATS 0x0000001d
587 #define ETHTOOL_GTSO 0x0000001e
590 #define ETHTOOL_STSO 0x0000001f
593 #ifndef ETHTOOL_BUSINFO_LEN
594 #define ETHTOOL_BUSINFO_LEN 32
597 #ifndef HAVE_PCI_SET_MWI
598 #define pci_set_mwi(X) pci_write_config_word(X, \
599 PCI_COMMAND, adapter->hw.bus.pci_cmd_word | \
600 PCI_COMMAND_INVALIDATE);
601 #define pci_clear_mwi(X) pci_write_config_word(X, \
602 PCI_COMMAND, adapter->hw.bus.pci_cmd_word & \
603 ~PCI_COMMAND_INVALIDATE);