From: Harshitha Ramamurthy <hramamurthy@google.com>
To: netdev@vger.kernel.org
Cc: joshwash@google.com, hramamurthy@google.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
sdf@fomichev.me, jordanrhee@google.com, willemb@google.com,
nktgrg@google.com, maolson@google.com, thostet@google.com,
jacob.e.keller@intel.com, debarghyak@google.com,
kees@kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next v3 06/15] gve: introduce ctrl ops to set vectors and Qs
Date: Mon, 3 Aug 2026 18:46:21 +0000 [thread overview]
Message-ID: <20260803184630.3813311-7-hramamurthy@google.com> (raw)
In-Reply-To: <20260803184630.3813311-1-hramamurthy@google.com>
Introduce following ctrl ops for Adminq mode. This change does
not introduce any functional change, just movement of code into
ops.
- 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.
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
---
drivers/net/ethernet/google/gve/gve.h | 6 ++
drivers/net/ethernet/google/gve/gve_adminq.c | 45 ++++++++++++++
drivers/net/ethernet/google/gve/gve_adminq.h | 2 +
drivers/net/ethernet/google/gve/gve_main.c | 64 +++-----------------
4 files changed, 63 insertions(+), 54 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index 56148ea3cfbf..1bc5e32b6618 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -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 {
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index 9c3ebdb547cf..1d9ae601cdeb 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -1612,3 +1612,48 @@ void gve_adminq_unmap_db_bar(struct gve_priv *priv)
pci_iounmap(pdev, priv->db_bar2);
}
+
+int gve_adminq_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_adminq_set_num_queues(struct gve_priv *priv)
+{
+ struct gve_device_info *device_info = &priv->device_info;
+
+ 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 (device_info->default_tx_queues > 0)
+ priv->tx_cfg.num_queues = min_t(int,
+ device_info->default_tx_queues,
+ priv->tx_cfg.num_queues);
+ if (device_info->default_rx_queues > 0)
+ priv->rx_cfg.num_queues = min_t(int,
+ device_info->default_rx_queues,
+ priv->rx_cfg.num_queues);
+}
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.h b/drivers/net/ethernet/google/gve/gve_adminq.h
index 2a184e051202..52fe4a9f7b87 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.h
+++ b/drivers/net/ethernet/google/gve/gve_adminq.h
@@ -658,5 +658,7 @@ int gve_adminq_get_ptype_map_dqo(struct gve_priv *priv,
struct gve_ptype_lut *ptype_lut);
int gve_adminq_map_db_bar(struct gve_priv *priv);
void gve_adminq_unmap_db_bar(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);
#endif /* _GVE_ADMINQ_H */
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index fff63b90dcbb..ce55f845a6f9 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -2398,56 +2398,6 @@ static const struct xdp_metadata_ops gve_xdp_metadata_ops = {
.xmo_rx_timestamp = gve_xdp_rx_timestamp,
};
-static 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;
-}
-
-static void gve_set_num_queues(struct gve_priv *priv)
-{
- struct gve_device_info *device_info = &priv->device_info;
-
- 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 (device_info->default_tx_queues > 0)
- priv->tx_cfg.num_queues = min_t(int,
- device_info->default_tx_queues,
- priv->tx_cfg.num_queues);
- if (device_info->default_rx_queues > 0)
- priv->rx_cfg.num_queues = min_t(int,
- device_info->default_rx_queues,
- priv->rx_cfg.num_queues);
-
- 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",
- priv->tx_cfg.max_queues, priv->rx_cfg.max_queues);
-}
-
static void gve_set_desc_cnt(struct gve_priv *priv)
{
struct gve_device_info *device_info = &priv->device_info;
@@ -2509,8 +2459,10 @@ 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,
+ .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)
@@ -2549,14 +2501,18 @@ 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",
+ priv->tx_cfg.max_queues, priv->rx_cfg.max_queues);
if (gve_is_dqo(priv)) {
/* DQO supports HW-GRO and UDP_GSO */
--
2.55.0.571.g244d577d93-goog
next prev parent reply other threads:[~2026-08-03 18:46 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 18:46 [PATCH net-next v3 00/15] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 01/15] gve: don't pass in unused parameter to gve_adminq_free Harshitha Ramamurthy
2026-08-04 18:46 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 02/15] gve: refactor initialization with helper functions Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 03/15] gve: add a few helper functions to set device properties Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 04/15] gve: add struct gve_device_info to hold " Harshitha Ramamurthy
2026-08-04 18:46 ` sashiko-bot
2026-08-06 7:19 ` Przemek Kitszel
2026-08-07 2:14 ` Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 05/15] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-08-03 18:46 ` Harshitha Ramamurthy [this message]
2026-08-06 7:33 ` [PATCH net-next v3 06/15] gve: introduce ctrl ops to set vectors and Qs Przemek Kitszel
2026-08-07 2:41 ` Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 07/15] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 08/15] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 09/15] gve: simplify reset logic Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-06 1:37 ` Jakub Kicinski
2026-08-07 0:18 ` Joshua Washington
2026-08-03 18:46 ` [PATCH net-next v3 10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 11/15] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 12/15] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 13/15] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-08-03 18:46 ` [PATCH net-next v3 14/15] gve: add ctrl ops to for queue operations Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
2026-08-03 18:46 ` [PATCH net-next v3 15/15] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-08-04 18:47 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260803184630.3813311-7-hramamurthy@google.com \
--to=hramamurthy@google.com \
--cc=andrew+netdev@lunn.ch \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=debarghyak@google.com \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=john.fastabend@gmail.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maolson@google.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=thostet@google.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.