From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 032A1CD98C5 for ; Sat, 13 Jun 2026 04:23:36 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D9AF8435CA; Sat, 13 Jun 2026 06:23:28 +0200 (CEST) Received: from mail-qt1-f201.google.com (mail-qt1-f201.google.com [209.85.160.201]) by mails.dpdk.org (Postfix) with ESMTP id B25F7435C3 for ; Sat, 13 Jun 2026 06:23:25 +0200 (CEST) Received: by mail-qt1-f201.google.com with SMTP id d75a77b69052e-5177b8def69so3543421cf.2 for ; Fri, 12 Jun 2026 21:23:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781324605; x=1781929405; darn=dpdk.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=+OAVoXU9F3VNEJ4r/YGFgJm3+K7B492qajuwt/51XJc=; b=Qbc5MTtdWae5gwL9gnM75jHXc0JLlISv7Qdt3vSO2XQVcXq9NV+U1I+/FjyVnNTdyO dkXzGe/SQLy8EzVh3LiUWrZb5DWEKKh9zZPlmQO9Rj5p/bm+Zbr00IyB21VtYGG0sgbO 38MWQbNTpewuDIVmMGX/v40Bj9Eg9e0C1YX2ZgsOJb5wlIgcMjjSoEfAlM9T011ve7Jn pHrmfUh96O2Ob2kG98RPOZfzqCzA7V/oWsHE7UkR17zQDLy3qvzIDa68I2IHHcg1OR9u aa1cvFH/gFarVSt4EZC+I3QUfmTYwss/Aov7DC50QSP/VdTqNYBMqrJzXUliZOGZ/uMR NI6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781324605; x=1781929405; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+OAVoXU9F3VNEJ4r/YGFgJm3+K7B492qajuwt/51XJc=; b=a9kHBQAv1RjTvPIlhLG099uXZx8GgcV+WfOTUDWPebp1gZ59LcypqxIvMLJIeyYlOg 07iKoHgw9AKUec4eYlU3RTPrRs6T2hqRvxmh5tJVlivpBSkPZDjnzYjM+8rMgrIzpgcP 5jPOePnDgUzKVYzG1mhvIkZc/k0bvF1E4/prp1ffTEVXKGoOqvy0UY2jUW1TDuAyTtI5 vulr3ZdgII7MmbrQMlDjpWYfKOfqGH/JKY+PLlhV/CcI4E62+uhOM4E2aqcrn+JWJ+ax A5sY8BKlpvyI89eZ5peB3qTGh12w4fLFq8hQb/sCiLwJ4Fp+pM+niZ4Dv6t+5RvLEk83 O7TQ== X-Gm-Message-State: AOJu0YwFW8N0OhcbVFjTN6H8fhNhJVuAOj0jBLLZ+74DxmVLtQw4pGKF fD54fPyihucluioF7pl5JjOIAbqQp0Ka5Iwknj8umrQU+m2pcU2KrLSPi3NQMraGgmmzYMN3MPi GwyWw+A== X-Received: from qtbkf13.prod.google.com ([2002:a05:622a:2a8d:b0:50f:d08f:b78f]) (user=blasko job=prod-delivery.src-stubby-dispatcher) by 2002:ac8:5d91:0:b0:517:8f98:aaff with SMTP id d75a77b69052e-51953573b01mr37926671cf.49.1781324604778; Fri, 12 Jun 2026 21:23:24 -0700 (PDT) Date: Sat, 13 Jun 2026 04:22:35 +0000 In-Reply-To: <20260613042300.3760470-1-blasko@google.com> Mime-Version: 1.0 References: <20260605213022.2770893-1-blasko@google.com> <20260613042300.3760470-1-blasko@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260613042300.3760470-3-blasko@google.com> Subject: [PATCH v4 2/6] net/gve: add device option support for HW timestamps From: Mark Blasko To: stephen@networkplumber.org Cc: dev@dpdk.org, joshwash@google.com, jtranoleary@google.com, blasko@google.com Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Introduce the necessary definitions and functions for the device option flag (GVE_DEV_OPT_ID_NIC_TIMESTAMP) to detect hardware timestamping support in the gvnic device. Signed-off-by: Mark Blasko Reviewed-by: Joshua Washington Reviewed-by: Jasper Tran O'Leary --- drivers/net/gve/base/gve_adminq.c | 41 ++++++++++++++++++++++++++----- drivers/net/gve/base/gve_adminq.h | 9 +++++++ drivers/net/gve/gve_ethdev.h | 3 +++ 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/drivers/net/gve/base/gve_adminq.c b/drivers/net/gve/base/gve_adminq.c index 743ab8e7ae..1ced1e442e 100644 --- a/drivers/net/gve/base/gve_adminq.c +++ b/drivers/net/gve/base/gve_adminq.c @@ -38,7 +38,8 @@ void gve_parse_device_option(struct gve_priv *priv, struct gve_device_option_dqo_rda **dev_op_dqo_rda, struct gve_device_option_flow_steering **dev_op_flow_steering, struct gve_device_option_modify_ring **dev_op_modify_ring, - struct gve_device_option_jumbo_frames **dev_op_jumbo_frames) + struct gve_device_option_jumbo_frames **dev_op_jumbo_frames, + struct gve_device_option_nic_timestamp **dev_op_nic_timestamp) { u32 req_feat_mask = be32_to_cpu(option->required_features_mask); u16 option_length = be16_to_cpu(option->option_length); @@ -168,6 +169,24 @@ void gve_parse_device_option(struct gve_priv *priv, } *dev_op_jumbo_frames = RTE_PTR_ADD(option, sizeof(*option)); break; + case GVE_DEV_OPT_ID_NIC_TIMESTAMP: + if (option_length < sizeof(**dev_op_nic_timestamp) || + req_feat_mask != GVE_DEV_OPT_REQ_FEAT_MASK_NIC_TIMESTAMP) { + PMD_DRV_LOG(WARNING, GVE_DEVICE_OPTION_ERROR_FMT, + "Nic Timestamp", + (int)sizeof(**dev_op_nic_timestamp), + GVE_DEV_OPT_REQ_FEAT_MASK_NIC_TIMESTAMP, + option_length, req_feat_mask); + break; + } + + if (option_length > sizeof(**dev_op_nic_timestamp)) { + PMD_DRV_LOG(WARNING, + GVE_DEVICE_OPTION_TOO_BIG_FMT, + "Nic Timestamp"); + } + *dev_op_nic_timestamp = RTE_PTR_ADD(option, sizeof(*option)); + break; default: /* If we don't recognize the option just continue * without doing anything. @@ -186,7 +205,8 @@ gve_process_device_options(struct gve_priv *priv, struct gve_device_option_dqo_rda **dev_op_dqo_rda, struct gve_device_option_flow_steering **dev_op_flow_steering, struct gve_device_option_modify_ring **dev_op_modify_ring, - struct gve_device_option_jumbo_frames **dev_op_jumbo_frames) + struct gve_device_option_jumbo_frames **dev_op_jumbo_frames, + struct gve_device_option_nic_timestamp **dev_op_nic_timestamp) { const int num_options = be16_to_cpu(descriptor->num_device_options); struct gve_device_option *dev_opt; @@ -207,7 +227,8 @@ gve_process_device_options(struct gve_priv *priv, gve_parse_device_option(priv, dev_opt, dev_op_gqi_rda, dev_op_gqi_qpl, dev_op_dqo_rda, dev_op_flow_steering, - dev_op_modify_ring, dev_op_jumbo_frames); + dev_op_modify_ring, dev_op_jumbo_frames, + dev_op_nic_timestamp); dev_opt = next_opt; } @@ -920,7 +941,8 @@ static void gve_enable_supported_features(struct gve_priv *priv, u32 supported_features_mask, const struct gve_device_option_flow_steering *dev_op_flow_steering, const struct gve_device_option_modify_ring *dev_op_modify_ring, - const struct gve_device_option_jumbo_frames *dev_op_jumbo_frames) + const struct gve_device_option_jumbo_frames *dev_op_jumbo_frames, + const struct gve_device_option_nic_timestamp *dev_op_nic_timestamp) { if (dev_op_flow_steering && (supported_features_mask & GVE_SUP_FLOW_STEERING_MASK) && @@ -947,6 +969,11 @@ static void gve_enable_supported_features(struct gve_priv *priv, PMD_DRV_LOG(INFO, "JUMBO FRAMES device option enabled."); 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)) { + PMD_DRV_LOG(INFO, "NIC TIMESTAMP device option enabled."); + priv->nic_timestamp_supported = true; + } } int gve_adminq_describe_device(struct gve_priv *priv) @@ -954,6 +981,7 @@ int gve_adminq_describe_device(struct gve_priv *priv) struct gve_device_option_jumbo_frames *dev_op_jumbo_frames = NULL; struct gve_device_option_modify_ring *dev_op_modify_ring = NULL; struct gve_device_option_flow_steering *dev_op_flow_steering = NULL; + struct gve_device_option_nic_timestamp *dev_op_nic_timestamp = NULL; struct gve_device_option_gqi_rda *dev_op_gqi_rda = NULL; struct gve_device_option_gqi_qpl *dev_op_gqi_qpl = NULL; struct gve_device_option_dqo_rda *dev_op_dqo_rda = NULL; @@ -983,7 +1011,8 @@ int gve_adminq_describe_device(struct gve_priv *priv) &dev_op_gqi_qpl, &dev_op_dqo_rda, &dev_op_flow_steering, &dev_op_modify_ring, - &dev_op_jumbo_frames); + &dev_op_jumbo_frames, + &dev_op_nic_timestamp); if (err) goto free_device_descriptor; @@ -1038,7 +1067,7 @@ int gve_adminq_describe_device(struct gve_priv *priv) gve_enable_supported_features(priv, supported_features_mask, dev_op_flow_steering, dev_op_modify_ring, - dev_op_jumbo_frames); + dev_op_jumbo_frames, dev_op_nic_timestamp); free_device_descriptor: gve_free_dma_mem(&descriptor_dma_mem); diff --git a/drivers/net/gve/base/gve_adminq.h b/drivers/net/gve/base/gve_adminq.h index d8e5e6a352..eaee5649f2 100644 --- a/drivers/net/gve/base/gve_adminq.h +++ b/drivers/net/gve/base/gve_adminq.h @@ -153,6 +153,12 @@ struct gve_device_option_jumbo_frames { GVE_CHECK_STRUCT_LEN(8, gve_device_option_jumbo_frames); +struct gve_device_option_nic_timestamp { + __be32 supported_features_mask; +}; + +GVE_CHECK_STRUCT_LEN(4, gve_device_option_nic_timestamp); + /* Terminology: * * RDA - Raw DMA Addressing - Buffers associated with SKBs are directly DMA @@ -169,6 +175,7 @@ enum gve_dev_opt_id { GVE_DEV_OPT_ID_MODIFY_RING = 0x6, GVE_DEV_OPT_ID_JUMBO_FRAMES = 0x8, GVE_DEV_OPT_ID_FLOW_STEERING = 0xb, + GVE_DEV_OPT_ID_NIC_TIMESTAMP = 0xd, }; enum gve_dev_opt_req_feat_mask { @@ -179,12 +186,14 @@ enum gve_dev_opt_req_feat_mask { GVE_DEV_OPT_REQ_FEAT_MASK_FLOW_STEERING = 0x0, GVE_DEV_OPT_REQ_FEAT_MASK_MODIFY_RING = 0x0, GVE_DEV_OPT_REQ_FEAT_MASK_JUMBO_FRAMES = 0x0, + GVE_DEV_OPT_REQ_FEAT_MASK_NIC_TIMESTAMP = 0x0, }; enum gve_sup_feature_mask { GVE_SUP_MODIFY_RING_MASK = 1 << 0, GVE_SUP_JUMBO_FRAMES_MASK = 1 << 2, GVE_SUP_FLOW_STEERING_MASK = 1 << 5, + GVE_SUP_NIC_TIMESTAMP_MASK = 1 << 8, }; #define GVE_DEV_OPT_LEN_GQI_RAW_ADDRESSING 0x0 diff --git a/drivers/net/gve/gve_ethdev.h b/drivers/net/gve/gve_ethdev.h index 524e48e723..b9b4688367 100644 --- a/drivers/net/gve/gve_ethdev.h +++ b/drivers/net/gve/gve_ethdev.h @@ -355,6 +355,9 @@ struct gve_priv { void *avail_flow_rule_bmp_mem; /* Backing memory for the bitmap */ pthread_mutex_t flow_rule_lock; /* Lock for bitmap and tailq access */ TAILQ_HEAD(, gve_flow) active_flows; + + /* HW Timestamping Fields */ + bool nic_timestamp_supported; }; static inline bool -- 2.54.0.1136.gdb2ca164c4-goog