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>
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>
64#include <net/pkt_sched.h>
65#include <linux/list.h>
66#include <linux/reboot.h>
72#include <net/checksum.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)}
106#define E1000_DBG(args...) pr_debug(args)
108#define E1000_DBG(args...)
112#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
114#define DPRINTK(nlevel, klevel, fmt, args...) \
115 (void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
116 printk(KERN_##klevel "%s: %s: %s: " fmt, KBUILD_MODNAME, \
117 adapter->netdev->name, __FUNCTION__, ##args))
119#define E1000_ERR(args...) pr_err(args)
121#define E1000_MAX_INTR 10
124#define E1000_DEFAULT_TXD 256
125#define E1000_MAX_TXD 256
126#define E1000_MIN_TXD 80
127#define E1000_MAX_82544_TXD 4096
129#define E1000_DEFAULT_RXD 256
130#define E1000_MAX_RXD 256
131#define E1000_MIN_RXD 80
132#define E1000_MAX_82544_RXD 4096
135#define E1000_RXBUFFER_128 128
136#define E1000_RXBUFFER_256 256
137#define E1000_RXBUFFER_512 512
138#define E1000_RXBUFFER_1024 1024
139#define E1000_RXBUFFER_2048 2048
140#define E1000_RXBUFFER_4096 4096
141#define E1000_RXBUFFER_8192 8192
142#define E1000_RXBUFFER_16384 16384
145#define E1000_SMARTSPEED_DOWNSHIFT 3
146#define E1000_SMARTSPEED_MAX 15
149#define E1000_PBA_BYTES_SHIFT 0xA
150#define E1000_TX_HEAD_ADDR_SHIFT 7
151#define E1000_PBA_TX_MASK 0xFFFF0000
154#define E1000_FC_HIGH_DIFF 0x1638
155#define E1000_FC_LOW_DIFF 0x1640
157#define E1000_FC_PAUSE_TIME 0x0680
160#define E1000_TX_QUEUE_WAKE 16
162#define E1000_RX_BUFFER_WRITE 16
164#define AUTO_ALL_MODES 0
165#define E1000_EEPROM_82544_APM 0x0004
166#define E1000_EEPROM_ICH8_APME 0x0004
167#define E1000_EEPROM_APME 0x0400
169#ifndef E1000_MASTER_SLAVE
171#define E1000_MASTER_SLAVE e1000_ms_hw_default
174#ifdef NETIF_F_HW_VLAN_TX
175#define E1000_MNG_VLAN_NONE -1
178#define PS_PAGE_BUFFERS MAX_PS_BUFFERS-1
181#define E1000_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
188 unsigned long time_stamp;
190 uint16_t next_to_watch;
194struct e1000_ps_page {
struct page *ps_page[PS_PAGE_BUFFERS]; };
195struct e1000_ps_page_dma { uint64_t ps_page_dma[PS_PAGE_BUFFERS]; };
197struct e1000_tx_ring {
207 unsigned int next_to_use;
209 unsigned int next_to_clean;
211 struct e1000_buffer *buffer_info;
216 boolean_t last_tx_tso;
219struct e1000_rx_ring {
229 unsigned int next_to_use;
231 unsigned int next_to_clean;
233 struct e1000_buffer *buffer_info;
235 struct e1000_ps_page *ps_page;
236 struct e1000_ps_page_dma *ps_page_dma;
245#define E1000_DESC_UNUSED(R) \
246 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
247 (R)->next_to_clean - (R)->next_to_use - 1)
249#define E1000_RX_DESC_PS(R, i) \
250 (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
251#define E1000_RX_DESC_EXT(R, i) \
252 (&(((union e1000_rx_desc_extended *)((R).desc))[i]))
253#define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
254#define E1000_RX_DESC(R, i) E1000_GET_DESC(R, i, e1000_rx_desc)
255#define E1000_TX_DESC(R, i) E1000_GET_DESC(R, i, e1000_tx_desc)
256#define E1000_CONTEXT_DESC(R, i) E1000_GET_DESC(R, i, e1000_context_desc)
260struct e1000_adapter {
261#ifdef NETIF_F_HW_VLAN_TX
262 struct vlan_group *vlgrp;
263 uint16_t mng_vlan_id;
266 uint32_t rx_buffer_len;
269 uint32_t ksp3_port_a;
273 uint16_t link_duplex;
274#ifdef CONFIG_E1000_NAPI
275 spinlock_t tx_queue_lock;
278 struct work_struct reset_task;
281#ifdef ETHTOOL_PHYS_ID
282 struct timer_list blink_timer;
283 unsigned long led_status;
287 struct e1000_tx_ring *tx_ring;
288 unsigned long tx_queue_len;
290 uint32_t tx_int_delay;
291 uint32_t tx_abs_int_delay;
296 uint32_t tx_timeout_count;
297 uint32_t tx_fifo_head;
298 uint32_t tx_head_addr;
299 uint32_t tx_fifo_size;
300 uint8_t tx_timeout_factor;
302 boolean_t pcix_82544;
303 boolean_t detect_tx_hung;
306#ifdef CONFIG_E1000_NAPI
307 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
308 struct e1000_rx_ring *rx_ring,
309 int *work_done,
int work_to_do);
311 boolean_t (*clean_rx) (
struct e1000_adapter *adapter,
312 struct e1000_rx_ring *rx_ring);
314 void (*alloc_rx_buf) (
struct e1000_adapter *adapter,
315 struct e1000_rx_ring *rx_ring,
317 struct e1000_rx_ring *rx_ring;
318#ifdef CONFIG_E1000_NAPI
319 struct net_device *polling_netdev;
324 uint64_t hw_csum_err;
325 uint64_t hw_csum_good;
326 uint64_t rx_hdr_split;
327 uint32_t alloc_rx_buff_failed;
328 uint32_t rx_int_delay;
329 uint32_t rx_abs_int_delay;
331 unsigned int rx_ps_pages;
334 uint16_t rx_ps_bsize0;
340 struct rtnet_device *netdev;
341 struct pci_dev *pdev;
342 struct net_device_stats net_stats;
344 rtdm_irq_t irq_handle;
345 boolean_t data_received;
349 struct e1000_hw_stats stats;
350 struct e1000_phy_info phy_info;
351 struct e1000_phy_stats phy_stats;
355 struct e1000_tx_ring test_tx_ring;
356 struct e1000_rx_ring test_rx_ring;
359#ifdef E1000_COUNT_ICR
372 uint32_t *config_space;
381 boolean_t smart_power_down;
384 struct delayed_work watchdog_task;
385 struct delayed_work fifo_stall_task;
386 struct delayed_work phy_info_task;
390 __E1000_DRIVER_TESTING,
394void e1000_check_options(
struct e1000_adapter *adapter);
pipeline_spinlock_t rtdm_lock_t
Lock variable.
Definition driver.h:552
Copyright © 2011 Gilles Chanteperdrix gilles.chanteperdrix@xenomai.org.
Definition atomic.h:24