Subject: Re: [PATCH net-next v5 14/22] ethtool: provide timestamping information in GET_INFO request

From: Florian Fainelli <[email-masked]>
Date: Wed, 27 Mar 2019 20:36:53 -0700

On 3/25/2019 10:08 AM, Michal Kubecek wrote:
> Add timestamping information as provided by ETHTOOL_GET_TS_INFO ioctl
> command in GET_INFO reply if ETH_INFO_IM_TSINFO flag is set in the request.
> 
> Add constants for counts of HWTSTAMP_TX_* and HWTSTAM_FILTER_* constants
> and provide symbolic names for timestamping related values so that they can
> be retrieved in GET_STRSET and GET_INFO requests.
> 
> Signed-off-by: Michal Kubecek <[email-masked]>
> ---

[snip]

> +int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
> +{
> +	const struct ethtool_ops *ops = dev->ethtool_ops;
> +	struct phy_device *phydev = dev->phydev;
> +	int err = 0;
> +
> +	memset(info, 0, sizeof(*info));
> +	info->cmd = ETHTOOL_GET_TS_INFO;
> +
> +	if (phydev && phydev->drv && phydev->drv->ts_info) {
> +		err = phydev->drv->ts_info(phydev, info);
> +	} else if (ops->get_ts_info) {
> +		err = ops->get_ts_info(dev, info);
> +	} else {
> +		info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
> +					SOF_TIMESTAMPING_SOFTWARE;
> +		info->phc_index = -1;
> +	}

We don't have to solve this just yet, but this is the type of logic that
we want to be able to change in the future, there are a number of things
in the current ethtool code where, say, we always prefer PHY time
stamping over MAC time stamping when there should be a choice if both
are supported.

I don't know if you maintain a TODO for after when this patch series get
merged, but we may want to start one :)
-- 
Florian