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/pcimsix.h>
20 #include <ipxe/in.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  /** Number of device options */
161  /** Total length (including this header) */
163  /** Reserved */
165  /** Space for options
166  *
167  * There is no specified upper limit, and no negotiation
168  * mechanism for the amount of space required. We allow space
169  * for seems like a reasonable number of options.
170  */
171  uint8_t opts[216];
172 } __attribute__ (( packed ));
173 
174 /** Device option header */
175 struct gve_option {
176  /** Option ID */
178  /** Length (excluding this header) */
180  /** Required feature mask
181  *
182  * The purpose of this field is remarkably unclear. The Linux
183  * kernel driver does define enum gve_dev_opt_req_feat_mask,
184  * but every member of this enum has a zero value.
185  */
187 } __attribute__ (( packed ));
188 
189 /** In-order descriptor queues with raw DMA addressing */
190 #define GVE_OPT_GQI_RDA 0x02
191 
192 /** In-order descriptor queues with queue page list addressing */
193 #define GVE_OPT_GQI_QPL 0x03
194 
195 /** Out-of-order descriptor queues with raw DMA addressing */
196 #define GVE_OPT_DQO_RDA 0x04
197 
198 /** Out-of-order descriptor queues with queue page list addressing */
199 #define GVE_OPT_DQO_QPL 0x07
200 
201 /** Configure device resources command */
202 #define GVE_ADMIN_CONFIGURE 0x0002
203 
204 /** Configure device resources command */
206  /** Header */
208  /** Event counter array */
210  /** IRQ doorbell address */
212  /** Number of event counters */
214  /** Number of IRQ doorbells */
216  /** IRQ doorbell stride */
218  /** MSI-X base index */
220  /** Descriptor queue format */
222  /** Reserved */
224 } __attribute__ (( packed ));
225 
226 /** Descriptor queue format */
227 #define GVE_FORMAT( mode ) ( (mode) + 1 )
228 
229 /** Register page list command */
230 #define GVE_ADMIN_REGISTER 0x0003
231 
232 /** Register page list command */
234  /** Header */
236  /** Page list ID */
238  /** Number of pages */
240  /** Address list address */
242  /** Page size */
244 } __attribute__ (( packed ));
245 
246 /**
247  * Maximum number of pages per queue
248  *
249  * This is a policy decision. Must be sufficient to allow for both
250  * the transmit and receive queue fill levels.
251  */
252 #define GVE_QPL_MAX 32
253 
254 /** Page list */
255 struct gve_pages {
256  /** Page address */
258 } __attribute__ (( packed ));
259 
260 /** Unregister page list command */
261 #define GVE_ADMIN_UNREGISTER 0x0004
262 
263 /** Create transmit queue command */
264 #define GVE_ADMIN_CREATE_TX 0x0005
265 
266 /** Create transmit queue command */
268  /** Header */
270  /** Queue ID */
272  /** Reserved */
274  /** Queue resources address */
276  /** Descriptor ring address */
278  /** Queue page list ID */
280  /** Notification channel ID */
282  /** Completion ring address */
284  /** Number of descriptor ring entries */
286  /** Number of completion ring entries */
288  /** Reserved */
290 } __attribute__ (( packed ));
291 
292 /** Create receive queue command */
293 #define GVE_ADMIN_CREATE_RX 0x0006
294 
295 /** Create receive queue command */
297  /** Header */
299  /** Queue ID */
301  /** Index */
303  /** Reserved */
305  /** Notification channel ID */
307  /** Queue resources address */
309  /** Completion ring address */
311  /** Descriptor ring address */
313  /** Queue page list ID */
315  /** Number of descriptor ring entries */
317  /** Packet buffer size */
319  /** Number of completion ring entries */
321  /** Reserved */
323 } __attribute__ (( packed ));
324 
325 /** Destroy transmit queue command */
326 #define GVE_ADMIN_DESTROY_TX 0x0007
327 
328 /** Destroy receive queue command */
329 #define GVE_ADMIN_DESTROY_RX 0x0008
330 
331 /** Deconfigure device resources command */
332 #define GVE_ADMIN_DECONFIGURE 0x0009
333 
334 /** An admin queue command */
336  /** Header */
338  /** Simple command */
340  /** Describe device */
342  /** Configure device resources */
344  /** Register page list */
346  /** Create transmit queue */
348  /** Create receive queue */
350  /** Padding */
352 };
353 
354 /**
355  * Number of admin queue commands
356  *
357  * This is theoretically a policy decision. However, older revisions
358  * of the hardware seem to have only the "admin queue page frame
359  * number" register and no "admin queue length" register, with the
360  * implication that the admin queue must be exactly one page in
361  * length.
362  *
363  * Choose to use a one page (4kB) admin queue for both older and newer
364  * versions of the hardware, to minimise variability.
365  */
366 #define GVE_ADMIN_COUNT ( GVE_PAGE_SIZE / sizeof ( union gve_admin_command ) )
367 
368 /** Admin queue */
369 struct gve_admin {
370  /** Commands */
372  /** Producer counter */
374  /** DMA mapping */
375  struct dma_mapping map;
376 };
377 
378 /** Scratch buffer for admin queue commands */
379 struct gve_scratch {
380  /** Buffer contents */
381  union {
382  /** Device descriptor */
384  /** Page address list */
385  struct gve_pages pages;
386  } *buf;
387  /** DMA mapping */
388  struct dma_mapping map;
389 };
390 
391 /**
392  * An event counter
393  *
394  * Written by the device to indicate completions. The device chooses
395  * which counter to use for each transmit queue, and stores the index
396  * of the chosen counter in the queue resources.
397  */
398 struct gve_event {
399  /** Number of events that have occurred */
400  volatile uint32_t count;
401 } __attribute__ (( packed ));
402 
403 /** Event counter array */
404 struct gve_events {
405  /** Event counters */
406  struct gve_event *event;
407  /** DMA mapping */
408  struct dma_mapping map;
409  /** Actual number of event counters */
410  unsigned int count;
411 };
412 
413 /** An interrupt channel */
414 struct gve_irq {
415  /** Interrupt doorbell index (within doorbell BAR) */
417  /** Reserved */
419 } __attribute__ (( packed ));
420 
421 /**
422  * Number of interrupt channels
423  *
424  * We tell the device how many interrupt channels we have provided via
425  * the "configure device resources" admin queue command. The device
426  * will accept being given zero interrupt channels, but will
427  * subsequently fail to create more than a single queue (either
428  * transmit or receive).
429  *
430  * There is, of course, no documentation indicating how may interrupt
431  * channels actually need to be provided. In the absence of evidence
432  * to the contrary, assume that two channels (one for transmit, one
433  * for receive) will be sufficient.
434  */
435 #define GVE_IRQ_COUNT 2
436 
437 /** Interrupt channel array */
438 struct gve_irqs {
439  /** Interrupt channels */
440  struct gve_irq *irq;
441  /** DMA mapping */
442  struct dma_mapping map;
443  /** Interrupt doorbells */
445 };
446 
447 /** Disable in-order queue interrupt */
448 #define GVE_GQI_IRQ_DISABLE 0x40000000UL
449 
450 /** Rearm out-of-order queue interrupt */
451 #define GVE_DQO_IRQ_REARM 0x00000019UL
452 
453 /**
454  * Queue resources
455  *
456  * Written by the device to indicate the indices of the chosen event
457  * counter and descriptor doorbell register.
458  *
459  * This appears to be a largely pointless data structure: the relevant
460  * information is static for the lifetime of the queue and could
461  * trivially have been returned in the response for the "create
462  * transmit/receive queue" command, instead of requiring yet another
463  * page-aligned coherent DMA buffer allocation.
464  */
466  /** Descriptor doorbell index (within doorbell BAR) */
468  /** Event counter index (within event counter array) */
470  /** Reserved */
472 } __attribute__ (( packed ));
473 
474 /**
475  * Queue data buffer size
476  *
477  * In theory, we may specify the size of receive buffers. However,
478  * the original version of the device seems not to have a parameter
479  * for this, and assumes the use of half-page (2kB) buffers. Choose
480  * to use this as the buffer size, on the assumption that older
481  * devices will not support any other buffer size.
482  */
483 #define GVE_BUF_SIZE ( GVE_PAGE_SIZE / 2 )
484 
485 /** Number of data buffers per page */
486 #define GVE_BUF_PER_PAGE ( GVE_PAGE_SIZE / GVE_BUF_SIZE )
487 
488 /**
489  * Queue page list
490  *
491  * The device uses preregistered pages for fast-path DMA operations
492  * (i.e. transmit and receive buffers). A list of device addresses
493  * for each page must be registered before the transmit or receive
494  * queue is created, and cannot subsequently be modified.
495  *
496  * The Linux driver allocates pages as DMA_TO_DEVICE or
497  * DMA_FROM_DEVICE as appropriate, and uses dma_sync_single_for_cpu()
498  * etc to ensure that data is copied to/from bounce buffers as needed.
499  *
500  * Unfortunately there is no such sync operation available within our
501  * DMA API, since we are constrained by the limitations imposed by
502  * EFI_PCI_IO_PROTOCOL. There is no way to synchronise a buffer
503  * without also [un]mapping it, and no way to force the reuse of the
504  * same device address for a subsequent remapping. We are therefore
505  * constrained to use only DMA-coherent buffers, since this is the
506  * only way we can repeatedly reuse the same device address.
507  *
508  * Newer versions of the gVNIC device support "raw DMA addressing
509  * (RDA)", which is essentially a prebuilt queue page list covering
510  * the whole of the guest address space. Unfortunately we cannot rely
511  * on this, since older versions will not support it.
512  *
513  * Experimentation suggests that the device will accept a request to
514  * create a queue page list covering the whole of the guest address
515  * space via two giant "pages" of 2^63 bytes each. However,
516  * experimentation also suggests that the device will accept any old
517  * garbage value as the "page size". In the total absence of any
518  * documentation, it is probably unsafe to conclude that the device is
519  * bothering to look at or respect the "page size" parameter: it is
520  * most likely just presuming the use of 4kB pages.
521  */
522 struct gve_qpl {
523  /** Page addresses */
524  void *data;
525  /** Page mapping */
526  struct dma_mapping map;
527  /** Number of pages */
528  unsigned int count;
529  /** Queue page list ID */
530  unsigned int id;
531  /** Queue page list base device address
532  *
533  * This will be zero in the GQI-QPL operating mode, or the DMA
534  * address of the first page in any other operating mode.
535  * (Despite its name, DQO-QPL still requires the use of raw
536  * DMA addresses in transmit and receive descriptors.)
537  */
539 };
540 
541 /** Raw DMA addressing queue page list ID */
542 #define GVE_RAW_QPL 0xffffffff
543 
544 /**
545  * Maximum number of transmit buffers
546  *
547  * This is a policy decision.
548  */
549 #define GVE_TX_FILL 8
550 
551 /** Transmit queue page list ID */
552 #define GVE_TX_QPL 0x18ae5458
553 
554 /** Tranmsit queue interrupt channel */
555 #define GVE_TX_IRQ 0
556 
557 /** A transmit or receive buffer descriptor */
558 struct gve_buffer {
559  /** Address (within queue page list address space) */
561 } __attribute__ (( packed ));
562 
563 /** An in-order transmit descriptor */
565  /** Type */
567  /** Reserved */
569  /** Number of descriptors in this packet */
571  /** Total length of this packet */
573  /** Length of this descriptor */
575  /** Buffer descriptor */
576  struct gve_buffer buf;
577 } __attribute__ (( packed ));
578 
579 /** Start of packet transmit descriptor type */
580 #define GVE_GQI_TX_TYPE_START 0x00
581 
582 /** Continuation of packet transmit descriptor type */
583 #define GVE_GQI_TX_TYPE_CONT 0x20
584 
585 /** An out-of-order transmit tag
586  *
587  * From the hardware perspective, this is an opaque 15-bit (sic) value
588  * that is simply copied from the descriptor to the corresponding
589  * completion.
590  */
592  /** Buffer index within queue page list */
594  /** Number of descriptors covered by this completion
595  *
596  * Note that this is a 7-bit quantity: the high bit may be
597  * (ab)used by the hardware to indicate that a completion is a
598  * terminologically undefined "miss" completion.
599  */
601 } __attribute__ (( packed ));
602 
603 /** An out-of-order transmit descriptor */
605  /** Buffer descriptor */
606  struct gve_buffer buf;
607  /** Descriptor type and flags */
609  /** Reserved */
611  /** Tag */
613  /** Length of this descriptor */
615 } __attribute__ (( packed ));
616 
617 /** Normal packet transmit descriptor type */
618 #define GVE_DQO_TX_TYPE_PACKET 0x0c
619 
620 /** Last transmit descriptor in a packet */
621 #define GVE_DQO_TX_TYPE_LAST 0x20
622 
623 /** An out-of-order transmit completion */
625  /** Reserved */
627  /** Completion flags */
629  /** Tag */
631  /** Reserved */
633 } __attribute__ (( packed ));
634 
635 /** Transmit completion packet flag */
636 #define GVE_DQO_TXF_PKT 0x10
637 
638 /** Transmit completion generation flag */
639 #define GVE_DQO_TXF_GEN 0x80
640 
641 /**
642  * Maximum number of receive buffers
643  *
644  * This is a policy decision. Experiments suggest that using fewer
645  * than 64 receive buffers leads to excessive packet drop rates on
646  * some instance types.
647  */
648 #define GVE_RX_FILL 64
649 
650 /** Receive queue page list ID */
651 #define GVE_RX_QPL 0x18ae5258
652 
653 /** Receive queue interrupt channel */
654 #define GVE_RX_IRQ 1
655 
656 /** An in-order receive descriptor */
658  /** Buffer descriptor */
659  struct gve_buffer buf;
660 } __attribute__ (( packed ));
661 
662 /** Receive error */
663 #define GVE_GQI_RXF_ERROR 0x08
664 
665 /** Receive packet continues into next descriptor */
666 #define GVE_GQI_RXF_MORE 0x20
667 
668 /** Receive sequence number mask */
669 #define GVE_GQI_RX_SEQ_MASK 0x07
670 
671 /** An in-order receive completion descriptor */
673  /** Reserved */
675  /** Length */
677  /** Flags */
679  /** Sequence number */
681 } __attribute__ (( packed ));
682 
683 /** Padding at the start of all received packets */
684 #define GVE_GQI_RX_PAD 2
685 
686 /** An out-of-order receive descriptor */
688  /** Tag */
690  /** Reserved */
692  /** Buffer descriptor */
693  struct gve_buffer buf;
694  /** Reserved */
696 } __attribute__ (( packed ));
697 
698 /** An out-of-order receive completion */
700  /** Reserved */
702  /** Status */
704  /** Reserved */
706  /** Length and generation bit */
708  /** Reserved */
710  /** Flags */
712  /** Reserved */
714  /** Tag */
716  /** Reserved */
718 } __attribute__ (( packed ));
719 
720 /** Receive error */
721 #define GVE_DQO_RXS_ERROR 0x04
722 
723 /** Receive completion generation flag */
724 #define GVE_DQO_RXL_GEN 0x4000
725 
726 /** Last receive descriptor in a packet */
727 #define GVE_DQO_RXF_LAST 0x02
728 
729 /** Queue strides */
731  /** Descriptor ring stride */
733  /** Completion ring stride */
735 };
736 
737 /** A descriptor queue */
738 struct gve_queue {
739  /** Descriptor ring */
740  union {
741  /** Transmit descriptors */
742  union {
743  /** In-order transmit descriptors */
745  /** Out-of-order transmit descriptors */
747  } tx;
748  /** Receive descriptors */
749  union {
750  /** In-order receive descriptors */
752  /** Out-of-order receive descriptors */
754  } rx;
755  /** Raw data */
756  void *raw;
757  } desc;
758  /** Completion ring */
759  union {
760  /** Transmit completions */
761  union {
762  /** Out-of-order transmit completions */
764  } tx;
765  /** Receive completions */
766  union {
767  /** In-order receive completions */
769  /** Out-of-order receive completions */
771  } rx;
772  /** Raw data */
773  void *raw;
774  } cmplt;
775  /** Queue resources */
777 
778  /** Queue type */
779  const struct gve_queue_type *type;
780  /** Queue strides */
782  /** Number of descriptors (must be a power of two) */
783  unsigned int count;
784  /** Maximum fill level (must be a power of two) */
785  unsigned int fill;
786 
787  /** Descriptor mapping */
789  /** Completion mapping */
791  /** Queue resources mapping */
793 
794  /** Doorbell register */
795  volatile uint32_t *db;
796  /** Event counter */
797  struct gve_event *event;
798 
799  /** Producer counter */
801  /** Consumer counter */
803  /** Completion counter */
805  /** Tag ring */
807 
808  /** Queue page list */
809  struct gve_qpl qpl;
810 };
811 
812 /** A descriptor queue type */
814  /** Name */
815  const char *name;
816  /**
817  * Populate command parameters to create queue
818  *
819  * @v queue Descriptor queue
820  * @v qpl Queue page list ID
821  * @v cmd Admin queue command
822  */
823  void ( * param ) ( struct gve_queue *queue, uint32_t qpl,
824  union gve_admin_command *cmd );
825  /** Queue page list ID */
827  /** Interrupt channel */
829  /** Maximum fill level */
831  /** Queue strides */
832  struct {
833  /** In-order queue strides */
835  /** Out-of-order queue strides */
837  } stride;
838  /** Command to create queue */
840  /** Command to destroy queue */
842 };
843 
844 /** A Google Virtual Ethernet NIC */
845 struct gve_nic {
846  /** Configuration registers */
847  void *cfg;
848  /** Doorbell registers */
849  void *db;
850  /** PCI revision */
852  /** Network device */
854  /** DMA device */
855  struct dma_device *dma;
856  /** Dummy MSI-X interrupt */
857  struct pci_msix msix;
858 
859  /** Admin queue */
860  struct gve_admin admin;
861  /** Interrupt channels */
862  struct gve_irqs irqs;
863  /** Event counters */
865  /** Scratch buffer */
867  /** Supported options */
869  /** Operating mode */
870  unsigned int mode;
871 
872  /** Transmit queue */
873  struct gve_queue tx;
874  /** Receive queue */
875  struct gve_queue rx;
876  /** Transmit I/O buffers (indexed by tag) */
878  /** Transmit tag chain */
880  /** Transmit tag ring */
882  /** Receive tag ring */
884  /** Receive sequence number */
885  unsigned int seq;
886 
887  /** Startup process */
888  struct process startup;
889  /** Startup process retry counter */
890  unsigned int retries;
891  /** Reset recovery watchdog timer */
893  /** Reset recovery recorded activity counter */
895 };
896 
897 /** Operating mode
898  *
899  * These values are chosen to allow for easy transformation to a queue
900  * format identifier as used for the "Configure device resources"
901  * command.
902  */
903 #define GVE_MODE_QPL 0x01 /**< Use registered queue pages */
904 #define GVE_MODE_DQO 0x02 /**< Use out-of-order queues */
905 
906 /** Maximum time to wait for admin queue commands */
907 #define GVE_ADMIN_MAX_WAIT_MS 500
908 
909 /** Maximum number of times to reattempt device reset */
910 #define GVE_RESET_MAX_RETRY 5
911 
912 /** Time between reset recovery checks */
913 #define GVE_WATCHDOG_TIMEOUT ( 1 * TICKS_PER_SEC )
914 
915 #endif /* _GVE_H */
void * data
Page addresses.
Definition: gve.h:524
uint8_t reserved_a[10]
Reserved.
Definition: gve.h:144
A process.
Definition: process.h:17
#define __attribute__(x)
Definition: compiler.h:10
uint16_t len
Total length (including this header)
Definition: gve.h:162
Register page list command.
Definition: gve.h:233
struct dma_device * dma
DMA device.
Definition: gve.h:855
struct dma_mapping res_map
Queue resources mapping.
Definition: gve.h:792
uint8_t flags
Flags.
Definition: gve.h:678
unsigned short uint16_t
Definition: stdint.h:11
struct in_addr in
Local IPv4 address.
Definition: gve.h:38
uint16_t desc_count
Number of descriptor ring entries.
Definition: gve.h:316
uint32_t id
Page list ID.
Definition: gve.h:237
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:213
uint8_t reserved_a[4]
Reserved.
Definition: gve.h:304
uint8_t reserved[60]
Reserved.
Definition: gve.h:418
uint32_t count
Number of pages.
Definition: gve.h:239
uint16_t len
Length and generation bit.
Definition: gve.h:707
uint64_t irqs
IRQ doorbell address.
Definition: gve.h:211
Create receive queue command.
Definition: gve.h:296
uint32_t evt_idx
Event counter index (within event counter array)
Definition: gve.h:469
uint8_t desc
Descriptor ring stride.
Definition: gve.h:732
uint32_t required
Required feature mask.
Definition: gve.h:186
uint16_t bufsz
Packet buffer size.
Definition: gve.h:318
struct gve_queue_stride stride
Queue strides.
Definition: gve.h:781
uint32_t id
Queue ID.
Definition: gve.h:271
uint16_t opt_count
Number of device options.
Definition: gve.h:160
struct dma_mapping map
DMA mapping.
Definition: gve.h:408
unsigned int fill
Maximum fill level (must be a power of two)
Definition: gve.h:785
struct gve_event * event
Event counters.
Definition: gve.h:406
uint8_t type
Type.
Definition: gve.h:566
uint16_t len
Length of this descriptor.
Definition: gve.h:614
uint8_t reserved[7]
Reserved.
Definition: gve.h:223
Describe device command.
Definition: gve.h:127
uint32_t qpl_id
Queue page list ID.
Definition: gve.h:314
physaddr_t base
Queue page list base device address.
Definition: gve.h:538
struct gve_device_descriptor desc
Device descriptor.
Definition: gve.h:383
uint64_t res
Queue resources address.
Definition: gve.h:308
struct gve_resources * res
Queue resources.
Definition: gve.h:776
struct gve_dqo_tx_tag tag
Tag.
Definition: gve.h:630
volatile uint32_t * db
Doorbell register.
Definition: gve.h:795
Retry timers.
An event counter.
Definition: gve.h:398
uint8_t reserved[60]
Reserved.
Definition: gve.h:674
Create transmit queue command.
Definition: gve.h:267
uint32_t db_idx
Descriptor doorbell index (within doorbell BAR)
Definition: gve.h:467
uint16_t total
Total length of this packet.
Definition: gve.h:572
uint16_t len
Length of this descriptor.
Definition: gve.h:574
Simple admin command.
Definition: gve.h:116
uint8_t seq
Sequence number.
Definition: gve.h:680
A retry timer.
Definition: retry.h:21
uint64_t addr[GVE_QPL_MAX]
Page address.
Definition: gve.h:257
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:693
unsigned long long uint64_t
Definition: stdint.h:13
uint8_t flags
Completion flags.
Definition: gve.h:628
union gve_queue::@53 desc
Descriptor ring.
PCI MSI-X interrupts.
uint16_t id
Option ID.
Definition: gve.h:177
DMA mappings.
uint32_t qpl
Queue page list ID.
Definition: gve.h:826
struct gve_qpl qpl
Queue page list.
Definition: gve.h:809
A transmit or receive buffer descriptor.
Definition: gve.h:558
uint8_t rx_tag[GVE_RX_FILL]
Receive tag ring.
Definition: gve.h:883
struct gve_admin_create_rx create_rx
Create receive queue.
Definition: gve.h:349
uint8_t type
Descriptor type and flags.
Definition: gve.h:608
const char * name
Name.
Definition: gve.h:815
Device descriptor.
Definition: gve.h:142
uint8_t reserved[3]
Reserved.
Definition: gve.h:105
uint8_t reserved_c[2]
Reserved.
Definition: gve.h:709
struct gve_admin_register reg
Register page list.
Definition: gve.h:345
struct gve_queue rx
Receive queue.
Definition: gve.h:875
struct gve_dqo_tx_tag tag
Tag.
Definition: gve.h:612
uint8_t status
Status.
Definition: gve.h:703
unsigned int mode
Operating mode.
Definition: gve.h:870
struct gve_admin_header hdr
Header.
Definition: gve.h:129
struct gve_queue tx
Transmit queue.
Definition: gve.h:873
#define GVE_TX_FILL
Maximum number of transmit buffers.
Definition: gve.h:549
uint8_t reserved[2]
Reserved.
Definition: gve.h:36
uint8_t reserved_a[4]
Reserved.
Definition: gve.h:273
struct gve_admin_create_tx create_tx
Create transmit queue.
Definition: gve.h:347
uint64_t size
Page size.
Definition: gve.h:243
struct gve_dqo_tx_descriptor * dqo
Out-of-order transmit descriptors.
Definition: gve.h:746
struct dma_mapping map
Page mapping.
Definition: gve.h:526
struct gve_queue_type::@59 stride
Queue strides.
uint8_t reserved[6]
Reserved.
Definition: gve.h:322
uint32_t activity
Reset recovery recorded activity counter.
Definition: gve.h:894
void * db
Doorbell registers.
Definition: gve.h:849
struct retry_timer watchdog
Reset recovery watchdog timer.
Definition: gve.h:892
An admin queue command.
Definition: gve.h:335
Queue resources.
Definition: gve.h:465
uint32_t options
Supported options.
Definition: gve.h:868
uint8_t opts[216]
Space for options.
Definition: gve.h:171
struct dma_mapping map
DMA mapping.
Definition: gve.h:388
struct process startup
Startup process.
Definition: gve.h:888
#define GVE_RX_FILL
Maximum number of receive buffers.
Definition: gve.h:648
uint64_t cmplt
Completion ring address.
Definition: gve.h:283
uint8_t opcode
Operation code.
Definition: gve.h:107
uint8_t fill
Maximum fill level.
Definition: gve.h:830
struct gve_gqi_rx_descriptor * gqi
In-order receive descriptors.
Definition: gve.h:751
uint32_t cons
Consumer counter.
Definition: gve.h:802
PCI MSI-X capability.
Definition: pcimsix.h:34
volatile uint32_t * db[GVE_IRQ_COUNT]
Interrupt doorbells.
Definition: gve.h:444
uint8_t reserved_a[1]
Reserved.
Definition: gve.h:701
uint32_t prod
Producer counter.
Definition: gve.h:373
Admin queue entry header.
Definition: gve.h:103
unsigned int count
Number of pages.
Definition: gve.h:528
uint8_t reserved[56]
Reserved.
Definition: gve.h:471
uint8_t tag
Tag.
Definition: gve.h:689
Queue page list.
Definition: gve.h:522
uint8_t reserved_e[19]
Reserved.
Definition: gve.h:717
signed char int8_t
Definition: stdint.h:15
struct gve_dqo_rx_descriptor * dqo
Out-of-order receive descriptors.
Definition: gve.h:753
struct gve_irqs irqs
Interrupt channels.
Definition: gve.h:862
void * raw
Raw data.
Definition: gve.h:756
uint32_t id
Queue ID.
Definition: gve.h:300
uint32_t irq_stride
IRQ doorbell stride.
Definition: gve.h:217
uint16_t len
Length.
Definition: gve.h:676
struct gve_admin_header hdr
Header.
Definition: gve.h:118
A descriptor queue.
Definition: gve.h:738
uint8_t count
Number of descriptors in this packet.
Definition: gve.h:570
volatile uint32_t count
Number of events that have occurred.
Definition: gve.h:400
void * cfg
Configuration registers.
Definition: gve.h:847
An out-of-order transmit tag.
Definition: gve.h:591
struct google_mac mac
MAC address.
Definition: gve.h:158
struct pci_msix msix
Dummy MSI-X interrupt.
Definition: gve.h:857
IP address structure.
Definition: in.h:41
struct gve_admin_describe desc
Describe device.
Definition: gve.h:341
Configure device resources command.
Definition: gve.h:205
uint64_t events
Event counter array.
Definition: gve.h:209
PCI bus.
struct gve_admin_header hdr
Header.
Definition: gve.h:269
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:404
union gve_queue::@53::@55 tx
Transmit descriptors.
uint8_t reserved_b[16]
Reserved.
Definition: gve.h:695
A network device.
Definition: netdevice.h:352
uint8_t reserved_a[3]
Reserved.
Definition: gve.h:610
uint8_t cmplt
Completion ring stride.
Definition: gve.h:734
Processes.
uint8_t reserved_a[7]
Reserved.
Definition: gve.h:691
uint8_t tx_tag[GVE_TX_FILL]
Transmit tag ring.
Definition: gve.h:881
unsigned char uint8_t
Definition: stdint.h:10
A Google Virtual Ethernet NIC.
Definition: gve.h:845
struct io_buffer * tx_iobuf[GVE_TX_FILL]
Transmit I/O buffers (indexed by tag)
Definition: gve.h:877
uint8_t * tag
Tag ring.
Definition: gve.h:806
uint8_t reserved_b[2]
Reserved.
Definition: gve.h:705
uint8_t reserved_b[4]
Reserved.
Definition: gve.h:289
An out-of-order receive descriptor.
Definition: gve.h:687
struct gve_pages pages
Page address list.
Definition: gve.h:385
An in-order receive descriptor.
Definition: gve.h:657
unsigned int uint32_t
Definition: stdint.h:12
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
unsigned int seq
Receive sequence number.
Definition: gve.h:885
uint16_t len
Length (excluding this header)
Definition: gve.h:179
uint8_t reserved_a[2]
Reserved.
Definition: gve.h:568
struct gve_gqi_tx_descriptor * gqi
In-order transmit descriptors.
Definition: gve.h:744
struct gve_dqo_rx_completion * dqo
Out-of-order receive completions.
Definition: gve.h:770
uint32_t done
Completion counter.
Definition: gve.h:804
uint8_t destroy
Command to destroy queue.
Definition: gve.h:841
#define GVE_QPL_MAX
Maximum number of pages per queue.
Definition: gve.h:252
uint8_t reserved_b[2]
Reserved.
Definition: gve.h:150
uint32_t num_irqs
Number of IRQ doorbells.
Definition: gve.h:215
uint32_t qpl_id
Queue page list ID.
Definition: gve.h:279
unsigned long physaddr_t
Definition: stdint.h:20
Device option header.
Definition: gve.h:175
unsigned int id
Queue page list ID.
Definition: gve.h:530
uint64_t addr
Descriptor buffer address.
Definition: gve.h:131
uint64_t desc
Descriptor ring address.
Definition: gve.h:312
struct gve_admin_header hdr
Header.
Definition: gve.h:207
An out-of-order transmit descriptor.
Definition: gve.h:604
uint32_t status
Status.
Definition: gve.h:109
An interrupt channel.
Definition: gve.h:414
uint32_t msix_base
MSI-X base index.
Definition: gve.h:219
An in-order receive completion descriptor.
Definition: gve.h:672
struct gve_admin_configure conf
Configure device resources.
Definition: gve.h:343
An in-order transmit descriptor.
Definition: gve.h:564
unsigned int count
Number of descriptors (must be a power of two)
Definition: gve.h:783
uint32_t notify_id
Notification channel ID.
Definition: gve.h:281
struct gve_events events
Event counters.
Definition: gve.h:864
uint8_t reserved_d[3]
Reserved.
Definition: gve.h:713
uint8_t reserved_d[6]
Reserved.
Definition: gve.h:164
int8_t count
Number of descriptors covered by this completion.
Definition: gve.h:600
#define GVE_IRQ_COUNT
Number of interrupt channels.
Definition: gve.h:435
struct dma_mapping cmplt_map
Completion mapping.
Definition: gve.h:790
union gve_scratch::@52 * buf
Buffer contents.
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:576
uint64_t addr
Address (within queue page list address space)
Definition: gve.h:560
Interrupt channel array.
Definition: gve.h:438
uint8_t tx_chain[GVE_TX_FILL]
Transmit tag chain.
Definition: gve.h:879
struct gve_event * event
Event counter.
Definition: gve.h:797
unsigned int retries
Startup process retry counter.
Definition: gve.h:890
union gve_queue::@53::@56 rx
Receive descriptors.
unsigned int count
Actual number of event counters.
Definition: gve.h:410
struct gve_admin_header hdr
Header.
Definition: gve.h:337
uint16_t cmplt_count
Number of completion ring entries.
Definition: gve.h:287
uint64_t desc
Descriptor ring address.
Definition: gve.h:277
uint8_t revision
PCI revision.
Definition: gve.h:851
uint16_t desc_count
Number of descriptor ring entries.
Definition: gve.h:285
A Google Cloud MAC address.
Definition: gve.h:34
An out-of-order transmit completion.
Definition: gve.h:624
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:659
uint32_t len
Descriptor maximum length.
Definition: gve.h:135
uint8_t reserved_a[1]
Reserved.
Definition: gve.h:626
uint64_t res
Queue resources address.
Definition: gve.h:275
Page list.
Definition: gve.h:255
uint32_t db_idx
Interrupt doorbell index (within doorbell BAR)
Definition: gve.h:416
Scratch buffer for admin queue commands.
Definition: gve.h:379
uint32_t notify_id
Notification channel ID.
Definition: gve.h:306
struct gve_queue_stride gqi
In-order queue strides.
Definition: gve.h:834
struct net_device * netdev
Network device.
Definition: gve.h:853
struct gve_admin_header hdr
Header.
Definition: gve.h:235
uint32_t index
Index.
Definition: gve.h:302
struct dma_mapping map
DMA mapping.
Definition: gve.h:442
struct gve_irq * irq
Interrupt channels.
Definition: gve.h:440
Admin queue.
Definition: gve.h:369
uint8_t flags
Flags.
Definition: gve.h:711
uint8_t format
Descriptor queue format.
Definition: gve.h:221
union gve_admin_command * cmd
Commands.
Definition: gve.h:371
void(* param)(struct gve_queue *queue, uint32_t qpl, union gve_admin_command *cmd)
Populate command parameters to create queue.
Definition: gve.h:823
struct dma_mapping desc_map
Descriptor mapping.
Definition: gve.h:788
A descriptor queue type.
Definition: gve.h:813
union gve_queue::@54 cmplt
Completion ring.
struct dma_mapping map
DMA mapping.
Definition: gve.h:375
uint16_t counters
Number of event counters.
Definition: gve.h:154
struct gve_admin_header hdr
Header.
Definition: gve.h:298
const struct gve_queue_type * type
Queue type.
Definition: gve.h:779
struct gve_dqo_tx_completion * dqo
Out-of-order transmit completions.
Definition: gve.h:763
struct gve_admin admin
Admin queue.
Definition: gve.h:860
uint8_t tag
Tag.
Definition: gve.h:715
uint16_t queue
Queue ID.
Definition: ena.h:22
An out-of-order receive completion.
Definition: gve.h:699
uint32_t prod
Producer counter.
Definition: gve.h:800
A DMA mapping.
Definition: dma.h:32
struct golan_eqe_cmd cmd
Definition: CIB_PRM.h:29
struct gve_buffer buf
Buffer descriptor.
Definition: gve.h:606
uint8_t create
Command to create queue.
Definition: gve.h:839
uint8_t reserved_b[4]
Reserved.
Definition: gve.h:632
uint16_t cmplt_count
Number of completion ring entries.
Definition: gve.h:320
uint8_t irq
Interrupt channel.
Definition: gve.h:828
struct gve_queue_stride dqo
Out-of-order queue strides.
Definition: gve.h:836
struct gve_scratch scratch
Scratch buffer.
Definition: gve.h:866
uint8_t reserved_c[4]
Reserved.
Definition: gve.h:156
Queue strides.
Definition: gve.h:730
uint64_t addr
Address list address.
Definition: gve.h:241
uint8_t pad[64]
Padding.
Definition: gve.h:351
struct gve_gqi_rx_completion * gqi
In-order receive completions.
Definition: gve.h:768
A DMA-capable device.
Definition: dma.h:47
uint64_t cmplt
Completion ring address.
Definition: gve.h:310
struct gve_admin_simple simple
Simple command.
Definition: gve.h:339
A persistent I/O buffer.
Definition: iobuf.h:37
uint16_t mtu
Maximum transmit unit.
Definition: gve.h:152
uint8_t id
Buffer index within queue page list.
Definition: gve.h:593