net: Add support for providing the PTP hardware source in tsinfo

Multi-PTP source support within a network topology has been merged,
but the hardware timestamp source is not yet exposed to users.
Currently, users only see the PTP index, which does not indicate
whether the timestamp comes from a PHY or a MAC.

Add support for reporting the hwtstamp source using a
hwtstamp-source field, alongside hwtstamp-phyindex, to describe
the origin of the hardware timestamp.

Remove HWTSTAMP_SOURCE_UNSPEC enum value as it is not used at all.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20250519-feature_ptp_source-v4-1-5d10e19a0265@bootlin.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Kory Maincent
2025-05-19 10:45:05 +02:00
committed by Paolo Abeni
parent 3da895b239
commit 4ff4d86f6c
6 changed files with 94 additions and 11 deletions

View File

@@ -37,6 +37,18 @@ enum ethtool_tcp_data_split {
ETHTOOL_TCP_DATA_SPLIT_ENABLED,
};
/**
* enum hwtstamp_source - Source of the hardware timestamp
* @HWTSTAMP_SOURCE_NETDEV: Hardware timestamp comes from a MAC or a device
* which has MAC and PHY integrated
* @HWTSTAMP_SOURCE_PHYLIB: Hardware timestamp comes from one PHY device of the
* network topology
*/
enum hwtstamp_source {
HWTSTAMP_SOURCE_NETDEV = 1,
HWTSTAMP_SOURCE_PHYLIB,
};
enum {
ETHTOOL_A_HEADER_UNSPEC,
ETHTOOL_A_HEADER_DEV_INDEX,
@@ -401,6 +413,8 @@ enum {
ETHTOOL_A_TSINFO_PHC_INDEX,
ETHTOOL_A_TSINFO_STATS,
ETHTOOL_A_TSINFO_HWTSTAMP_PROVIDER,
ETHTOOL_A_TSINFO_HWTSTAMP_SOURCE,
ETHTOOL_A_TSINFO_HWTSTAMP_PHYINDEX,
__ETHTOOL_A_TSINFO_CNT,
ETHTOOL_A_TSINFO_MAX = (__ETHTOOL_A_TSINFO_CNT - 1)