iPXE
gve.h
Go to the documentation of this file.
1 #ifndef _GVE_H
2 #define _GVE_H
3 
4 /** @file
5  *
6  * Google Virtual Ethernet network driver
7  *
8  * The Google Virtual Ethernet NIC (GVE or gVNIC) is found only in
9  * Google Cloud instances. There is essentially zero documentation
10  * available beyond the mostly uncommented source code in the Linux
11  * kernel.
12  */
13 
14 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
15 
16 #include <stdint.h>
17 #include <ipxe/dma.h>
18 #include <ipxe/pci.h>
19 #include <ipxe/in.h>
20 #include <ipxe/uaccess.h>
21 #include <ipxe/process.h>
22 #include <ipxe/retry.h>
23 
24 struct gve_nic;
25 
26 /**
27  * A Google Cloud MAC address
28  *
29  * Google Cloud locally assigned MAC addresses encode the local IPv4
30  * address in the trailing 32 bits, presumably as a performance
31  * optimisation to allow ARP resolution to be skipped by a suitably
32  * aware network stack.
33  */
34 struct google_mac {
35  /** Reserved */
37  /** Local IPv4 address */
38  struct in_addr in;
39 } __attribute__ (( packed ));
40 
41 /** Page size */
42 #define GVE_PAGE_SIZE 0x1000
43 
44 /**
45  * Address alignment
46  *
47  * All DMA data structure base addresses seem to need to be aligned to
48  * a page boundary. (This is not documented anywhere, but is inferred
49  * from existing source code and experimentation.)
50  */
51 #define GVE_ALIGN GVE_PAGE_SIZE
52 
53 /** Configuration BAR */
54 #define GVE_CFG_BAR PCI_BASE_ADDRESS_0
55 
56 /**
57  * Configuration BAR size
58  *
59  * All registers within the configuration BAR are big-endian.
60  */
61 #define GVE_CFG_SIZE 0x1000
62 
63 /** Device status */
64 #define GVE_CFG_DEVSTAT 0x0000
65 #define GVE_CFG_DEVSTAT_RESET 0x00000010UL /**< Device is reset */
66 
67 /** Driver status */
68 #define GVE_CFG_DRVSTAT 0x0004
69 #define GVE_CFG_DRVSTAT_RUN 0x00000001UL /**< Run admin queue */
70 
71 /** Maximum time to wait for reset */
72 #define GVE_RESET_MAX_WAIT_MS 500
73 
74 /** Admin queue page frame number (for older devices) */
75 #define GVE_CFG_ADMIN_PFN 0x0010
76 
77 /** Admin queue doorbell */
78 #define GVE_CFG_ADMIN_DB 0x0014
79 
80 /** Admin queue event counter */
81 #define GVE_CFG_ADMIN_EVT 0x0018
82 
83 /** Driver version (8-bit register) */
84 #define GVE_CFG_VERSION 0x001f
85 
86 /** Admin queue base address high 32 bits */
87 #define GVE_CFG_ADMIN_BASE_HI 0x0020
88 
89 /** Admin queue base address low 32 bits */
90 #define GVE_CFG_ADMIN_BASE_LO 0x0024
91 
92 /** Admin queue base address length (16-bit register) */
93 #define GVE_CFG_ADMIN_LEN 0x0028
94 
95 /** Doorbell BAR */
96 #define GVE_DB_BAR PCI_BASE_ADDRESS_2
97 
98 /**
99  * Admin queue entry header
100  *
101  * All values within admin queue entries are big-endian.
102  */
104  /** Reserved */
106  /** Operation code */
108  /** Status */
110 } __attribute__ (( packed ));
111 
112 /** Command succeeded */
113 #define GVE_ADMIN_STATUS_OK 0x00000001
114 
115 /** Simple admin command */
117  /** Header */
119  /** ID */
121 } __attribute__ (( packed ));
122 
123 /** Describe device command */
124 #define GVE_ADMIN_DESCRIBE 0x0001
125 
126 /** Describe device command */
128  /** Header */
130  /** Descriptor buffer address */
132  /** Descriptor version */
134  /** Descriptor maximum length */
136 } __attribute__ (( packed ));
137 
138 /** Device descriptor version */
139 #define GVE_ADMIN_DESCRIBE_VER 1
140 
141 /** Device descriptor */
143  /** Reserved */
145  /** Number of transmit queue entries */
147  /** Number of receive queue entries */
149  /** Reserved */
151  /** Maximum transmit unit */
153  /** Number of event counters */
155  /** Reserved */
157  /** MAC address */
158  struct google_mac mac;
159  /** Reserved */
161 } __attribute__ (( packed ));
162 
163 /** Configure device resources command */
164 #define GVE_ADMIN_CONFIGURE 0x0002
165 
166 /** Configure device resources command */
168  /** Header */
170  /** Event counter array */
172  /** IRQ doorbell address */
174  /** Number of event counters */
176  /** Number of IRQ doorbells */
178  /** IRQ doorbell stride */
180 } __attribute__ (( packed ));
181 
182 /** Register page list command */
183 #define GVE_ADMIN_REGISTER 0x0003
184 
185 /** Register page list command */
187  /** Header */
189  /** Page list ID */
191  /** Number of pages */
193  /** Address list address */
195  /** Page size */
197 } __attribute__ (( packed ));
198 
199 /**
200  * Maximum number of pages per queue
201  *
202  * This is a policy decision. Must be sufficient to allow for both
203  * the transmit and receive queue fill levels.
204  */
205 #define GVE_QPL_MAX 32
206 
207 /** Page list */
208 struct gve_pages {
209  /** Page address */
211 } __attribute__ (( packed ));
212 
213 /** Unregister page list command */
214 #define GVE_ADMIN_UNREGISTER 0x0004
215 
216 /** Create transmit queue command */
217 #define GVE_ADMIN_CREATE_TX 0x0005
218 
219 /** Create transmit queue command */
221  /** Header */
223  /** Queue ID */
225  /** Reserved */
227  /** Queue resources address */
229  /** Descriptor ring address */
231  /** Queue page list ID */
233  /** Notification channel ID */
235 } __attribute__ (( packed ));
236 
237 /** Create receive queue command */
238 #define GVE_ADMIN_CREATE_RX 0x0006
239 
240 /** Create receive queue command */
242  /** Header */
244  /** Queue ID */
246  /** Index */
248  /** Reserved */
250  /** Notification channel ID */
252  /** Queue resources address */
254  /** Completion ring address */
256  /** Descriptor ring address */
258  /** Queue page list ID */
260  /** Reserved */
262  /** Packet buffer size */
264 } __attribute__ (( packed ));
265 
266 /** Destroy transmit queue command */
267 #define GVE_ADMIN_DESTROY_TX 0x0007
268 
269 /** Destroy receive queue command */
270 #define GVE_ADMIN_DESTROY_RX 0x0008
271 
272 /** Deconfigure device resources command */
273 #define GVE_ADMIN_DECONFIGURE 0x0009
274 
275 /** An admin queue command */
277  /** Header */
279  /** Simple command */
281  /** Describe device */
283  /** Configure device resources */
285  /** Register page list */
287  /** Create transmit queue */
289  /** Create receive queue */
291  /** Padding */
293 };
294 
295 /**
296  * Number of admin queue commands
297  *
298  * This is theoretically a policy decision. However, older revisions
299  * of the hardware seem to have only the "admin queue page frame
300  * number" register and no "admin queue length" register, with the
301  * implication that the admin queue must be exactly one page in
302  * length.
303  *
304  * Choose to use a one page (4kB) admin queue for both older and newer
305  * versions of the hardware, to minimise variability.
306  */
307 #define GVE_ADMIN_COUNT ( GVE_PAGE_SIZE / sizeof ( union gve_admin_command ) )
308 
309 /** Admin queue */
310 struct gve_admin {
311  /** Commands */
313  /** Producer counter */
315  /** DMA mapping */
316  struct dma_mapping map;
317 };
318 
319 /** Scratch buffer for admin queue commands */
320 struct gve_scratch {
321  /** Buffer contents */
322  union {
323  /** Device descriptor */
325  /** Page address list */
326  struct gve_pages pages;
327  } *buf;
328  /** DMA mapping */
329  struct dma_mapping map;
330 };
331 
332 /**
333  * An event counter
334  *
335  * Written by the device to indicate completions. The device chooses
336  * which counter to use for each transmit queue, and stores the index
337  * of the chosen counter in the queue resources.
338  */
339 struct gve_event {
340  /** Number of events that have occurred */
341  volatile uint32_t count;
342 } __attribute__ (( packed ));
343 
344 /** Event counter array */
345 struct gve_events {
346  /** Event counters */
347  struct gve_event *event;
348  /** DMA mapping */
349  struct dma_mapping map;
350  /** Actual number of event counters */
351  unsigned int count;
352 };
353 
354 /** An interrupt channel */
355 struct gve_irq {
356  /** Interrupt doorbell index (within doorbell BAR) */
358  /** Reserved */
360 } __attribute__ (( packed ));
361 
362 /**
363  * Number of interrupt channels
364  *
365  * We tell the device how many interrupt channels we have provided via
366  * the "configure device resources" admin queue command. The device
367  * will accept being given zero interrupt channels, but will
368  * subsequently fail to create more than a single queue (either
369  * transmit or receive).
370  *
371  * There is, of course, no documentation indicating how may interrupt
372  * channels actually need to be provided. In the absence of evidence
373  * to the contrary, assume that two channels (one for transmit, one
374  * for receive) will be sufficient.
375  */
376 #define GVE_IRQ_COUNT 2
377 
378 /** Interrupt channel array */
379 struct gve_irqs {
380  /** Interrupt channels */
381  struct gve_irq *irq;
382  /** DMA mapping */
383  struct dma_mapping map;
384  /** Interrupt doorbells */
386 };
387 
388 /** Disable interrupts */
389 #define GVE_IRQ_DISABLE 0x40000000UL
390 
391 /**
392  * Queue resources
393  *
394  * Written by the device to indicate the indices of the chosen event
395  * counter and descriptor doorbell register.
396  *
397  * This appears to be a largely pointless data structure: the relevant
398  * information is static for the lifetime of the queue and could
399  * trivially have been returned in the response for the "create
400  * transmit/receive queue" command, instead of requiring yet another
401  * page-aligned coherent DMA buffer allocation.
402  */
404  /** Descriptor doorbell index (within doorbell BAR) */
406  /** Event counter index (within event counter array) */
408  /** Reserved */
410 } __attribute__ (( packed ));
411 
412 /**
413  * Queue data buffer size
414  *
415  * In theory, we may specify the size of receive buffers. However,
416  * the original version of the device seems not to have a parameter
417  * for this, and assumes the use of half-page (2kB) buffers. Choose
418  * to use this as the buffer size, on the assumption that older
419  * devices will not support any other buffer size.
420  */
421 #define GVE_BUF_SIZE ( GVE_PAGE_SIZE / 2 )
422 
423 /** Number of data buffers per page */
424 #define GVE_BUF_PER_PAGE ( GVE_PAGE_SIZE / GVE_BUF_SIZE )
425 
426 /**
427  * Queue page list
428  *
429  * The device uses preregistered pages for fast-path DMA operations
430  * (i.e. transmit and receive buffers). A list of device addresses
431  * for each page must be registered before the transmit or receive
432  * queue is created, and cannot subsequently be modified.
433  *
434  * The Linux driver allocates pages as DMA_TO_DEVICE or
435  * DMA_FROM_DEVICE as appropriate, and uses dma_sync_single_for_cpu()
436  * etc to ensure that data is copied to/from bounce buffers as needed.
437  *
438  * Unfortunately there is no such sync operation available within our
439  * DMA API, since we are constrained by the limitations imposed by
440  * EFI_PCI_IO_PROTOCOL. There is no way to synchronise a buffer
441  * without also [un]mapping it, and no way to force the reuse of the
442  * same device address for a subsequent remapping. We are therefore
443  * constrained to use only DMA-coherent buffers, since this is the
444  * only way we can repeatedly reuse the same device address.
445  *
446  * Newer versions of the gVNIC device support "raw DMA addressing
447  * (RDA)", which is essentially a prebuilt queue page list covering
448  * the whole of the guest address space. Unfortunately we cannot rely
449  * on this, since older versions will not support it.
450  *
451  * Experimentation suggests that the device will accept a request to
452  * create a queue page list covering the whole of the guest address
453  * space via two giant "pages" of 2^63 bytes each. However,
454  * experimentation also suggests that the device will accept any old
455  * garbage value as the "page size". In the total absence of any
456  * documentation, it is probably unsafe to conclude that the device is
457  * bothering to look at or respect the "page size" parameter: it is
458  * most likely just presuming the use of 4kB pages.
459  */
460 struct gve_qpl {
461  /** Page addresses */
463  /** Page mapping */
464  struct dma_mapping map;
465  /** Number of pages */
466  unsigned int count;
467  /** Queue page list ID */
468  unsigned int id;
469 };
470 
471 /**
472  * Maximum number of transmit buffers
473  *
474  * This is a policy decision.
475  */
476 #define GVE_TX_FILL 8
477 
478 /** Transmit queue page list ID */
479 #define GVE_TX_QPL 0x18ae5458
480 
481 /** Tranmsit queue interrupt channel */
482 #define GVE_TX_IRQ 0
483 
484 /** A transmit or receive buffer descriptor */
485 struct gve_buffer {
486  /** Address (within queue page list address space) */
488 } __attribute__ (( packed ));
489 
490 /** A transmit packet descriptor */
492  /** Type */
494  /** Reserved */
496  /** Number of descriptors in this packet */
498  /** Total length of this packet */
500  /** Length of this descriptor */
502 } __attribute__ (( packed ));
503 
504 /** A transmit descriptor */
506  /** Packet descriptor */
508  /** Buffer descriptor */
509  struct gve_buffer buf;
510 } __attribute__ (( packed ));
511 
512 /** Start of packet transmit descriptor type */
513 #define GVE_TX_TYPE_START 0x00
514 
515 /** Continuation of packet transmit descriptor type */
516 #define GVE_TX_TYPE_CONT 0x20
517 
518 /**
519  * Maximum number of receive buffers
520  *
521  * This is a policy decision. Experiments suggest that using fewer
522  * than 64 receive buffers leads to excessive packet drop rates on
523  * some instance types.
524  */
525 #define GVE_RX_FILL 64
526 
527 /** Receive queue page list ID */
528 #define GVE_RX_QPL 0x18ae5258
529 
530 /** Receive queue interrupt channel */
531 #define GVE_RX_IRQ 1
532 
533 /** A receive descriptor */
535  /** Buffer descriptor */
536  struct gve_buffer buf;
537 } __attribute__ (( packed ));
538 
539 /** A receive packet descriptor */
541  /** Length */
543  /** Flags */
545  /** Sequence number */
547 } __attribute__ (( packed ));
548 
549 /** Receive error */
550 #define GVE_RXF_ERROR 0x08
551 
552 /** Receive packet continues into next descriptor */
553 #define GVE_RXF_MORE 0x20
554 
555 /** Receive sequence number mask */
556 #define GVE_RX_SEQ_MASK 0x07
557 
558 /** A receive completion descriptor */
560  /** Reserved */
562  /** Packet descriptor */
564 } __attribute__ (( packed ));
565 
566 /** Padding at the start of all received packets */
567 #define GVE_RX_PAD 2
568 
569 /** A descriptor queue */
570 struct gve_queue {
571  /** Descriptor ring */
573  /** Completion ring */
575  /** Queue resources */
577 
578  /** Queue type */
579  const struct gve_queue_type *type;
580  /** Number of descriptors (must be a power of two) */
581  unsigned int count;
582  /** Maximum fill level (must be a power of two) */
583  unsigned int fill;
584 
585  /** Descriptor mapping */
587  /** Completion mapping */
589  /** Queue resources mapping */
591 
592  /** Doorbell register */
593  volatile uint32_t *db;
594  /** Event counter */
595  struct gve_event *event;
596 
597  /** Producer counter */
599  /** Consumer counter */
601 
602  /** Queue page list */
603  struct gve_qpl qpl;
604 };
605 
606 /** A descriptor queue type */
608  /** Name */
609  const char *name;
610  /**
611  * Populate command parameters to create queue
612  *
613  * @v queue Descriptor queue
614  * @v cmd Admin queue command
615  */
616  void ( * param ) ( struct gve_queue *queue,
617  union gve_admin_command *cmd );
618  /** Queue page list ID */
620  /** Interrupt channel */
622  /** Maximum fill level */
624  /** Descriptor size */
626  /** Completion size */
628  /** Command to create queue */
630  /** Command to destroy queue */
632 };
633 
634 /** A Google Virtual Ethernet NIC */
635 struct gve_nic {
636  /** Configuration registers */
637  void *cfg;
638  /** Doorbell registers */
639  void *db;
640  /** PCI revision */
642  /** Network device */
644  /** DMA device */
645  struct dma_device *dma;
646 
647  /** Admin queue */
648  struct gve_admin admin;
649  /** Interrupt channels */
650  struct gve_irqs irqs;
651  /** Event counters */
653  /** Scratch buffer */
655 
656  /** Transmit queue */
657  struct gve_queue tx;
658  /** Receive queue */
659  struct gve_queue rx;
660  /** Transmit I/O buffers */
662  /** Receive sequence number */
663  unsigned int seq;
664 
665  /** Startup process */
666  struct process startup;
667  /** Startup process retry counter */
668  unsigned int retries;
669  /** Reset recovery watchdog timer */
671  /** Reset recovery recorded activity counter */
673 };
674 
675 /** Maximum time to wait for admin queue commands */
676 #define GVE_ADMIN_MAX_WAIT_MS 500
677 
678 /** Maximum number of times to reattempt device reset */
679 #define GVE_RESET_MAX_RETRY 5
680 
681 /** Time between reset recovery checks */
682 #define GVE_WATCHDOG_TIMEOUT ( 1 * TICKS_PER_SEC )
683 
684 #endif /* _GVE_H */
uint8_t reserved_a[10]
Reserved.
Definition: gve.h:144
A process.
Definition: process.h:17
#define __attribute__(x)
Definition: compiler.h:10
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:509
Register page list command.
Definition: gve.h:186
struct dma_device * dma
DMA device.
Definition: gve.h:645
struct dma_mapping res_map
Queue resources mapping.
Definition: gve.h:590
unsigned short uint16_t
Definition: stdint.h:11
struct gve_rx_packet pkt
Packet descriptor.
Definition: gve.h:563
struct in_addr in
Local IPv4 address.
Definition: gve.h:38
DMA mappings.
uint32_t id
Page list ID.
Definition: gve.h:190
uint32_t id
ID.
Definition: gve.h:120
uint16_t rx_count
Number of receive queue entries.
Definition: gve.h:148
uint32_t num_events
Number of event counters.
Definition: gve.h:175
uint8_t reserved_a[4]
Reserved.
Definition: gve.h:249
A receive descriptor.
Definition: gve.h:534
uint8_t reserved[60]
Reserved.
Definition: gve.h:359
uint32_t count
Number of pages.
Definition: gve.h:192
uint8_t type
Type.
Definition: gve.h:493
uint64_t irqs
IRQ doorbell address.
Definition: gve.h:173
Create receive queue command.
Definition: gve.h:241
uint32_t evt_idx
Event counter index (within event counter array)
Definition: gve.h:407
uint16_t bufsz
Packet buffer size.
Definition: gve.h:263
userptr_t desc
Descriptor ring.
Definition: gve.h:572
uint32_t id
Queue ID.
Definition: gve.h:224
struct dma_mapping map
DMA mapping.
Definition: gve.h:349
unsigned int fill
Maximum fill level (must be a power of two)
Definition: gve.h:583
struct gve_event * event
Event counters.
Definition: gve.h:347
union gve_scratch::@46 * buf
Buffer contents.
Describe device command.
Definition: gve.h:127
uint32_t qpl_id
Queue page list ID.
Definition: gve.h:259
uint8_t reserved_a[2]
Reserved.
Definition: gve.h:495
struct gve_device_descriptor desc
Device descriptor.
Definition: gve.h:324
uint64_t res
Queue resources address.
Definition: gve.h:253
struct gve_resources * res
Queue resources.
Definition: gve.h:576
volatile uint32_t * db
Doorbell register.
Definition: gve.h:593
Retry timers.
An event counter.
Definition: gve.h:339
Create transmit queue command.
Definition: gve.h:220
uint32_t db_idx
Descriptor doorbell index (within doorbell BAR)
Definition: gve.h:405
A transmit packet descriptor.
Definition: gve.h:491
Simple admin command.
Definition: gve.h:116
struct gve_tx_packet pkt
Packet descriptor.
Definition: gve.h:507
A retry timer.
Definition: retry.h:21
uint64_t addr[GVE_QPL_MAX]
Page address.
Definition: gve.h:210
unsigned long long uint64_t
Definition: stdint.h:13
A receive completion descriptor.
Definition: gve.h:559
uint32_t qpl
Queue page list ID.
Definition: gve.h:619
struct gve_qpl qpl
Queue page list.
Definition: gve.h:603
A transmit or receive buffer descriptor.
Definition: gve.h:485
struct gve_admin_create_rx create_rx
Create receive queue.
Definition: gve.h:290
const char * name
Name.
Definition: gve.h:609
Device descriptor.
Definition: gve.h:142
uint8_t reserved[3]
Reserved.
Definition: gve.h:105
Access to external ("user") memory.
uint16_t len
Length.
Definition: gve.h:542
struct gve_admin_register reg
Register page list.
Definition: gve.h:286
struct gve_queue rx
Receive queue.
Definition: gve.h:659
struct gve_admin_header hdr
Header.
Definition: gve.h:129
struct gve_queue tx
Transmit queue.
Definition: gve.h:657
#define GVE_TX_FILL
Maximum number of transmit buffers.
Definition: gve.h:476
uint8_t reserved[2]
Reserved.
Definition: gve.h:36
uint8_t reserved_b[2]
Reserved.
Definition: gve.h:261
uint8_t reserved_a[4]
Reserved.
Definition: gve.h:226
struct gve_admin_create_tx create_tx
Create transmit queue.
Definition: gve.h:288
uint64_t size
Page size.
Definition: gve.h:196
struct dma_mapping map
Page mapping.
Definition: gve.h:464
uint32_t activity
Reset recovery recorded activity counter.
Definition: gve.h:672
void * db
Doorbell registers.
Definition: gve.h:639
struct retry_timer watchdog
Reset recovery watchdog timer.
Definition: gve.h:670
uint32_t userptr_t
A pointer to a user buffer.
Definition: libkir.h:159
An admin queue command.
Definition: gve.h:276
Queue resources.
Definition: gve.h:403
struct dma_mapping map
DMA mapping.
Definition: gve.h:329
struct process startup
Startup process.
Definition: gve.h:666
uint8_t seq
Sequence number.
Definition: gve.h:546
uint8_t opcode
Operation code.
Definition: gve.h:107
uint8_t fill
Maximum fill level.
Definition: gve.h:623
uint32_t cons
Consumer counter.
Definition: gve.h:600
A receive packet descriptor.
Definition: gve.h:540
volatile uint32_t * db[GVE_IRQ_COUNT]
Interrupt doorbells.
Definition: gve.h:385
uint32_t prod
Producer counter.
Definition: gve.h:314
Admin queue entry header.
Definition: gve.h:103
unsigned int count
Number of pages.
Definition: gve.h:466
uint8_t reserved[56]
Reserved.
Definition: gve.h:409
Queue page list.
Definition: gve.h:460
struct gve_irqs irqs
Interrupt channels.
Definition: gve.h:650
uint32_t id
Queue ID.
Definition: gve.h:245
uint32_t irq_stride
IRQ doorbell stride.
Definition: gve.h:179
struct gve_admin_header hdr
Header.
Definition: gve.h:118
A descriptor queue.
Definition: gve.h:570
uint8_t flags
Flags.
Definition: gve.h:544
volatile uint32_t count
Number of events that have occurred.
Definition: gve.h:341
void * cfg
Configuration registers.
Definition: gve.h:637
uint16_t total
Total length of this packet.
Definition: gve.h:499
struct google_mac mac
MAC address.
Definition: gve.h:158
IP address structure.
Definition: in.h:41
struct gve_admin_describe desc
Describe device.
Definition: gve.h:282
Configure device resources command.
Definition: gve.h:167
uint64_t events
Event counter array.
Definition: gve.h:171
PCI bus.
struct gve_admin_header hdr
Header.
Definition: gve.h:222
uint32_t ver
Descriptor version.
Definition: gve.h:133
uint16_t tx_count
Number of transmit queue entries.
Definition: gve.h:146
Event counter array.
Definition: gve.h:345
A network device.
Definition: netdevice.h:352
Processes.
unsigned char uint8_t
Definition: stdint.h:10
userptr_t cmplt
Completion ring.
Definition: gve.h:574
A Google Virtual Ethernet NIC.
Definition: gve.h:635
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers.
Definition: gve.h:661
struct gve_pages pages
Page address list.
Definition: gve.h:326
unsigned int uint32_t
Definition: stdint.h:12
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int seq
Receive sequence number.
Definition: gve.h:663
uint8_t desc_len
Descriptor size.
Definition: gve.h:625
uint8_t destroy
Command to destroy queue.
Definition: gve.h:631
#define GVE_QPL_MAX
Maximum number of pages per queue.
Definition: gve.h:205
uint8_t reserved_b[2]
Reserved.
Definition: gve.h:150
uint32_t num_irqs
Number of IRQ doorbells.
Definition: gve.h:177
uint32_t qpl_id
Queue page list ID.
Definition: gve.h:232
unsigned int id
Queue page list ID.
Definition: gve.h:468
uint64_t addr
Descriptor buffer address.
Definition: gve.h:131
uint64_t desc
Descriptor ring address.
Definition: gve.h:257
struct gve_admin_header hdr
Header.
Definition: gve.h:169
uint32_t status
Status.
Definition: gve.h:109
An interrupt channel.
Definition: gve.h:355
struct gve_admin_configure conf
Configure device resources.
Definition: gve.h:284
unsigned int count
Number of descriptors (must be a power of two)
Definition: gve.h:581
uint32_t notify_id
Notification channel ID.
Definition: gve.h:234
struct gve_events events
Event counters.
Definition: gve.h:652
#define GVE_IRQ_COUNT
Number of interrupt channels.
Definition: gve.h:376
userptr_t data
Page addresses.
Definition: gve.h:462
struct dma_mapping cmplt_map
Completion mapping.
Definition: gve.h:588
uint64_t addr
Address (within queue page list address space)
Definition: gve.h:487
Interrupt channel array.
Definition: gve.h:379
struct gve_event * event
Event counter.
Definition: gve.h:595
unsigned int retries
Startup process retry counter.
Definition: gve.h:668
unsigned int count
Actual number of event counters.
Definition: gve.h:351
struct gve_admin_header hdr
Header.
Definition: gve.h:278
uint64_t desc
Descriptor ring address.
Definition: gve.h:230
uint8_t revision
PCI revision.
Definition: gve.h:641
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:536
uint8_t reserved[60]
Reserved.
Definition: gve.h:561
A Google Cloud MAC address.
Definition: gve.h:34
uint32_t len
Descriptor maximum length.
Definition: gve.h:135
uint64_t res
Queue resources address.
Definition: gve.h:228
uint8_t count
Number of descriptors in this packet.
Definition: gve.h:497
uint16_t len
Length of this descriptor.
Definition: gve.h:501
Page list.
Definition: gve.h:208
uint32_t db_idx
Interrupt doorbell index (within doorbell BAR)
Definition: gve.h:357
Scratch buffer for admin queue commands.
Definition: gve.h:320
uint32_t notify_id
Notification channel ID.
Definition: gve.h:251
struct net_device * netdev
Network device.
Definition: gve.h:643
struct gve_admin_header hdr
Header.
Definition: gve.h:188
uint32_t index
Index.
Definition: gve.h:247
struct dma_mapping map
DMA mapping.
Definition: gve.h:383
struct gve_irq * irq
Interrupt channels.
Definition: gve.h:381
Admin queue.
Definition: gve.h:310
union gve_admin_command * cmd
Commands.
Definition: gve.h:312
struct dma_mapping desc_map
Descriptor mapping.
Definition: gve.h:586
A descriptor queue type.
Definition: gve.h:607
uint8_t cmplt_len
Completion size.
Definition: gve.h:627
struct dma_mapping map
DMA mapping.
Definition: gve.h:316
uint16_t counters
Number of event counters.
Definition: gve.h:154
struct gve_admin_header hdr
Header.
Definition: gve.h:243
const struct gve_queue_type * type
Queue type.
Definition: gve.h:579
struct gve_admin admin
Admin queue.
Definition: gve.h:648
uint16_t queue
Queue ID.
Definition: ena.h:22
uint32_t prod
Producer counter.
Definition: gve.h:598
A DMA mapping.
Definition: dma.h:32
struct golan_eqe_cmd cmd
Definition: CIB_PRM.h:29
void(* param)(struct gve_queue *queue, union gve_admin_command *cmd)
Populate command parameters to create queue.
Definition: gve.h:616
uint8_t create
Command to create queue.
Definition: gve.h:629
uint8_t reserved_d[10]
Reserved.
Definition: gve.h:160
A transmit descriptor.
Definition: gve.h:505
uint8_t irq
Interrupt channel.
Definition: gve.h:621
struct gve_scratch scratch
Scratch buffer.
Definition: gve.h:654
uint8_t reserved_c[4]
Reserved.
Definition: gve.h:156
uint64_t addr
Address list address.
Definition: gve.h:194
uint8_t pad[64]
Padding.
Definition: gve.h:292
A DMA-capable device.
Definition: dma.h:47
uint64_t cmplt
Completion ring address.
Definition: gve.h:255
struct gve_admin_simple simple
Simple command.
Definition: gve.h:280
A persistent I/O buffer.
Definition: iobuf.h:33
uint16_t mtu
Maximum transmit unit.
Definition: gve.h:152