1 /*******************************************************************************
4 Copyright(c) 1999 - 2003 Intel Corporation. All rights reserved.
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 2 of the License, or (at your option)
11 This program is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16 You should have received a copy of the GNU General Public License along with
17 this program; if not, write to the Free Software Foundation, Inc., 59
18 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 The full GNU General Public License is included in this distribution in the
24 Linux NICS <linux.nics@intel.com>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26 *******************************************************************************/
31 #include <linux/stddef.h>
32 #include <linux/config.h>
33 #include <linux/module.h>
34 #include <linux/types.h>
35 #include <asm/byteorder.h>
36 #include <linux/init.h>
37 #include <linux/ioport.h>
38 #include <linux/pci.h>
39 #include <linux/netdevice.h>
40 #include <linux/etherdevice.h>
41 #include <linux/skbuff.h>
42 #include <linux/delay.h>
43 #include <linux/timer.h>
44 #include <linux/string.h>
45 #include <linux/pagemap.h>
46 #include <linux/dma-mapping.h>
47 #include <linux/bitops.h>
50 #include <linux/tcp.h>
51 #include <linux/udp.h>
52 #include <net/pkt_sched.h>
53 #include <linux/list.h>
54 #include <linux/workqueue.h>
55 #include <linux/reboot.h>
57 #include <net/checksum.h>
61 #include <linux/ethtool.h>
62 #include <linux/if_vlan.h>
75 #define IXGB_DBG(args...) printk(KERN_DEBUG "ixgb: " args)
77 #define IXGB_DBG(args...)
80 #define IXGB_ERR(args...) printk(KERN_ERR "ixgb: " args)
82 /* Supported Rx Buffer Sizes */
83 #define IXGB_RXBUFFER_2048 2048
84 #define IXGB_RXBUFFER_4096 4096
85 #define IXGB_RXBUFFER_8192 8192
86 #define IXGB_RXBUFFER_16384 16384
88 /* How many Tx Descriptors do we need to call netif_wake_queue? */
89 #define IXGB_TX_QUEUE_WAKE 16
91 /* How many Rx Buffers do we bundle into one write to the hardware ? */
92 #define IXGB_RX_BUFFER_WRITE 16
94 /* only works for sizes that are powers of 2 */
95 #define IXGB_ROUNDUP(i, size) ((i) = (((i) + (size) - 1) & ~((size) - 1)))
97 /* wrapper around a pointer to a socket buffer,
98 * so a DMA handle can be stored along with the buffer */
102 unsigned long length;
103 unsigned long time_stamp;
106 struct ixgb_desc_ring {
107 /* pointer to the descriptor ring memory */
109 /* physical address of the descriptor ring */
111 /* length of descriptor ring in bytes */
113 /* number of descriptors in the ring */
115 /* next descriptor to associate a buffer with */
116 unsigned int next_to_use;
117 /* next descriptor to check for DD status bit */
118 unsigned int next_to_clean;
119 /* array of buffer information structs */
120 struct ixgb_buffer *buffer_info;
123 #define IXGB_DESC_UNUSED(R) \
124 ((((R)->next_to_clean + (R)->count) - ((R)->next_to_use + 1)) % ((R)->count))
126 #define IXGB_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
127 #define IXGB_RX_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_rx_desc)
128 #define IXGB_TX_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_tx_desc)
129 #define IXGB_CONTEXT_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_context_desc)
131 /* board specific private data structure */
133 struct ixgb_adapter {
134 struct timer_list watchdog_timer;
135 struct vlan_group *vlgrp;
143 struct work_struct tx_timeout_task;
145 #ifdef ETHTOOL_PHYS_ID
146 struct timer_list blink_timer;
147 unsigned long led_status;
149 #ifdef _INTERNAL_LOOPBACK_DRIVER_
150 struct ixgb_desc_ring diag_tx_ring;
151 struct ixgb_desc_ring diag_rx_ring;
154 struct ixgb_desc_ring tx_ring;
155 unsigned long timeo_start;
157 int max_data_per_txd;
158 uint64_t hw_csum_tx_good;
159 uint64_t hw_csum_tx_error;
162 boolean_t tx_int_delay_enable;
165 struct ixgb_desc_ring rx_ring;
166 uint64_t hw_csum_rx_error;
167 uint64_t hw_csum_rx_good;
172 /* OS defined structs */
173 struct net_device *netdev;
174 struct pci_dev *pdev;
175 struct net_device_stats net_stats;
177 /* structs defined in ixgb_hw.h */
179 struct ixgb_hw_stats stats;
181 char ifname[IFNAMSIZ];
184 #endif /* _IXGB_H_ */