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
30#ifndef _IGBVF_H_
31#define _IGBVF_H_
32
33#include <linux/types.h>
34#include <linux/timer.h>
35#include <linux/io.h>
36#include <linux/netdevice.h>
37
38
39#include "vf.h"
40
41
42struct igbvf_info;
43struct igbvf_adapter;
44
45
46#define IGBVF_START_ITR 648
47
48
49#define IGBVF_INT_MODE_LEGACY 0
50#define IGBVF_INT_MODE_MSI 1
51#define IGBVF_INT_MODE_MSIX 2
52
53
54#define IGBVF_DEFAULT_TXD 256
55#define IGBVF_MAX_TXD 4096
56#define IGBVF_MIN_TXD 80
57
58#define IGBVF_DEFAULT_RXD 256
59#define IGBVF_MAX_RXD 4096
60#define IGBVF_MIN_RXD 80
61
62#define IGBVF_MIN_ITR_USECS 10
63#define IGBVF_MAX_ITR_USECS 10000
64
65
66
67
68
69
70
71
72
73
74
75
76#define IGBVF_RX_PTHRESH 16
77#define IGBVF_RX_HTHRESH 8
78#define IGBVF_RX_WTHRESH 1
79
80
81#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
82
83#define IGBVF_FC_PAUSE_TIME 0x0680
84
85
86#define IGBVF_TX_QUEUE_WAKE 32
87
88#define IGBVF_RX_BUFFER_WRITE 16
89
90#define AUTO_ALL_MODES 0
91#define IGBVF_EEPROM_APME 0x0400
92
93#define IGBVF_MNG_VLAN_NONE (-1)
94
95
96#define PS_PAGE_BUFFERS (MAX_PS_BUFFERS - 1)
97
98enum igbvf_boards {
99 board_vf,
100};
101
102struct igbvf_queue_stats {
103 u64 packets;
104 u64 bytes;
105};
106
107
108
109
110
111struct igbvf_buffer {
112 dma_addr_t dma;
113 struct sk_buff *skb;
114 union {
115
116 struct {
117 unsigned long time_stamp;
118 u16 length;
119 u16 next_to_watch;
120 };
121
122 struct {
123 struct page *page;
124 u64 page_dma;
125 unsigned int page_offset;
126 };
127 };
128 struct page *page;
129};
130
131union igbvf_desc {
132 union e1000_adv_rx_desc rx_desc;
133 union e1000_adv_tx_desc tx_desc;
134 struct e1000_adv_tx_context_desc tx_context_desc;
135};
136
137struct igbvf_ring {
138 struct igbvf_adapter *adapter;
139 union igbvf_desc *desc;
140 dma_addr_t dma;
141 unsigned int size;
142 unsigned int count;
143
144 u16 next_to_use;
145 u16 next_to_clean;
146
147 u16 head;
148 u16 tail;
149
150
151 struct igbvf_buffer *buffer_info;
152 struct napi_struct napi;
153
154 char name[IFNAMSIZ + 5];
155 u32 eims_value;
156 u32 itr_val;
157 u16 itr_register;
158 int set_itr;
159
160 struct sk_buff *rx_skb_top;
161
162 struct igbvf_queue_stats stats;
163};
164
165
166struct igbvf_adapter {
167 struct timer_list watchdog_timer;
168 struct timer_list blink_timer;
169
170 struct work_struct reset_task;
171 struct work_struct watchdog_task;
172
173 const struct igbvf_info *ei;
174
175 struct vlan_group *vlgrp;
176 u32 bd_number;
177 u32 rx_buffer_len;
178 u32 polling_interval;
179 u16 mng_vlan_id;
180 u16 link_speed;
181 u16 link_duplex;
182
183 spinlock_t tx_queue_lock;
184
185
186 unsigned long state;
187
188
189 u32 itr;
190 u32 itr_setting;
191 u16 tx_itr;
192 u16 rx_itr;
193
194
195
196
197 struct igbvf_ring *tx_ring
198 ____cacheline_aligned_in_smp;
199
200 unsigned long tx_queue_len;
201 unsigned int restart_queue;
202 u32 txd_cmd;
203
204 bool detect_tx_hung;
205 u8 tx_timeout_factor;
206
207 u32 tx_int_delay;
208 u32 tx_abs_int_delay;
209
210 unsigned int total_tx_bytes;
211 unsigned int total_tx_packets;
212 unsigned int total_rx_bytes;
213 unsigned int total_rx_packets;
214
215
216 u32 tx_timeout_count;
217 u32 tx_fifo_head;
218 u32 tx_head_addr;
219 u32 tx_fifo_size;
220 u32 tx_dma_failed;
221
222
223
224
225 struct igbvf_ring *rx_ring;
226
227 u32 rx_int_delay;
228 u32 rx_abs_int_delay;
229
230
231 u64 hw_csum_err;
232 u64 hw_csum_good;
233 u64 rx_hdr_split;
234 u32 alloc_rx_buff_failed;
235 u32 rx_dma_failed;
236
237 unsigned int rx_ps_hdr_size;
238 u32 max_frame_size;
239 u32 min_frame_size;
240
241
242 struct net_device *netdev;
243 struct pci_dev *pdev;
244 struct net_device_stats net_stats;
245 spinlock_t stats_lock;
246
247
248 struct e1000_hw hw;
249
250
251
252
253
254 struct e1000_vf_stats stats;
255 u64 zero_base;
256
257 struct igbvf_ring test_tx_ring;
258 struct igbvf_ring test_rx_ring;
259 u32 test_icr;
260
261 u32 msg_enable;
262 struct msix_entry *msix_entries;
263 int int_mode;
264 u32 eims_enable_mask;
265 u32 eims_other;
266 u32 int_counter0;
267 u32 int_counter1;
268
269 u32 eeprom_wol;
270 u32 wol;
271 u32 pba;
272
273 bool fc_autoneg;
274
275 unsigned long led_status;
276
277 unsigned int flags;
278};
279
280struct igbvf_info {
281 enum e1000_mac_type mac;
282 unsigned int flags;
283 u32 pba;
284 void (*init_ops)(struct e1000_hw *);
285 s32 (*get_variants)(struct igbvf_adapter *);
286};
287
288
289#define IGBVF_FLAG_RX_CSUM_DISABLED (1 << 0)
290
291#define IGBVF_RX_DESC_ADV(R, i) \
292 (&((((R).desc))[i].rx_desc))
293#define IGBVF_TX_DESC_ADV(R, i) \
294 (&((((R).desc))[i].tx_desc))
295#define IGBVF_TX_CTXTDESC_ADV(R, i) \
296 (&((((R).desc))[i].tx_context_desc))
297
298enum igbvf_state_t {
299 __IGBVF_TESTING,
300 __IGBVF_RESETTING,
301 __IGBVF_DOWN
302};
303
304enum latency_range {
305 lowest_latency = 0,
306 low_latency = 1,
307 bulk_latency = 2,
308 latency_invalid = 255
309};
310
311extern char igbvf_driver_name[];
312extern const char igbvf_driver_version[];
313
314extern void igbvf_check_options(struct igbvf_adapter *);
315extern void igbvf_set_ethtool_ops(struct net_device *);
316
317extern int igbvf_up(struct igbvf_adapter *);
318extern void igbvf_down(struct igbvf_adapter *);
319extern void igbvf_reinit_locked(struct igbvf_adapter *);
320extern int igbvf_setup_rx_resources(struct igbvf_adapter *, struct igbvf_ring *);
321extern int igbvf_setup_tx_resources(struct igbvf_adapter *, struct igbvf_ring *);
322extern void igbvf_free_rx_resources(struct igbvf_ring *);
323extern void igbvf_free_tx_resources(struct igbvf_ring *);
324extern void igbvf_update_stats(struct igbvf_adapter *);
325
326extern unsigned int copybreak;
327
328#endif
329