gve: Define config structs for queue allocation
authorShailend Chand <shailend@google.com>
Mon, 22 Jan 2024 18:26:27 +0000 (18:26 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 24 Jan 2024 01:41:30 +0000 (17:41 -0800)
Queue allocation functions currently can only allocate into priv and
free memory in priv. These new structs would be passed into the queue
functions in a subsequent change to make them capable of returning newly
allocated resources and not just writing them into priv. They also make
it possible to allocate resources for queues with a different config
than that of the currently active queues.

Signed-off-by: Shailend Chand <shailend@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jeroen de Borst <jeroendb@google.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20240122182632.1102721-2-shailend@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/google/gve/gve.h

index b80349154604b11510637deebf908bbe3b73ac5e..00e7f8b06d8986e3d0ca6beca91da1d413fe22ba 100644 (file)
@@ -622,6 +622,55 @@ struct gve_ptype_lut {
        struct gve_ptype ptypes[GVE_NUM_PTYPES];
 };
 
+/* Parameters for allocating queue page lists */
+struct gve_qpls_alloc_cfg {
+       struct gve_qpl_config *qpl_cfg;
+       struct gve_queue_config *tx_cfg;
+       struct gve_queue_config *rx_cfg;
+
+       u16 num_xdp_queues;
+       bool raw_addressing;
+       bool is_gqi;
+
+       /* Allocated resources are returned here */
+       struct gve_queue_page_list *qpls;
+};
+
+/* Parameters for allocating resources for tx queues */
+struct gve_tx_alloc_rings_cfg {
+       struct gve_queue_config *qcfg;
+
+       /* qpls and qpl_cfg must already be allocated */
+       struct gve_queue_page_list *qpls;
+       struct gve_qpl_config *qpl_cfg;
+
+       u16 ring_size;
+       u16 start_idx;
+       u16 num_rings;
+       bool raw_addressing;
+
+       /* Allocated resources are returned here */
+       struct gve_tx_ring *tx;
+};
+
+/* Parameters for allocating resources for rx queues */
+struct gve_rx_alloc_rings_cfg {
+       /* tx config is also needed to determine QPL ids */
+       struct gve_queue_config *qcfg;
+       struct gve_queue_config *qcfg_tx;
+
+       /* qpls and qpl_cfg must already be allocated */
+       struct gve_queue_page_list *qpls;
+       struct gve_qpl_config *qpl_cfg;
+
+       u16 ring_size;
+       bool raw_addressing;
+       bool enable_header_split;
+
+       /* Allocated resources are returned here */
+       struct gve_rx_ring *rx;
+};
+
 /* GVE_QUEUE_FORMAT_UNSPECIFIED must be zero since 0 is the default value
  * when the entire configure_device_resources command is zeroed out and the
  * queue_format is not specified.