]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: remove legacy way to get/set HW timestamp config
authorVadim Fedorenko <vadim.fedorenko@linux.dev>
Fri, 16 Jan 2026 06:21:20 +0000 (06:21 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 Jan 2026 02:21:27 +0000 (18:21 -0800)
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>
Documentation/networking/timestamping.rst
drivers/infiniband/ulp/ipoib/ipoib_main.c
net/core/dev_ioctl.c

index 7aabead906487ef460868ad6ac7a95a1e50fa546..2162c4f2b28a6b118b98e00c02ce44dced2ac034 100644 (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
index 300afc27c5612c3ceb8a9efed942802878cc1a47..4a504b7c42930b652e2011283c297f7729c8e61f 100644 (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);
 }
index 53a53357cfef5b48ae89156d65ed5798084d1539..7a8966544c9d7d4772e22ead8145605336d20558 100644 (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;
-
-               netdev_lock_ops(dev);
-               err = dev_get_hwtstamp_phylib(dev, kernel_cfg);
-               netdev_unlock_ops(dev);
+       if (!ops->ndo_hwtstamp_get)
+               return -EOPNOTSUPP;
 
-               return err;
-       }
+       netdev_lock_ops(dev);
+       err = dev_get_hwtstamp_phylib(dev, kernel_cfg);
+       netdev_unlock_ops(dev);
 
-       /* 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;
-
-               netdev_lock_ops(dev);
-               err = dev_set_hwtstamp_phylib(dev, kernel_cfg, extack);
-               netdev_unlock_ops(dev);
+       if (!ops->ndo_hwtstamp_set)
+               return -EOPNOTSUPP;
 
-               return err;
-       }
+       netdev_lock_ops(dev);
+       err = dev_set_hwtstamp_phylib(dev, kernel_cfg, extack);
+       netdev_unlock_ops(dev);
 
-       /* Legacy path: unconverted lower driver */
-       return generic_hwtstamp_ioctl_lower(dev, SIOCSHWTSTAMP, kernel_cfg);
+       return err;
 }
 EXPORT_SYMBOL(generic_hwtstamp_set_lower);