36 #include <linux/stddef.h>
37 #include <linux/module.h>
38 #include <linux/types.h>
39 #include <asm/byteorder.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/vmalloc.h>
53 #include <linux/interrupt.h>
54 #include <linux/string.h>
55 #include <linux/pagemap.h>
56 #include <linux/bitops.h>
59 #include <linux/capability.h>
62 #include <linux/tcp.h>
63 #include <linux/udp.h>
64 #include <net/pkt_sched.h>
65 #include <linux/list.h>
66 #include <linux/reboot.h>
72 #include <net/checksum.h>
75 #include <linux/mii.h>
78 #include <linux/ethtool.h>
81 #ifdef NETIF_F_HW_VLAN_TX
82 #undef NETIF_F_HW_VLAN_TX
85 #ifdef NETIF_F_HW_VLAN_TX
86 #include <linux/if_vlan.h>
90 #include <rtnet_port.h>
98 #define INTEL_E1000_ETHERNET_DEVICE(device_id) {\
99 PCI_DEVICE(PCI_VENDOR_ID_INTEL, device_id)}
101 struct e1000_adapter;
103 #include "e1000_hw.h"
106 #define E1000_DBG(args...) printk(KERN_DEBUG "e1000: " args)
108 #define E1000_DBG(args...)
111 #define E1000_ERR(args...) printk(KERN_ERR "e1000: " args)
113 #define PFX "e1000: "
114 #define DPRINTK(nlevel, klevel, fmt, args...) \
115 (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
116 printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
117 __FUNCTION__ , ## args))
119 #define E1000_MAX_INTR 10
122 #define E1000_DEFAULT_TXD 256
123 #define E1000_MAX_TXD 256
124 #define E1000_MIN_TXD 80
125 #define E1000_MAX_82544_TXD 4096
127 #define E1000_DEFAULT_RXD 256
128 #define E1000_MAX_RXD 256
129 #define E1000_MIN_RXD 80
130 #define E1000_MAX_82544_RXD 4096
133 #define E1000_RXBUFFER_128 128
134 #define E1000_RXBUFFER_256 256
135 #define E1000_RXBUFFER_512 512
136 #define E1000_RXBUFFER_1024 1024
137 #define E1000_RXBUFFER_2048 2048
138 #define E1000_RXBUFFER_4096 4096
139 #define E1000_RXBUFFER_8192 8192
140 #define E1000_RXBUFFER_16384 16384
143 #define E1000_SMARTSPEED_DOWNSHIFT 3
144 #define E1000_SMARTSPEED_MAX 15
147 #define E1000_PBA_BYTES_SHIFT 0xA
148 #define E1000_TX_HEAD_ADDR_SHIFT 7
149 #define E1000_PBA_TX_MASK 0xFFFF0000
152 #define E1000_FC_HIGH_DIFF 0x1638
153 #define E1000_FC_LOW_DIFF 0x1640
155 #define E1000_FC_PAUSE_TIME 0x0680
158 #define E1000_TX_QUEUE_WAKE 16
160 #define E1000_RX_BUFFER_WRITE 16
162 #define AUTO_ALL_MODES 0
163 #define E1000_EEPROM_82544_APM 0x0004
164 #define E1000_EEPROM_ICH8_APME 0x0004
165 #define E1000_EEPROM_APME 0x0400
167 #ifndef E1000_MASTER_SLAVE
169 #define E1000_MASTER_SLAVE e1000_ms_hw_default
172 #ifdef NETIF_F_HW_VLAN_TX
173 #define E1000_MNG_VLAN_NONE -1
176 #define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
179 #define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
183 struct e1000_buffer {
186 unsigned long time_stamp;
188 uint16_t next_to_watch;
192 struct e1000_ps_page {
struct page *ps_page[PS_PAGE_BUFFERS]; };
193 struct e1000_ps_page_dma { uint64_t ps_page_dma[PS_PAGE_BUFFERS]; };
195 struct e1000_tx_ring {
205 unsigned int next_to_use;
207 unsigned int next_to_clean;
209 struct e1000_buffer *buffer_info;
214 boolean_t last_tx_tso;
217 struct e1000_rx_ring {
227 unsigned int next_to_use;
229 unsigned int next_to_clean;
231 struct e1000_buffer *buffer_info;
233 struct e1000_ps_page *ps_page;
234 struct e1000_ps_page_dma *ps_page_dma;
243 #define E1000_DESC_UNUSED(R) \
244 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
245 (R)->next_to_clean - (R)->next_to_use - 1)
247 #define E1000_RX_DESC_PS(R, i) \
248 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
249 #define E1000_RX_DESC_EXT(R, i) \
250 (&(((union e1000_rx_desc_extended *)((R).desc))[i]))
251 #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
252 #define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
253 #define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
254 #define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
258 struct e1000_adapter {
259 struct timer_list tx_fifo_stall_timer;
260 struct timer_list watchdog_timer;
261 struct timer_list phy_info_timer;
262 #ifdef NETIF_F_HW_VLAN_TX
263 struct vlan_group *vlgrp;
264 uint16_t mng_vlan_id;
267 uint32_t rx_buffer_len;
270 uint32_t ksp3_port_a;
274 uint16_t link_duplex;
275 #ifdef CONFIG_E1000_NAPI
276 spinlock_t tx_queue_lock;
279 struct work_struct reset_task;
282 #ifdef ETHTOOL_PHYS_ID
283 struct timer_list blink_timer;
284 unsigned long led_status;
288 struct e1000_tx_ring *tx_ring;
289 unsigned long tx_queue_len;
291 uint32_t tx_int_delay;
292 uint32_t tx_abs_int_delay;
297 uint32_t tx_timeout_count;
298 uint32_t tx_fifo_head;
299 uint32_t tx_head_addr;
300 uint32_t tx_fifo_size;
301 uint8_t tx_timeout_factor;
303 boolean_t pcix_82544;
304 boolean_t detect_tx_hung;
307 #ifdef CONFIG_E1000_NAPI
308 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
309 struct e1000_rx_ring *rx_ring,
310 int *work_done,
int work_to_do);
312 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
313 struct e1000_rx_ring *rx_ring);
315 void (*alloc_rx_buf) (
struct e1000_adapter *adapter,
316 struct e1000_rx_ring *rx_ring,
318 struct e1000_rx_ring *rx_ring;
319 #ifdef CONFIG_E1000_NAPI
320 struct net_device *polling_netdev;
325 uint64_t hw_csum_err;
326 uint64_t hw_csum_good;
327 uint64_t rx_hdr_split;
328 uint32_t alloc_rx_buff_failed;
329 uint32_t rx_int_delay;
330 uint32_t rx_abs_int_delay;
332 unsigned int rx_ps_pages;
335 uint16_t rx_ps_bsize0;
341 struct rtnet_device *netdev;
342 struct pci_dev *pdev;
343 struct net_device_stats net_stats;
345 rtdm_irq_t irq_handle;
346 boolean_t data_received;
350 struct e1000_hw_stats stats;
351 struct e1000_phy_info phy_info;
352 struct e1000_phy_stats phy_stats;
356 struct e1000_tx_ring test_tx_ring;
357 struct e1000_rx_ring test_rx_ring;
360 #ifdef E1000_COUNT_ICR
373 uint32_t *config_space;
375 #ifdef CONFIG_PCI_MSI
382 boolean_t smart_power_down;
387 __E1000_DRIVER_TESTING,
ipipe_spinlock_t rtdm_lock_t
Lock variable.
Definition: driver.h:528
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24