Re: [PATCH net-next v5 1/4] net: ethtool: tsconfig: allow selecting a provider

From: Maxime Chevallier

Date: Tue Dec 01 2026 - 05:35:12 EST


Hi,

On 12/1/26 10:44, javen wrote:
> From: Javen <javen_xu@xxxxxxxxxxxxxx>
>
> A hwtstamp provider can obly ne selected with ETHTOOL_MSG_TSCONFIG_SET
> when the device already has an active time stamping source: a MAC
> implementing ndo_hwtstamp_set(), a PHY flagged as default_timestamp, or
> a previously selected dev->hwprov.
>
> This patch makes it possible to select a PHY time stamper on a MAC
> without time stamping support. New phy drivers are expected to reply on
> dev->hwprov rather than default_timestamp.
>
> Signed-off-by: Javen <javen_xu@xxxxxxxxxxxxxx>
> ---
> Changes in v5:
> - new file.
> ---
> net/ethtool/tsconfig.c | 17 +++++++++++------
> 1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c
> index 2db0e7ba8b9f..9c983666a1b0 100644
> --- a/net/ethtool/tsconfig.c
> +++ b/net/ethtool/tsconfig.c
> @@ -300,14 +300,16 @@ static int ethnl_set_tsconfig(struct ethnl_req_info *req_base,
> struct hwtstamp_provider *hwprov = NULL;
> struct net_device *dev = req_base->dev;
> struct nlattr **tb = info->attrs;
> + bool has_hwts;
> int ret;
>
> if (!netif_device_present(dev))
> return -ENODEV;
>
> - if (!dev->netdev_ops->ndo_hwtstamp_set &&
> - !phy_is_default_hwtstamp(dev->phydev) &&
> - !netdev_ops_lock_dereference(dev->hwprov, dev))
> + has_hwts = dev->netdev_ops->ndo_hwtstamp_set ||
> + phy_is_default_hwtstamp(dev->phydev) ||

Isn't "phy_has_hwtstsamp() enough here ? We just need to check if there's some
timestamper available, the PHY's "default_timestamp" field shouldn't
matter, no ?

I may be missing something though,

Maxime