net: remove legacy way to get/set HW timestamp config

With all drivers converted to use ndo_hwstamp callbacks the legacy way
can be removed, marking ioctl interface as deprecated.

Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20260116062121.1230184-1-vadim.fedorenko@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Vadim Fedorenko 2026-01-16 06:21:20 +00:00 committed by Jakub Kicinski
parent 3fbb5395c7
commit 5062245a5a
3 changed files with 21 additions and 52 deletions

View file

@ -627,10 +627,9 @@ ioctl(SIOCSHWTSTAMP). However, this has not been implemented in all drivers.
--------------------------------------------------------
A driver which supports hardware time stamping must support the
ndo_hwtstamp_set NDO or the legacy SIOCSHWTSTAMP ioctl and update the
supplied struct hwtstamp_config with the actual values as described in
the section on SIOCSHWTSTAMP. It should also support ndo_hwtstamp_get or
the legacy SIOCGHWTSTAMP.
ndo_hwtstamp_set NDO and update the supplied struct hwtstamp_config with
the actual values as described in the section on SIOCSHWTSTAMP. It
should also support ndo_hwtstamp_get NDO to retrieve configuration.
Time stamps for received packets must be stored in the skb. To get a pointer
to the shared time stamp structure of the skb call skb_hwtstamps(). Then

View file

@ -1831,8 +1831,7 @@ static int ipoib_hwtstamp_get(struct net_device *dev,
struct ipoib_dev_priv *priv = ipoib_priv(dev);
if (!priv->rn_ops->ndo_hwtstamp_get)
/* legacy */
return dev_eth_ioctl(dev, config->ifr, SIOCGHWTSTAMP);
return -EOPNOTSUPP;
return priv->rn_ops->ndo_hwtstamp_get(dev, config);
}
@ -1844,8 +1843,7 @@ static int ipoib_hwtstamp_set(struct net_device *dev,
struct ipoib_dev_priv *priv = ipoib_priv(dev);
if (!priv->rn_ops->ndo_hwtstamp_set)
/* legacy */
return dev_eth_ioctl(dev, config->ifr, SIOCSHWTSTAMP);
return -EOPNOTSUPP;
return priv->rn_ops->ndo_hwtstamp_set(dev, config, extack);
}

View file

@ -287,7 +287,7 @@ static int dev_get_hwtstamp(struct net_device *dev, struct ifreq *ifr)
int err;
if (!ops->ndo_hwtstamp_get)
return dev_eth_ioctl(dev, ifr, SIOCGHWTSTAMP); /* legacy */
return -EOPNOTSUPP;
if (!netif_device_present(dev))
return -ENODEV;
@ -414,7 +414,7 @@ static int dev_set_hwtstamp(struct net_device *dev, struct ifreq *ifr)
}
if (!ops->ndo_hwtstamp_set)
return dev_eth_ioctl(dev, ifr, SIOCSHWTSTAMP); /* legacy */
return -EOPNOTSUPP;
if (!netif_device_present(dev))
return -ENODEV;
@ -438,48 +438,23 @@ static int dev_set_hwtstamp(struct net_device *dev, struct ifreq *ifr)
return 0;
}
static int generic_hwtstamp_ioctl_lower(struct net_device *dev, int cmd,
struct kernel_hwtstamp_config *kernel_cfg)
{
struct ifreq ifrr;
int err;
if (!kernel_cfg->ifr)
return -EINVAL;
strscpy_pad(ifrr.ifr_name, dev->name, IFNAMSIZ);
ifrr.ifr_ifru = kernel_cfg->ifr->ifr_ifru;
err = dev_eth_ioctl(dev, &ifrr, cmd);
if (err)
return err;
kernel_cfg->ifr->ifr_ifru = ifrr.ifr_ifru;
kernel_cfg->copied_to_user = true;
return 0;
}
int generic_hwtstamp_get_lower(struct net_device *dev,
struct kernel_hwtstamp_config *kernel_cfg)
{
const struct net_device_ops *ops = dev->netdev_ops;
int err;
if (!netif_device_present(dev))
return -ENODEV;
if (ops->ndo_hwtstamp_get) {
int err;
if (!ops->ndo_hwtstamp_get)
return -EOPNOTSUPP;
netdev_lock_ops(dev);
err = dev_get_hwtstamp_phylib(dev, kernel_cfg);
netdev_unlock_ops(dev);
netdev_lock_ops(dev);
err = dev_get_hwtstamp_phylib(dev, kernel_cfg);
netdev_unlock_ops(dev);
return err;
}
/* Legacy path: unconverted lower driver */
return generic_hwtstamp_ioctl_lower(dev, SIOCGHWTSTAMP, kernel_cfg);
return err;
}
EXPORT_SYMBOL(generic_hwtstamp_get_lower);
@ -488,22 +463,19 @@ int generic_hwtstamp_set_lower(struct net_device *dev,
struct netlink_ext_ack *extack)
{
const struct net_device_ops *ops = dev->netdev_ops;
int err;
if (!netif_device_present(dev))
return -ENODEV;
if (ops->ndo_hwtstamp_set) {
int err;
if (!ops->ndo_hwtstamp_set)
return -EOPNOTSUPP;
netdev_lock_ops(dev);
err = dev_set_hwtstamp_phylib(dev, kernel_cfg, extack);
netdev_unlock_ops(dev);
netdev_lock_ops(dev);
err = dev_set_hwtstamp_phylib(dev, kernel_cfg, extack);
netdev_unlock_ops(dev);
return err;
}
/* Legacy path: unconverted lower driver */
return generic_hwtstamp_ioctl_lower(dev, SIOCSHWTSTAMP, kernel_cfg);
return err;
}
EXPORT_SYMBOL(generic_hwtstamp_set_lower);