[PATCH net-next v5 1/9] net: ethtool: tsconfig: allow hardware timestamping without a PHC
From: Steffen Trumtrar
Date: Thu Nov 12 2026 - 06:36:50 EST
A driver can do hardware timestamping without a PTP hardware clock; its
get_ts_info() then reports hardware timestamping with phc_index -1.
ngbe and txgbe (libwx) do so when no PTP clock is registered, e.g. with
CONFIG_PTP_1588_CLOCK=n, and dpaa without a ptimer-handle.
SIOCGHWTSTAMP and SIOCSHWTSTAMP work for such a device, but
tsconfig_prepare_data() refuses it with -ENODEV:
- TSCONFIG_GET fails.
- TSCONFIG_SET passes the new config to ndo_hwtstamp_set() first and
fails only when building the reply, so user space gets an error
although the config was applied.
- In a dump only -EOPNOTSUPP is skipped; the error ends the dump, and
the devices after this one are not listed.
The reply already leaves out ETHTOOL_A_TSCONFIG_HWTSTAMP_PROVIDER when
the index is -1. Let tsconfig_prepare_data() take that path instead of
failing.
Fixes: 6e9e2eed4f39 ("net: ethtool: Add support for tsconfig command to get/set hwtstamp config")
Signed-off-by: Steffen Trumtrar <s.trumtrar@xxxxxxxxxxxxxx>
---
net/ethtool/tsconfig.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/ethtool/tsconfig.c b/net/ethtool/tsconfig.c
index 2db0e7ba8b9f5..75f9b319aa310 100644
--- a/net/ethtool/tsconfig.c
+++ b/net/ethtool/tsconfig.c
@@ -73,11 +73,7 @@ static int tsconfig_prepare_data(const struct ethnl_req_info *req_base,
if (ret)
goto out;
- if (ts_info.phc_index == -1) {
- ret = -ENODEV;
- goto out;
- }
-
+ /* -1 without a PHC: the reply leaves out the provider */
data->hwprov_desc.index = ts_info.phc_index;
data->hwprov_desc.qualifier = ts_info.phc_qualifier;
}
--
2.56.0