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