iPXE
|
Google Virtual Ethernet network driver. More...
#include <stdint.h>
#include <ipxe/dma.h>
#include <ipxe/pci.h>
#include <ipxe/in.h>
#include <ipxe/uaccess.h>
#include <ipxe/process.h>
#include <ipxe/retry.h>
Go to the source code of this file.
Data Structures | |
struct | google_mac |
A Google Cloud MAC address. More... | |
struct | gve_admin_header |
Admin queue entry header. More... | |
struct | gve_admin_simple |
Simple admin command. More... | |
struct | gve_admin_describe |
Describe device command. More... | |
struct | gve_device_descriptor |
Device descriptor. More... | |
struct | gve_admin_configure |
Configure device resources command. More... | |
struct | gve_admin_register |
Register page list command. More... | |
struct | gve_pages |
Page list. More... | |
struct | gve_admin_create_tx |
Create transmit queue command. More... | |
struct | gve_admin_create_rx |
Create receive queue command. More... | |
union | gve_admin_command |
An admin queue command. More... | |
struct | gve_admin |
Admin queue. More... | |
struct | gve_scratch |
Scratch buffer for admin queue commands. More... | |
struct | gve_event |
An event counter. More... | |
struct | gve_events |
Event counter array. More... | |
struct | gve_irq |
An interrupt channel. More... | |
struct | gve_irqs |
Interrupt channel array. More... | |
struct | gve_resources |
Queue resources. More... | |
struct | gve_qpl |
Queue page list. More... | |
struct | gve_buffer |
A transmit or receive buffer descriptor. More... | |
struct | gve_tx_packet |
A transmit packet descriptor. More... | |
struct | gve_tx_descriptor |
A transmit descriptor. More... | |
struct | gve_rx_descriptor |
A receive descriptor. More... | |
struct | gve_rx_packet |
A receive packet descriptor. More... | |
struct | gve_rx_completion |
A receive completion descriptor. More... | |
struct | gve_queue |
A descriptor queue. More... | |
struct | gve_queue_type |
A descriptor queue type. More... | |
struct | gve_nic |
A Google Virtual Ethernet NIC. More... | |
Macros | |
#define | GVE_PAGE_SIZE 0x1000 |
Page size. More... | |
#define | GVE_ALIGN GVE_PAGE_SIZE |
Address alignment. More... | |
#define | GVE_CFG_BAR PCI_BASE_ADDRESS_0 |
Configuration BAR. More... | |
#define | GVE_CFG_SIZE 0x1000 |
Configuration BAR size. More... | |
#define | GVE_CFG_DEVSTAT 0x0000 |
Device status. More... | |
#define | GVE_CFG_DEVSTAT_RESET 0x00000010UL |
Device is reset. More... | |
#define | GVE_CFG_DRVSTAT 0x0004 |
Driver status. More... | |
#define | GVE_CFG_DRVSTAT_RUN 0x00000001UL |
Run admin queue. More... | |
#define | GVE_RESET_MAX_WAIT_MS 500 |
Maximum time to wait for reset. More... | |
#define | GVE_CFG_ADMIN_PFN 0x0010 |
Admin queue page frame number (for older devices) More... | |
#define | GVE_CFG_ADMIN_DB 0x0014 |
Admin queue doorbell. More... | |
#define | GVE_CFG_ADMIN_EVT 0x0018 |
Admin queue event counter. More... | |
#define | GVE_CFG_VERSION 0x001f |
Driver version (8-bit register) More... | |
#define | GVE_CFG_ADMIN_BASE_HI 0x0020 |
Admin queue base address high 32 bits. More... | |
#define | GVE_CFG_ADMIN_BASE_LO 0x0024 |
Admin queue base address low 32 bits. More... | |
#define | GVE_CFG_ADMIN_LEN 0x0028 |
Admin queue base address length (16-bit register) More... | |
#define | GVE_DB_BAR PCI_BASE_ADDRESS_2 |
Doorbell BAR. More... | |
#define | GVE_ADMIN_STATUS_OK 0x00000001 |
Command succeeded. More... | |
#define | GVE_ADMIN_DESCRIBE 0x0001 |
Describe device command. More... | |
#define | GVE_ADMIN_DESCRIBE_VER 1 |
Device descriptor version. More... | |
#define | GVE_ADMIN_CONFIGURE 0x0002 |
Configure device resources command. More... | |
#define | GVE_ADMIN_REGISTER 0x0003 |
Register page list command. More... | |
#define | GVE_QPL_MAX 32 |
Maximum number of pages per queue. More... | |
#define | GVE_ADMIN_UNREGISTER 0x0004 |
Unregister page list command. More... | |
#define | GVE_ADMIN_CREATE_TX 0x0005 |
Create transmit queue command. More... | |
#define | GVE_ADMIN_CREATE_RX 0x0006 |
Create receive queue command. More... | |
#define | GVE_ADMIN_DESTROY_TX 0x0007 |
Destroy transmit queue command. More... | |
#define | GVE_ADMIN_DESTROY_RX 0x0008 |
Destroy receive queue command. More... | |
#define | GVE_ADMIN_DECONFIGURE 0x0009 |
Deconfigure device resources command. More... | |
#define | GVE_ADMIN_COUNT ( GVE_PAGE_SIZE / sizeof ( union gve_admin_command ) ) |
Number of admin queue commands. More... | |
#define | GVE_IRQ_COUNT 2 |
Number of interrupt channels. More... | |
#define | GVE_IRQ_DISABLE 0x40000000UL |
Disable interrupts. More... | |
#define | GVE_BUF_SIZE ( GVE_PAGE_SIZE / 2 ) |
Queue data buffer size. More... | |
#define | GVE_BUF_PER_PAGE ( GVE_PAGE_SIZE / GVE_BUF_SIZE ) |
Number of data buffers per page. More... | |
#define | GVE_TX_FILL 8 |
Maximum number of transmit buffers. More... | |
#define | GVE_TX_QPL 0x18ae5458 |
Transmit queue page list ID. More... | |
#define | GVE_TX_IRQ 0 |
Tranmsit queue interrupt channel. More... | |
#define | GVE_TX_TYPE_START 0x00 |
Start of packet transmit descriptor type. More... | |
#define | GVE_TX_TYPE_CONT 0x20 |
Continuation of packet transmit descriptor type. More... | |
#define | GVE_RX_FILL 64 |
Maximum number of receive buffers. More... | |
#define | GVE_RX_QPL 0x18ae5258 |
Receive queue page list ID. More... | |
#define | GVE_RX_IRQ 1 |
Receive queue interrupt channel. More... | |
#define | GVE_RXF_ERROR 0x08 |
Receive error. More... | |
#define | GVE_RXF_MORE 0x20 |
Receive packet continues into next descriptor. More... | |
#define | GVE_RX_SEQ_MASK 0x07 |
Receive sequence number mask. More... | |
#define | GVE_RX_PAD 2 |
Padding at the start of all received packets. More... | |
#define | GVE_ADMIN_MAX_WAIT_MS 500 |
Maximum time to wait for admin queue commands. More... | |
#define | GVE_RESET_MAX_RETRY 5 |
Maximum number of times to reattempt device reset. More... | |
#define | GVE_WATCHDOG_TIMEOUT ( 1 * TICKS_PER_SEC ) |
Time between reset recovery checks. More... | |
Functions | |
FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
Google Virtual Ethernet network driver.
The Google Virtual Ethernet NIC (GVE or gVNIC) is found only in Google Cloud instances. There is essentially zero documentation available beyond the mostly uncommented source code in the Linux kernel.
Definition in file gve.h.
#define GVE_ALIGN GVE_PAGE_SIZE |
#define GVE_CFG_BAR PCI_BASE_ADDRESS_0 |
#define GVE_CFG_SIZE 0x1000 |
#define GVE_RESET_MAX_WAIT_MS 500 |
#define GVE_CFG_ADMIN_PFN 0x0010 |
#define GVE_CFG_ADMIN_BASE_HI 0x0020 |
#define GVE_CFG_ADMIN_BASE_LO 0x0024 |
#define GVE_CFG_ADMIN_LEN 0x0028 |
#define GVE_DB_BAR PCI_BASE_ADDRESS_2 |
#define GVE_ADMIN_CONFIGURE 0x0002 |
#define GVE_QPL_MAX 32 |
#define GVE_ADMIN_UNREGISTER 0x0004 |
#define GVE_ADMIN_CREATE_TX 0x0005 |
#define GVE_ADMIN_CREATE_RX 0x0006 |
#define GVE_ADMIN_DESTROY_TX 0x0007 |
#define GVE_ADMIN_DESTROY_RX 0x0008 |
#define GVE_ADMIN_DECONFIGURE 0x0009 |
#define GVE_ADMIN_COUNT ( GVE_PAGE_SIZE / sizeof ( union gve_admin_command ) ) |
Number of admin queue commands.
This is theoretically a policy decision. However, older revisions of the hardware seem to have only the "admin queue page frame number" register and no "admin queue length" register, with the implication that the admin queue must be exactly one page in length.
Choose to use a one page (4kB) admin queue for both older and newer versions of the hardware, to minimise variability.
#define GVE_IRQ_COUNT 2 |
Number of interrupt channels.
We tell the device how many interrupt channels we have provided via the "configure device resources" admin queue command. The device will accept being given zero interrupt channels, but will subsequently fail to create more than a single queue (either transmit or receive).
There is, of course, no documentation indicating how may interrupt channels actually need to be provided. In the absence of evidence to the contrary, assume that two channels (one for transmit, one for receive) will be sufficient.
#define GVE_BUF_SIZE ( GVE_PAGE_SIZE / 2 ) |
Queue data buffer size.
In theory, we may specify the size of receive buffers. However, the original version of the device seems not to have a parameter for this, and assumes the use of half-page (2kB) buffers. Choose to use this as the buffer size, on the assumption that older devices will not support any other buffer size.
#define GVE_BUF_PER_PAGE ( GVE_PAGE_SIZE / GVE_BUF_SIZE ) |
#define GVE_TX_FILL 8 |
#define GVE_TX_TYPE_START 0x00 |
#define GVE_TX_TYPE_CONT 0x20 |
#define GVE_RX_FILL 64 |
#define GVE_RXF_MORE 0x20 |
#define GVE_RX_PAD 2 |
#define GVE_ADMIN_MAX_WAIT_MS 500 |
#define GVE_RESET_MAX_RETRY 5 |
#define GVE_WATCHDOG_TIMEOUT ( 1 * TICKS_PER_SEC ) |
FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |