[PATCH RFC net-next v8 02/13] net: Make dev_get_hwtstamp_phylib accessible

Kory Maincent
2024-02-16T15:53:05Z

Make the dev_get_hwtstamp_phylib function accessible in prevision to use
it from ethtool to read the hwtstamp current configuration.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---

Change in v8:
- New patch
---
include/linux/netdevice.h | 2 ++
net/core/dev_ioctl.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index c541550b0e6e..fa92085c29a8 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -4005,6 +4005,8 @@ int generic_hwtstamp_set_lower(struct net_device *dev,
int dev_set_hwtstamp_phylib(struct net_device *dev,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack);
+int dev_get_hwtstamp_phylib(struct net_device *dev,
+ struct kernel_hwtstamp_config *cfg);
int dev_ethtool(struct net *net, struct ifreq *ifr, void __user *userdata);
unsigned int dev_get_flags(const struct net_device *);
int __dev_change_flags(struct net_device *dev, unsigned int flags,
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 9a66cf5015f2..5d3b169d8f18 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -268,14 +268,15 @@ static int dev_eth_ioctl(struct net_device *dev,
* -EOPNOTSUPP for phylib for now, which is still more accurate than letting
* the netdev handle the GET request.
*/
-static int dev_get_hwtstamp_phylib(struct net_device *dev,
- struct kernel_hwtstamp_config *cfg)
+int dev_get_hwtstamp_phylib(struct net_device *dev,
+ struct kernel_hwtstamp_config *cfg)
{
if (phy_has_hwtstamp(dev->phydev))
return phy_hwtstamp_get(dev->phydev, cfg);

return dev->netdev_ops->ndo_hwtstamp_get(dev, cfg);
}
+EXPORT_SYMBOL_GPL(dev_get_hwtstamp_phylib);

static int dev_get_hwtstamp(struct net_device *dev, struct ifreq *ifr)
{

--
2.25.1