Re: [PATCH net-next RFC v4 1/5] net: ethtool: Refactor identical get_ts_info implementations.

Vladimir Oltean
2023-04-12T13:17:55Z

On Thu, Apr 06, 2023 at 07:33:04PM +0200, Köry Maincent wrote:
> From: Richard Cochran <richardcochran@gmail.com>
>
> The vlan, macvlan and the bonding drivers call their "real" device driver
> in order to report the time stamping capabilities. Provide a core
> ethtool helper function to avoid copy/paste in the stack.
>
> Signed-off-by: Richard Cochran <richardcochran@gmail.com>
> Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
> ---
> static netdev_features_t macvlan_fix_features(struct net_device *dev,
> diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
> index 798d35890118..a21302032dfa 100644
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -1042,6 +1042,14 @@ static inline int ethtool_mm_frag_size_min_to_add(u32 val_min, u32 *val_add,
> return -EINVAL;
> }
>
> +/**
> + * ethtool_get_ts_info_by_layer - Obtains time stamping capabilities from the MAC or PHY layer.
> + * @dev: pointer to net_device structure
> + * @info: buffer to hold the result
> + * Returns zero on sauces, non-zero otherwise.

Not sure if I'm missing some joke with the sauces here.

> + */
> +int ethtool_get_ts_info_by_layer(struct net_device *dev, struct ethtool_ts_info *info);
> +
> /**
> * ethtool_sprintf - Write formatted string to ethtool string data
> * @data: Pointer to start of string to update