[gve] Add concept of operating mode

The GVE family supports two incompatible descriptor queue formats:

  * GQI: in-order descriptor queues
  * DQO: out-of-order descriptor queues

and two addressing modes:

  * QPL: pre-registered queue page list addressing
  * RDA: raw DMA addressing

All four combinations (GQI-QPL, GQI-RDA, DQO-QPL, and DQO-RDA) are
theoretically supported by the Linux driver, which is essentially the
only public reference provided by Google.  The original versions of
the GVE NIC supported only GQI-QPL mode, and so the iPXE driver is
written to target this mode, on the assumption that it would continue
to be supported by all models of the GVE NIC.

This assumption turns out to be incorrect: Google does not deem it
necessary to retain backwards compatibility.  Some newer machine types
(such as a4-highgpu-8g) support only the DQO-RDA operating mode.

Add a definition of operating mode, and pass this as an explicit
parameter to the "configure device resources" admin queue command.  We
choose a representation that subtracts one from the value passed in
this command, since this happens to allow us to decompose the mode
into two independent bits (one representing the use of DQO descriptor
format, one representing the use of QPL addressing).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-09-29 11:46:15 +01:00
parent 610089b98e
commit 048a346705
2 changed files with 42 additions and 0 deletions

View File

@@ -214,8 +214,17 @@ struct gve_admin_configure {
uint32_t num_irqs;
/** IRQ doorbell stride */
uint32_t irq_stride;
/** MSI-X base index */
uint32_t msix_base;
/** Descriptor queue format */
uint8_t format;
/** Reserved */
uint8_t reserved[7];
} __attribute__ (( packed ));
/** Descriptor queue format */
#define GVE_FORMAT( mode ) ( (mode) + 1 )
/** Register page list command */
#define GVE_ADMIN_REGISTER 0x0003
@@ -691,6 +700,8 @@ struct gve_nic {
struct gve_scratch scratch;
/** Supported options */
uint32_t options;
/** Operating mode */
unsigned int mode;
/** Transmit queue */
struct gve_queue tx;
@@ -711,6 +722,15 @@ struct gve_nic {
uint32_t activity;
};
/** Operating mode
*
* These values are chosen to allow for easy transformation to a queue
* format identifier as used for the "Configure device resources"
* command.
*/
#define GVE_MODE_QPL 0x01 /**< Use registered queue pages */
#define GVE_MODE_DQO 0x02 /**< Use out-of-order queues */
/** Maximum time to wait for admin queue commands */
#define GVE_ADMIN_MAX_WAIT_MS 500