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 #ifdef NETIF_F_HW_VLAN_TX 260 struct vlan_group *vlgrp;
261 uint16_t mng_vlan_id;
264 uint32_t rx_buffer_len;
267 uint32_t ksp3_port_a;
271 uint16_t link_duplex;
272 #ifdef CONFIG_E1000_NAPI 273 spinlock_t tx_queue_lock;
276 struct work_struct reset_task;
279 #ifdef ETHTOOL_PHYS_ID 280 struct timer_list blink_timer;
281 unsigned long led_status;
285 struct e1000_tx_ring *tx_ring;
286 unsigned long tx_queue_len;
288 uint32_t tx_int_delay;
289 uint32_t tx_abs_int_delay;
294 uint32_t tx_timeout_count;
295 uint32_t tx_fifo_head;
296 uint32_t tx_head_addr;
297 uint32_t tx_fifo_size;
298 uint8_t tx_timeout_factor;
300 boolean_t pcix_82544;
301 boolean_t detect_tx_hung;
304 #ifdef CONFIG_E1000_NAPI 305 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
306 struct e1000_rx_ring *rx_ring,
307 int *work_done,
int work_to_do);
309 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
310 struct e1000_rx_ring *rx_ring);
312 void (*alloc_rx_buf) (
struct e1000_adapter *adapter,
313 struct e1000_rx_ring *rx_ring,
315 struct e1000_rx_ring *rx_ring;
316 #ifdef CONFIG_E1000_NAPI 317 struct net_device *polling_netdev;
322 uint64_t hw_csum_err;
323 uint64_t hw_csum_good;
324 uint64_t rx_hdr_split;
325 uint32_t alloc_rx_buff_failed;
326 uint32_t rx_int_delay;
327 uint32_t rx_abs_int_delay;
329 unsigned int rx_ps_pages;
332 uint16_t rx_ps_bsize0;
338 struct rtnet_device *netdev;
339 struct pci_dev *pdev;
340 struct net_device_stats net_stats;
342 rtdm_irq_t irq_handle;
343 boolean_t data_received;
347 struct e1000_hw_stats stats;
348 struct e1000_phy_info phy_info;
349 struct e1000_phy_stats phy_stats;
353 struct e1000_tx_ring test_tx_ring;
354 struct e1000_rx_ring test_rx_ring;
357 #ifdef E1000_COUNT_ICR 370 uint32_t *config_space;
372 #ifdef CONFIG_PCI_MSI 379 boolean_t smart_power_down;
382 struct delayed_work watchdog_task;
383 struct delayed_work fifo_stall_task;
384 struct delayed_work phy_info_task;
388 __E1000_DRIVER_TESTING,
ipipe_spinlock_t rtdm_lock_t
Lock variable.
Definition: driver.h:551
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition: atomic.h:24