Skip to contentSkip to conversation

gve: AdminQ mode related refactors

PATCH Superseded Harshitha Ramamurthy 5 participants 30 messages Aug 14 – Aug 18

Subsystems (4)

v4 of 9 Superseded 3 of 15 applied Latest is v9 →

lore
Share & tools
lore

Harshitha Ramamurthy

author maintainer
#0 lore raw

v4 cover gve: AdminQ mode related refactors

This series is preparing the driver for the addition of a new control plane mode(MailboxQ) by commonizing and reusing as much code as possible. MailboxQ is a new control plane infrastructure which uses mailbox queues. This is a new control plane to communicate with the device when the driver is running on bare-metal instances as well as newer versions of the device.

This series contains 2 main changes to the gve driver's existing control plane(AdminQ):
1) refactor some initialization/teardown path methods to make it work for both control planes.
2) add gve_ctrl_ops structure to the driver for various control plane operations

The refactors are mainly around the init, reset and recover paths so that functionalities could be moved into the control ops like 'set_num_queues', 'set_num_ntfy_blks' etc.

This patch series only sets the control ops for AdminQ mode. This is intended as a preparation for adding MailboxQ mode in upcoming series which will add the new control plane infrastructure and then introduce the corresponding control ops for MailboxQ mode.

The entire list of future patches can be found here for reference:
https://github.com/hramamurthy12/linux/commits/gve-mailbox-queues/

Changes in v4:
- Reduce code churn by placing new functions directly in gve_adminq.c, introducing final tab spacing and using local variable (Przemek Kitszel)
- Fix kdoc formatting and drop spurious management interrupt(patch 9)
- Propagate release_db_resources naming change (patch 12)
- Remove double logging in destroy queues path (patch 14)
- v3: https://lore.kernel.org/netdev/[email protected]/

Changes in v3:
- Fix driver compatibility verification in the reset and recovery paths (patches 2, 8).
- Mark gve_adminq_get_device_properties() with __maybe_unused ahead of its usage (patch 7).
- Refine error handling and resource cleanup in reset, probe, and queue creation paths (patches 8, 9, 11, 14).
- Keep IRQ doorbell allocation/release in control plane resource helpers (patch 12).
- Minor fixes: fix TOCTOU issue for link speed, correct kdoc comments, and remove redundant teardown calls (patches 4, 11, 15).
- v2: https://lore.kernel.org/netdev/[email protected]/

Changes in v2:
- Rebased against latest net-next to resolve apply failure for patch 5
- Fixed a few typos in commit messages of patch 9 and 14
- Fixed a kdoc warning in patch 9
- v1: https://lore.kernel.org/netdev/[email protected]/
Harshitha Ramamurthy (9):
gve: don't pass in unused parameter to gve_adminq_free
gve: refactor initialization with helper functions
gve: add a few helper functions to set device properties
gve: add struct gve_device_info to hold device properties
gve: introduce control plane operations structure
gve: introduce ctrl ops to set vectors and Qs
gve: introduce gve_adminq_get_device_properties()
gve: refactor gve_init_priv for reset path
gve: add ctrl ops to for queue operations

Joshua Washington (6):
gve: simplify reset logic
gve: add gve_ctrl_ops for gve initialization/teardown sequences
gve: split up notify block allocation and setup paths
gve: introduce new methods to handle IRQ doorbells
gve: setup and teardown management interrupts
gve: add link status/speed ctrl ops

 drivers/net/ethernet/google/gve/gve.h         |  89 +-
 drivers/net/ethernet/google/gve/gve_adminq.c  | 437 ++++++--
 drivers/net/ethernet/google/gve/gve_adminq.h  |  25 +-
 drivers/net/ethernet/google/gve/gve_dqo.h     |   2 +-
 drivers/net/ethernet/google/gve/gve_ethtool.c |   5 +-
 .../net/ethernet/google/gve/gve_flow_rule.c   |  15 +-
 drivers/net/ethernet/google/gve/gve_main.c    | 940 +++++++++---------
 7 files changed, 957 insertions(+), 556 deletions(-)
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#1 lore raw

PATCH v4 1/15 gve: don't pass in unused parameter to gve_adminq_free

Clean up gve_adminq_free to not take in an unused parameter.

---
 drivers/net/ethernet/google/gve/gve_adminq.c | 2 +-
 drivers/net/ethernet/google/gve/gve_adminq.h | 2 +-
 drivers/net/ethernet/google/gve/gve_main.c   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/google/gve/gve_adminq.c +1 -1
index 08587bf40ed4..70ffed8b52c3 100644
@@ -385,7 +385,7 @@ void gve_adminq_release(struct gve_priv *priv)
 	gve_clear_admin_queue_ok(priv);
 }
 
-void gve_adminq_free(struct device *dev, struct gve_priv *priv)
+void gve_adminq_free(struct gve_priv *priv)
 {
 	if (!gve_get_admin_queue_ok(priv))
 		return;
drivers/net/ethernet/google/gve/gve_adminq.h +1 -1
index 22a74b6aa17e..8e80f36116ec 100644
@@ -620,7 +620,7 @@ union gve_adminq_command {
 static_assert(sizeof(union gve_adminq_command) == 64);
 
 int gve_adminq_alloc(struct device *dev, struct gve_priv *priv);
-void gve_adminq_free(struct device *dev, struct gve_priv *priv);
+void gve_adminq_free(struct gve_priv *priv);
 void gve_adminq_release(struct gve_priv *priv);
 int gve_adminq_describe_device(struct gve_priv *priv);
 int gve_adminq_configure_device_resources(struct gve_priv *priv,
drivers/net/ethernet/google/gve/gve_main.c +2 -2
index e4d78ae52daf..30bf6df4ebc5 100644
@@ -2506,14 +2506,14 @@ static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
 	bitmap_free(priv->xsk_pools);
 	priv->xsk_pools = NULL;
 err:
-	gve_adminq_free(&priv->pdev->dev, priv);
+	gve_adminq_free(priv);
 	return err;
 }
 
 static void gve_teardown_priv_resources(struct gve_priv *priv)
 {
 	gve_teardown_device_resources(priv);
-	gve_adminq_free(&priv->pdev->dev, priv);
+	gve_adminq_free(priv);
 	bitmap_free(priv->xsk_pools);
 	priv->xsk_pools = NULL;
 }
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#2 lore raw

Re: [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Workqueue is destroyed after freeing resources in gve_remove, leading to resource leaks and UAF if a reset is pending.
- [High] Hardware device resources are not deconfigured before DMA memory is freed in the gve_setup_device_resources error path. --

--- Patch [1]: [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free --- commit 9a4a2e123b2090a5f84279c50fa3476f0a484a87
Author: Harshitha Ramamurthy <[email protected]>

gve: don't pass in unused parameter to gve_adminq_free

Clean up gve_adminq_free to not take in an unused parameter.

drivers/net/ethernet/google/gve/gve_main.c static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device) · line 2511

Quoted 12 lines
drivers/net/ethernet/google/gve/gve_main.c +1 -1
index e4d78ae52dafe..30bf6df4ebc58 100644
@@ -2506,14 +2506,14 @@ static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
 	bitmap_free(priv->xsk_pools);
 	priv->xsk_pools = NULL;
 err:
-	gve_adminq_free(&priv->pdev->dev, priv);
+	gve_adminq_free(priv);
 	return err;
 }

[Severity: High]
This is a pre-existing issue, but does the error path in gve_setup_device_resources() leave hardware configured with freed DMA addresses?

If an initialization step fails after configuring the hardware, the error path frees the DMA memory without deconfiguring or resetting the hardware:

drivers/net/ethernet/google/gve/gve_main.c:gve_setup_device_resources() {
    ...
    err = gve_adminq_configure_device_resources(...);
    ...
abort_with_ntfy_blocks:
	gve_free_notify_blocks(priv);
abort_with_counter:
	gve_free_counter_array(priv);
    ...
}

Can this allow the hardware to asynchronously write to the freed DMA addresses until it is finally reset later by the gve_adminq_free() call in gve_init_priv(), causing a use-after-free?

drivers/net/ethernet/google/gve/gve_main.c static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device) · line 2519

Quoted 8 lines
drivers/net/ethernet/google/gve/gve_main.c +1 -1
 static void gve_teardown_priv_resources(struct gve_priv *priv)
 {
 	gve_teardown_device_resources(priv);
-	gve_adminq_free(&priv->pdev->dev, priv);
+	gve_adminq_free(priv);
 	bitmap_free(priv->xsk_pools);
 	priv->xsk_pools = NULL;
 }

[Severity: High]
This is a pre-existing issue, but can the sequence in gve_remove() lead to a resource leak and use-after-free if a reset is pending?

In gve_remove(), teardown is performed before the workqueue is destroyed, and the service task is not cancelled:

drivers/net/ethernet/google/gve/gve_main.c:gve_remove() {
    ...
	gve_teardown_priv_resources(priv);
	destroy_workqueue(priv->gve_wq);
	free_netdev(netdev);
    ...
}

If a device reset is requested or handled by gve_service_task() concurrently with module removal:

1. unregister_netdev() drops the rtnl_lock.
2. The pending gve_service_task() acquires the lock and allocates new device resources during reset recovery.
3. Concurrently, gve_remove() calls gve_teardown_priv_resources() without rtnl_lock, racing with the reset teardown/recovery.
4. destroy_workqueue() waits for the service task to complete.
5. gve_remove() calls free_netdev().

Are the newly allocated resources from the reset recovery leaked, leaving the hardware active to DMA into freed structures?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author maintainer
#3 lore raw

PATCH v4 2/15 gve: refactor initialization with helper functions

In reply to Harshitha Ramamurthy

In the interest of commonizing code, refactor gve_probe() and gve_init_priv() with a few helper functions that can be expanded and utilized in upcoming patches that add the mailbox ABI to the driver. The helper functions are:

- gve_set_num_ntfy_blks()
- gve_set_num_queues()

Reorder code to combine lines that accomplish a similar objective like setting defaults. Move setting HW-GRO and UDP GSO support out of an Adminq method into gve_init_priv().

These changes are just code movement, no functional change.

---
v4:
- move the new functions to gve_adminq.c since that will be their final home in the following patches (Przemek Kitszel)
v2:
- ensure to call verify driver compatibility in reset path

 drivers/net/ethernet/google/gve/gve_adminq.c | 49 ++++++++++++++---
 drivers/net/ethernet/google/gve/gve_adminq.h |  2 +
 drivers/net/ethernet/google/gve/gve_main.c   | 58 +++++++-------------
 3 files changed, 62 insertions(+), 47 deletions(-)
drivers/net/ethernet/google/gve/gve_adminq.c +41 -8
index 70ffed8b52c3..fe0dedfb25d7 100644
@@ -1117,14 +1117,6 @@ int gve_adminq_describe_device(struct gve_priv *priv)
 
 	gve_set_default_rss_sizes(priv);
 
-	/* DQO supports HW-GRO and UDP_GSO */
-	if (gve_is_dqo(priv)) {
-		u64 additional_features = NETIF_F_GRO_HW | NETIF_F_GSO_UDP_L4;
-
-		priv->dev->hw_features |= additional_features;
-		priv->dev->features |= additional_features;
-	}
-
 	priv->max_registered_pages =
 				be64_to_cpu(descriptor->max_registered_pages);
 	mtu = be16_to_cpu(descriptor->mtu);
@@ -1600,3 +1592,44 @@ int gve_adminq_query_rss_config(struct gve_priv *priv, struct ethtool_rxfh_param
 	dma_pool_free(priv->adminq_pool, descriptor, descriptor_bus);
 	return err;
 }
+
+int gve_set_num_ntfy_blks(struct gve_priv *priv)
+{
+	int num_ntfy;
+
+	num_ntfy = pci_msix_vec_count(priv->pdev);
+	if (num_ntfy <= 0) {
+		dev_err(&priv->pdev->dev,
+			"could not count MSI-x vectors: err=%d\n", num_ntfy);
+		return num_ntfy;
+	} else if (num_ntfy < GVE_MIN_MSIX) {
+		dev_err(&priv->pdev->dev, "gve needs at least %d MSI-x vectors, but only has %d\n",
+			GVE_MIN_MSIX, num_ntfy);
+		return -EINVAL;
+	}
+
+	/* gvnic has one Notification Block per MSI-x vector, except for the
+	 * management vector
+	 */
+	priv->num_ntfy_blks = (num_ntfy - 1) & ~0x1;
+	priv->mgmt_msix_idx = priv->num_ntfy_blks;
+
+	return 0;
+}
+
+void gve_set_num_queues(struct gve_priv *priv)
+{
+	priv->tx_cfg.max_queues =
+		min_t(int, priv->tx_cfg.max_queues, priv->num_ntfy_blks / 2);
+	priv->rx_cfg.max_queues =
+		min_t(int, priv->rx_cfg.max_queues, priv->num_ntfy_blks / 2);
+
+	priv->tx_cfg.num_queues = priv->tx_cfg.max_queues;
+	priv->rx_cfg.num_queues = priv->rx_cfg.max_queues;
+	if (priv->default_num_queues > 0) {
+		priv->tx_cfg.num_queues = min_t(int, priv->default_num_queues,
+						priv->tx_cfg.num_queues);
+		priv->rx_cfg.num_queues = min_t(int, priv->default_num_queues,
+						priv->rx_cfg.num_queues);
+	}
+}
drivers/net/ethernet/google/gve/gve_adminq.h +2 -0
index 8e80f36116ec..82b52424a63f 100644
@@ -656,5 +656,7 @@ int gve_adminq_report_nic_ts(struct gve_priv *priv,
 struct gve_ptype_lut;
 int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 				 struct gve_ptype_lut *ptype_lut);
+int gve_set_num_ntfy_blks(struct gve_priv *priv);
+void gve_set_num_queues(struct gve_priv *priv);
 
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +19 -39

83 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#4 lore raw

Re: [PATCH net-next v4 02/15] gve: refactor initialization with helper functions

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Pre-existing issues:
- [Critical] Disabling XDP triggers an out-of-bounds array access due to the old BPF program remaining active while the TX arrays are shrunk.
- [High] Device resets permanently break AF_XDP sockets because the driver zeroes the xsk_pools bitmask.
- [High] gve_xsk_pool_enable causes a data race by modifying the XDP memory model concurrently with the NAPI polling context. --

--- Patch [2]: [PATCH net-next v4 02/15] gve: refactor initialization with helper functions --- commit f4310d54d17a7a878691c693aea2b3ce23d39802
Author: Harshitha Ramamurthy <[email protected]>

gve: refactor initialization with helper functions

In the interest of commonizing code, refactor gve_probe() and gve_init_priv() with a few helper functions that can be expanded and utilized in upcoming patches that add the mailbox ABI to the driver.

drivers/net/ethernet/google/gve/gve_main.c static const struct xdp_metadata_ops gve_xdp_metadata_ops = { · line 2402

Quoted 8 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0
index 30bf6df4ebc58..37e6205e2eefd 100644
@@ -2400,7 +2400,6 @@ static const struct xdp_metadata_ops gve_xdp_metadata_ops = {
 
 static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
 {

[Severity: High]
This is a pre-existing issue, but could device resets permanently break AF_XDP sockets because the driver zeroes the xsk_pools bitmask?

When a device reset occurs (e.g., due to timeout, adminq failure, or MTU change), it triggers gve_teardown_priv_resources() which frees the bitmask:

    bitmap_free(priv->xsk_pools);
    priv->xsk_pools = NULL;

During recovery, the initialization path reallocates a fresh zeroed xsk_pools bitmap (e.g., via priv->xsk_pools = bitmap_zalloc(...)), permanently losing the previous state. Because the driver never restores the xsk_pools state from the core net_device, AF_XDP sockets silently stop working after a reset.

[Severity: Critical]
This is a pre-existing issue, but is there a risk of an out-of-bounds array access when disabling XDP?

In gve_set_xdp(), the xdp_prog pointer is updated after the queues have been restarted with a shrunken TX array:

    err = gve_configure_rings_xdp(priv, 0);
    if (err)
        goto out;

    WRITE_ONCE(priv->xdp_prog, prog);

If a local privileged user disables XDP, gve_set_xdp() calls gve_configure_rings_xdp(priv, 0), which reallocates priv->tx without XDP queues and restarts NAPI polling. Since priv->xdp_prog is updated only after NAPI restarts, the active NAPI poll can execute the old BPF program. If the program returns XDP_TX, it accesses priv->tx[tx_qid] where tx_qid exceeds the new, smaller array size, leading to memory corruption.

[Severity: High]
This is a pre-existing issue, but does gve_xsk_pool_enable() cause a data race by modifying the XDP memory model concurrently with the NAPI polling context?

In gve_xsk_pool_enable(), it registers an AF_XDP pool by modifying the XDP memory model and rx->xsk_pool without first disabling NAPI polling:

    err = xdp_rxq_info_reg_mem_model(&rx->xdp_rxq, MEM_TYPE_XSK_BUFF_POOL,
                                     pool);
    if (err) {
        ...
    }

    rx->xsk_pool = pool;

If NAPI receives a packet in the race window, it may initialize the XDP buffer with MEM_TYPE_XSK_BUFF_POOL but allocate memory from the standard page pool because rx->xsk_pool was observed as NULL. When freed, xsk_buff_free() would be incorrectly called on a standard page, causing type confusion and memory corruption.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
author maintainer
#5 lore raw

PATCH v4 3/15 gve: add a few helper functions to set device properties

In reply to Harshitha Ramamurthy

For the mailbox ABI, device properties will come from a different source compared to the AdminQ mode. To accommodate the new source when the mailbox ABI is added, add a few helper functions to set a few device properties. Those functions are:

- gve_set_queue_properties() to set no. of pages for QPL mode and number of queues in general
- gve_set_mtu()
- gve_set_mac()

This is just code movement, no functional change.

---
v4: move mac to a variable to reduce diff for next patch

 drivers/net/ethernet/google/gve/gve_adminq.c | 38 +++------------
 drivers/net/ethernet/google/gve/gve_adminq.h |  7 ++-
 drivers/net/ethernet/google/gve/gve_main.c   | 49 ++++++++++++++++++++
 3 files changed, 62 insertions(+), 32 deletions(-)
drivers/net/ethernet/google/gve/gve_adminq.c +7 -31
index 7e242a0c8edc..8156c6f8c3b0 100644
@@ -920,19 +920,6 @@ int gve_adminq_destroy_rx_queues(struct gve_priv *priv, u32 num_queues)
 	return err;
 }
 
-static void gve_set_default_desc_cnt(struct gve_priv *priv,
-			const struct gve_device_descriptor *descriptor)
-{
-	priv->tx_desc_cnt = be16_to_cpu(descriptor->tx_queue_entries);
-	priv->rx_desc_cnt = be16_to_cpu(descriptor->rx_queue_entries);
-
-	/* set default ranges */
-	priv->max_tx_desc_cnt = priv->tx_desc_cnt;
-	priv->max_rx_desc_cnt = priv->rx_desc_cnt;
-	priv->min_tx_desc_cnt = priv->tx_desc_cnt;
-	priv->min_rx_desc_cnt = priv->rx_desc_cnt;
-}
-
 static void gve_set_default_rss_sizes(struct gve_priv *priv)
 {
 	if (!gve_is_gqi(priv)) {
@@ -1049,8 +1036,6 @@ int gve_adminq_describe_device(struct gve_priv *priv)
 	union gve_adminq_command cmd;
 	dma_addr_t descriptor_bus;
 	int err = 0;
-	u8 *mac;
-	u16 mtu;
 
 	memset(&cmd, 0, sizeof(cmd));
 	descriptor = dma_pool_alloc(priv->adminq_pool, GFP_KERNEL,
@@ -1112,26 +1097,17 @@ int gve_adminq_describe_device(struct gve_priv *priv)
 			 "Driver is running with GQI QPL queue format.\n");
 	}
 
-	/* set default descriptor counts */
-	gve_set_default_desc_cnt(priv, descriptor);
-
 	gve_set_default_rss_sizes(priv);
 
-	priv->max_registered_pages =
-				be64_to_cpu(descriptor->max_registered_pages);
-	mtu = be16_to_cpu(descriptor->mtu);
-	if (mtu < ETH_MIN_MTU) {
-		dev_err(&priv->pdev->dev, "MTU %d below minimum MTU\n", mtu);
-		err = -EINVAL;
+	err = gve_set_mtu(priv, descriptor);
+	if (err)
 		goto free_device_descriptor;
-	}
-	priv->dev->max_mtu = mtu;
+
 	priv->num_event_counters = be16_to_cpu(descriptor->counters);
-	eth_hw_addr_set(priv->dev, descriptor->mac);
-	mac = descriptor->mac;
-	dev_info(&priv->pdev->dev, "MAC addr: %pM\n", mac);
-	priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl);
-	priv->default_num_queues = be16_to_cpu(descriptor->default_num_queues);
+
+	gve_set_mac(priv, descriptor);
+
+	gve_set_queue_properties(priv, descriptor);
 
 	gve_enable_supported_features(priv, supported_features_mask,
 				      dev_op_jumbo_frames, dev_op_dqo_qpl,
drivers/net/ethernet/google/gve/gve_adminq.h +6 -1
index 82b52424a63f..68c63ce75505 100644
@@ -658,5 +658,10 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 				 struct gve_ptype_lut *ptype_lut);
 int gve_set_num_ntfy_blks(struct gve_priv *priv);
 void gve_set_num_queues(struct gve_priv *priv);
-
+void gve_set_queue_properties(struct gve_priv *priv,
+			      struct gve_device_descriptor *descriptor);
+int gve_set_mtu(struct gve_priv *priv,
+		struct gve_device_descriptor *descriptor);
+void gve_set_mac(struct gve_priv *priv,
+		 struct gve_device_descriptor *descriptor);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +49 -0

55 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#6 lore raw

PATCH v4 4/15 gve: add struct gve_device_info to hold device properties

In reply to Harshitha Ramamurthy

In the current AdminQ mode, device properties are written into struct gve_device_descriptor that is allocated in shared memory between the driver and device. In the upcoming MailboxQ mode, these properties will be returned in the response of a mailbox message. Hence, add struct gve_device_info as the structure that holds all the properties that are negotiated with the device in either mode.

Change the AdminQ mode method gve_adminq_describe_device() and its children to fill up device information into this newly introduced struct gve_device_info. Move a few helper functions and code that set device properties in the priv structure into gve_init_priv(). So now gve_init_priv() calls/does the following:

- gve_set_mtu()
- gve_set_mac()
- gve_set_queue_properties()
- gve_set_buf_sizes()
- set flow steering and RSS properties
- set other priv properties

When MailboxQ support is added, device information will be filled into the same structure and the same gve_init_priv() path would be used to set device properties to ensure common code reusage.

These changes are refactors only, no functional change.

---
v4:
- reuse mtu variable
v3:
- Read default_min_ring_size from device info instead of priv

 drivers/net/ethernet/google/gve/gve.h        |  29 +++++
 drivers/net/ethernet/google/gve/gve_adminq.c | 115 +++++++++++--------
 drivers/net/ethernet/google/gve/gve_adminq.h |   6 -
 drivers/net/ethernet/google/gve/gve_main.c   |  86 ++++++++++----
 4 files changed, 160 insertions(+), 76 deletions(-)
drivers/net/ethernet/google/gve/gve.h +29 -0
index c280ff35ee77..021adb9108df 100644
@@ -797,6 +797,34 @@ struct gve_ptp {
 	struct gve_priv *priv;
 };
 
+struct gve_device_info {
+	enum gve_queue_format queue_format;
+	u16 default_tx_queues;
+	u16 default_rx_queues;
+	u16 max_tx_queues;
+	u16 max_rx_queues;
+	u16 default_tx_ring_size;
+	u16 default_rx_ring_size;
+	u16 max_tx_ring_size;
+	u16 max_rx_ring_size;
+	u16 min_tx_ring_size;
+	u16 min_rx_ring_size;
+	u16 max_mtu;
+	u8 mac[ETH_ALEN];
+	u16 max_rx_buffer_size;
+	u16 header_buf_size;
+	u32 max_flow_rules;
+	u16 rss_key_size;
+	u16 rss_lut_size;
+	u16 tx_pages_per_qpl;
+	u16 num_event_counters;
+	u64 max_registered_pages;
+	bool default_min_ring_size;
+	bool nic_timestamp_supported;
+	bool modify_ring_size_enabled;
+	bool cache_rss_config;
+};
+
 struct gve_priv {
 	struct net_device *dev;
 	struct gve_tx_ring *tx; /* array of tx_cfg.num_queues */
@@ -929,6 +957,7 @@ struct gve_priv {
 	struct gve_nic_ts_report *nic_ts_report;
 	dma_addr_t nic_ts_report_bus;
 	u64 last_sync_nic_counter; /* Clock counter from last NIC TS report */
+	struct gve_device_info device_info;
 };
 
 enum gve_service_task_flags_bit {
drivers/net/ethernet/google/gve/gve_adminq.c +69 -46

220 lines not on this page · raw message

drivers/net/ethernet/google/gve/gve_adminq.h +0 -6
index 68c63ce75505..a17af755b454 100644
@@ -658,10 +658,4 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 				 struct gve_ptype_lut *ptype_lut);
 int gve_set_num_ntfy_blks(struct gve_priv *priv);
 void gve_set_num_queues(struct gve_priv *priv);
-void gve_set_queue_properties(struct gve_priv *priv,
-			      struct gve_device_descriptor *descriptor);
-int gve_set_mtu(struct gve_priv *priv,
-		struct gve_device_descriptor *descriptor);
-void gve_set_mac(struct gve_priv *priv,
-		 struct gve_device_descriptor *descriptor);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +62 -24

144 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#7 lore raw

Re: [PATCH net-next v4 04/15] gve: add struct gve_device_info to hold device properties

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The driver ignores the hardware-requested default queue limits and blindly allocates the maximum…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The driver ignores the hardware-requested default queue limits and blindly allocates the maximum number of queues due to an uninitialized variable introduced during refactoring.
- [Low] The conditional assignment of max_rx_buffer_size incorrectly drops valid device limits that are smaller than the driver's default size.
--

--- Patch [4]: [PATCH net-next v4 04/15] gve: add struct gve_device_info to hold device properties --- commit 7fded5d146c6551cb7cea8119862eccd51e6f61f
Author: Harshitha Ramamurthy <[email protected]>

gve: add struct gve_device_info to hold device properties

This commit introduces a new gve_device_info structure to hold negotiated device properties for both AdminQ and upcoming MailboxQ modes. It refactors gve_adminq_describe_device and its children to populate this structure and centralizes device property initialization in gve_init_priv.

Quoted 3 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0

[ ... ]

Quoted 5 lines
drivers/net/ethernet/google/gve/gve_main.c +1 -3
-void gve_set_queue_properties(struct gve_priv *priv,
-			      struct gve_device_descriptor *descriptor)
+static void gve_set_queue_properties(struct gve_priv *priv)
 {
-	/* set default descriptor counts */

drivers/net/ethernet/google/gve/gve_main.c static const struct xdp_metadata_ops gve_xdp_metadata_ops = { · line 2420

Quoted 10 lines
drivers/net/ethernet/google/gve/gve_main.c +4 -4
-	gve_set_default_desc_cnt(priv, descriptor);
+	struct gve_device_info *device_info = &priv->device_info;
 
-	priv->max_registered_pages = be64_to_cpu(descriptor->max_registered_pages);
-	priv->tx_pages_per_qpl = be16_to_cpu(descriptor->tx_pages_per_qpl);
-	priv->default_num_queues = be16_to_cpu(descriptor->default_num_queues);
+	gve_set_desc_cnt(priv);
+	priv->max_registered_pages = device_info->max_registered_pages;
+	priv->tx_pages_per_qpl = device_info->tx_pages_per_qpl;
 }

[Severity: Medium]
Does this leave priv->default_num_queues uninitialized?

The previous code initialized it from the descriptor. The new device_info struct holds default_tx_queues and default_rx_queues, but it appears priv->default_num_queues is no longer being populated.

Because of this, will gve_set_num_queues() bypass device-suggested queue limits and always allocate the maximum possible number of queues since the check for priv->default_num_queues > 0 will fail?

[ ... ]

drivers/net/ethernet/google/gve/gve_main.c static const struct xdp_metadata_ops gve_xdp_metadata_ops = { · line 2453

Quoted 6 lines
drivers/net/ethernet/google/gve/gve_main.c +6 -0
+static void gve_set_buf_sizes(struct gve_priv *priv)
+{
+	struct gve_device_info *device_info = &priv->device_info;
+
+	if (device_info->max_rx_buffer_size > priv->max_rx_buffer_size)
+		priv->max_rx_buffer_size = device_info->max_rx_buffer_size;

[Severity: Low]
Is it intentional to only update priv->max_rx_buffer_size if the device limit is strictly greater than the driver's current default?

The previous implementation in gve_enable_supported_features() applied the device value unconditionally. Does this conditional check discard valid hardware limits if they happen to be smaller than the driver's default size?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
author maintainer
#8 lore raw

PATCH v4 5/15 gve: introduce control plane operations structure

In reply to Harshitha Ramamurthy

To abstract out the difference in implementation of control plane operations between the existing Adminq ABI and the upcoming Mailbox ABI, introduce a new gve_ctrl_ops structure which will contain the basic operations. At probe, these ops will be set based on the ABI and the corresponding ops will be called in relevant places.

As of this patch, only Adminq ops are set. In future patches, corresponding ops will be set for the new mailbox mode.

Implement a ctrl op to map/unmap the doorbell bar. Since this functionality has moved to a control op, call this op after control ops are set for AdminQ mode.

---
 drivers/net/ethernet/google/gve/gve.h        | 11 ++++++
 drivers/net/ethernet/google/gve/gve_adminq.c | 21 ++++++++++++
 drivers/net/ethernet/google/gve/gve_adminq.h |  2 ++
 drivers/net/ethernet/google/gve/gve_main.c   | 36 +++++++++++---------
 4 files changed, 54 insertions(+), 16 deletions(-)
drivers/net/ethernet/google/gve/gve.h +11 -0
index 021adb9108df..56148ea3cfbf 100644
@@ -825,6 +825,16 @@ struct gve_device_info {
 	bool cache_rss_config;
 };
 
+/**
+ * struct gve_ctrl_ops - Control plane operations structure
+ * @map_db_bar: Maps the doorbell BAR for the device and store in @priv.
+ * @unmap_db_bar: Unmaps the doorbell BAR previously mapped by @map_db_bar.
+ */
+struct gve_ctrl_ops {
+	int (*map_db_bar)(struct gve_priv *priv);
+	void (*unmap_db_bar)(struct gve_priv *priv);
+};
+
 struct gve_priv {
 	struct net_device *dev;
 	struct gve_tx_ring *tx; /* array of tx_cfg.num_queues */
@@ -958,6 +968,7 @@ struct gve_priv {
 	dma_addr_t nic_ts_report_bus;
 	u64 last_sync_nic_counter; /* Clock counter from last NIC TS report */
 	struct gve_device_info device_info;
+	const struct gve_ctrl_ops *ctrl_ops;
 };
 
 enum gve_service_task_flags_bit {
drivers/net/ethernet/google/gve/gve_adminq.c +21 -0
index f41b386042e1..fc5482215588 100644
@@ -1632,3 +1632,24 @@ void gve_set_num_queues(struct gve_priv *priv)
 						priv->rx_cfg.num_queues);
 	}
 }
+
+int gve_adminq_map_db_bar(struct gve_priv *priv)
+{
+	struct pci_dev *pdev = priv->pdev;
+	void __iomem *db_bar;
+
+	db_bar = pci_iomap(pdev, GVE_DOORBELL_BAR, 0);
+	if (!db_bar) {
+		dev_err(&pdev->dev, "Failed to map doorbell bar!\n");
+		return -ENOMEM;
+	}
+	priv->db_bar2 = db_bar;
+	return 0;
+}
+
+void gve_adminq_unmap_db_bar(struct gve_priv *priv)
+{
+	struct pci_dev *pdev = priv->pdev;
+
+	pci_iounmap(pdev, priv->db_bar2);
+}
drivers/net/ethernet/google/gve/gve_adminq.h +2 -0
index a17af755b454..93d3cabb67f1 100644
@@ -658,4 +658,6 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 				 struct gve_ptype_lut *ptype_lut);
 int gve_set_num_ntfy_blks(struct gve_priv *priv);
 void gve_set_num_queues(struct gve_priv *priv);
+int gve_adminq_map_db_bar(struct gve_priv *priv);
+void gve_adminq_unmap_db_bar(struct gve_priv *priv);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +20 -16
index 2a5a12f2cbda..27da5e1284ce 100644
@@ -2460,6 +2460,11 @@ static void gve_set_buf_sizes(struct gve_priv *priv)
 		priv->header_buf_size = device_info->header_buf_size;
 }
 
+static const struct gve_ctrl_ops gve_adminq_ops = {
+	.map_db_bar		= gve_adminq_map_db_bar,
+	.unmap_db_bar		= gve_adminq_unmap_db_bar,
+};
+
 static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
 {
 	struct gve_device_info *device_info = &priv->device_info;
@@ -2861,7 +2866,6 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
 	int max_tx_queues, max_rx_queues;
 	struct net_device *dev;
-	__be32 __iomem *db_bar;
 	struct gve_registers __iomem *reg_bar;
 	struct gve_priv *priv;
 	int err;
@@ -2889,13 +2893,6 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 		goto abort_with_pci_region;
 	}
 
-	db_bar = pci_iomap(pdev, GVE_DOORBELL_BAR, 0);
-	if (!db_bar) {
-		dev_err(&pdev->dev, "Failed to map doorbell bar!\n");
-		err = -ENOMEM;
-		goto abort_with_reg_bar;
-	}
-
 	gve_write_version(&reg_bar->driver_version);
 	/* Get max queues to alloc etherdev */
 	max_tx_queues = ioread32be(&reg_bar->max_tx_queues);
@@ -2905,7 +2902,7 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (!dev) {
 		dev_err(&pdev->dev, "could not allocate netdev\n");
 		err = -ENOMEM;
-		goto abort_with_db_bar;
+		goto abort_with_reg_bar;
 	}
 	SET_NETDEV_DEV(dev, &pdev->dev);
 	pci_set_drvdata(pdev, dev);
@@ -2937,19 +2934,27 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	priv->pdev = pdev;
 	priv->msg_enable = DEFAULT_MSG_LEVEL;
 	priv->reg_bar0 = reg_bar;
-	priv->db_bar2 = db_bar;
 	priv->service_task_flags = 0x0;
 	priv->state_flags = 0x0;
 	priv->ethtool_flags = 0x0;
 	priv->rx_cfg.packet_buffer_size = GVE_DEFAULT_RX_BUFFER_SIZE;
 	priv->max_rx_buffer_size = GVE_DEFAULT_RX_BUFFER_SIZE;
 
+	/* Set adminq ctrl ops */
+	priv->ctrl_ops = &gve_adminq_ops;
+
+	err = priv->ctrl_ops->map_db_bar(priv);
+	if (err) {
+		err = -ENOMEM;
+		goto abort_with_netdev;
+	}
+
 	gve_set_probe_in_progress(priv);
 	priv->gve_wq = alloc_ordered_workqueue("gve", 0);
 	if (!priv->gve_wq) {
 		dev_err(&pdev->dev, "Could not allocate workqueue");
 		err = -ENOMEM;
-		goto abort_with_netdev;
+		goto abort_with_unmap_db_bar;
 	}
 	INIT_WORK(&priv->service_task, gve_service_task);
 	INIT_WORK(&priv->stats_report_task, gve_stats_report_task);
@@ -2979,12 +2984,12 @@ static int gve_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 abort_with_wq:
 	destroy_workqueue(priv->gve_wq);
 
+abort_with_unmap_db_bar:
+	priv->ctrl_ops->unmap_db_bar(priv);
+
 abort_with_netdev:
 	free_netdev(dev);
 
-abort_with_db_bar:
-	pci_iounmap(pdev, db_bar);
-
 abort_with_reg_bar:
 	pci_iounmap(pdev, reg_bar);
 
@@ -3000,14 +3005,13 @@ static void gve_remove(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct gve_priv *priv = netdev_priv(netdev);
-	__be32 __iomem *db_bar = priv->db_bar2;
 	void __iomem *reg_bar = priv->reg_bar0;
 
 	unregister_netdev(netdev);
 	gve_teardown_priv_resources(priv);
 	destroy_workqueue(priv->gve_wq);
+	priv->ctrl_ops->unmap_db_bar(priv);
 	free_netdev(netdev);
-	pci_iounmap(pdev, db_bar);
 	pci_iounmap(pdev, reg_bar);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#9 lore raw

Re: [PATCH net-next v4 05/15] gve: introduce control plane operations structure

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Workqueue flushed after private resources are freed, leading to memory leaks and Use-After-Free. --

--- Patch [5]: [PATCH net-next v4 05/15] gve: introduce control plane operations structure --- commit 21d462ce52db670852717f6c821149b6dd730ea9
Author: Harshitha Ramamurthy <[email protected]>

gve: introduce control plane operations structure

To abstract out the difference in implementation of control plane operations between the existing Adminq ABI and the upcoming Mailbox ABI, introduce a new gve_ctrl_ops structure which will contain the basic operations.

Quoted 3 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0

[ ... ]

Quoted 6 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -1
@@ -3000,14 +3005,13 @@ static void gve_remove(struct pci_dev *pdev)
 {
 	struct net_device *netdev = pci_get_drvdata(pdev);
 	struct gve_priv *priv = netdev_priv(netdev);
-	__be32 __iomem *db_bar = priv->db_bar2;
 	void __iomem *reg_bar = priv->reg_bar0;

drivers/net/ethernet/google/gve/gve_main.c static void gve_remove(struct pci_dev *pdev) · line 3017

Quoted 10 lines
drivers/net/ethernet/google/gve/gve_main.c +1 -1
 
 	unregister_netdev(netdev);
 	gve_teardown_priv_resources(priv);
 	destroy_workqueue(priv->gve_wq);
+	priv->ctrl_ops->unmap_db_bar(priv);
 	free_netdev(netdev);
-	pci_iounmap(pdev, db_bar);
 	pci_iounmap(pdev, reg_bar);
 	pci_release_regions(pdev);
 	pci_disable_device(pdev);

[Severity: High]
This is a pre-existing issue, but is it possible that tearing down private resources before destroying the workqueue causes memory leaks and a use after free?

If a service task is pending during gve_remove() and a reset was requested via management IRQ, destroy_workqueue() will flush and execute it.

The service task executes gve_reset() which can re-allocate resources and re-register MSI-X interrupts.

Since gve_teardown_priv_resources() has already run, these newly allocated resources won't be torn down before free_netdev() frees the priv pointer.

If the active MSI-X interrupt fires afterwards, would the interrupt handler end up accessing the freed priv pointer?

It looks like this same ordering issue also exists in the probe error handling path.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
author maintainer
#10 lore raw

PATCH v4 6/15 gve: introduce ctrl ops to set vectors and Qs

In reply to Harshitha Ramamurthy

Introduce following ctrl ops for Adminq mode.

- set_num_queues to set maximum and default TX/RX queues in the alloc structures used in the initialization flow.
- set_num_ntfy_blks op to set number of vectors(ntfy_blks) in the initialization flow.

This is done by attaching the adminq_ prefix to the existing functions placed in the gve_adminq.c file.

---
v4: Attach 'adminq_' prefix in the function names for gve_set_num_queues
and gve_set_num_ntfy_blks and set them as ops (Przemek Kitszel)

 drivers/net/ethernet/google/gve/gve.h        | 6 ++++++
 drivers/net/ethernet/google/gve/gve_adminq.c | 4 ++--
 drivers/net/ethernet/google/gve/gve_adminq.h | 4 ++--
 drivers/net/ethernet/google/gve/gve_main.c   | 6 ++++--
 4 files changed, 14 insertions(+), 6 deletions(-)
drivers/net/ethernet/google/gve/gve.h +6 -0
index 56148ea3cfbf..1bc5e32b6618 100644
@@ -829,10 +829,16 @@ struct gve_device_info {
  * struct gve_ctrl_ops - Control plane operations structure
  * @map_db_bar: Maps the doorbell BAR for the device and store in @priv.
  * @unmap_db_bar: Unmaps the doorbell BAR previously mapped by @map_db_bar.
+ * @set_num_queues: Sets default and max TX/RX queues into allocation
+ *                  structures stored in @priv to be used during initialization.
+ * @set_num_ntfy_blks: Sets no. of vectors into @priv to be used during
+ *                     initialization.
  */
 struct gve_ctrl_ops {
 	int (*map_db_bar)(struct gve_priv *priv);
 	void (*unmap_db_bar)(struct gve_priv *priv);
+	void (*set_num_queues)(struct gve_priv *priv);
+	int (*set_num_ntfy_blks)(struct gve_priv *priv);
 };
 
 struct gve_priv {
drivers/net/ethernet/google/gve/gve_adminq.c +2 -2
index fc5482215588..d0b7ce8ff4c5 100644
@@ -1592,7 +1592,7 @@ int gve_adminq_query_rss_config(struct gve_priv *priv, struct ethtool_rxfh_param
 	return err;
 }
 
-int gve_set_num_ntfy_blks(struct gve_priv *priv)
+int gve_adminq_set_num_ntfy_blks(struct gve_priv *priv)
 {
 	int num_ntfy;
 
@@ -1616,7 +1616,7 @@ int gve_set_num_ntfy_blks(struct gve_priv *priv)
 	return 0;
 }
 
-void gve_set_num_queues(struct gve_priv *priv)
+void gve_adminq_set_num_queues(struct gve_priv *priv)
 {
 	priv->tx_cfg.max_queues =
 		min_t(int, priv->tx_cfg.max_queues, priv->num_ntfy_blks / 2);
drivers/net/ethernet/google/gve/gve_adminq.h +2 -2
index 93d3cabb67f1..ed3504853908 100644
@@ -656,8 +656,8 @@ int gve_adminq_report_nic_ts(struct gve_priv *priv,
 struct gve_ptype_lut;
 int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 				 struct gve_ptype_lut *ptype_lut);
-int gve_set_num_ntfy_blks(struct gve_priv *priv);
-void gve_set_num_queues(struct gve_priv *priv);
+int gve_adminq_set_num_ntfy_blks(struct gve_priv *priv);
+void gve_adminq_set_num_queues(struct gve_priv *priv);
 int gve_adminq_map_db_bar(struct gve_priv *priv);
 void gve_adminq_unmap_db_bar(struct gve_priv *priv);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +4 -2
index 27da5e1284ce..37eed00c4ed1 100644
@@ -2463,6 +2463,8 @@ static void gve_set_buf_sizes(struct gve_priv *priv)
 static const struct gve_ctrl_ops gve_adminq_ops = {
 	.map_db_bar		= gve_adminq_map_db_bar,
 	.unmap_db_bar		= gve_adminq_unmap_db_bar,
+	.set_num_queues		= gve_adminq_set_num_queues,
+	.set_num_ntfy_blks	= gve_adminq_set_num_ntfy_blks,
 };
 
 static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
@@ -2501,14 +2503,14 @@ static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device)
 
 	priv->queue_format = priv->device_info.queue_format;
 
-	err = gve_set_num_ntfy_blks(priv);
+	err = priv->ctrl_ops->set_num_ntfy_blks(priv);
 	if (err) {
 		dev_err(&priv->pdev->dev,
 			"Could not setup notify blocks: err=%d\n", err);
 		goto err;
 	}
 
-	gve_set_num_queues(priv);
+	priv->ctrl_ops->set_num_queues(priv);
 	dev_info(&priv->pdev->dev, "TX queues %d, RX queues %d\n",
 		 priv->tx_cfg.num_queues, priv->rx_cfg.num_queues);
 	dev_info(&priv->pdev->dev, "Max TX queues %d, Max RX queues %d\n",
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#11 lore raw

Re: [PATCH net-next v4 06/15] gve: introduce ctrl ops to set vectors and Qs

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Refactoring of device info leaves `priv->default_num_queues` uninitialized, bypassing the…

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Refactoring of device info leaves priv->default_num_queues uninitialized, bypassing the device's suggested queue limits. --

--- Patch [6]: [PATCH net-next v4 06/15] gve: introduce ctrl ops to set vectors and Qs --- commit 69a42c3a205dae467269f4679a52b92e85d73da9
Author: Harshitha Ramamurthy <[email protected]>

gve: introduce ctrl ops to set vectors and Qs

This patch introduces control operations for Adminq mode by attaching the adminq_ prefix to the existing functions placed in the gve_adminq.c file. It adds set_num_queues and set_num_ntfy_blks to the control operations to set maximum and default TX/RX queues in the initialization flow.

drivers/net/ethernet/google/gve/gve_adminq.c int gve_set_num_ntfy_blks(struct gve_priv *priv) · line 1622

Quoted 13 lines
drivers/net/ethernet/google/gve/gve_adminq.c +1 -1
index fc5482215588a..d0b7ce8ff4c5f 100644
@@ -1616,7 +1616,7 @@ int gve_set_num_ntfy_blks(struct gve_priv *priv)
 	return 0;
 }
 
-void gve_set_num_queues(struct gve_priv *priv)
+void gve_adminq_set_num_queues(struct gve_priv *priv)
 {
 	priv->tx_cfg.max_queues =
 		min_t(int, priv->tx_cfg.max_queues, priv->num_ntfy_blks / 2);

[Severity: Medium]
Are we certain priv->default_num_queues is properly initialized before being used further down in this function?

Looking at device probe initialization, it appears a prior refactoring parses the device descriptor into priv->device_info.default_tx_queues via gve_fill_device_info(), but the explicit assignment to priv->default_num_queues was removed:

drivers/net/ethernet/google/gve/gve_adminq.c:gve_fill_device_info() {
	...
	default_num_queues = be16_to_cpu(descriptor->default_num_queues);
	device_info->default_tx_queues = default_num_queues;
	device_info->default_rx_queues = default_num_queues;
	...
}

Because priv->default_num_queues evaluates to 0, does this check fail in gve_adminq_set_num_queues():

drivers/net/ethernet/google/gve/gve_adminq.c:gve_adminq_set_num_queues() {
	...
	if (priv->default_num_queues > 0) {
		priv->tx_cfg.num_queues = min_t(int, priv->default_num_queues,
						priv->tx_cfg.num_queues);
	...
}

Would this unconditionally allocate the absolute maximum number of queues available (up to priv->num_ntfy_blks / 2) and completely bypass the default limits suggested by the hardware?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
author maintainer
#12 lore raw

PATCH v4 7/15 gve: introduce gve_adminq_get_device_properties()

In reply to Harshitha Ramamurthy

Introduce gve_adminq_get_device_properties() which executes the first two Adminq commands: VERIFY_DRIVER_COMPATIBILITY and DESCRIBE_DEVICE so that this can be called during initialization.

Move these to Adminq specific files. This is just code movement, no functional change.

---
Changes v3:
- move patch down so that the function is introduced just before usage
- mark function as maybe_unused
- update commit message

 drivers/net/ethernet/google/gve/gve.h        |  2 +
 drivers/net/ethernet/google/gve/gve_adminq.c | 66 ++++++++++++++++++--
 drivers/net/ethernet/google/gve/gve_adminq.h |  5 +-
 drivers/net/ethernet/google/gve/gve_main.c   | 46 +-------------
 4 files changed, 65 insertions(+), 54 deletions(-)
drivers/net/ethernet/google/gve/gve.h +2 -0
index 1bc5e32b6618..d6e7ab0649ac 100644
@@ -16,6 +16,8 @@
 #include <linux/timer.h>
 #include <linux/ptp_clock_kernel.h>
 #include <linux/u64_stats_sync.h>
+#include <linux/utsname.h>
+#include <linux/version.h>
 #include <net/page_pool/helpers.h>
 #include <net/xdp.h>
 
drivers/net/ethernet/google/gve/gve_adminq.c +60 -6

86 lines not on this page · raw message

drivers/net/ethernet/google/gve/gve_adminq.h +2 -3
index ed3504853908..2ab68c822e22 100644
@@ -640,9 +640,8 @@ int gve_adminq_register_page_list(struct gve_priv *priv,
 int gve_adminq_unregister_page_list(struct gve_priv *priv, u32 page_list_id);
 int gve_adminq_report_stats(struct gve_priv *priv, u64 stats_report_len,
 			    dma_addr_t stats_report_addr, u64 interval);
-int gve_adminq_verify_driver_compatibility(struct gve_priv *priv,
-					   u64 driver_info_len,
-					   dma_addr_t driver_info_addr);
+int gve_adminq_verify_driver_compatibility(struct gve_priv *priv);
+int gve_adminq_get_device_properties(struct gve_priv *priv);
 int gve_adminq_report_link_speed(struct gve_priv *priv);
 int gve_adminq_add_flow_rule(struct gve_priv *priv, struct gve_adminq_flow_rule *rule, u32 loc);
 int gve_adminq_del_flow_rule(struct gve_priv *priv, u32 loc);
drivers/net/ethernet/google/gve/gve_main.c +1 -45

64 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#13 lore raw

PATCH v4 8/15 gve: refactor gve_init_priv for reset path

In reply to Harshitha Ramamurthy

The driver does not need to renegotiate all properties with the device on a reset since those should stay constant through a reset. Hence change gve_init_priv() into a method that only sets these properties into the priv structure and hence needs to be only called once during gve_probe().

To achieve this end state of gve_init_priv(), do the following:
- introduce gve_adminq_init() which writes the driver version register and allocates the AdminQ and call it in gve_probe()
- call gve_adminq_get_device_properties() into gve_probe() to learn device properties
- introduce gve_setup_device() which deals with device setup logic and call it in gve_probe()
- resetting no. of registered pages is moved into gve_setup_device() since that needs to be reset every time queues are re-created.

With these changes, gve_adminq_get_device_properties() and gve_init_priv() are only called once during gve_probe. gve_reset_recovery() now calls targeted setup functions directly.

This prepares the driver to add mailbox mode's control plane initialization and device properties negotiation in the same place as is done in AdminQ mode in the upcoming patches when adding the mailbox ABI.

These changes are only code movement, no functional change.

---
v3:
- gve_reset_recovery also calls verify driver compatibility
- don't free device resources if gve_open() fails in the reset path
- move resetting no. of registered pages to gve_setup_device()

 drivers/net/ethernet/google/gve/gve.h        |   2 +
 drivers/net/ethernet/google/gve/gve_adminq.c |  12 +-
 drivers/net/ethernet/google/gve/gve_adminq.h |   2 +-
 drivers/net/ethernet/google/gve/gve_main.c   | 146 ++++++++++---------
 4 files changed, 95 insertions(+), 67 deletions(-)
drivers/net/ethernet/google/gve/gve.h +2 -0
index d6e7ab0649ac..143c666fcebd 100644
@@ -1255,6 +1255,8 @@ static inline bool gve_is_clock_enabled(struct gve_priv *priv)
 	return priv->nic_ts_report;
 }
 
+void gve_adminq_write_version(u8 __iomem *driver_version_register);
+
 /* gqi napi handler defined in gve_main.c */
 int gve_napi_poll(struct napi_struct *napi, int budget);
 
drivers/net/ethernet/google/gve/gve_adminq.c +11 -1
index bdac2dd9b86a..fda752f09a66 100644
@@ -296,8 +296,10 @@ gve_process_device_options(struct gve_priv *priv,
 	return 0;
 }
 
-int gve_adminq_alloc(struct device *dev, struct gve_priv *priv)
+static int gve_adminq_alloc(struct gve_priv *priv)
 {
+	struct device *dev = &priv->pdev->dev;
+
 	priv->adminq_pool = dma_pool_create("adminq_pool", dev,
 					    GVE_ADMINQ_BUFFER_SIZE, 0, 0);
 	if (unlikely(!priv->adminq_pool))
@@ -353,6 +355,14 @@ int gve_adminq_alloc(struct device *dev, struct gve_priv *priv)
 	return 0;
 }
 
+int gve_adminq_init(struct gve_priv *priv)
+{
+	struct gve_registers __iomem *reg_bar = priv->reg_bar0;
+
+	gve_adminq_write_version(&reg_bar->driver_version);
+	return gve_adminq_alloc(priv);
+}
+
 void gve_adminq_release(struct gve_priv *priv)
 {
 	int i = 0;
drivers/net/ethernet/google/gve/gve_adminq.h +1 -1
index 2ab68c822e22..78eee3b5cb7f 100644
@@ -619,7 +619,7 @@ union gve_adminq_command {
 
 static_assert(sizeof(union gve_adminq_command) == 64);
 
-int gve_adminq_alloc(struct device *dev, struct gve_priv *priv);
+int gve_adminq_init(struct gve_priv *priv);
 void gve_adminq_free(struct gve_priv *priv);
 void gve_adminq_release(struct gve_priv *priv);
 int gve_adminq_describe_device(struct gve_priv *priv);
drivers/net/ethernet/google/gve/gve_main.c +81 -65

232 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#14 lore raw

Re: [PATCH net-next v4 08/15] gve: refactor gve_init_priv for reset path

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

Pre-existing issues:
- [High] AF_XDP socket pool bindings are silently detached and forgotten upon driver reset.
- [High] Background tasks (stats_report_task, service_task) are not canceled before the resources they depend on are freed, leading to a Use-After-Free and kernel panic.
- [High] Null Pointer Dereference in gve_xsk_pool_enable and gve_xsk_pool_disable if device setup fails.
--

--- Patch [8]: [PATCH net-next v4 08/15] gve: refactor gve_init_priv for reset path --- commit eabed5dc37b0260679aedc435501a49d2e938fb5
Author: Harshitha Ramamurthy <[email protected]>

gve: refactor gve_init_priv for reset path

The driver does not need to renegotiate all properties with the device on a reset since those should stay constant through a reset. Hence change gve_init_priv() into a method that only sets these properties into the priv structure and hence needs to be only called once during gve_probe().

Quoted 2 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0

[ ... ]

drivers/net/ethernet/google/gve/gve_main.c static void gve_set_buf_sizes(struct gve_priv *priv) · line 2425

Quoted 7 lines
drivers/net/ethernet/google/gve/gve_main.c +7 -0
+static int gve_setup_device(struct gve_priv *priv)
+{
+	int err;
+
+	priv->num_registered_pages = 0;
+
+	priv->xsk_pools = bitmap_zalloc(priv->rx_cfg.max_queues, GFP_KERNEL);

[Severity: High]
This isn't a bug introduced by this patch, but does this allocation silently detach and forget existing AF_XDP socket pool bindings upon a driver reset?

If a driver reset occurs, for example due to a Tx timeout, the recovery path calls gve_setup_device() which unconditionally allocates a new, zeroed xsk_pools bitmap.

When queues restart, gve_reg_xdp_info() will find no registered pools and configure the hardware for standard traffic instead of zero-copy. Could this cause existing AF_XDP applications to stop receiving and sending packets without notification?

Quoted 8 lines
drivers/net/ethernet/google/gve/gve_main.c +8 -0
+	if (!priv->xsk_pools) {
+		err = -ENOMEM;
+		goto err;
+	}
+
+	gve_set_netdev_xdp_features(priv);
+	if (!gve_is_gqi(priv))
+		priv->dev->xdp_metadata_ops = &gve_xdp_metadata_ops;

drivers/net/ethernet/google/gve/gve_main.c static void gve_set_buf_sizes(struct gve_priv *priv) · line 2443

Quoted 10 lines
drivers/net/ethernet/google/gve/gve_main.c +10 -0
+
+	err = gve_setup_device_resources(priv);
+	if (err)
+		goto err_free_xsk_bitmap;
+
+	return 0;
+
+err_free_xsk_bitmap:
+	bitmap_free(priv->xsk_pools);
+	priv->xsk_pools = NULL;

[Severity: High]
This is a pre-existing issue, but can this lead to a NULL pointer dereference if the device setup fails?

If gve_setup_device() fails during a reset recovery and frees the bitmap, xsk_pools is set to NULL. If a privileged user then attempts to attach or detach an AF_XDP socket before the device is fully recovered:

gve_xsk_pool_enable()

    set_bit(qid, priv->xsk_pools);

Would this unconditionally dereference the NULL priv->xsk_pools pointer?

Quoted 3 lines
drivers/net/ethernet/google/gve/gve_main.c +3 -0
+err:
+	return err;
+}

[ ... ]

drivers/net/ethernet/google/gve/gve_main.c static int gve_init_priv(struct gve_priv *priv, bool skip_describe_device) · line 2518

Quoted 9 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -6
-err_free_xsk_bitmap:
-	bitmap_free(priv->xsk_pools);
-	priv->xsk_pools = NULL;
-err:
-	gve_adminq_free(priv);
-	return err;
 }
 
 static void gve_teardown_priv_resources(struct gve_priv *priv)

[Severity: High]
This is a pre-existing issue not touched by this patch, but does the driver have a use-after-free during module removal?

In gve_remove(), gve_teardown_priv_resources() is called before destroy_workqueue(). This frees priv->stats_report.

Because the driver does not cancel the background tasks before freeing these resources, if stats_report_task is queued, destroy_workqueue() will flush and execute it. Could this cause gve_handle_report_stats() to dereference the freed stats_report pointer and panic?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
author maintainer
#15 lore raw

PATCH v4 9/15 gve: simplify reset logic

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Current GVE reset logic is quite complex, with a number of methods with similar names and functionalities. This complexity has allowed a number of bugs to enter the reset/recovery path, including the potential for reset loops if an operation fails during teardown.

Simplify the reset path by doing the following:
1) Removing recursive resets. Recursive resets have two major issues. First, there is the potential for stack overflows if resets are invoked too many times in a row. Second, long recursive calls mean that GVE never gives up the RTNL lock, or at the very least holds it for too long. If a reset must occur anywhere during the reset/recovery path, it should be scheduled as a separate task.
2) Removing resets during teardown. This is partly covered by removing recursive resets, but the primary goal in this case is to ensure that the driver is capable of actually executing a hardware reset if something goes wrong with a control plane operation. As it stands, if deconfigure_device_resources fails, for example, GVE will preempt its reset with another reset without actually invoking a hardware reset, which could actually help with recovery.
3) Decompose allocation/de-allocation and setup/teardown. Performing allocation and setup for each control plane system (RSS, ptype map, etc) leaves many more error conditions to handle, causing teardown in the case of failures to be much more complex than they need to be. This will also be useful to better align a major behavioral change in mailbox mode, which will use separate response buffers instead to get data from the device instead of a pre-allocated shared memory region.

With the new reset functionality, shared resources between the device and driver are not freed until after the hardware reset has completed in the event that deconfigure_device_resources fails, meaning that the device could potentially still be holding on to shared memory.

---
v4:
- fix kdoc formatting for gve_teardown_control_plane_resources
- ignore management interrupt if device is not okay

v3:
- only reset when failing to program flow rules as ethtool op
- don't attempt to teardown rings in reset path if AQ is not allocated
- fix work queue semantics related to management IRQ handler

v2:
- Fixed typos in commit message (recursive, preempt)
- Fixed a kdoc warning

 drivers/net/ethernet/google/gve/gve.h         |   2 +-
 drivers/net/ethernet/google/gve/gve_adminq.c  |   9 +-
 drivers/net/ethernet/google/gve/gve_adminq.h  |   1 -
 drivers/net/ethernet/google/gve/gve_ethtool.c |   2 +-
 .../net/ethernet/google/gve/gve_flow_rule.c   |  15 +-
 drivers/net/ethernet/google/gve/gve_main.c    | 359 +++++++++---------
 6 files changed, 204 insertions(+), 184 deletions(-)
drivers/net/ethernet/google/gve/gve.h +1 -1
index 143c666fcebd..7d40267b0672 100644
@@ -1350,7 +1350,7 @@ struct page_pool *gve_rx_create_page_pool(struct gve_priv *priv,
 
 /* Reset */
 void gve_schedule_reset(struct gve_priv *priv);
-int gve_reset(struct gve_priv *priv, bool attempt_teardown);
+int gve_reset(struct gve_priv *priv, bool skip_queue_setup);
 void gve_get_curr_alloc_cfgs(struct gve_priv *priv,
 			     struct gve_tx_alloc_rings_cfg *tx_alloc_cfg,
 			     struct gve_rx_alloc_rings_cfg *rx_alloc_cfg);
drivers/net/ethernet/google/gve/gve_adminq.c +2 -7
index fda752f09a66..7e5a6f4110db 100644
@@ -363,7 +363,7 @@ int gve_adminq_init(struct gve_priv *priv)
 	return gve_adminq_alloc(priv);
 }
 
-void gve_adminq_release(struct gve_priv *priv)
+static void gve_adminq_release(struct gve_priv *priv)
 {
 	int i = 0;
 
@@ -392,7 +392,6 @@ void gve_adminq_release(struct gve_priv *priv)
 	}
 	gve_clear_device_rings_ok(priv);
 	gve_clear_device_resources_ok(priv);
-	gve_clear_admin_queue_ok(priv);
 }
 
 void gve_adminq_free(struct gve_priv *priv)
@@ -1375,12 +1374,8 @@ gve_adminq_configure_flow_rule(struct gve_priv *priv,
 			sizeof(struct gve_adminq_configure_flow_rule),
 			flow_rule_cmd);
 
-	if (err == -ETIME) {
-		dev_err(&priv->pdev->dev, "Timeout to configure the flow rule, trigger reset");
-		gve_reset(priv, true);
-	} else if (!err) {
+	if (!err)
 		priv->flow_rules_cache.rules_cache_synced = false;
-	}
 
 	return err;
 }
drivers/net/ethernet/google/gve/gve_adminq.h +0 -1
index 78eee3b5cb7f..fe1e8868cdfe 100644
@@ -621,7 +621,6 @@ static_assert(sizeof(union gve_adminq_command) == 64);
 
 int gve_adminq_init(struct gve_priv *priv);
 void gve_adminq_free(struct gve_priv *priv);
-void gve_adminq_release(struct gve_priv *priv);
 int gve_adminq_describe_device(struct gve_priv *priv);
 int gve_adminq_configure_device_resources(struct gve_priv *priv,
 					  dma_addr_t counter_array_bus_addr,
drivers/net/ethernet/google/gve/gve_ethtool.c +1 -1
index 8199738ba979..dd1c44fedc77 100644
@@ -651,7 +651,7 @@ static int gve_user_reset(struct net_device *netdev, u32 *flags)
 
 	if (*flags == ETH_RESET_ALL) {
 		*flags = 0;
-		return gve_reset(priv, true);
+		return gve_reset(priv, false);
 	}
 
 	return -EOPNOTSUPP;
drivers/net/ethernet/google/gve/gve_flow_rule.c +14 -1
index 2c80cda28ef3..fae552f4ad6f 100644
@@ -278,6 +278,11 @@ int gve_add_flow_rule(struct gve_priv *priv, struct ethtool_rxnfc *cmd)
 		goto out;
 
 	err = gve_adminq_add_flow_rule(priv, rule, fsp->location);
+	if (err == -ETIME) {
+		dev_err(&priv->pdev->dev,
+			"Timeout to add flow rule, trigger reset.");
+		gve_reset(priv, false);
+	}
 
 out:
 	kvfree(rule);
@@ -290,9 +295,17 @@ int gve_add_flow_rule(struct gve_priv *priv, struct ethtool_rxnfc *cmd)
 int gve_del_flow_rule(struct gve_priv *priv, struct ethtool_rxnfc *cmd)
 {
 	struct ethtool_rx_flow_spec *fsp = (struct ethtool_rx_flow_spec *)&cmd->fs;
+	int err;
 
 	if (!priv->max_flow_rules)
 		return -EOPNOTSUPP;
 
-	return gve_adminq_del_flow_rule(priv, fsp->location);
+	err = gve_adminq_del_flow_rule(priv, fsp->location);
+	if (err == -ETIME) {
+		dev_err(&priv->pdev->dev,
+			"Timeout to delete flow rule, trigger reset.");
+		gve_reset(priv, false);
+	}
+
+	return err;
 }
drivers/net/ethernet/google/gve/gve_main.c +186 -173

583 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#16 lore raw

Re: [PATCH net-next v4 09/15] gve: simplify reset logic

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] Dangling pointers for `priv->tx` and `priv->rx` are left behind if `gve_create_rings()` fails…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Dangling pointers for priv->tx and priv->rx are left behind if gve_create_rings() fails during interface open, leading to a Use-After-Free.
- [High] The gve_recover function unconditionally forces the service_task work item to become enabled, breaking synchronization guarantees in power management and teardown paths and leading to a WARN_ON_ONCE or hardware fault. --

--- Patch [9]: [PATCH net-next v4 09/15] gve: simplify reset logic --- commit 49cb37f017cb334dfcf8209cde2a7c5d05f9e88e
Author: Joshua Washington <[email protected]>
Subject: gve: simplify reset logic

This commit simplifies the reset logic in the GVE driver by removing recursive resets and restructuring the teardown and deallocation steps. It ensures that the driver can execute a hardware reset even if control plane operations fail, and consolidates the recovery path.

Quoted 23 lines
drivers/net/ethernet/google/gve/gve_main.c +18 -0
@@ -2515,93 +2543,81 @@ static int gve_init_priv(struct gve_priv *priv)
[ ... ]
+static int gve_recover(struct gve_priv *priv, bool setup_queues)
+{
+	bool service_task_enabled = false;
+	int err;
+
+	err = gve_adminq_init(priv);
+	if (err) {
+		dev_err(&priv->pdev->dev,
+			"Failed to alloc admin queue: err=%d\n", err);
+		goto teardown_device;
+	}
+
+	err = gve_adminq_verify_driver_compatibility(priv);
+	if (err) {
+		dev_err(&priv->pdev->dev,
+			"Could not verify driver compatibility: err=%d\n", err);
+		goto teardown_device;
+	}

drivers/net/ethernet/google/gve/gve_main.c static int gve_init_priv(struct gve_priv *priv)

Quoted 10 lines
drivers/net/ethernet/google/gve/gve_main.c +10 -0
+
+	err = gve_setup_device(priv);
+	if (err)
+		goto teardown_device;
+
+	/* In the case of cascading failures, the disable count could be greater
+	 * than 1. The service task must be enabled before starting queues.
+	 */
+	while (!service_task_enabled)
+		service_task_enabled = enable_work(&priv->service_task);

[Severity: High]
Does this loop risk breaking the synchronization guarantees of power management callbacks?

Functions like gve_suspend(), gve_shutdown(), and gve_remove() explicitly synchronize and disable the background work by calling disable_work_sync() to ensure the task does not execute while hardware resources are unavailable:

gve_suspend() {
    disable_work_sync(&priv->service_task);
    ...
    if (was_up)
        gve_close(priv->dev);
    ...
}

If gve_close() fails during one of these callbacks (for example, due to an adminq timeout), it triggers a fallback to gve_reset() which in turn calls gve_recover(). Won't this loop unconditionally undo the intentional disable_work_sync(), leaving the device in suspend or shutdown with the service task fully active?

Additionally, on the subsequent gve_resume(), gve_recover() is called again. Since the disable depth would already be 0, wouldn't calling enable_work() here trigger a WARN_ON_ONCE(!offqd->disable) in the core workqueue subsystem?

drivers/net/ethernet/google/gve/gve_main.c static int gve_init_priv(struct gve_priv *priv)

Quoted 3 lines
drivers/net/ethernet/google/gve/gve_main.c +3 -0
+
+	if (setup_queues) {
+		err = gve_open(priv->dev);

[Severity: High]
If gve_create_rings() fails during this nested gve_open() call, could it leave dangling pointers for priv->tx and priv->rx?

When gve_create_rings() fails during an initial gve_open(), it triggers gve_reset(). Because the interface is marked as starting, gve_reset() performs cleanup via gve_queues_mem_remove() (which properly nullifies priv->tx and priv->rx) and then calls gve_recover() to restart the queues.

Inside gve_recover(), this nested call to gve_open() allocates new ring memory and updates the priv->tx and priv->rx pointers. If queue creation fails again, gve_queues_start() detects that reset_in_progress is true (set by the outer gve_reset) and jumps to the stop_and_free_rings label:

gve_queues_start() {
...
stop_and_free_rings:

    gve_tx_stop_rings(priv, gve_num_tx_queues(priv));
    gve_rx_stop_rings(priv, priv->rx_cfg.num_queues);
free_rings:
    gve_queues_mem_free(priv, tx_alloc_cfg, rx_alloc_cfg);
    return err;
}

The stop_and_free_rings path frees the memory using gve_queues_mem_free(), but doesn't appear to nullify priv->tx and priv->rx like gve_queues_mem_remove() does. Could this lead to a use-after-free if another context like ethtool -S checks if (priv->tx) and dereferences these pointers?

Quoted 5 lines
drivers/net/ethernet/google/gve/gve_main.c +5 -0
+		if (err)
+			goto disable_work;
+	}
+
+	return 0;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=9
author maintainer
#17 lore raw

PATCH v4 10/15 gve: add gve_ctrl_ops for gve initialization/teardown sequences

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Driver initialization and teardown involve a number of control plane operations that need to be defined for gve_probe to operate in both mailbox and adminq modes. This list includes:

- get_ptype_map: a mapping of packet types (L3+L4) held in RX completion descriptors
- configure_rss: set up default RSS configuration if the device is not queryable
- setup_stats_report: set up DMA region for stats report (AQ-only)
- reset_flow_rules: needed in teardown; flushes all flow rules from device

---
 drivers/net/ethernet/google/gve/gve.h        | 12 ++++++++++
 drivers/net/ethernet/google/gve/gve_adminq.c |  7 +++---
 drivers/net/ethernet/google/gve/gve_adminq.h |  3 +--
 drivers/net/ethernet/google/gve/gve_main.c   | 24 +++++++++++++++-----
 4 files changed, 34 insertions(+), 12 deletions(-)
drivers/net/ethernet/google/gve/gve.h +12 -0
index 7d40267b0672..c65c7d264430 100644
@@ -835,12 +835,24 @@ struct gve_device_info {
  *                  structures stored in @priv to be used during initialization.
  * @set_num_ntfy_blks: Sets no. of vectors into @priv to be used during
  *                     initialization.
+ * @get_ptype_map: Learn packet type map from device and store it in @priv
+ * @configure_rss: Set up default RSS configuration
+ * @setup_stats_report: Set up DMA region for stats report (AdminQ only)
+ * @reset_flow_rules: Flush all flow rules from device
  */
 struct gve_ctrl_ops {
 	int (*map_db_bar)(struct gve_priv *priv);
 	void (*unmap_db_bar)(struct gve_priv *priv);
 	void (*set_num_queues)(struct gve_priv *priv);
 	int (*set_num_ntfy_blks)(struct gve_priv *priv);
+	int (*get_ptype_map)(struct gve_priv *priv);
+	int (*configure_rss)(struct gve_priv *priv,
+			     struct ethtool_rxfh_param *param);
+	int (*setup_stats_report)(struct gve_priv *priv,
+				  u64 stats_report_len,
+				  dma_addr_t stats_report_addr,
+				  u64 interval_ms); /* AQ-specific */
+	int (*reset_flow_rules)(struct gve_priv *priv);
 };
 
 struct gve_priv {
drivers/net/ethernet/google/gve/gve_adminq.c +3 -4
index 7e5a6f4110db..28a27beac7c5 100644
@@ -1327,8 +1327,7 @@ int gve_adminq_report_nic_ts(struct gve_priv *priv,
 	return gve_adminq_execute_cmd(priv, &cmd);
 }
 
-int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
-				 struct gve_ptype_lut *ptype_lut)
+int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv)
 {
 	struct gve_ptype_map *ptype_map;
 	union gve_adminq_command cmd;
@@ -1354,9 +1353,9 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
 
 	/* Populate ptype_lut. */
 	for (i = 0; i < GVE_NUM_PTYPES; i++) {
-		ptype_lut->ptypes[i].l3_type =
+		priv->ptype_lut_dqo->ptypes[i].l3_type =
 			ptype_map->ptypes[i].l3_type;
-		ptype_lut->ptypes[i].l4_type =
+		priv->ptype_lut_dqo->ptypes[i].l4_type =
 			ptype_map->ptypes[i].l4_type;
 	}
 err:
drivers/net/ethernet/google/gve/gve_adminq.h +1 -2
index fe1e8868cdfe..5e51c060e237 100644
@@ -652,8 +652,7 @@ int gve_adminq_report_nic_ts(struct gve_priv *priv,
 			     dma_addr_t nic_ts_report_addr);
 
 struct gve_ptype_lut;
-int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
-				 struct gve_ptype_lut *ptype_lut);
+int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv);
 int gve_adminq_set_num_ntfy_blks(struct gve_priv *priv);
 void gve_adminq_set_num_queues(struct gve_priv *priv);
 int gve_adminq_map_db_bar(struct gve_priv *priv);
drivers/net/ethernet/google/gve/gve_main.c +18 -6
index 9fba76059a8f..9327c5d6956e 100644
@@ -653,7 +653,8 @@ static int gve_alloc_control_plane_resources(struct gve_priv *priv)
 
 static int gve_setup_control_plane_resources(struct gve_priv *priv)
 {
-	int err = 0;
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
+	int err;
 
 	err = gve_adminq_configure_device_resources(priv,
 						    priv->counter_array_bus,
@@ -668,7 +669,7 @@ static int gve_setup_control_plane_resources(struct gve_priv *priv)
 	}
 
 	if (!gve_is_gqi(priv)) {
-		err = gve_adminq_get_ptype_map_dqo(priv, priv->ptype_lut_dqo);
+		err = ops->get_ptype_map(priv);
 		if (err) {
 			dev_err(&priv->pdev->dev,
 				"Failed to get ptype map: err=%d\n", err);
@@ -690,12 +691,13 @@ static int gve_setup_control_plane_resources(struct gve_priv *priv)
 		goto teardown_clock;
 	}
 
-	err = gve_adminq_report_stats(priv, priv->stats_report_len,
+	err = ops->setup_stats_report(priv, priv->stats_report_len,
 				      priv->stats_report_bus,
 				      GVE_STATS_REPORT_TIMER_PERIOD);
 	if (err)
 		dev_err(&priv->pdev->dev,
 			"Failed to report stats: err=%d\n", err);
+
 	gve_set_device_resources_ok(priv);
 	return 0;
 
@@ -719,6 +721,7 @@ static int gve_setup_control_plane_resources(struct gve_priv *priv)
  */
 static void gve_teardown_control_plane_resources(struct gve_priv *priv)
 {
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 	int err;
 
 	/* Tell device its resources are being freed */
@@ -728,11 +731,13 @@ static void gve_teardown_control_plane_resources(struct gve_priv *priv)
 			dev_err(&priv->pdev->dev,
 				"Failed to reset flow rules: err=%d\n", err);
 		/* detach the stats report */
-		err = gve_adminq_report_stats(priv, 0, 0x0, GVE_STATS_REPORT_TIMER_PERIOD);
+		err = ops->setup_stats_report(priv, 0, 0x0,
+					      GVE_STATS_REPORT_TIMER_PERIOD);
 		if (err)
 			dev_err(&priv->pdev->dev,
 				"Failed to detach stats report: err=%d\n", err);
 		gve_teardown_clock(priv);
+
 		err = gve_adminq_deconfigure_device_resources(priv);
 		if (err)
 			dev_err(&priv->pdev->dev,
@@ -1816,6 +1821,7 @@ static int gve_xdp(struct net_device *dev, struct netdev_bpf *xdp)
 
 int gve_init_rss_config(struct gve_priv *priv, u16 num_queues)
 {
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 	struct gve_rss_config *rss_config = &priv->rss_config;
 	struct ethtool_rxfh_param rxfh = {0};
 	u16 i;
@@ -1831,15 +1837,17 @@ int gve_init_rss_config(struct gve_priv *priv, u16 num_queues)
 
 	rxfh.hfunc = ETH_RSS_HASH_TOP;
 
-	return gve_adminq_configure_rss(priv, &rxfh);
+	return ops->configure_rss(priv, &rxfh);
 }
 
 int gve_flow_rules_reset(struct gve_priv *priv)
 {
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
+
 	if (!priv->max_flow_rules)
 		return 0;
 
-	return gve_adminq_reset_flow_rules(priv);
+	return ops->reset_flow_rules(priv);
 }
 
 int gve_adjust_config(struct gve_priv *priv,
@@ -2478,6 +2486,10 @@ static const struct gve_ctrl_ops gve_adminq_ops = {
 	.unmap_db_bar		= gve_adminq_unmap_db_bar,
 	.set_num_queues		= gve_adminq_set_num_queues,
 	.set_num_ntfy_blks	= gve_adminq_set_num_ntfy_blks,
+	.get_ptype_map		= gve_adminq_get_ptype_map_dqo,
+	.reset_flow_rules	= gve_adminq_reset_flow_rules,
+	.setup_stats_report	= gve_adminq_report_stats,
+	.configure_rss		= gve_adminq_configure_rss,
 };
 
 static int gve_init_priv(struct gve_priv *priv)
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#18 lore raw

PATCH v4 11/15 gve: split up notify block allocation and setup paths

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Before this patch, notify block allocation and setup occurred in the same method. This all occurred before gve_adminq_configure_device_resources, which populates the irq_db_indicies array, a DMA region with BAR offsets for MSI-X vectors.

The coming mailbox mode will require notify blocks to be set up only after receiving the IRQ doorbell offsets, as the request does not work with a supplied DMA buffer in the way that admin queue mode does. The intended flow in that case would be:

1) allocate notify blocks
2) request doorbell information
3) set up MSI-X vectors based on doorbell info

This ordering also works for admin queue mode, so it will be updated to match.

---
v3:
- remove redundant call to gve_teardown_clock()

 drivers/net/ethernet/google/gve/gve.h      |   2 +
 drivers/net/ethernet/google/gve/gve_main.c | 155 +++++++++++----------
 2 files changed, 86 insertions(+), 71 deletions(-)
drivers/net/ethernet/google/gve/gve.h +2 -0
index c65c7d264430..8766ea62baf1 100644
@@ -676,6 +676,7 @@ struct gve_notify_block {
 	struct gve_tx_ring *tx; /* tx rings on this block */
 	struct gve_rx_ring *rx; /* rx rings on this block */
 	u32 irq;
+	bool irq_requested;
 };
 
 /* Tracks allowed and current rx queue settings */
@@ -956,6 +957,7 @@ struct gve_priv {
 	u64 link_speed;
 	bool up_before_suspend; /* True if dev was up before suspend */
 
+	bool mgmt_irq_requested;
 	struct gve_ptype_lut *ptype_lut_dqo;
 
 	/* Must be a power of two. */
drivers/net/ethernet/google/gve/gve_main.c +84 -71

227 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#19 lore raw

PATCH v4 12/15 gve: introduce new methods to handle IRQ doorbells

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Introduce request_db_info and release_db_resources to struct gve_ctrl_ops. These encapsulate the configuration of device resources (counter arrays and IRQ doorbell indices) which vary between Admin Queue and Mailbox modes. Registration and de-registratino of IRQ dorrbell indices with the device will be managed by these new methods instead of occurring directly in notify_block setup/teardown methods. Similarly, GQ ring counters will be managed in request_db_info.

---
v4:
- propagate code changes as specified by v3.
v3:
- move allocation of IRQ DB indices and counter array back into gve_alloc_control_plane_resources() from gve_adminq_request_db_info().
- Similar to above, move free logic out of gve_adminq_free_db_resources() and rename all introduced methods from *free_db_resources to *release_db_resources to reflect the behavioral change.

 drivers/net/ethernet/google/gve/gve.h        | 10 ++
 drivers/net/ethernet/google/gve/gve_adminq.c | 37 ++++++++
 drivers/net/ethernet/google/gve/gve_adminq.h |  2 +
 drivers/net/ethernet/google/gve/gve_main.c   | 98 ++++++++++----------
 4 files changed, 97 insertions(+), 50 deletions(-)
drivers/net/ethernet/google/gve/gve.h +10 -0
index 8766ea62baf1..2d869d249cdd 100644
@@ -836,6 +836,9 @@ struct gve_device_info {
  *                  structures stored in @priv to be used during initialization.
  * @set_num_ntfy_blks: Sets no. of vectors into @priv to be used during
  *                     initialization.
+ * @request_db_info: Request and store doorbell information into @priv
+ * @release_db_resources: Release device hold on DMA memory holding doorbell
+ *			  info (AdminQ only)
  * @get_ptype_map: Learn packet type map from device and store it in @priv
  * @configure_rss: Set up default RSS configuration
  * @setup_stats_report: Set up DMA region for stats report (AdminQ only)
@@ -846,6 +849,8 @@ struct gve_ctrl_ops {
 	void (*unmap_db_bar)(struct gve_priv *priv);
 	void (*set_num_queues)(struct gve_priv *priv);
 	int (*set_num_ntfy_blks)(struct gve_priv *priv);
+	int (*request_db_info)(struct gve_priv *priv);
+	void (*release_db_resources)(struct gve_priv *priv);
 	int (*get_ptype_map)(struct gve_priv *priv);
 	int (*configure_rss)(struct gve_priv *priv,
 			     struct ethtool_rxfh_param *param);
@@ -1166,6 +1171,11 @@ static inline u32 gve_rx_idx_to_ntfy(struct gve_priv *priv, u32 queue_idx)
 	return (priv->num_ntfy_blks / 2) + queue_idx;
 }
 
+static inline u32 gve_ntfy_to_msix_idx(struct gve_priv *priv, u32 ntfy_blk_idx)
+{
+	return ntfy_blk_idx;
+}
+
 static inline bool gve_is_qpl(struct gve_priv *priv)
 {
 	return priv->queue_format == GVE_GQI_QPL_FORMAT ||
drivers/net/ethernet/google/gve/gve_adminq.c +37 -0
index 28a27beac7c5..049ef3c48307 100644
@@ -1716,3 +1716,40 @@ void gve_adminq_unmap_db_bar(struct gve_priv *priv)
 
 	pci_iounmap(pdev, priv->db_bar2);
 }
+
+int gve_adminq_request_db_info(struct gve_priv *priv)
+{
+	int err;
+	int i;
+
+	err = gve_adminq_configure_device_resources(priv,
+						    priv->counter_array_bus,
+						    priv->num_event_counters,
+						    priv->irq_db_indices_bus,
+						    priv->num_ntfy_blks);
+	if (unlikely(err)) {
+		dev_err(&priv->pdev->dev,
+			"could not setup device_resources: err=%d\n", err);
+		return -ENXIO;
+	}
+
+	for (i = 0; i < priv->num_ntfy_blks; i++)
+		priv->ntfy_blocks[i].irq_db_index =
+			&priv->irq_db_indices[i].index;
+	return 0;
+}
+
+void gve_adminq_release_db_resources(struct gve_priv *priv)
+{
+	int err;
+
+	/* Log error in deconfigure device, but don't fail. This is only ever
+	 * called as a reset is about to be triggered, so it would be redundant
+	 * to trigger a reset.
+	 */
+	err = gve_adminq_deconfigure_device_resources(priv);
+	if (err)
+		dev_err(&priv->pdev->dev,
+			"Could not deconfigure device resources: err=%d\n",
+			err);
+}
drivers/net/ethernet/google/gve/gve_adminq.h +2 -0
index 5e51c060e237..52172bf228eb 100644
@@ -657,4 +657,6 @@ int gve_adminq_set_num_ntfy_blks(struct gve_priv *priv);
 void gve_adminq_set_num_queues(struct gve_priv *priv);
 int gve_adminq_map_db_bar(struct gve_priv *priv);
 void gve_adminq_unmap_db_bar(struct gve_priv *priv);
+int gve_adminq_request_db_info(struct gve_priv *priv);
+void gve_adminq_release_db_resources(struct gve_priv *priv);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +48 -50

211 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#20 lore raw

PATCH v4 13/15 gve: setup and teardown management interrupts

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Introduce control ops to setup/teardown control plane IRQs. Admin queue-specific functionality is moved to admin queue files.

---
 drivers/net/ethernet/google/gve/gve.h        |  4 +++
 drivers/net/ethernet/google/gve/gve_adminq.c | 36 ++++++++++++++++++++
 drivers/net/ethernet/google/gve/gve_adminq.h |  2 ++
 drivers/net/ethernet/google/gve/gve_main.c   | 32 +++++------------
 4 files changed, 51 insertions(+), 23 deletions(-)
drivers/net/ethernet/google/gve/gve.h +4 -0
index 2d869d249cdd..c9fffc727eb3 100644
@@ -839,6 +839,8 @@ struct gve_device_info {
  * @request_db_info: Request and store doorbell information into @priv
  * @release_db_resources: Release device hold on DMA memory holding doorbell
  *			  info (AdminQ only)
+ * @setup_mgmt_irq: Setup control plane IRQ
+ * @teardown_mgmt_irq: Teardown control plane IRQ
  * @get_ptype_map: Learn packet type map from device and store it in @priv
  * @configure_rss: Set up default RSS configuration
  * @setup_stats_report: Set up DMA region for stats report (AdminQ only)
@@ -851,6 +853,8 @@ struct gve_ctrl_ops {
 	int (*set_num_ntfy_blks)(struct gve_priv *priv);
 	int (*request_db_info)(struct gve_priv *priv);
 	void (*release_db_resources)(struct gve_priv *priv);
+	int (*setup_mgmt_irq)(struct gve_priv *priv);
+	void (*teardown_mgmt_irq)(struct gve_priv *priv);
 	int (*get_ptype_map)(struct gve_priv *priv);
 	int (*configure_rss)(struct gve_priv *priv,
 			     struct ethtool_rxfh_param *param);
drivers/net/ethernet/google/gve/gve_adminq.c +36 -0
index 3fdc3575c077..9a06af652533 100644
@@ -1748,3 +1748,39 @@ void gve_adminq_release_db_resources(struct gve_priv *priv)
 			"Could not deconfigure device resources: err=%d\n",
 			err);
 }
+
+static irqreturn_t gve_mgmnt_intr(int irq, void *arg)
+{
+	struct gve_priv *priv = arg;
+
+	/* Device resources are not okay; consider the interrupt spurious. */
+	if (!gve_get_device_resources_ok(priv))
+		return IRQ_NONE;
+
+	queue_work(priv->gve_wq, &priv->service_task);
+	return IRQ_HANDLED;
+}
+
+int gve_adminq_setup_mgmt_irq(struct gve_priv *priv)
+{
+	int err;
+
+	snprintf(priv->mgmt_msix_name, sizeof(priv->mgmt_msix_name),
+		 "gve-mgmnt@pci:%s", pci_name(priv->pdev));
+	err = request_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector,
+			  gve_mgmnt_intr, 0, priv->mgmt_msix_name, priv);
+	if (err)
+		return err;
+
+	priv->mgmt_irq_requested = true;
+
+	return 0;
+}
+
+void gve_adminq_teardown_mgmt_irq(struct gve_priv *priv)
+{
+	if (priv->mgmt_irq_requested) {
+		free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
+		priv->mgmt_irq_requested = false;
+	}
+}
drivers/net/ethernet/google/gve/gve_adminq.h +2 -0
index 52172bf228eb..0b48e9f2a82a 100644
@@ -659,4 +659,6 @@ int gve_adminq_map_db_bar(struct gve_priv *priv);
 void gve_adminq_unmap_db_bar(struct gve_priv *priv);
 int gve_adminq_request_db_info(struct gve_priv *priv);
 void gve_adminq_release_db_resources(struct gve_priv *priv);
+int gve_adminq_setup_mgmt_irq(struct gve_priv *priv);
+void gve_adminq_teardown_mgmt_irq(struct gve_priv *priv);
 #endif /* _GVE_ADMINQ_H */
drivers/net/ethernet/google/gve/gve_main.c +9 -23
index e57c8596fca4..eecc98807395 100644
@@ -291,18 +291,6 @@ static void gve_free_stats_report(struct gve_priv *priv)
 	priv->stats_report = NULL;
 }
 
-static irqreturn_t gve_mgmnt_intr(int irq, void *arg)
-{
-	struct gve_priv *priv = arg;
-
-	/* Device resources are not okay; consider the interrupt spurious. */
-	if (!gve_get_device_resources_ok(priv))
-		return IRQ_NONE;
-
-	queue_work(priv->gve_wq, &priv->service_task);
-	return IRQ_HANDLED;
-}
-
 static irqreturn_t gve_intr(int irq, void *arg)
 {
 	struct gve_notify_block *block = arg;
@@ -527,6 +515,7 @@ static int gve_alloc_notify_blocks(struct gve_priv *priv)
 
 static void gve_teardown_notify_blocks(struct gve_priv *priv)
 {
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 	int i;
 
 	if (!priv->ntfy_blocks)
@@ -546,29 +535,24 @@ static void gve_teardown_notify_blocks(struct gve_priv *priv)
 		block->irq_requested = false;
 	}
 
-	if (priv->mgmt_irq_requested) {
-		free_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector, priv);
-		priv->mgmt_irq_requested = false;
-	}
+	ops->teardown_mgmt_irq(priv);
 }
 
 static int gve_setup_notify_blocks(struct gve_priv *priv)
 {
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 	const struct cpumask *node_mask;
 	unsigned int cur_cpu;
 	int i;
 	int err;
 
-	/* Setup Management Vector  - the last vector */
-	snprintf(priv->mgmt_msix_name, sizeof(priv->mgmt_msix_name),
-		 "gve-mgmnt@pci:%s", pci_name(priv->pdev));
-	err = request_irq(priv->msix_vectors[priv->mgmt_msix_idx].vector,
-			  gve_mgmnt_intr, 0, priv->mgmt_msix_name, priv);
+	/* Setup Management Vector */
+	err = ops->setup_mgmt_irq(priv);
 	if (err) {
-		dev_err(&priv->pdev->dev, "Did not receive management vector.\n");
+		dev_err(&priv->pdev->dev,
+			"Did not receive management vector.\n");
 		return err;
 	}
-	priv->mgmt_irq_requested = true;
 
 	node_mask = gve_get_node_mask(priv);
 	cur_cpu = cpumask_first(node_mask);
@@ -2501,6 +2485,8 @@ static const struct gve_ctrl_ops gve_adminq_ops = {
 	.configure_rss		= gve_adminq_configure_rss,
 	.request_db_info	= gve_adminq_request_db_info,
 	.release_db_resources	= gve_adminq_release_db_resources,
+	.setup_mgmt_irq		= gve_adminq_setup_mgmt_irq,
+	.teardown_mgmt_irq	= gve_adminq_teardown_mgmt_irq,
 };
 
 static int gve_init_priv(struct gve_priv *priv)
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
author maintainer
#21 lore raw

PATCH v4 14/15 gve: add ctrl ops to for queue operations

In reply to Harshitha Ramamurthy

Add the next few control ops to

- create queues
- destroy queues

These changes are just moving existing code into ops, no functional change.

---
v4
- remove double logging in destroy path

v3
- remove double logging in the create queues path

 drivers/net/ethernet/google/gve/gve.h        |  4 ++
 drivers/net/ethernet/google/gve/gve_adminq.c | 50 ++++++++++++++++++++
 drivers/net/ethernet/google/gve/gve_adminq.h |  2 +
 drivers/net/ethernet/google/gve/gve_dqo.h    |  2 +-
 drivers/net/ethernet/google/gve/gve_main.c   | 45 ++++--------------
 5 files changed, 66 insertions(+), 37 deletions(-)
drivers/net/ethernet/google/gve/gve.h +4 -0
index c9fffc727eb3..f3906be810d8 100644
@@ -845,6 +845,8 @@ struct gve_device_info {
  * @configure_rss: Set up default RSS configuration
  * @setup_stats_report: Set up DMA region for stats report (AdminQ only)
  * @reset_flow_rules: Flush all flow rules from device
+ * @create_queues: Sends commands to the device to create TX/RX queues.
+ * @destroy_queues: Sends commands to the device to destroy TX/RX queues.
  */
 struct gve_ctrl_ops {
 	int (*map_db_bar)(struct gve_priv *priv);
@@ -863,6 +865,8 @@ struct gve_ctrl_ops {
 				  dma_addr_t stats_report_addr,
 				  u64 interval_ms); /* AQ-specific */
 	int (*reset_flow_rules)(struct gve_priv *priv);
+	int (*create_queues)(struct gve_priv *priv);
+	int (*destroy_queues)(struct gve_priv *priv);
 };
 
 struct gve_priv {
drivers/net/ethernet/google/gve/gve_adminq.c +50 -0

59 lines not on this page · raw message

drivers/net/ethernet/google/gve/gve_adminq.h +2 -0
index 0b48e9f2a82a..d696e4932a8b 100644
@@ -628,6 +628,8 @@ int gve_adminq_configure_device_resources(struct gve_priv *priv,
 					  dma_addr_t db_array_bus_addr,
 					  u32 num_ntfy_blks);
 int gve_adminq_deconfigure_device_resources(struct gve_priv *priv);
+int gve_adminq_create_queues(struct gve_priv *priv);
+int gve_adminq_destroy_queues(struct gve_priv *priv);
 int gve_adminq_create_tx_queues(struct gve_priv *priv, u32 start_id, u32 num_queues);
 int gve_adminq_destroy_tx_queues(struct gve_priv *priv, u32 start_id, u32 num_queues);
 int gve_adminq_create_single_rx_queue(struct gve_priv *priv, u32 queue_index);
drivers/net/ethernet/google/gve/gve_dqo.h +1 -1
index 5871f773f0c7..ce402020dff6 100644
@@ -66,7 +66,7 @@ void gve_rx_write_doorbell_dqo(const struct gve_priv *priv, int queue_idx);
 void gve_xdp_tx_flush_dqo(struct gve_priv *priv, u32 xdp_qid);
 
 static inline void
-gve_tx_put_doorbell_dqo(const struct gve_priv *priv,
+gve_tx_put_doorbell_dqo(struct gve_priv *priv,
 			const struct gve_queue_resources *q_resources, u32 val)
 {
 	u64 index;
drivers/net/ethernet/google/gve/gve_main.c +9 -36

74 lines not on this page · raw message

Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#22 lore raw

Re: [PATCH net-next v4 14/15] gve: add ctrl ops to for queue operations

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] Double logging remains in the create queues error path, contradicting the commit message. --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Double logging remains in the create queues error path, contradicting the commit message. --

--- Patch [14]: [PATCH net-next v4 14/15] gve: add ctrl ops to for queue operations --- commit 026806681c18ac8de5714de37a0562162a553296
Author: Harshitha Ramamurthy <[email protected]>

gve: add ctrl ops to for queue operations

This commit adds control operations for creating and destroying queues. It moves existing admin queue functions into the new ops structure to abstract these operations.

Quoted 4 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0
index eecc988073951..500247b0e34aa 100644

[ ... ]

Quoted 17 lines
drivers/net/ethernet/google/gve/gve_main.c +1 -8
@@ -874,33 +874,18 @@ static int gve_unregister_qpls(struct gve_priv *priv)
 
 static int gve_create_rings(struct gve_priv *priv)
 {
-	int num_tx_queues = gve_num_tx_queues(priv);
 	int err;
 	int i;
 
-	err = gve_adminq_create_tx_queues(priv, 0, num_tx_queues);
+	err = priv->ctrl_ops->create_queues(priv);
 	if (err) {
-		netif_err(priv, drv, priv->dev, "failed to create %d tx queues\n",
-			  num_tx_queues);
-		/* This failure will trigger a reset - no need to clean
-		 * up
-		 */
-		return err;

drivers/net/ethernet/google/gve/gve_main.c static int gve_unregister_qpls(struct gve_priv *priv) · line 883

Quoted 10 lines
drivers/net/ethernet/google/gve/gve_main.c +2 -8
-	}
-	netif_dbg(priv, drv, priv->dev, "created %d tx queues\n",
-		  num_tx_queues);
-
-	err = gve_adminq_create_rx_queues(priv, priv->rx_cfg.num_queues);
-	if (err) {
-		netif_err(priv, drv, priv->dev, "failed to create %d rx queues\n",
-			  priv->rx_cfg.num_queues);
+		netif_err(priv, drv, priv->dev,
+			  "failed to create queues\n");

[Severity: Medium]
The v3 changelog notes state "remove double logging in the create queues path", but doesn't this still leave a double logging issue when create_queues() fails?

If priv->ctrl_ops->create_queues() (which maps to gve_adminq_create_queues()) encounters an error, it logs a specific message:

drivers/net/ethernet/google/gve/gve_adminq.c:gve_adminq_create_queues() {
	...
	err = gve_adminq_create_tx_queues(priv, 0, num_tx_queues);
	if (err) {
		netif_err(priv, drv, priv->dev, "failed to create %d tx queues\n",
			  num_tx_queues);
		return err;
	}
	...
}

Then it returns the error back here to gve_create_rings(), which logs a second generic "failed to create queues" message. Should this netif_err() in gve_create_rings() be removed to fully resolve the double logging?

Quoted 5 lines
drivers/net/ethernet/google/gve/gve_main.c +0 -0
 		/* This failure will trigger a reset - no need to clean
 		 * up
 		 */
 		return err;
 	}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=14
author maintainer
#23 lore raw

PATCH v4 15/15 gve: add link status/speed ctrl ops

In reply to Harshitha Ramamurthy

From: Joshua Washington <[email protected]>

Refactor link status check to use a control plane op. Introduce new op for retrieving the link status in AQ mode. This op reads the link status from the device status register and stores the value in priv.

Also add an op for retrieving link speed in AQ mode which calls into gve_adminq_report_link_speed.

---
v3:
- Fix kdoc typo ("set link status" -> "set link speed")
- Copy link status into local variable instead of reading twice to prevent TOCTOU issue.

 drivers/net/ethernet/google/gve/gve.h         |  5 ++++
 drivers/net/ethernet/google/gve/gve_adminq.c  | 10 +++++++
 drivers/net/ethernet/google/gve/gve_adminq.h  |  1 +
 drivers/net/ethernet/google/gve/gve_ethtool.c |  3 +--
 drivers/net/ethernet/google/gve/gve_main.c    | 26 ++++++++++++-------
 5 files changed, 33 insertions(+), 12 deletions(-)
drivers/net/ethernet/google/gve/gve.h +5 -0
index f3906be810d8..3a50e7f7a2e7 100644
@@ -847,6 +847,8 @@ struct gve_device_info {
  * @reset_flow_rules: Flush all flow rules from device
  * @create_queues: Sends commands to the device to create TX/RX queues.
  * @destroy_queues: Sends commands to the device to destroy TX/RX queues.
+ * @report_link_status: Set link status into @priv->link_up
+ * @report_link_speed: Set link speed into @priv->link_speed
  */
 struct gve_ctrl_ops {
 	int (*map_db_bar)(struct gve_priv *priv);
@@ -867,6 +869,8 @@ struct gve_ctrl_ops {
 	int (*reset_flow_rules)(struct gve_priv *priv);
 	int (*create_queues)(struct gve_priv *priv);
 	int (*destroy_queues)(struct gve_priv *priv);
+	int (*report_link_status)(struct gve_priv *priv);
+	int (*report_link_speed)(struct gve_priv *priv);
 };
 
 struct gve_priv {
@@ -968,6 +972,7 @@ struct gve_priv {
 
 	/* Gvnic device link speed from hypervisor. */
 	u64 link_speed;
+	bool link_up;
 	bool up_before_suspend; /* True if dev was up before suspend */
 
 	bool mgmt_irq_requested;
drivers/net/ethernet/google/gve/gve_adminq.c +10 -0
index 3635e81e936a..97071bfd8078 100644
@@ -1839,3 +1839,13 @@ int gve_adminq_create_queues(struct gve_priv *priv)
 
 	return err;
 }
+
+int gve_adminq_report_link_status(struct gve_priv *priv)
+{
+	u32 status;
+
+	status = ioread32be(&priv->reg_bar0->device_status);
+	WRITE_ONCE(priv->link_up,
+		   !!(GVE_DEVICE_STATUS_LINK_STATUS_MASK & status));
+	return 0;
+}
drivers/net/ethernet/google/gve/gve_adminq.h +1 -0
index d696e4932a8b..8daac5fd685a 100644
@@ -643,6 +643,7 @@ int gve_adminq_report_stats(struct gve_priv *priv, u64 stats_report_len,
 			    dma_addr_t stats_report_addr, u64 interval);
 int gve_adminq_verify_driver_compatibility(struct gve_priv *priv);
 int gve_adminq_get_device_properties(struct gve_priv *priv);
+int gve_adminq_report_link_status(struct gve_priv *priv);
 int gve_adminq_report_link_speed(struct gve_priv *priv);
 int gve_adminq_add_flow_rule(struct gve_priv *priv, struct gve_adminq_flow_rule *rule, u32 loc);
 int gve_adminq_del_flow_rule(struct gve_priv *priv, u32 loc);
drivers/net/ethernet/google/gve/gve_ethtool.c +1 -2
index dd1c44fedc77..a3220c651438 100644
@@ -749,12 +749,11 @@ static int gve_get_link_ksettings(struct net_device *netdev,
 	int err = 0;
 
 	if (priv->link_speed == 0)
-		err = gve_adminq_report_link_speed(priv);
+		err = priv->ctrl_ops->report_link_speed(priv);
 
 	cmd->base.speed = priv->link_speed;
 
 	cmd->base.duplex = DUPLEX_FULL;
-
 	return err;
 }
 
drivers/net/ethernet/google/gve/gve_main.c +16 -10
index 500247b0e34a..800e1104d01b 100644
@@ -1504,15 +1504,18 @@ static int gve_close(struct net_device *dev)
 	return err;
 }
 
-static void gve_handle_link_status(struct gve_priv *priv, bool link_status)
+static void gve_handle_link_status(struct gve_priv *priv)
 {
+	bool link_up;
+
 	if (!gve_get_napi_enabled(priv))
 		return;
 
-	if (link_status == netif_carrier_ok(priv->dev))
+	link_up = READ_ONCE(priv->link_up);
+	if (link_up == netif_carrier_ok(priv->dev))
 		return;
 
-	if (link_status) {
+	if (link_up) {
 		netdev_info(priv->dev, "Device link is up.\n");
 		netif_carrier_on(priv->dev);
 	} else {
@@ -1539,7 +1542,6 @@ static int gve_set_xdp(struct gve_priv *priv, struct bpf_prog *prog,
 {
 	struct bpf_prog *old_prog;
 	int err = 0;
-	u32 status;
 
 	old_prog = READ_ONCE(priv->xdp_prog);
 	if (!netif_running(priv->dev)) {
@@ -1566,8 +1568,8 @@ static int gve_set_xdp(struct gve_priv *priv, struct bpf_prog *prog,
 		bpf_prog_put(old_prog);
 
 out:
-	status = ioread32be(&priv->reg_bar0->device_status);
-	gve_handle_link_status(priv, GVE_DEVICE_STATUS_LINK_STATUS_MASK & status);
+	priv->ctrl_ops->report_link_status(priv);
+	gve_handle_link_status(priv);
 	return err;
 }
 
@@ -2000,11 +2002,11 @@ static void gve_turnup(struct gve_priv *priv)
 
 static void gve_turnup_and_check_status(struct gve_priv *priv)
 {
-	u32 status;
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 
 	gve_turnup(priv);
-	status = ioread32be(&priv->reg_bar0->device_status);
-	gve_handle_link_status(priv, GVE_DEVICE_STATUS_LINK_STATUS_MASK & status);
+	ops->report_link_status(priv);
+	gve_handle_link_status(priv);
 }
 
 static struct gve_notify_block *gve_get_tx_notify_block(struct gve_priv *priv,
@@ -2328,12 +2330,14 @@ static void gve_service_task(struct work_struct *work)
 {
 	struct gve_priv *priv = container_of(work, struct gve_priv,
 					     service_task);
+	const struct gve_ctrl_ops *ops = priv->ctrl_ops;
 	u32 status = ioread32be(&priv->reg_bar0->device_status);
 
 	gve_handle_status(priv, status);
 
 	gve_handle_reset(priv);
-	gve_handle_link_status(priv, GVE_DEVICE_STATUS_LINK_STATUS_MASK & status);
+	ops->report_link_status(priv);
+	gve_handle_link_status(priv);
 }
 
 static void gve_set_netdev_xdp_features(struct gve_priv *priv)
@@ -2460,6 +2464,8 @@ static const struct gve_ctrl_ops gve_adminq_ops = {
 	.teardown_mgmt_irq	= gve_adminq_teardown_mgmt_irq,
 	.create_queues		= gve_adminq_create_queues,
 	.destroy_queues		= gve_adminq_destroy_queues,
+	.report_link_status	= gve_adminq_report_link_status,
+	.report_link_speed	= gve_adminq_report_link_speed,
 };
 
 static int gve_init_priv(struct gve_priv *priv)
Signature · 1 line
2.55.0.691.gc56d675ccc-goog
#24 lore raw

Re: [PATCH net-next v4 15/15] gve: add link status/speed ctrl ops

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [Critical] DMA Use-After-Free due to missing device reset on Admin Queue command timeout. --

--- Patch [15]: [PATCH net-next v4 15/15] gve: add link status/speed ctrl ops --- commit bafe15595d2df2fbd631b0f3f40244e39beaf6e5
Author: Joshua Washington <[email protected]>

gve: add link status/speed ctrl ops

This commit refactors the link status check to use a control plane op and introduces a new op for retrieving the link status in AQ mode from the device status register. It also adds an op for retrieving link speed in AQ mode which calls into gve_adminq_report_link_speed.

Quoted 4 lines
drivers/net/ethernet/google/gve/gve_ethtool.c +0 -0
index 8199738ba979e..a3220c6514382 100644

[ ... ]

drivers/net/ethernet/google/gve/gve_ethtool.c static int gve_get_link_ksettings(struct net_device *netdev, · line 752

Quoted 6 lines
drivers/net/ethernet/google/gve/gve_ethtool.c +1 -1
@@ -749,12 +749,11 @@ static int gve_get_link_ksettings(struct net_device *netdev,
 	int err = 0;
 
 	if (priv->link_speed == 0)
-		err = gve_adminq_report_link_speed(priv);
+		err = priv->ctrl_ops->report_link_speed(priv);

[Severity: Critical]
This isn't a bug introduced by this patch, but while reviewing the use of the report_link_speed control operation, I noticed a pre-existing regression when handling Admin Queue timeouts.

Could the underlying gve_adminq_report_link_speed() function corrupt memory if the device responds late?

In drivers/net/ethernet/google/gve/gve_adminq.c, gve_adminq_report_link_speed() unconditionally frees the DMA region:

    err = gve_adminq_execute_cmd(priv, &gvnic_cmd);

    priv->link_speed = be64_to_cpu(*link_speed_region);
    dma_free_coherent(&priv->pdev->dev, sizeof(*link_speed_region),
                      link_speed_region, link_speed_region_bus);

If the hardware is delayed and gve_adminq_execute_cmd() returns a timeout, the DMA memory is freed without synchronously resetting or quiescing the device.

If the hardware later completes the command, could it write the link speed into the now-freed DMA address and corrupt newly allocated memory?

A similar unconditional free after timeout happens in gve_adminq_execute_extended_cmd():

    err = gve_adminq_execute_cmd(priv, &cmd);

    dma_free_coherent(&priv->pdev->dev, cmd_size, inner_cmd, inner_cmd_bus);

Since an unprivileged user can trigger this path via ethtool, does the hardware need to be reset before freeing these DMA buffers, or should the buffers be leaked until a reset is guaranteed?

Quoted 7 lines
drivers/net/ethernet/google/gve/gve_ethtool.c +0 -1
 	cmd->base.speed = priv->link_speed;
 
 	cmd->base.duplex = DUPLEX_FULL;
-
 	return err;
 }
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=15
Reviewed-by on the v4 series
#25 lore raw
In reply to Harshitha Ramamurthy
Quoted 65 lines · Harshitha Ramamurthy

This series is preparing the driver for the addition of a new control plane mode(MailboxQ) by commonizing and reusing as much code as possible. MailboxQ is a new control plane infrastructure which uses mailbox queues. This is a new control plane to communicate with the device when the driver is running on bare-metal instances as well as newer versions of the device.

This series contains 2 main changes to the gve driver's existing control plane(AdminQ):
1) refactor some initialization/teardown path methods to make it work for both control planes.
2) add gve_ctrl_ops structure to the driver for various control plane operations

The refactors are mainly around the init, reset and recover paths so that functionalities could be moved into the control ops like 'set_num_queues', 'set_num_ntfy_blks' etc.

This patch series only sets the control ops for AdminQ mode. This is intended as a preparation for adding MailboxQ mode in upcoming series which will add the new control plane infrastructure and then introduce the corresponding control ops for MailboxQ mode.

The entire list of future patches can be found here for reference:
https://github.com/hramamurthy12/linux/commits/gve-mailbox-queues/

Changes in v4:
- Reduce code churn by placing new functions directly in gve_adminq.c, introducing final tab spacing and using local variable (Przemek Kitszel)
- Fix kdoc formatting and drop spurious management interrupt(patch 9)
- Propagate release_db_resources naming change (patch 12)
- Remove double logging in destroy queues path (patch 14)
- v3: https://lore.kernel.org/netdev/[email protected]/

Changes in v3:
- Fix driver compatibility verification in the reset and recovery paths (patches 2, 8).
- Mark gve_adminq_get_device_properties() with __maybe_unused ahead of its usage (patch 7).
- Refine error handling and resource cleanup in reset, probe, and queue creation paths (patches 8, 9, 11, 14).
- Keep IRQ doorbell allocation/release in control plane resource helpers (patch 12).
- Minor fixes: fix TOCTOU issue for link speed, correct kdoc comments, and remove redundant teardown calls (patches 4, 11, 15).
- v2: https://lore.kernel.org/netdev/[email protected]/

Changes in v2:
- Rebased against latest net-next to resolve apply failure for patch 5
- Fixed a few typos in commit messages of patch 9 and 14
- Fixed a kdoc warning in patch 9
- v1: https://lore.kernel.org/netdev/[email protected]/
Harshitha Ramamurthy (9):
gve: don't pass in unused parameter to gve_adminq_free
gve: refactor initialization with helper functions
gve: add a few helper functions to set device properties
gve: add struct gve_device_info to hold device properties
gve: introduce control plane operations structure
gve: introduce ctrl ops to set vectors and Qs
gve: introduce gve_adminq_get_device_properties()
gve: refactor gve_init_priv for reset path
gve: add ctrl ops to for queue operations

Joshua Washington (6):
gve: simplify reset logic
gve: add gve_ctrl_ops for gve initialization/teardown sequences
gve: split up notify block allocation and setup paths
gve: introduce new methods to handle IRQ doorbells
gve: setup and teardown management interrupts
gve: add link status/speed ctrl ops

Quoted 9 lines
  drivers/net/ethernet/google/gve/gve.h         |  89 +-
  drivers/net/ethernet/google/gve/gve_adminq.c  | 437 ++++++--
  drivers/net/ethernet/google/gve/gve_adminq.h  |  25 +-
  drivers/net/ethernet/google/gve/gve_dqo.h     |   2 +-
  drivers/net/ethernet/google/gve/gve_ethtool.c |   5 +-
  .../net/ethernet/google/gve/gve_flow_rule.c   |  15 +-
  drivers/net/ethernet/google/gve/gve_main.c    | 940 +++++++++---------
  7 files changed, 957 insertions(+), 556 deletions(-)
author maintainer
#26 lore raw
In reply to Harshitha Ramamurthy
Quoted 18 lines · Harshitha Ramamurthy

This series is preparing the driver for the addition of a new control plane mode(MailboxQ) by commonizing and reusing as much code as possible. MailboxQ is a new control plane infrastructure which uses mailbox queues. This is a new control plane to communicate with the device when the driver is running on bare-metal instances as well as newer versions of the device.

This series contains 2 main changes to the gve driver's existing control plane(AdminQ):
1) refactor some initialization/teardown path methods to make it work for both control planes.
2) add gve_ctrl_ops structure to the driver for various control plane operations

The refactors are mainly around the init, reset and recover paths so that functionalities could be moved into the control ops like 'set_num_queues', 'set_num_ntfy_blks' etc.

Quoted 7 lines

This patch series only sets the control ops for AdminQ mode. This is intended as a preparation for adding MailboxQ mode in upcoming series which will add the new control plane infrastructure and then introduce the corresponding control ops for MailboxQ mode.

The entire list of future patches can be found here for reference:
https://github.com/hramamurthy12/linux/commits/gve-mailbox-queues/

Sashiko has spotted a few issues - will look through them and fix them in v5.

Quoted 53 lines

Changes in v4:
- Reduce code churn by placing new functions directly in gve_adminq.c, introducing final tab spacing and using local variable (Przemek Kitszel)
- Fix kdoc formatting and drop spurious management interrupt(patch 9)
- Propagate release_db_resources naming change (patch 12)
- Remove double logging in destroy queues path (patch 14)
- v3: https://lore.kernel.org/netdev/[email protected]/

Changes in v3:
- Fix driver compatibility verification in the reset and recovery paths (patches 2, 8).
- Mark gve_adminq_get_device_properties() with __maybe_unused ahead of its usage (patch 7).
- Refine error handling and resource cleanup in reset, probe, and queue creation paths (patches 8, 9, 11, 14).
- Keep IRQ doorbell allocation/release in control plane resource helpers (patch 12).
- Minor fixes: fix TOCTOU issue for link speed, correct kdoc comments, and remove redundant teardown calls (patches 4, 11, 15).
- v2: https://lore.kernel.org/netdev/[email protected]/

Changes in v2:
- Rebased against latest net-next to resolve apply failure for patch 5
- Fixed a few typos in commit messages of patch 9 and 14
- Fixed a kdoc warning in patch 9
- v1: https://lore.kernel.org/netdev/[email protected]/
Harshitha Ramamurthy (9):
gve: don't pass in unused parameter to gve_adminq_free
gve: refactor initialization with helper functions
gve: add a few helper functions to set device properties
gve: add struct gve_device_info to hold device properties
gve: introduce control plane operations structure
gve: introduce ctrl ops to set vectors and Qs
gve: introduce gve_adminq_get_device_properties()
gve: refactor gve_init_priv for reset path
gve: add ctrl ops to for queue operations

Joshua Washington (6):
gve: simplify reset logic
gve: add gve_ctrl_ops for gve initialization/teardown sequences
gve: split up notify block allocation and setup paths
gve: introduce new methods to handle IRQ doorbells
gve: setup and teardown management interrupts
gve: add link status/speed ctrl ops

 drivers/net/ethernet/google/gve/gve.h         |  89 +-
 drivers/net/ethernet/google/gve/gve_adminq.c  | 437 ++++++--
 drivers/net/ethernet/google/gve/gve_adminq.h  |  25 +-
 drivers/net/ethernet/google/gve/gve_dqo.h     |   2 +-
 drivers/net/ethernet/google/gve/gve_ethtool.c |   5 +-
 .../net/ethernet/google/gve/gve_flow_rule.c   |  15 +-
 drivers/net/ethernet/google/gve/gve_main.c    | 940 +++++++++---------
 7 files changed, 957 insertions(+), 556 deletions(-)

--
2.55.0.691.gc56d675ccc-goog

maintainer
#27 lore raw
Quoted 1 line · On Mon, 17 Aug 2026 14:45:08 -0700 Harshitha Ramamurthy wrote:

Sashiko has spotted a few issues - will look through them and fix them in v5.

net-next has closed. I'll take the first 3 from v4 and the rest has to wait until after the merge window.

author maintainer
#28 lore raw
Quoted 6 lines · Jakub Kicinski
Quoted 1 line · On Mon, 17 Aug 2026 14:45:08 -0700 Harshitha Ramamurthy wrote:

Sashiko has spotted a few issues - will look through them and fix them in v5.

net-next has closed. I'll take the first 3 from v4 and the rest has to wait until after the merge window.

Sounds good, will post the rest when net-next opens. Thanks!

#29 lore raw
In reply to Harshitha Ramamurthy
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Fri, 14 Aug 2026 02:13:50 +0000 you wrote:

This series is preparing the driver for the addition of a new control plane mode(MailboxQ) by commonizing and reusing as much code as possible. MailboxQ is a new control plane infrastructure which uses mailbox queues. This is a new control plane to communicate with the device when the driver is running on bare-metal instances as well as newer versions of the device.

Quoted 8 lines

This series contains 2 main changes to the gve driver's existing control plane(AdminQ):
1) refactor some initialization/teardown path methods to make it work for both control planes.
2) add gve_ctrl_ops structure to the driver for various control plane operations

[...]

Here is the summary with links:
- [net-next,v4,01/15] gve: don't pass in unused parameter to gve_adminq_free

    https://git.kernel.org/netdev/net-next/c/063aeece6053
  - [net-next,v4,02/15] gve: refactor initialization with helper functions
    https://git.kernel.org/netdev/net-next/c/94afe5cebcd2
  - [net-next,v4,03/15] gve: add a few helper functions to set device properties
    https://git.kernel.org/netdev/net-next/c/69886e8085ab

- [net-next,v4,04/15] gve: add struct gve_device_info to hold device properties (no matching commit)
- [net-next,v4,05/15] gve: introduce control plane operations structure (no matching commit)
- [net-next,v4,06/15] gve: introduce ctrl ops to set vectors and Qs
(no matching commit)
- [net-next,v4,07/15] gve: introduce gve_adminq_get_device_properties() (no matching commit)
- [net-next,v4,08/15] gve: refactor gve_init_priv for reset path
(no matching commit)
- [net-next,v4,09/15] gve: simplify reset logic
(no matching commit)
- [net-next,v4,10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences (no matching commit)
- [net-next,v4,11/15] gve: split up notify block allocation and setup paths (no matching commit)
- [net-next,v4,12/15] gve: introduce new methods to handle IRQ doorbells (no matching commit)
- [net-next,v4,13/15] gve: setup and teardown management interrupts
(no matching commit)
- [net-next,v4,14/15] gve: add ctrl ops to for queue operations
(no matching commit)
- [net-next,v4,15/15] gve: add link status/speed ctrl ops
(no matching commit)

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html