Skip to content

Commit ce30ba1

Browse files
committed
[gve] Select preferred operating mode
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 <[email protected]>
1 parent 74c9fd7 commit ce30ba1

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/drivers/net/gve.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,22 @@ static int gve_describe ( struct gve_nic *gve ) {
559559
DBGC ( gve, "GVE %p supports options %#08x\n", gve, gve->options );
560560

561561
/* Select preferred operating mode */
562-
gve->mode = GVE_MODE_QPL;
562+
if ( gve->options & ( 1 << GVE_OPT_GQI_QPL ) ) {
563+
/* GQI-QPL: in-order queues, queue page list addressing */
564+
gve->mode = GVE_MODE_QPL;
565+
} else if ( gve->options & ( 1 << GVE_OPT_GQI_RDA ) ) {
566+
/* GQI-RDA: in-order queues, raw DMA addressing */
567+
gve->mode = 0;
568+
} else if ( gve->options & ( 1 << GVE_OPT_DQO_QPL ) ) {
569+
/* DQO-QPL: out-of-order queues, queue page list addressing */
570+
gve->mode = ( GVE_MODE_DQO | GVE_MODE_QPL );
571+
} else if ( gve->options & ( 1 << GVE_OPT_DQO_RDA ) ) {
572+
/* DQO-RDA: out-of-order queues, raw DMA addressing */
573+
gve->mode = GVE_MODE_DQO;
574+
} else {
575+
/* No options matched: assume the original GQI-QPL mode */
576+
gve->mode = GVE_MODE_QPL;
577+
}
563578
DBGC ( gve, "GVE %p using %s mode\n",
564579
gve, gve_mode_name ( gve->mode ) );
565580

0 commit comments

Comments
 (0)