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, przemyslaw.kitszel@intel.com,
debarghyak@google.com, kees@kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH net-next v4 10/15] gve: add gve_ctrl_ops for gve initialization/teardown sequences
Date: Fri, 14 Aug 2026 02:14:00 +0000 [thread overview]
Message-ID: <20260814021406.3044324-11-hramamurthy@google.com> (raw)
In-Reply-To: <20260814021406.3044324-1-hramamurthy@google.com>
From: Joshua Washington <joshwash@google.com>
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
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Jordan Rhee <jordanrhee@google.com>
Signed-off-by: Joshua Washington <joshwash@google.com>
Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
---
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(-)
diff --git a/drivers/net/ethernet/google/gve/gve.h b/drivers/net/ethernet/google/gve/gve.h
index 7d40267b0672..c65c7d264430 100644
--- a/drivers/net/ethernet/google/gve/gve.h
+++ b/drivers/net/ethernet/google/gve/gve.h
@@ -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 {
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
index 7e5a6f4110db..28a27beac7c5 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.c
+++ b/drivers/net/ethernet/google/gve/gve_adminq.c
@@ -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:
diff --git a/drivers/net/ethernet/google/gve/gve_adminq.h b/drivers/net/ethernet/google/gve/gve_adminq.h
index fe1e8868cdfe..5e51c060e237 100644
--- a/drivers/net/ethernet/google/gve/gve_adminq.h
+++ b/drivers/net/ethernet/google/gve/gve_adminq.h
@@ -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);
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 9fba76059a8f..9327c5d6956e 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -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)
--
2.55.0.691.gc56d675ccc-goog
next prev parent reply other threads:[~2026-08-14 2:14 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 2:13 [PATCH net-next v4 00/15] gve: AdminQ mode related refactors Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 01/15] gve: don't pass in unused parameter to gve_adminq_free Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 02/15] gve: refactor initialization with helper functions Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 03/15] gve: add a few helper functions to set device properties Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 04/15] gve: add struct gve_device_info to hold " Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 05/15] gve: introduce control plane operations structure Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 06/15] gve: introduce ctrl ops to set vectors and Qs Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 07/15] gve: introduce gve_adminq_get_device_properties() Harshitha Ramamurthy
2026-08-14 2:13 ` [PATCH net-next v4 08/15] gve: refactor gve_init_priv for reset path Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:13 ` [PATCH net-next v4 09/15] gve: simplify reset logic Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:14 ` Harshitha Ramamurthy [this message]
2026-08-14 2:14 ` [PATCH net-next v4 11/15] gve: split up notify block allocation and setup paths Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 12/15] gve: introduce new methods to handle IRQ doorbells Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 13/15] gve: setup and teardown management interrupts Harshitha Ramamurthy
2026-08-14 2:14 ` [PATCH net-next v4 14/15] gve: add ctrl ops to for queue operations Harshitha Ramamurthy
2026-08-15 2:14 ` sashiko-bot
2026-08-14 2:14 ` [PATCH net-next v4 15/15] gve: add link status/speed ctrl ops Harshitha Ramamurthy
2026-08-15 2:14 ` 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=20260814021406.3044324-11-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=przemyslaw.kitszel@intel.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.