iPXE
intelxlvf.h
Go to the documentation of this file.
1 #ifndef _INTELXLVF_H
2 #define _INTELXLVF_H
3 
4 /** @file
5  *
6  * Intel 40 Gigabit Ethernet virtual function network card driver
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include "intelxl.h"
13 
14 /** BAR size */
15 #define INTELXLVF_BAR_SIZE 0x10000
16 
17 /** MSI-X vector
18  *
19  * The 100 Gigabit physical function driver requires a virtual
20  * function driver to request that transmit and receive queues are
21  * mapped to MSI-X vector 1 or higher.
22  */
23 #define INTELXLVF_MSIX_VECTOR 1
24 
25 /** Transmit Queue Tail Register */
26 #define INTELXLVF_QTX_TAIL 0x00000
27 
28 /** Receive Queue Tail Register */
29 #define INTELXLVF_QRX_TAIL 0x02000
30 
31 /** VF Interrupt N Dynamic Control Register */
32 #define INTELXLVF_VFINT_DYN_CTLN( x ) ( 0x3800 + ( 0x4 * ( (x) - 1 ) ) )
33 
34 /** VF Interrupt Zero Dynamic Control Register */
35 #define INTELXLVF_VFINT_DYN_CTL0 0x5c00
36 
37 /** VF Admin Queue register block */
38 #define INTELXLVF_ADMIN 0x6000
39 
40 /** Admin Command Queue Base Address Low Register (offset) */
41 #define INTELXLVF_ADMIN_CMD_BAL 0x1c00
42 
43 /** Admin Command Queue Base Address High Register (offset) */
44 #define INTELXLVF_ADMIN_CMD_BAH 0x1800
45 
46 /** Admin Command Queue Length Register (offset) */
47 #define INTELXLVF_ADMIN_CMD_LEN 0x0800
48 
49 /** Admin Command Queue Head Register (offset) */
50 #define INTELXLVF_ADMIN_CMD_HEAD 0x0400
51 
52 /** Admin Command Queue Tail Register (offset) */
53 #define INTELXLVF_ADMIN_CMD_TAIL 0x2400
54 
55 /** Admin Event Queue Base Address Low Register (offset) */
56 #define INTELXLVF_ADMIN_EVT_BAL 0x0c00
57 
58 /** Admin Event Queue Base Address High Register (offset) */
59 #define INTELXLVF_ADMIN_EVT_BAH 0x0000
60 
61 /** Admin Event Queue Length Register (offset) */
62 #define INTELXLVF_ADMIN_EVT_LEN 0x2000
63 
64 /** Admin Event Queue Head Register (offset) */
65 #define INTELXLVF_ADMIN_EVT_HEAD 0x1400
66 
67 /** Admin Event Queue Tail Register (offset) */
68 #define INTELXLVF_ADMIN_EVT_TAIL 0x1000
69 
70 /** Maximum time to wait for a VF admin request to complete */
71 #define INTELXLVF_ADMIN_MAX_WAIT_MS 2000
72 
73 /** Admin queue Send Message to PF command */
74 #define INTELXLVF_ADMIN_SEND_TO_PF 0x0801
75 
76 /** Admin queue Send Message to VF command */
77 #define INTELXLVF_ADMIN_SEND_TO_VF 0x0802
78 
79 /** Admin Queue VF Version opcode */
80 #define INTELXLVF_ADMIN_VERSION 0x00000001
81 
82 /** Admin Queue VF Version data buffer */
84  /** Major version */
86  /** Minor version */
88 } __attribute__ (( packed ));
89 
90 /** Admin queue VF API major version */
91 #define INTELXLVF_ADMIN_API_MAJOR 1
92 
93 /** Admin queue VF API minor version */
94 #define INTELXLVF_ADMIN_API_MINOR 1
95 
96 /** Admin Queue VF Reset opcode */
97 #define INTELXLVF_ADMIN_RESET 0x00000002
98 
99 /** Admin Queue VF Get Resources opcode */
100 #define INTELXLVF_ADMIN_GET_RESOURCES 0x00000003
101 
102 /** Admin Queue VF Capabilities data buffer */
104  /** Capabilities */
106 } __attribute__ (( packed ));
107 
108 /** Admin Queue VF Get Resources data buffer */
110  /** Number of VSIs */
112  /** Number of queue pairs */
114  /** Number of MSI-X vectors */
116  /** Maximum MTU */
118  /** Capabilities */
120  /** Reserved */
122  /** VSI switching element ID */
124  /** Reserved */
126  /** MAC address */
128 } __attribute__ (( packed ));
129 
130 /** Layer 2 capabilities (add/remove MAC, configure promiscuous mode) */
131 #define INTELXLVF_ADMIN_CAP_L2 0x00000001
132 
133 /** Request Queues capabilities */
134 #define INTELXLVF_ADMIN_CAP_RQPS 0x00000040
135 
136 /** Admin Queue VF Status Change Event opcode */
137 #define INTELXLVF_ADMIN_STATUS 0x00000011
138 
139 /** Link status change event type */
140 #define INTELXLVF_ADMIN_STATUS_LINK 0x00000001
141 
142 /** Link status change event data */
144  /** Link speed */
146  /** Link status */
148  /** Reserved */
150 } __attribute__ (( packed ));
151 
152 /** Admin Queue VF Status Change Event data buffer */
154  /** Event type */
156  /** Event data */
157  union {
158  /** Link change event data */
160  } data;
161  /** Reserved */
163 } __attribute__ (( packed ));
164 
165 /** Admin Queue VF Configure Queues opcode */
166 #define INTELXLVF_ADMIN_CONFIGURE 0x00000006
167 
168 /** Admin Queue VF Configure Queues data buffer */
170  /** VSI switching element ID */
172  /** Number of queue pairs */
174  /** Reserved */
176  /** Transmit queue */
177  struct {
178  /** VSI switching element ID */
179  uint16_t vsi;
180  /** Queue ID */
182  /** Queue count */
183  uint16_t count;
184  /** Reserved */
185  uint8_t reserved_a[2];
186  /** Base address */
188  /** Reserved */
190  } __attribute__ (( packed )) tx;
191  /** Receive queue */
192  struct {
193  /** VSI switching element ID */
194  uint16_t vsi;
195  /** Queue ID */
196  uint16_t id;
197  /** Queue count */
199  /** Reserved */
200  uint8_t reserved_a[4];
201  /** Data buffer length */
203  /** Maximum frame size */
205  /** Reserved */
206  uint8_t reserved_b[4];
207  /** Base address */
208  uint64_t base;
209  /** Reserved */
211  } __attribute__ (( packed )) rx;
212  /** Reserved
213  *
214  * This field exists only due to a bug in the PF driver's
215  * message validation logic, which causes it to miscalculate
216  * the expected message length.
217  */
218  uint8_t reserved_b[64];
219 } __attribute__ (( packed ));
220 
221 /** Admin Queue VF IRQ Map opcode */
222 #define INTELXLVF_ADMIN_IRQ_MAP 0x00000007
223 
224 /** Admin Queue VF IRQ Map data buffer */
226  /** Number of interrupt vectors */
228  /** VSI switching element ID */
230  /** Interrupt vector ID */
232  /** Receive queue bitmap */
234  /** Transmit queue bitmap */
236  /** Receive interrupt throttling index */
238  /** Transmit interrupt throttling index */
240  /** Reserved
241  *
242  * This field exists only due to a bug in the PF driver's
243  * message validation logic, which causes it to miscalculate
244  * the expected message length.
245  */
247 } __attribute__ (( packed ));
248 
249 /** Admin Queue VF Enable Queues opcode */
250 #define INTELXLVF_ADMIN_ENABLE 0x00000008
251 
252 /** Admin Queue VF Disable Queues opcode */
253 #define INTELXLVF_ADMIN_DISABLE 0x00000009
254 
255 /** Admin Queue VF Enable/Disable Queues data buffer */
257  /** VSI switching element ID */
259  /** Reserved */
261  /** Receive queue bitmask */
263  /** Transmit queue bitmask */
265 } __attribute__ (( packed ));
266 
267 /** Admin Queue VF Configure Promiscuous Mode opcode */
268 #define INTELXLVF_ADMIN_PROMISC 0x0000000e
269 
270 /** Admin Queue VF Configure Promiscuous Mode data buffer */
272  /** VSI switching element ID */
274  /** Flags */
276 } __attribute__ (( packed ));
277 
278 /** Admin Queue VF Get Statistics opcode */
279 #define INTELXLVF_ADMIN_GET_STATS 0x0000000f
280 
281 /** VF statistics */
283  /** Bytes */
285  /** Unicast packets */
287  /** Multicast packets */
289  /** Broadcast packets */
291  /** Discarded packets */
293  /** Errors */
295 } __attribute__ (( packed ));
296 
297 /** Admin Queue VF Get Statistics data buffer */
299  /** Receive statistics */
301  /** Transmit statistics */
303 } __attribute__ (( packed ));
304 
305 /** Admin Queue VF Request Queues opcode */
306 #define INTELXLVF_ADMIN_REQUEST_QPS 0x0000001d
307 
308 /** Admin Queue VF Request Queues data buffer */
310  /** Number of queue pairs */
312 } __attribute__ (( packed ));
313 
314 /** Admin queue data buffer */
316  /** Original 40 Gigabit Ethernet data buffer */
318  /** VF Version data buffer */
320  /** VF Capabilities data buffer */
322  /** VF Get Resources data buffer */
324  /** VF Status Change Event data buffer */
326  /** VF Configure Queues data buffer */
328  /** VF Enable/Disable Queues data buffer */
330  /** VF Configure Promiscuous Mode data buffer */
332  /** VF IRQ Map data buffer */
334  /** VF Get Statistics data buffer */
336  /** VF Request Queues data buffer */
338 } __attribute__ (( packed ));
339 
340 /** Admin queue descriptor */
342  /** Transparent union */
343  union {
344  /** Original 40 Gigabit Ethernet descriptor */
346  /** Transparent struct */
347  struct {
348  /** Flags */
350  /** Opcode */
352  /** Data length */
354  /** Return value */
356  /** VF opcode */
358  /** VF return value */
360  /** Parameters */
362  } __attribute__ (( packed ));
363  } __attribute__ (( packed ));
364 } __attribute__ (( packed ));
365 
366 /**
367  * Get next admin command queue descriptor
368  *
369  * @v intelxl Intel device
370  * @ret cmd Command descriptor
371  */
374  struct intelxl_admin_descriptor *xlcmd =
376 
377  return container_of ( xlcmd, struct intelxlvf_admin_descriptor, xl );
378 }
379 
380 /**
381  * Get next admin command queue data buffer
382  *
383  * @v intelxl Intel device
384  * @ret buf Data buffer
385  */
386 static inline __attribute__ (( always_inline )) union intelxlvf_admin_buffer *
388  union intelxl_admin_buffer *xlbuf =
389  intelxl_admin_command_buffer ( intelxl );
390 
391  return container_of ( xlbuf, union intelxlvf_admin_buffer, xl );
392 }
393 
394 /** VF Reset Status Register */
395 #define INTELXLVF_VFGEN_RSTAT 0x8800
396 #define INTELXLVF_VFGEN_RSTAT_VFR_STATE(x) ( (x) & 0x3 )
397 #define INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE 0x2
398 
399 /** Minimum time to wait for reset to complete */
400 #define INTELXLVF_RESET_DELAY_MS 100
401 
402 /** Maximum time to wait for reset to complete */
403 #define INTELXLVF_RESET_MAX_WAIT_MS 1000
404 
405 /**
406  * Initialise descriptor ring
407  *
408  * @v ring Descriptor ring
409  * @v count Number of descriptors
410  * @v len Length of a single descriptor
411  * @v tail Tail register offset
412  */
413 static inline __attribute__ (( always_inline)) void
414 intelxlvf_init_ring ( struct intelxl_ring *ring, unsigned int count,
415  size_t len, unsigned int tail ) {
416 
417  ring->len = ( count * len );
418  ring->tail = tail;
419 }
420 
421 #endif /* _INTELXLVF_H */
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:258
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:273
struct intelxl_admin_descriptor * intelxl_admin_command_descriptor(struct intelxl_nic *intelxl)
Get next admin command queue descriptor.
Definition: intelxl.c:239
#define __attribute__(x)
Definition: compiler.h:10
uint8_t reserved[2]
Reserved.
Definition: intelxlvf.h:260
union intelxlvf_admin_status_buffer::@67 data
Event data.
Admin queue data buffer.
Definition: intelxlvf.h:315
uint16_t flags
Flags.
Definition: intelxlvf.h:349
size_t len
Length (in bytes)
Definition: intelxl.h:777
unsigned short uint16_t
Definition: stdint.h:11
uint16_t txmap
Transmit queue bitmap.
Definition: intelxlvf.h:235
struct intelxlvf_admin_version_buffer ver
VF Version data buffer.
Definition: intelxlvf.h:319
uint16_t vectors
Number of MSI-X vectors.
Definition: intelxlvf.h:115
struct intelxlvf_admin_status_link link
Link change event data.
Definition: intelxlvf.h:159
Admin Queue VF Get Resources data buffer.
Definition: intelxlvf.h:109
uint32_t event
Event type.
Definition: intelxlvf.h:155
uint32_t tx
Transmit queue bitmask.
Definition: intelxlvf.h:264
struct intelxlvf_admin_irq_map_buffer irq
VF IRQ Map data buffer.
Definition: intelxlvf.h:333
int32_t vret
VF return value.
Definition: intelxlvf.h:359
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:229
uint8_t reserved_a[4]
Reserved.
Definition: intelxlvf.h:175
union intelxl_admin_buffer * intelxl_admin_command_buffer(struct intelxl_nic *intelxl)
Get next admin command queue data buffer.
Definition: intelxl.c:256
unsigned long long uint64_t
Definition: stdint.h:13
struct intelxlvf_admin_queues_buffer queues
VF Enable/Disable Queues data buffer.
Definition: intelxlvf.h:329
uint16_t txitr
Transmit interrupt throttling index.
Definition: intelxlvf.h:239
uint64_t broadcasts
Broadcast packets.
Definition: intelxlvf.h:290
Admin Queue VF Enable/Disable Queues data buffer.
Definition: intelxlvf.h:256
struct intelxlvf_admin_capabilities_buffer caps
VF Capabilities data buffer.
Definition: intelxlvf.h:321
struct intelxlvf_admin_configure_buffer::@68 tx
Transmit queue.
struct intelxlvf_admin_stats tx
Transmit statistics.
Definition: intelxlvf.h:302
struct intelxlvf_admin_promisc_buffer promisc
VF Configure Promiscuous Mode data buffer.
Definition: intelxlvf.h:331
uint8_t reserved_a[8]
Reserved.
Definition: intelxlvf.h:121
Admin Queue VF Configure Promiscuous Mode data buffer.
Definition: intelxlvf.h:271
Admin queue command parameters.
Definition: intelxl.h:368
Intel 40 Gigabit Ethernet network card driver.
Admin Queue VF Configure Queues data buffer.
Definition: intelxlvf.h:169
uint16_t rxitr
Receive interrupt throttling index.
Definition: intelxlvf.h:237
uint64_t multicasts
Multicast packets.
Definition: intelxlvf.h:288
uint32_t caps
Capabilities.
Definition: intelxlvf.h:119
struct intelxlvf_admin_configure_buffer cfg
VF Configure Queues data buffer.
Definition: intelxlvf.h:327
struct intelxlvf_admin_get_resources_buffer res
VF Get Resources data buffer.
Definition: intelxlvf.h:323
Admin Queue VF Request Queues data buffer.
Definition: intelxlvf.h:309
struct intelxlvf_admin_status_buffer stat
VF Status Change Event data buffer.
Definition: intelxlvf.h:325
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:123
Admin Queue VF Capabilities data buffer.
Definition: intelxlvf.h:103
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:35
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
uint64_t base
Base address.
Definition: intelxlvf.h:187
uint16_t rxmap
Receive queue bitmap.
Definition: intelxlvf.h:233
uint64_t errors
Errors.
Definition: intelxlvf.h:294
uint32_t len
Data buffer length.
Definition: intelxlvf.h:202
uint8_t reserved_b[8]
Reserved.
Definition: intelxlvf.h:125
uint16_t count
Number of entries.
Definition: ena.h:22
uint16_t count
Number of queue pairs.
Definition: intelxlvf.h:173
uint8_t reserved[12]
Reserved.
Definition: intelxlvf.h:246
struct intelxl_admin_descriptor xl
Original 40 Gigabit Ethernet descriptor.
Definition: intelxlvf.h:345
uint16_t vsi
VSI switching element ID.
Definition: intelxlvf.h:171
uint16_t count
Number of queue pairs.
Definition: intelxlvf.h:311
uint16_t count
Number of interrupt vectors.
Definition: intelxlvf.h:227
uint32_t minor
Minor version.
Definition: intelxlvf.h:87
struct intelxlvf_admin_request_qps_buffer rqps
VF Request Queues data buffer.
Definition: intelxlvf.h:337
uint32_t vopcode
VF opcode.
Definition: intelxlvf.h:357
uint16_t qps
Number of queue pairs.
Definition: intelxlvf.h:113
Admin Queue VF IRQ Map data buffer.
Definition: intelxlvf.h:225
uint8_t reserved_b[8]
Reserved.
Definition: intelxlvf.h:189
uint8_t mac[ETH_ALEN]
MAC address.
Definition: intelxlvf.h:127
Admin queue descriptor.
Definition: intelxlvf.h:341
unsigned char uint8_t
Definition: stdint.h:10
An Intel 40 Gigabit network card.
Definition: intelxl.h:919
#define ETH_ALEN
Definition: if_ether.h:8
uint32_t major
Major version.
Definition: intelxlvf.h:85
unsigned int uint32_t
Definition: stdint.h:12
VF statistics.
Definition: intelxlvf.h:282
uint16_t ret
Return value.
Definition: intelxlvf.h:355
uint64_t bytes
Bytes.
Definition: intelxlvf.h:284
uint32_t count
Queue count.
Definition: intelxlvf.h:198
uint32_t caps
Capabilities.
Definition: intelxlvf.h:105
struct intelxlvf_admin_stats_buffer stats
VF Get Statistics data buffer.
Definition: intelxlvf.h:335
uint16_t vsis
Number of VSIs.
Definition: intelxlvf.h:111
static union intelxlvf_admin_buffer * intelxlvf_admin_command_buffer(struct intelxl_nic *intelxl)
Get next admin command queue data buffer.
Definition: intelxlvf.h:387
Admin queue descriptor.
Definition: intelxl.h:415
struct intelxlvf_admin_stats rx
Receive statistics.
Definition: intelxlvf.h:300
signed int int32_t
Definition: stdint.h:17
uint8_t reserved[4]
Reserved.
Definition: intelxlvf.h:162
Admin Queue VF Get Statistics data buffer.
Definition: intelxlvf.h:298
uint64_t discards
Discarded packets.
Definition: intelxlvf.h:292
struct intelxlvf_admin_configure_buffer::@69 rx
Receive queue.
Admin Queue VF Version data buffer.
Definition: intelxlvf.h:83
uint16_t vec
Interrupt vector ID.
Definition: intelxlvf.h:231
static void intelxlvf_init_ring(struct intelxl_ring *ring, unsigned int count, size_t len, unsigned int tail)
Initialise descriptor ring.
Definition: intelxlvf.h:414
Descriptor ring.
Definition: intelxl.h:755
unsigned int tail
Tail register.
Definition: intelxl.h:775
uint32_t rx
Receive queue bitmask.
Definition: intelxlvf.h:262
struct intelxlvf_admin_descriptor * intelxlvf_admin_command_descriptor(struct intelxl_nic *intelxl)
Get next admin command queue descriptor.
Definition: intelxlvf.h:373
uint16_t opcode
Opcode.
Definition: intelxlvf.h:351
union intelxl_admin_params params
Parameters.
Definition: intelxlvf.h:361
Admin Queue VF Status Change Event data buffer.
Definition: intelxlvf.h:153
uint32_t len
Length.
Definition: ena.h:14
union intelxl_admin_buffer xl
Original 40 Gigabit Ethernet data buffer.
Definition: intelxlvf.h:317
uint32_t mfs
Maximum frame size.
Definition: intelxlvf.h:204
Admin queue data buffer.
Definition: intelxl.h:401
uint8_t reserved_c[8]
Reserved.
Definition: intelxlvf.h:210
uint64_t unicasts
Unicast packets.
Definition: intelxlvf.h:286
uint16_t len
Data length.
Definition: intelxlvf.h:353