Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

funeth: convert to ndo_hwtstamp API

Convert driver to use .ndo_hwtstamp_get()/.ndo_hwtstamp_set() callbacks.
.ndo_eth_ioctl() implementation becomes empty, 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-8-vadim.fedorenko@linux.dev
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vadim Fedorenko and committed by
Jakub Kicinski
dc340406 d8db98db

+16 -28
+2 -2
drivers/net/ethernet/fungible/funeth/funeth.h
··· 4 4 #define _FUNETH_H 5 5 6 6 #include <uapi/linux/if_ether.h> 7 - #include <uapi/linux/net_tstamp.h> 7 + #include <linux/net_tstamp.h> 8 8 #include <linux/mutex.h> 9 9 #include <linux/seqlock.h> 10 10 #include <linux/xarray.h> ··· 121 121 u8 rx_coal_usec; 122 122 u8 rx_coal_count; 123 123 124 - struct hwtstamp_config hwtstamp_cfg; 124 + struct kernel_hwtstamp_config hwtstamp_cfg; 125 125 126 126 /* cumulative queue stats from earlier queue instances */ 127 127 u64 tx_packets;
+14 -26
drivers/net/ethernet/fungible/funeth/funeth_main.c
··· 1014 1014 return 0; 1015 1015 } 1016 1016 1017 - static int fun_hwtstamp_get(struct net_device *dev, struct ifreq *ifr) 1017 + static int fun_hwtstamp_get(struct net_device *dev, 1018 + struct kernel_hwtstamp_config *config) 1018 1019 { 1019 1020 const struct funeth_priv *fp = netdev_priv(dev); 1020 1021 1021 - return copy_to_user(ifr->ifr_data, &fp->hwtstamp_cfg, 1022 - sizeof(fp->hwtstamp_cfg)) ? -EFAULT : 0; 1022 + *config = fp->hwtstamp_cfg; 1023 + return 0; 1023 1024 } 1024 1025 1025 - static int fun_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) 1026 + static int fun_hwtstamp_set(struct net_device *dev, 1027 + struct kernel_hwtstamp_config *config, 1028 + struct netlink_ext_ack *extack) 1026 1029 { 1027 1030 struct funeth_priv *fp = netdev_priv(dev); 1028 - struct hwtstamp_config cfg; 1029 - 1030 - if (copy_from_user(&cfg, ifr->ifr_data, sizeof(cfg))) 1031 - return -EFAULT; 1032 1031 1033 1032 /* no TX HW timestamps */ 1034 - cfg.tx_type = HWTSTAMP_TX_OFF; 1033 + config->tx_type = HWTSTAMP_TX_OFF; 1035 1034 1036 - switch (cfg.rx_filter) { 1035 + switch (config->rx_filter) { 1037 1036 case HWTSTAMP_FILTER_NONE: 1038 1037 break; 1039 1038 case HWTSTAMP_FILTER_ALL: ··· 1050 1051 case HWTSTAMP_FILTER_PTP_V2_SYNC: 1051 1052 case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: 1052 1053 case HWTSTAMP_FILTER_NTP_ALL: 1053 - cfg.rx_filter = HWTSTAMP_FILTER_ALL; 1054 + config->rx_filter = HWTSTAMP_FILTER_ALL; 1054 1055 break; 1055 1056 default: 1056 1057 return -ERANGE; 1057 1058 } 1058 1059 1059 - fp->hwtstamp_cfg = cfg; 1060 - return copy_to_user(ifr->ifr_data, &cfg, sizeof(cfg)) ? -EFAULT : 0; 1061 - } 1062 - 1063 - static int fun_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) 1064 - { 1065 - switch (cmd) { 1066 - case SIOCSHWTSTAMP: 1067 - return fun_hwtstamp_set(dev, ifr); 1068 - case SIOCGHWTSTAMP: 1069 - return fun_hwtstamp_get(dev, ifr); 1070 - default: 1071 - return -EOPNOTSUPP; 1072 - } 1060 + fp->hwtstamp_cfg = *config; 1061 + return 0; 1073 1062 } 1074 1063 1075 1064 /* Prepare the queues for XDP. */ ··· 1327 1340 .ndo_change_mtu = fun_change_mtu, 1328 1341 .ndo_set_mac_address = fun_set_macaddr, 1329 1342 .ndo_validate_addr = eth_validate_addr, 1330 - .ndo_eth_ioctl = fun_ioctl, 1331 1343 .ndo_uninit = fun_uninit, 1332 1344 .ndo_bpf = fun_xdp, 1333 1345 .ndo_xdp_xmit = fun_xdp_xmit_frames, ··· 1334 1348 .ndo_set_vf_vlan = fun_set_vf_vlan, 1335 1349 .ndo_set_vf_rate = fun_set_vf_rate, 1336 1350 .ndo_get_vf_config = fun_get_vf_config, 1351 + .ndo_hwtstamp_get = fun_hwtstamp_get, 1352 + .ndo_hwtstamp_set = fun_hwtstamp_set, 1337 1353 }; 1338 1354 1339 1355 #define GSO_ENCAP_FLAGS (NETIF_F_GSO_GRE | NETIF_F_GSO_IPXIP4 | \