Message ID | 20220322210722.6405-5-gerhard@engleder-embedded.com (mailing list archive) |
---|---|
State | Deferred |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | ptp: Support hardware clocks with additional free running time | expand |
On Tue, Mar 22, 2022 at 10:07:20PM +0100, Gerhard Engleder wrote: > Add a new function, which returns the physical clock index of a > networking device. This function will be used to get the physical clock > of a device for timestamp manipulation in the receive path. > > Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> Acked-by: Richard Cochran <richardcochran@gmail.com>
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 4af58459a1e7..e107069f37a4 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -820,6 +820,14 @@ void ethtool_params_from_link_mode(struct ethtool_link_ksettings *link_ksettings, enum ethtool_link_mode_bit_indices link_mode); +/** + * ethtool_get_phc - Get phc index + * @dev: pointer to net_device structure + * + * Return index of phc + */ +int ethtool_get_phc(struct net_device *dev); + /** * ethtool_get_phc_vclocks - Derive phc vclocks information, and caller * is responsible to free memory of vclock_index diff --git a/net/ethtool/common.c b/net/ethtool/common.c index 0c5210015911..8218e3b3e98a 100644 --- a/net/ethtool/common.c +++ b/net/ethtool/common.c @@ -557,6 +557,19 @@ int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info) return 0; } +int ethtool_get_phc(struct net_device *dev) +{ + struct ethtool_ts_info info; + int ret; + + ret = __ethtool_get_ts_info(dev, &info); + if (ret) + return ret; + + return info.phc_index; +} +EXPORT_SYMBOL(ethtool_get_phc); + int ethtool_get_phc_vclocks(struct net_device *dev, int **vclock_index) { struct ethtool_ts_info info = { };
Add a new function, which returns the physical clock index of a networking device. This function will be used to get the physical clock of a device for timestamp manipulation in the receive path. Signed-off-by: Gerhard Engleder <gerhard@engleder-embedded.com> --- include/linux/ethtool.h | 8 ++++++++ net/ethtool/common.c | 13 +++++++++++++ 2 files changed, 21 insertions(+)