iPXE
igbvf.h
Go to the documentation of this file.
1/*******************************************************************************
2
3 Intel(R) 82576 Virtual Function Linux driver
4 Copyright(c) 1999 - 2008 Intel Corporation.
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms and conditions of the GNU General Public License,
8 version 2, as published by the Free Software Foundation.
9
10 This program is distributed in the hope it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 more details.
14
15 You should have received a copy of the GNU General Public License along with
16 this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
18
19 The full GNU General Public License is included in this distribution in
20 the file called "COPYING".
21
22 Contact Information:
23 Linux NICS <linux.nics@intel.com>
24 e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
25 Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26
27*******************************************************************************/
28
29FILE_LICENCE ( GPL2_ONLY );
30
31/* Linux PRO/1000 Ethernet Driver main header file */
32
33#ifndef _IGBVF_H_
34#define _IGBVF_H_
35
36#include "igbvf_vf.h"
37
38/* Forward declarations */
39struct igbvf_info;
40struct igbvf_adapter;
41
42/* Interrupt defines */
43#define IGBVF_START_ITR 648 /* ~6000 ints/sec */
44
45/* Tx/Rx descriptor defines */
46#define IGBVF_DEFAULT_TXD 256
47#define IGBVF_MAX_TXD 4096
48#define IGBVF_MIN_TXD 80
49
50#define IGBVF_DEFAULT_RXD 256
51#define IGBVF_MAX_RXD 4096
52#define IGBVF_MIN_RXD 80
53
54#define IGBVF_MIN_ITR_USECS 10 /* 100000 irq/sec */
55#define IGBVF_MAX_ITR_USECS 10000 /* 100 irq/sec */
56
57/* RX descriptor control thresholds.
58 * PTHRESH - MAC will consider prefetch if it has fewer than this number of
59 * descriptors available in its onboard memory.
60 * Setting this to 0 disables RX descriptor prefetch.
61 * HTHRESH - MAC will only prefetch if there are at least this many descriptors
62 * available in host memory.
63 * If PTHRESH is 0, this should also be 0.
64 * WTHRESH - RX descriptor writeback threshold - MAC will delay writing back
65 * descriptors until either it has this many to write back, or the
66 * ITR timer expires.
67 */
68#define IGBVF_RX_PTHRESH 16
69#define IGBVF_RX_HTHRESH 8
70#define IGBVF_RX_WTHRESH 1
71
72#define IGBVF_TX_PTHRESH 8
73#define IGBVF_TX_HTHRESH 1
74#define IGBVF_TX_WTHRESH 1
75
76/* this is the size past which hardware will drop packets when setting LPE=0 */
77#define MAXIMUM_ETHERNET_VLAN_SIZE 1522
78
79#define IGBVF_FC_PAUSE_TIME 0x0680 /* 858 usec */
80
81/* How many Tx Descriptors do we need to call netif_wake_queue ? */
82#define IGBVF_TX_QUEUE_WAKE 32
83/* How many Rx Buffers do we bundle into one write to the hardware ? */
84#define IGBVF_RX_BUFFER_WRITE 16 /* Must be power of 2 */
85
86#define AUTO_ALL_MODES 0
87#define IGBVF_EEPROM_APME 0x0400
88
89#define IGBVF_MNG_VLAN_NONE (-1)
90
94
99
100/*
101 * wrappers around a pointer to a socket buffer,
102 * so a DMA handle can be stored along with the buffer
103 */
105#if 0
107 dma_addr_t page_dma;
108 struct sk_buff *skb;
109 union {
110 /* Tx */
111 struct {
112 unsigned long time_stamp;
113 u16 length;
114 u16 next_to_watch;
115 };
116 /* Rx */
117 struct {
118 struct page *page;
119 unsigned int page_offset;
120 };
121 };
122 struct page *page;
123#endif
124};
125
127#if 0
128 struct igbvf_adapter *adapter; /* backlink */
129 void *desc; /* pointer to ring memory */
130 dma_addr_t dma; /* phys address of ring */
131 unsigned int size; /* length of ring in bytes */
132 unsigned int count; /* number of desc. in ring */
133
134 u16 next_to_use;
135 u16 next_to_clean;
136
137 u16 head;
138 u16 tail;
139
140 /* array of buffer information structs */
141 struct igbvf_buffer *buffer_info;
142 struct napi_struct napi;
143
144 char name[IFNAMSIZ + 5];
145 u32 eims_value;
146 u32 itr_val;
147 u16 itr_register;
148 int set_itr;
149
150 struct sk_buff *rx_skb_top;
151
152 struct igbvf_queue_stats stats;
153#endif
154};
155
156/* board specific private data structure */
158#if 0
159 struct timer_list watchdog_timer;
160 struct timer_list blink_timer;
161
162 struct work_struct reset_task;
163 struct work_struct watchdog_task;
164
165 const struct igbvf_info *ei;
166
167 struct vlan_group *vlgrp;
168 u32 bd_number;
169 u32 rx_buffer_len;
170 u32 polling_interval;
171 u16 mng_vlan_id;
172 u16 link_speed;
173 u16 link_duplex;
174
175 spinlock_t tx_queue_lock; /* prevent concurrent tail updates */
176
177 /* track device up/down/testing state */
178 unsigned long state;
179
180 /* Interrupt Throttle Rate */
181 u32 itr;
182 u32 itr_setting;
183 u16 tx_itr;
184 u16 rx_itr;
185
186 /*
187 * Tx
188 */
189 struct igbvf_ring *tx_ring /* One per active queue */
191
192 unsigned long tx_queue_len;
193 unsigned int restart_queue;
194 u32 txd_cmd;
195
196 bool detect_tx_hung;
197 u8 tx_timeout_factor;
198
199 unsigned int total_tx_bytes;
200 unsigned int total_tx_packets;
201 unsigned int total_rx_bytes;
202 unsigned int total_rx_packets;
203
204 /* Tx stats */
205 u32 tx_timeout_count;
206 u32 tx_fifo_head;
207 u32 tx_head_addr;
208 u32 tx_fifo_size;
209 u32 tx_dma_failed;
210
211 /*
212 * Rx
213 */
214 struct igbvf_ring *rx_ring;
215
216 /* Rx stats */
217 u64 hw_csum_err;
218 u64 hw_csum_good;
219 u64 rx_hdr_split;
220 u32 alloc_rx_buff_failed;
221 u32 rx_dma_failed;
222
223 unsigned int rx_ps_hdr_size;
226
227 /* OS defined structs */
228 struct net_device *netdev;
229 struct pci_dev *pdev;
231 spinlock_t stats_lock; /* prevent concurrent stats updates */
232
233 /* structs defined in e1000_hw.h */
234 struct e1000_hw hw;
235
236 /* The VF counters don't clear on read so we have to get a base
237 * count on driver start up and always subtract that base on
238 * on the first update, thus the flag..
239 */
240 struct e1000_vf_stats stats;
241 u64 zero_base;
242
243 struct igbvf_ring test_tx_ring;
244 struct igbvf_ring test_rx_ring;
245 u32 test_icr;
246
247 u32 msg_enable;
248 struct msix_entry *msix_entries;
249 int int_mode;
250 u32 eims_enable_mask;
251 u32 eims_other;
252 u32 int_counter0;
253 u32 int_counter1;
254
255 u32 eeprom_wol;
256 u32 wol;
257 u32 pba;
258
259 bool fc_autoneg;
260
261 unsigned long led_status;
262
263 unsigned int flags;
264 unsigned long last_reset;
265 u32 *config_space;
266#endif
267 /* OS defined structs */
271
272 /* structs defined in e1000_hw.h */
273 struct e1000_hw hw;
274
277
279
280#define NUM_TX_DESC 8
281#define NUM_RX_DESC 8
282
285
288
291
295
297
300
304};
305
308 unsigned int flags;
310 void (*init_ops)(struct e1000_hw *);
312};
313
314/* hardware capability, feature, and workaround flags */
315#define IGBVF_FLAG_RX_CSUM_DISABLED (1 << 0)
316
317#define IGBVF_DESC_UNUSED(R) \
318 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
319 (R)->next_to_clean - (R)->next_to_use - 1)
320
321#define IGBVF_RX_DESC_ADV(R, i) \
322 (&(((union e1000_adv_rx_desc *)((R).desc))[i]))
323#define IGBVF_TX_DESC_ADV(R, i) \
324 (&(((union e1000_adv_tx_desc *)((R).desc))[i]))
325#define IGBVF_TX_CTXTDESC_ADV(R, i) \
326 (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))
327
333
340
341extern char igbvf_driver_name[];
342extern const char igbvf_driver_version[];
343
344extern void igbvf_check_options(struct igbvf_adapter *adapter);
346#ifdef ETHTOOL_OPS_COMPAT
347extern int ethtool_ioctl(struct ifreq *ifr);
348#endif
349
350extern int igbvf_up(struct igbvf_adapter *adapter);
351extern void igbvf_down(struct igbvf_adapter *adapter);
352extern void igbvf_reinit_locked(struct igbvf_adapter *adapter);
353extern void igbvf_reset(struct igbvf_adapter *adapter);
354extern int igbvf_setup_rx_resources(struct igbvf_adapter *adapter);
355extern int igbvf_setup_tx_resources(struct igbvf_adapter *adapter);
356extern void igbvf_free_rx_resources(struct igbvf_adapter *adapter);
357extern void igbvf_free_tx_resources(struct igbvf_adapter *adapter);
358extern void igbvf_update_stats(struct igbvf_adapter *adapter);
361
362extern unsigned int copybreak;
363
364static inline u32 __er32(struct e1000_hw *hw, unsigned long reg)
365{
366 return readl(hw->hw_addr + reg);
367}
368
369static inline void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
370{
371 writel(val, hw->hw_addr + reg);
372}
373#define er32(reg) E1000_READ_REG(hw, E1000_##reg)
374#define ew32(reg,val) E1000_WRITE_REG(hw, E1000_##reg, (val))
375#define e1e_flush() er32(STATUS)
376
377#endif /* _IGBVF_H_ */
__be16 page_offset
Definition CIB_PRM.h:5
unsigned int uint32_t
Definition stdint.h:12
const char * name
Definition ath9k_hw.c:1986
uint8_t flags
Flags.
Definition ena.h:7
struct ena_llq_option desc
Descriptor counts.
Definition ena.h:9
#define tx_ring
Definition epic100.c:99
#define rx_ring
Definition epic100.c:98
uint8_t state
State.
Definition eth_slow.h:36
#define dma_addr_t
static struct net_device * netdev
Definition gdbudp.c:53
uint16_t size
Buffer size.
Definition dwmac.h:3
static unsigned int count
Number of entries.
Definition dwmac.h:220
uint8_t head
Head number.
Definition int13.h:23
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
Definition compiler.h:896
int igbvf_setup_rx_resources(struct igbvf_adapter *adapter)
igbvf_setup_rx_resources - allocate Rx resources (Descriptors)
Definition igbvf_main.c:564
void igbvf_reinit_locked(struct igbvf_adapter *adapter)
unsigned int copybreak
void igbvf_reset_interrupt_capability(struct igbvf_adapter *adapter)
void igbvf_update_stats(struct igbvf_adapter *adapter)
igbvf_boards
Definition igbvf.h:91
@ board_vf
Definition igbvf.h:92
void igbvf_check_options(struct igbvf_adapter *adapter)
latency_range
Definition igbvf.h:334
@ latency_invalid
Definition igbvf.h:338
@ bulk_latency
Definition igbvf.h:337
@ low_latency
Definition igbvf.h:336
@ lowest_latency
Definition igbvf.h:335
const char igbvf_driver_version[]
static u32 __er32(struct e1000_hw *hw, unsigned long reg)
Definition igbvf.h:364
void igbvf_free_rx_resources(struct igbvf_adapter *adapter)
igbvf_free_rx_resources - Free Rx Resources @adapter: board private structure
Definition igbvf_main.c:90
#define NUM_RX_DESC
Definition igbvf.h:281
void igbvf_set_ethtool_ops(struct net_device *netdev)
igbvf_state_t
Definition igbvf.h:328
@ __IGBVF_DOWN
Definition igbvf.h:331
@ __IGBVF_TESTING
Definition igbvf.h:329
@ __IGBVF_RESETTING
Definition igbvf.h:330
static void __ew32(struct e1000_hw *hw, unsigned long reg, u32 val)
Definition igbvf.h:369
void igbvf_free_tx_resources(struct igbvf_adapter *adapter)
igbvf_free_tx_resources - Free Tx Resources per Queue @adapter: board private structure
Definition igbvf_main.c:77
#define NUM_TX_DESC
Definition igbvf.h:280
int igbvf_up(struct igbvf_adapter *adapter)
char igbvf_driver_name[]
void igbvf_set_interrupt_capability(struct igbvf_adapter *adapter)
int igbvf_setup_tx_resources(struct igbvf_adapter *adapter)
igbvf_setup_tx_resources - allocate Tx resources (Descriptors)
Definition igbvf_main.c:43
void igbvf_reset(struct igbvf_adapter *adapter)
Definition igbvf_main.c:426
void igbvf_down(struct igbvf_adapter *adapter)
#define u8
Definition igbvf_osdep.h:40
int spinlock_t
Definition igbvf_osdep.h:54
#define ____cacheline_aligned_in_smp
Definition igbvf_osdep.h:48
e1000_mac_type
Definition igbvf_vf.h:167
void __asmcall int val
Definition setjmp.h:12
uint64_t u64
Definition stdint.h:26
int32_t s32
Definition stdint.h:23
physaddr_t dma(struct dma_mapping *map, void *addr)
Get DMA address from virtual address.
static unsigned int unsigned int reg
Definition myson.h:162
u16 length
Definition sky2.h:1
Definition hw.c:16
uint32_t tx_tail
Definition igbvf.h:293
u32 max_frame_size
Definition igbvf.h:276
union e1000_adv_tx_desc * tx_base
Definition igbvf.h:286
struct io_buffer * tx_iobuf[NUM_TX_DESC]
Definition igbvf.h:283
uint32_t tx_head
Definition igbvf.h:292
u32 min_frame_size
Definition igbvf.h:275
uint32_t txd_cmd
Definition igbvf.h:303
uint32_t tx_fill_ctr
Definition igbvf.h:294
struct net_device * netdev
Definition igbvf.h:268
u32 max_hw_frame_size
Definition igbvf.h:278
struct net_device_stats net_stats
Definition igbvf.h:270
union e1000_adv_rx_desc * rx_base
Definition igbvf.h:287
uint32_t rx_curr
Definition igbvf.h:296
uint32_t irqno
Definition igbvf.h:299
uint32_t rx_ring_size
Definition igbvf.h:290
struct io_buffer * rx_iobuf[NUM_RX_DESC]
Definition igbvf.h:284
uint32_t tx_ring_size
Definition igbvf.h:289
uint32_t ioaddr
Definition igbvf.h:298
uint32_t tx_abs_int_delay
Definition igbvf.h:302
uint32_t tx_int_delay
Definition igbvf.h:301
struct e1000_hw hw
Definition igbvf.h:273
struct pci_device * pdev
Definition igbvf.h:269
unsigned int flags
Definition igbvf.h:308
s32(* get_variants)(struct igbvf_adapter *)
Definition igbvf.h:311
void(* init_ops)(struct e1000_hw *)
Definition igbvf.h:310
u32 pba
Definition igbvf.h:309
enum e1000_mac_type mac
Definition igbvf.h:307
A persistent I/O buffer.
Definition iobuf.h:38
Network device statistics.
Definition netdevice.h:292
A network device.
Definition netdevice.h:353
A PCI device.
Definition pci.h:211
#define u16
Definition vga.h:20
#define u32
Definition vga.h:21
#define readl
Definition w89c840.c:157
#define writel
Definition w89c840.c:160