ethtool: provide timestamping information with TSINFO_GET request
Implement TSINFO_GET request to get timestamping information for a network device. This is traditionally available via ETHTOOL_GET_TS_INFO ioctl request. Move part of ethtool_get_ts_info() into common.c so that ioctl and netlink code use the same logic to get timestamping information from the device. v3: use "TSINFO" rather than "TIMESTAMP", suggested by Richard Cochran Signed-off-by: Michal Kubecek <mkubecek@suse.cz> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
#include <linux/net_tstamp.h>
|
||||
#include <linux/phy.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
@@ -350,3 +351,23 @@ int ethtool_check_ops(const struct ethtool_ops *ops)
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
int __ethtool_get_ts_info(struct net_device *dev, struct ethtool_ts_info *info)
|
||||
{
|
||||
const struct ethtool_ops *ops = dev->ethtool_ops;
|
||||
struct phy_device *phydev = dev->phydev;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->cmd = ETHTOOL_GET_TS_INFO;
|
||||
|
||||
if (phy_has_tsinfo(phydev))
|
||||
return phy_ts_info(phydev, info);
|
||||
if (ops->get_ts_info)
|
||||
return ops->get_ts_info(dev, info);
|
||||
|
||||
info->so_timestamping = SOF_TIMESTAMPING_RX_SOFTWARE |
|
||||
SOF_TIMESTAMPING_SOFTWARE;
|
||||
info->phc_index = -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user