lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aAhFdQgbTfP2ZuIC@LQ3V64L9R2>
Date: Tue, 22 Apr 2025 18:42:13 -0700
From: Joe Damato <jdamato@...tly.com>
To: Harshitha Ramamurthy <hramamurthy@...gle.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, jeroendb@...gle.com,
	andrew+netdev@...n.ch, willemb@...gle.com, ziweixiao@...gle.com,
	pkaligineedi@...gle.com, yyd@...gle.com, joshwash@...gle.com,
	shailend@...gle.com, linux@...blig.org, thostet@...gle.com,
	jfraker@...gle.com, horms@...nel.org, linux-kernel@...r.kernel.org,
	Jeff Rogers <jefrogers@...gle.com>
Subject: Re: [PATCH net-next 1/6] gve: Add device option for nic clock
 synchronization

On Fri, Apr 18, 2025 at 10:12:49PM +0000, Harshitha Ramamurthy wrote:
> From: John Fraker <jfraker@...gle.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@...gle.com>
> Signed-off-by: Jeff Rogers <jefrogers@...gle.com>
> Co-developed-by: Ziwei Xiao <ziweixiao@...gle.com>
> Signed-off-by: Ziwei Xiao <ziweixiao@...gle.com>
> Reviewed-by: Willem de Bruijn <willemb@...gle.com>
> Signed-off-by: John Fraker <jfraker@...gle.com>
> Signed-off-by: Harshitha Ramamurthy <hramamurthy@...gle.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@...tly.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ