]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
amd-xgbe: convert to ndo_hwtstamp callbacks
authorVadim Fedorenko <vadim.fedorenko@linux.dev>
Thu, 16 Oct 2025 15:25:11 +0000 (15:25 +0000)
committerJakub Kicinski <kuba@kernel.org>
Tue, 21 Oct 2025 00:30:26 +0000 (17:30 -0700)
Convert driver to use .ndo_hwtstamp_get()/.ndo_hwtstamp_set() callbacks.
.ndo_eth_ioctl() becomes empty function, remove it.

Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20251016152515.3510991-4-vadim.fedorenko@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
drivers/net/ethernet/amd/xgbe/xgbe-hwtstamp.c
drivers/net/ethernet/amd/xgbe/xgbe.h

index 4dc631af793324130249265c2742eb675e68addf..f3adf29b222bf3fe0b0d07ba5a86b0bfe1bf755f 100644 (file)
@@ -1754,27 +1754,6 @@ static int xgbe_set_mac_address(struct net_device *netdev, void *addr)
        return 0;
 }
 
-static int xgbe_ioctl(struct net_device *netdev, struct ifreq *ifreq, int cmd)
-{
-       struct xgbe_prv_data *pdata = netdev_priv(netdev);
-       int ret;
-
-       switch (cmd) {
-       case SIOCGHWTSTAMP:
-               ret = xgbe_get_hwtstamp_settings(pdata, ifreq);
-               break;
-
-       case SIOCSHWTSTAMP:
-               ret = xgbe_set_hwtstamp_settings(pdata, ifreq);
-               break;
-
-       default:
-               ret = -EOPNOTSUPP;
-       }
-
-       return ret;
-}
-
 static int xgbe_change_mtu(struct net_device *netdev, int mtu)
 {
        struct xgbe_prv_data *pdata = netdev_priv(netdev);
@@ -2020,7 +1999,6 @@ static const struct net_device_ops xgbe_netdev_ops = {
        .ndo_set_rx_mode        = xgbe_set_rx_mode,
        .ndo_set_mac_address    = xgbe_set_mac_address,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_eth_ioctl          = xgbe_ioctl,
        .ndo_change_mtu         = xgbe_change_mtu,
        .ndo_tx_timeout         = xgbe_tx_timeout,
        .ndo_get_stats64        = xgbe_get_stats64,
@@ -2033,6 +2011,8 @@ static const struct net_device_ops xgbe_netdev_ops = {
        .ndo_fix_features       = xgbe_fix_features,
        .ndo_set_features       = xgbe_set_features,
        .ndo_features_check     = xgbe_features_check,
+       .ndo_hwtstamp_get       = xgbe_get_hwtstamp_settings,
+       .ndo_hwtstamp_set       = xgbe_set_hwtstamp_settings,
 };
 
 const struct net_device_ops *xgbe_get_netdev_ops(void)
index bc52e5ec642059f00b22e8cb32908e6bd4d2d6c5..0127988e10beebb28990817c79a38baaebde132e 100644 (file)
@@ -157,26 +157,24 @@ unlock:
        spin_unlock_irqrestore(&pdata->tstamp_lock, flags);
 }
 
-int xgbe_get_hwtstamp_settings(struct xgbe_prv_data *pdata, struct ifreq *ifreq)
+int xgbe_get_hwtstamp_settings(struct net_device *netdev,
+                              struct kernel_hwtstamp_config *config)
 {
-       if (copy_to_user(ifreq->ifr_data, &pdata->tstamp_config,
-                        sizeof(pdata->tstamp_config)))
-               return -EFAULT;
+       struct xgbe_prv_data *pdata = netdev_priv(netdev);
+
+       *config = pdata->tstamp_config;
 
        return 0;
 }
 
-int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata, struct ifreq *ifreq)
+int xgbe_set_hwtstamp_settings(struct net_device *netdev,
+                              struct kernel_hwtstamp_config *config,
+                              struct netlink_ext_ack *extack)
 {
-       struct hwtstamp_config config;
-       unsigned int mac_tscr;
-
-       if (copy_from_user(&config, ifreq->ifr_data, sizeof(config)))
-               return -EFAULT;
-
-       mac_tscr = 0;
+       struct xgbe_prv_data *pdata = netdev_priv(netdev);
+       unsigned int mac_tscr = 0;
 
-       switch (config.tx_type) {
+       switch (config->tx_type) {
        case HWTSTAMP_TX_OFF:
                break;
 
@@ -188,7 +186,7 @@ int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata, struct ifreq *ifreq)
                return -ERANGE;
        }
 
-       switch (config.rx_filter) {
+       switch (config->rx_filter) {
        case HWTSTAMP_FILTER_NONE:
                break;
 
@@ -290,7 +288,7 @@ int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata, struct ifreq *ifreq)
 
        xgbe_config_tstamp(pdata, mac_tscr);
 
-       memcpy(&pdata->tstamp_config, &config, sizeof(config));
+       pdata->tstamp_config = *config;
 
        return 0;
 }
index e8bbb68059013a1f277cffb5d120eb018019ba2b..381f72a33d1af629ed9dc09ea99e808a23653566 100644 (file)
@@ -1146,7 +1146,7 @@ struct xgbe_prv_data {
        spinlock_t tstamp_lock;
        struct ptp_clock_info ptp_clock_info;
        struct ptp_clock *ptp_clock;
-       struct hwtstamp_config tstamp_config;
+       struct kernel_hwtstamp_config tstamp_config;
        unsigned int tstamp_addend;
        struct work_struct tx_tstamp_work;
        struct sk_buff *tx_tstamp_skb;
@@ -1307,10 +1307,11 @@ void xgbe_update_tstamp_addend(struct xgbe_prv_data *pdata,
 void xgbe_set_tstamp_time(struct xgbe_prv_data *pdata, unsigned int sec,
                          unsigned int nsec);
 void xgbe_tx_tstamp(struct work_struct *work);
-int xgbe_get_hwtstamp_settings(struct xgbe_prv_data *pdata,
-                              struct ifreq *ifreq);
-int xgbe_set_hwtstamp_settings(struct xgbe_prv_data *pdata,
-                              struct ifreq *ifreq);
+int xgbe_get_hwtstamp_settings(struct net_device *netdev,
+                              struct kernel_hwtstamp_config *config);
+int xgbe_set_hwtstamp_settings(struct net_device *netdev,
+                              struct kernel_hwtstamp_config *config,
+                              struct netlink_ext_ack *extack);
 void xgbe_prep_tx_tstamp(struct xgbe_prv_data *pdata,
                         struct sk_buff *skb,
                         struct xgbe_packet_data *packet);