From: Joe Damato <jdamato@fastly.com>
To: Harshitha Ramamurthy <hramamurthy@google.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, jeroendb@google.com,
andrew+netdev@lunn.ch, willemb@google.com, ziweixiao@google.com,
pkaligineedi@google.com, yyd@google.com, joshwash@google.com,
shailend@google.com, linux@treblig.org, thostet@google.com,
jfraker@google.com, horms@kernel.org,
linux-kernel@vger.kernel.org, Jeff Rogers <jefrogers@google.com>
Subject: Re: [PATCH net-next 1/6] gve: Add device option for nic clock synchronization
Date: Tue, 22 Apr 2025 18:42:13 -0700 [thread overview]
Message-ID: <aAhFdQgbTfP2ZuIC@LQ3V64L9R2> (raw)
In-Reply-To: <20250418221254.112433-2-hramamurthy@google.com>
On Fri, Apr 18, 2025 at 10:12:49PM +0000, Harshitha Ramamurthy wrote:
> From: John Fraker <jfraker@google.com>
>
> This patch adds the device option and negotiation with the device for
> clock synchronization with the nic. This option is necessary before the
> driver will advertise support for hardware timestamping or other related
> features.
>
> Co-developed-by: Jeff Rogers <jefrogers@google.com>
> Signed-off-by: Jeff Rogers <jefrogers@google.com>
> Co-developed-by: Ziwei Xiao <ziweixiao@google.com>
> Signed-off-by: Ziwei Xiao <ziweixiao@google.com>
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: John Fraker <jfraker@google.com>
> Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
> ---
[...]
> diff --git a/drivers/net/ethernet/google/gve/gve_adminq.c b/drivers/net/ethernet/google/gve/gve_adminq.c
> index 3e8fc33cc11f..ae20d2f7e6e1 100644
> --- a/drivers/net/ethernet/google/gve/gve_adminq.c
> +++ b/drivers/net/ethernet/google/gve/gve_adminq.c
> @@ -46,6 +46,7 @@ void gve_parse_device_option(struct gve_priv *priv,
> struct gve_device_option_buffer_sizes **dev_op_buffer_sizes,
> struct gve_device_option_flow_steering **dev_op_flow_steering,
> struct gve_device_option_rss_config **dev_op_rss_config,
> + struct gve_device_option_nic_timestamp **dev_op_nic_timestamp,
> struct gve_device_option_modify_ring **dev_op_modify_ring)
> {
> u32 req_feat_mask = be32_to_cpu(option->required_features_mask);
> @@ -225,6 +226,23 @@ void gve_parse_device_option(struct gve_priv *priv,
> "RSS config");
> *dev_op_rss_config = (void *)(option + 1);
> 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) {
> + dev_warn(&priv->pdev->dev, 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))
> + dev_warn(&priv->pdev->dev,
> + GVE_DEVICE_OPTION_TOO_BIG_FMT,
> + "Nic Timestamp");
> + *dev_op_nic_timestamp = (void *)(option + 1);
> + break;
Overall: The above pattern is repeated quite a bit. Maybe it's time
to refactor gve_parse_device_option to eliminate all the duplicated
logic via some helpers or macros or something?
Notwithstanding the above:
Reviewed-by: Joe Damato <jdamato@fastly.com>
next prev parent reply other threads:[~2025-04-23 1:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-18 22:12 [PATCH net-next 0/6] gve: Add Rx HW timestamping support Harshitha Ramamurthy
2025-04-18 22:12 ` [PATCH net-next 1/6] gve: Add device option for nic clock synchronization Harshitha Ramamurthy
2025-04-23 1:42 ` Joe Damato [this message]
2025-04-18 22:12 ` [PATCH net-next 2/6] gve: Add adminq command to report nic timestamp Harshitha Ramamurthy
2025-04-23 1:44 ` Joe Damato
2025-04-18 22:12 ` [PATCH net-next 3/6] gve: Add initial gve_clock Harshitha Ramamurthy
2025-04-23 1:49 ` Joe Damato
2025-04-18 22:12 ` [PATCH net-next 4/6] gve: Add rx hardware timestamp expansion Harshitha Ramamurthy
2025-04-23 1:21 ` Joe Damato
2025-04-24 18:40 ` Ziwei Xiao
2025-04-18 22:12 ` [PATCH net-next 5/6] gve: Add support for SIOC[GS]HWTSTAMP IOCTLs Harshitha Ramamurthy
2025-04-23 1:52 ` Joe Damato
2025-04-18 22:12 ` [PATCH net-next 6/6] gve: Advertise support for rx hardware timestamping Harshitha Ramamurthy
2025-04-23 1:53 ` Joe Damato
2025-04-23 10:13 ` [PATCH net-next 0/6] gve: Add Rx HW timestamping support Vadim Fedorenko
2025-04-23 20:46 ` Ziwei Xiao
2025-04-23 21:06 ` Vadim Fedorenko
2025-04-23 22:56 ` Jakub Kicinski
2025-04-24 18:39 ` Ziwei Xiao
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=aAhFdQgbTfP2ZuIC@LQ3V64L9R2 \
--to=jdamato@fastly.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=hramamurthy@google.com \
--cc=jefrogers@google.com \
--cc=jeroendb@google.com \
--cc=jfraker@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@treblig.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=shailend@google.com \
--cc=thostet@google.com \
--cc=willemb@google.com \
--cc=yyd@google.com \
--cc=ziweixiao@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox