1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29#ifndef _IXGB_H_
30#define _IXGB_H_
31
32#include <linux/stddef.h>
33#include <linux/module.h>
34#include <linux/types.h>
35#include <asm/byteorder.h>
36#include <linux/init.h>
37#include <linux/mm.h>
38#include <linux/errno.h>
39#include <linux/ioport.h>
40#include <linux/pci.h>
41#include <linux/kernel.h>
42#include <linux/netdevice.h>
43#include <linux/etherdevice.h>
44#include <linux/skbuff.h>
45#include <linux/delay.h>
46#include <linux/timer.h>
47#include <linux/slab.h>
48#include <linux/vmalloc.h>
49#include <linux/interrupt.h>
50#include <linux/string.h>
51#include <linux/pagemap.h>
52#include <linux/dma-mapping.h>
53#include <linux/bitops.h>
54#include <asm/io.h>
55#include <asm/irq.h>
56#include <linux/capability.h>
57#include <linux/in.h>
58#include <linux/ip.h>
59#include <linux/tcp.h>
60#include <linux/udp.h>
61#include <net/pkt_sched.h>
62#include <linux/list.h>
63#include <linux/reboot.h>
64#include <net/checksum.h>
65
66#include <linux/ethtool.h>
67#include <linux/if_vlan.h>
68
69#define BAR_0 0
70#define BAR_1 1
71#define BAR_5 5
72
73struct ixgb_adapter;
74#include "ixgb_hw.h"
75#include "ixgb_ee.h"
76#include "ixgb_ids.h"
77
78
79#define DEFAULT_TXD 256
80#define MAX_TXD 4096
81#define MIN_TXD 64
82
83
84
85
86#define DEFAULT_RXD 512
87#define MAX_RXD 512
88#define MIN_RXD 64
89
90
91#define IXGB_RXBUFFER_2048 2048
92#define IXGB_RXBUFFER_4096 4096
93#define IXGB_RXBUFFER_8192 8192
94#define IXGB_RXBUFFER_16384 16384
95
96
97#define IXGB_RX_BUFFER_WRITE 8
98
99
100
101struct ixgb_buffer {
102 struct sk_buff *skb;
103 dma_addr_t dma;
104 unsigned long time_stamp;
105 u16 length;
106 u16 next_to_watch;
107 u16 mapped_as_page;
108};
109
110struct ixgb_desc_ring {
111
112 void *desc;
113
114 dma_addr_t dma;
115
116 unsigned int size;
117
118 unsigned int count;
119
120 unsigned int next_to_use;
121
122 unsigned int next_to_clean;
123
124 struct ixgb_buffer *buffer_info;
125};
126
127#define IXGB_DESC_UNUSED(R) \
128 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
129 (R)->next_to_clean - (R)->next_to_use - 1)
130
131#define IXGB_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
132#define IXGB_RX_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_rx_desc)
133#define IXGB_TX_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_tx_desc)
134#define IXGB_CONTEXT_DESC(R, i) IXGB_GET_DESC(R, i, ixgb_context_desc)
135
136
137
138struct ixgb_adapter {
139 struct timer_list watchdog_timer;
140 unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
141 u32 bd_number;
142 u32 rx_buffer_len;
143 u32 part_num;
144 u16 link_speed;
145 u16 link_duplex;
146 struct work_struct tx_timeout_task;
147
148
149 struct ixgb_desc_ring tx_ring ____cacheline_aligned_in_smp;
150 unsigned int restart_queue;
151 unsigned long timeo_start;
152 u32 tx_cmd_type;
153 u64 hw_csum_tx_good;
154 u64 hw_csum_tx_error;
155 u32 tx_int_delay;
156 u32 tx_timeout_count;
157 bool tx_int_delay_enable;
158 bool detect_tx_hung;
159
160
161 struct ixgb_desc_ring rx_ring;
162 u64 hw_csum_rx_error;
163 u64 hw_csum_rx_good;
164 u32 rx_int_delay;
165 bool rx_csum;
166
167
168 struct napi_struct napi;
169 struct net_device *netdev;
170 struct pci_dev *pdev;
171
172
173 struct ixgb_hw hw;
174 u16 msg_enable;
175 struct ixgb_hw_stats stats;
176 u32 alloc_rx_buff_failed;
177 bool have_msi;
178 unsigned long flags;
179};
180
181enum ixgb_state_t {
182
183
184
185
186 __IXGB_DOWN
187};
188
189
190extern void ixgb_check_options(struct ixgb_adapter *adapter);
191extern void ixgb_set_ethtool_ops(struct net_device *netdev);
192extern char ixgb_driver_name[];
193extern const char ixgb_driver_version[];
194
195extern void ixgb_set_speed_duplex(struct net_device *netdev);
196
197extern int ixgb_up(struct ixgb_adapter *adapter);
198extern void ixgb_down(struct ixgb_adapter *adapter, bool kill_watchdog);
199extern void ixgb_reset(struct ixgb_adapter *adapter);
200extern int ixgb_setup_rx_resources(struct ixgb_adapter *adapter);
201extern int ixgb_setup_tx_resources(struct ixgb_adapter *adapter);
202extern void ixgb_free_rx_resources(struct ixgb_adapter *adapter);
203extern void ixgb_free_tx_resources(struct ixgb_adapter *adapter);
204extern void ixgb_update_stats(struct ixgb_adapter *adapter);
205
206
207#endif
208