DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Joshua Washington <joshwash@google.com>
To: Joshua Washington <joshwash@google.com>
Cc: dev@dpdk.org, Mark Blasko <blasko@google.com>
Subject: [PATCH 8/8] net/gve: refactor timestamp support to clock read type
Date: Fri,  2 Oct 2026 19:51:40 -0700	[thread overview]
Message-ID: <20261003025142.1930363-9-joshwash@google.com> (raw)
In-Reply-To: <20261003025142.1930363-1-joshwash@google.com>

From: Mark Blasko <blasko@google.com>

Replace the boolean nic_timestamp_supported field with enum
gve_dev_clk_type to represent the device clock read mode
(unsupported, Cmd). Update AdminQ capability negotiation
and ethdev operations to check clk_read_type.

Signed-off-by: Mark Blasko <blasko@google.com>
Signed-off-by: Joshua Washington <joshwash@google.com>
---
 drivers/net/gve/base/gve_adminq.c | 5 +++--
 drivers/net/gve/gve_ethdev.c      | 9 ++++++---
 drivers/net/gve/gve_ethdev.h      | 7 ++++++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c
index 60e8544ef4..6fd9323f0c 100644
--- a/drivers/net/gve/base/gve_adminq.c
+++ b/drivers/net/gve/base/gve_adminq.c
@@ -994,9 +994,10 @@ static void gve_enable_supported_features(struct gve_priv *priv,
 		priv->max_mtu = be16_to_cpu(dev_op_jumbo_frames->max_mtu);
 	}
 	if (dev_op_nic_timestamp &&
-	    (supported_features_mask & GVE_SUP_NIC_TIMESTAMP_MASK)) {
+	    (supported_features_mask & GVE_SUP_NIC_TIMESTAMP_MASK) &&
+	    !gve_is_gqi(priv)) {
 		PMD_DRV_LOG(INFO, "NIC TIMESTAMP device option enabled.");
-		priv->nic_timestamp_supported = true;
+		priv->clk_read_type = GVE_DEV_CLK_CMD;
 	}
 }
 
diff --git a/drivers/net/gve/gve_ethdev.c b/drivers/net/gve/gve_ethdev.c
index 5a2f95ae19..a1deadc8ba 100644
--- a/drivers/net/gve/gve_ethdev.c
+++ b/drivers/net/gve/gve_ethdev.c
@@ -554,6 +554,9 @@ gve_alloc_nic_ts_report(struct gve_priv *priv)
 {
 	char z_name[RTE_MEMZONE_NAMESIZE];
 
+	if (priv->clk_read_type == GVE_DEV_CLK_UNSUPPORTED)
+		return -EOPNOTSUPP;
+
 	snprintf(z_name, sizeof(z_name), "gve_%s_nic_ts_report",
 		 priv->pci_dev->device.name);
 	priv->nic_ts_report_mz = rte_memzone_reserve_aligned(z_name,
@@ -865,7 +868,7 @@ gve_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 	dev_info->min_mtu = RTE_ETHER_MIN_MTU;
 
 	dev_info->rx_offload_capa = RTE_ETH_RX_OFFLOAD_RSS_HASH;
-	if (!gve_is_gqi(priv) && priv->nic_ts_report_mz)
+	if (priv->clk_read_type != GVE_DEV_CLK_UNSUPPORTED)
 		dev_info->rx_offload_capa |= RTE_ETH_RX_OFFLOAD_TIMESTAMP;
 	dev_info->tx_offload_capa =
 		RTE_ETH_TX_OFFLOAD_MULTI_SEGS	|
@@ -1342,7 +1345,7 @@ gve_read_clock(struct rte_eth_dev *dev, uint64_t *clock)
 	uint64_t ts;
 	int err;
 
-	if (!priv->nic_timestamp_supported)
+	if (priv->clk_read_type == GVE_DEV_CLK_UNSUPPORTED)
 		return -EOPNOTSUPP;
 
 	if (!priv->nic_ts_report_mz)
@@ -1443,7 +1446,7 @@ gve_setup_nic_timestamp(struct gve_priv *priv)
 {
 	int err;
 
-	if (!priv->nic_timestamp_supported)
+	if (priv->clk_read_type == GVE_DEV_CLK_UNSUPPORTED)
 		return;
 
 	rte_atomic_store_explicit(&priv->nic_ts_read_fails, 0, rte_memory_order_relaxed);
diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h
index ef93db0c1d..21454802f9 100644
--- a/drivers/net/gve/gve_ethdev.h
+++ b/drivers/net/gve/gve_ethdev.h
@@ -274,6 +274,11 @@ extern const struct rte_flow_ops gve_flow_ops;
 struct gve_priv;
 struct gve_flow_rule_params;
 
+enum gve_dev_clk_type {
+	GVE_DEV_CLK_UNSUPPORTED = 0,
+	GVE_DEV_CLK_CMD,
+};
+
 struct gve_ctrl_ops {
 	int (*init_ctrl_plane)(struct gve_priv *priv);
 	void (*free_ctrl_plane)(struct gve_priv *priv);
@@ -411,7 +416,7 @@ struct gve_priv {
 	TAILQ_HEAD(, gve_flow) active_flows;
 
 	/* HW Timestamping Fields */
-	bool nic_timestamp_supported;
+	enum gve_dev_clk_type clk_read_type;
 	const struct rte_memzone *nic_ts_report_mz;
 	struct gve_nic_ts_report *nic_ts_report;
 	pthread_mutex_t nic_ts_lock;
-- 
2.56.0.rc1.315.gc6ed9934b7-goog


  parent reply	other threads:[~2026-10-03  2:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-03  2:51 [PATCH 0/8] gve: precursor control plane changes before bare-metal support Joshua Washington
2026-10-03  2:51 ` [PATCH 1/8] net/gve: refactor ethdev for control ops interface Joshua Washington
2026-10-03  2:51 ` [PATCH 2/8] net/gve: rename doorbell BAR variable to be more generic Joshua Washington
2026-10-03  2:51 ` [PATCH 3/8] net/gve: split default queue counts into Tx and Rx Joshua Washington
2026-10-03  2:51 ` [PATCH 4/8] net/gve: clean Tx queue directly in dqo Joshua Washington
2026-10-03  2:51 ` [PATCH 5/8] net/gve: update RSS config just after successful programming Joshua Washington
2026-10-03  2:51 ` [PATCH 6/8] net/gve: add RSS cache boolean flag Joshua Washington
2026-10-03  2:51 ` [PATCH 7/8] net/gve: fix RSS config memory leak on close Joshua Washington
2026-10-03  2:51 ` Joshua Washington [this message]
2026-10-03 16:29 ` [PATCH 0/8] gve: precursor control plane changes before bare-metal support Stephen Hemminger
2026-10-05 19:39 ` [PATCH v2 " Joshua Washington
2026-10-05 19:39   ` [PATCH v2 1/8] net/gve: refactor ethdev for control ops interface Joshua Washington
2026-10-05 19:39   ` [PATCH v2 2/8] net/gve: rename doorbell BAR variable to be more generic Joshua Washington
2026-10-05 19:39   ` [PATCH v2 3/8] net/gve: split default queue counts into Tx and Rx Joshua Washington
2026-10-05 19:39   ` [PATCH v2 4/8] net/gve: clean Tx queue directly in dqo Joshua Washington
2026-10-05 19:39   ` [PATCH v2 5/8] net/gve: update RSS config just after successful programming Joshua Washington
2026-10-05 19:39   ` [PATCH v2 6/8] net/gve: add RSS cache boolean flag Joshua Washington
2026-10-05 19:39   ` [PATCH v2 7/8] net/gve: fix RSS config memory leak on close Joshua Washington
2026-10-05 19:39   ` [PATCH v2 8/8] net/gve: refactor timestamp support to clock read type Joshua Washington
2026-10-06 14:19   ` [PATCH v2 0/8] gve: precursor control plane changes before bare-metal support Stephen Hemminger
2026-10-06 15:10   ` Stephen Hemminger
2026-10-07 20:11     ` Joshua Washington

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=20261003025142.1930363-9-joshwash@google.com \
    --to=joshwash@google.com \
    --cc=blasko@google.com \
    --cc=dev@dpdk.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox