]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[gve] Select preferred operating mode master
authorMichael Brown <mcb30@ipxe.org>
Mon, 6 Oct 2025 13:04:18 +0000 (14:04 +0100)
committerMichael Brown <mcb30@ipxe.org>
Mon, 6 Oct 2025 13:04:18 +0000 (14:04 +0100)
Select a preferred operating mode from those advertised as supported
by the device, falling back to the oldest known mode (GQI-QPL) if
no modes are advertised.

Since there are devices in existence that support only QPL addressing,
and since we want to minimise code size, we choose to always use a
single fixed ring buffer even when using raw DMA addressing.  Having
paid this penalty, we therefore choose to prefer QPL over RDA since
this allows the (virtual) hardware to minimise the number of page
table manipulations required.  We similarly prefer GQI over DQO since
this minimises the amount of work we have to do: in particular, the RX
descriptor ring contents can remain untouched for the lifetime of the
device and refills require only a doorbell write.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/gve.c

index 8759d71a949d5a78921480a7bcfba6288b0b3346..11ef353519da58bc10061783ce293dd40cd7c531 100644 (file)
@@ -559,7 +559,22 @@ static int gve_describe ( struct gve_nic *gve ) {
        DBGC ( gve, "GVE %p supports options %#08x\n", gve, gve->options );
 
        /* Select preferred operating mode */
-       gve->mode = GVE_MODE_QPL;
+       if ( gve->options & ( 1 << GVE_OPT_GQI_QPL ) ) {
+               /* GQI-QPL: in-order queues, queue page list addressing */
+               gve->mode = GVE_MODE_QPL;
+       } else if ( gve->options & ( 1 << GVE_OPT_GQI_RDA ) ) {
+               /* GQI-RDA: in-order queues, raw DMA addressing */
+               gve->mode = 0;
+       } else if ( gve->options & ( 1 << GVE_OPT_DQO_QPL ) ) {
+               /* DQO-QPL: out-of-order queues, queue page list addressing */
+               gve->mode = ( GVE_MODE_DQO | GVE_MODE_QPL );
+       } else if ( gve->options & ( 1 << GVE_OPT_DQO_RDA ) ) {
+               /* DQO-RDA: out-of-order queues, raw DMA addressing */
+               gve->mode = GVE_MODE_DQO;
+       } else {
+               /* No options matched: assume the original GQI-QPL mode */
+               gve->mode = GVE_MODE_QPL;
+       }
        DBGC ( gve, "GVE %p using %s mode\n",
               gve, gve_mode_name ( gve->mode ) );