When hardware timestamping is supported but no PTP clock has been registered yet (e.g. while the interface is down), stmmac_get_ts_info() currently reports phc_index as 0. Zero is a valid PHC index and would make userspace resolve the wrong clock; the absence of a clock should be reported as -1, matching ethtool_init_tsinfo() and ethtool_op_get_ts_info(). Report -1 when no PTP clock is available. Fixes: 9364fa7fcf12 ("net: stmmac: Remove setting of RX software timestamp") Signed-off-by: Lorenzo Bianconi --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c index 154cc0c7623d..eced707131cd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c @@ -1017,7 +1017,7 @@ static int stmmac_get_ts_info(struct net_device *dev, if (priv->ptp_clock) info->phc_index = ptp_clock_index(priv->ptp_clock); else - info->phc_index = 0; + info->phc_index = -1; info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); --- base-commit: 78445023439506ebd83b86d40b1e428a3b309d4a change-id: 20260912-stmmac-fix-phc_index-1ebf19cce076 Best regards, -- Lorenzo Bianconi