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

can: tree-wide: advertise software timestamping capabilities

Currently, some CAN drivers support hardware timestamping, some do
not. But userland has no method to query which features are supported
(aside maybe of getting RX messages and observe whether or not
hardware timestamps stay at zero).

The canonical way for a network driver to advertised what kind of
timestamping it supports is to implement ethtool_ops::get_ts_info().

This patch only targets the CAN drivers which *do not* support
hardware timestamping. For each of those CAN drivers, implement the
get_ts_info() using the generic ethtool_op_get_ts_info().

This way, userland can do:

| $ ethtool --show-time-stamping canX

to confirm the device timestamping capacities.

N.B. the drivers which support hardware timestamping will be migrated
in separate patches.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20220727101641.198847-6-mailhol.vincent@wanadoo.fr
[mkl: mscan: add missing mscan_ethtool_ops]
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

authored by

Vincent Mailhol and committed by
Marc Kleine-Budde
409c188c 6a37a28b

+159
+6
drivers/net/can/at91_can.c
··· 8 8 9 9 #include <linux/clk.h> 10 10 #include <linux/errno.h> 11 + #include <linux/ethtool.h> 11 12 #include <linux/if_arp.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/kernel.h> ··· 1153 1152 .ndo_change_mtu = can_change_mtu, 1154 1153 }; 1155 1154 1155 + static const struct ethtool_ops at91_ethtool_ops = { 1156 + .get_ts_info = ethtool_op_get_ts_info, 1157 + }; 1158 + 1156 1159 static ssize_t mb0_id_show(struct device *dev, 1157 1160 struct device_attribute *attr, char *buf) 1158 1161 { ··· 1298 1293 } 1299 1294 1300 1295 dev->netdev_ops = &at91_netdev_ops; 1296 + dev->ethtool_ops = &at91_ethtool_ops; 1301 1297 dev->irq = irq; 1302 1298 dev->flags |= IFF_ECHO; 1303 1299
+1
drivers/net/can/c_can/c_can_ethtool.c
··· 26 26 27 27 const struct ethtool_ops c_can_ethtool_ops = { 28 28 .get_ringparam = c_can_get_ringparam, 29 + .get_ts_info = ethtool_op_get_ts_info, 29 30 };
+5
drivers/net/can/can327.c
··· 850 850 .ndo_change_mtu = can_change_mtu, 851 851 }; 852 852 853 + static const struct ethtool_ops can327_ethtool_ops = { 854 + .get_ts_info = ethtool_op_get_ts_info, 855 + }; 856 + 853 857 static bool can327_is_valid_rx_char(u8 c) 854 858 { 855 859 static const bool lut_char_is_valid['z'] = { ··· 1038 1034 /* Configure netdev interface */ 1039 1035 elm->dev = dev; 1040 1036 dev->netdev_ops = &can327_netdev_ops; 1037 + dev->ethtool_ops = &can327_ethtool_ops; 1041 1038 1042 1039 /* Mark ldisc channel as alive */ 1043 1040 elm->tty = tty;
+6
drivers/net/can/cc770/cc770.c
··· 17 17 #include <linux/ptrace.h> 18 18 #include <linux/string.h> 19 19 #include <linux/errno.h> 20 + #include <linux/ethtool.h> 20 21 #include <linux/netdevice.h> 21 22 #include <linux/if_arp.h> 22 23 #include <linux/if_ether.h> ··· 837 836 .ndo_change_mtu = can_change_mtu, 838 837 }; 839 838 839 + static const struct ethtool_ops cc770_ethtool_ops = { 840 + .get_ts_info = ethtool_op_get_ts_info, 841 + }; 842 + 840 843 int register_cc770dev(struct net_device *dev) 841 844 { 842 845 struct cc770_priv *priv = netdev_priv(dev); ··· 851 846 return err; 852 847 853 848 dev->netdev_ops = &cc770_netdev_ops; 849 + dev->ethtool_ops = &cc770_ethtool_ops; 854 850 855 851 dev->flags |= IFF_ECHO; /* we support local echo */ 856 852
+6
drivers/net/can/ctucanfd/ctucanfd_base.c
··· 19 19 20 20 #include <linux/clk.h> 21 21 #include <linux/errno.h> 22 + #include <linux/ethtool.h> 22 23 #include <linux/init.h> 23 24 #include <linux/bitfield.h> 24 25 #include <linux/interrupt.h> ··· 1302 1301 .ndo_change_mtu = can_change_mtu, 1303 1302 }; 1304 1303 1304 + static const struct ethtool_ops ctucan_ethtool_ops = { 1305 + .get_ts_info = ethtool_op_get_ts_info, 1306 + }; 1307 + 1305 1308 int ctucan_suspend(struct device *dev) 1306 1309 { 1307 1310 struct net_device *ndev = dev_get_drvdata(dev); ··· 1382 1377 set_drvdata_fnc(dev, ndev); 1383 1378 SET_NETDEV_DEV(ndev, dev); 1384 1379 ndev->netdev_ops = &ctucan_netdev_ops; 1380 + ndev->ethtool_ops = &ctucan_ethtool_ops; 1385 1381 1386 1382 /* Getting the can_clk info */ 1387 1383 if (!can_clk_rate) {
+1
drivers/net/can/flexcan/flexcan-ethtool.c
··· 106 106 .get_priv_flags = flexcan_get_priv_flags, 107 107 .set_priv_flags = flexcan_set_priv_flags, 108 108 .get_sset_count = flexcan_get_sset_count, 109 + .get_ts_info = ethtool_op_get_ts_info, 109 110 };
+6
drivers/net/can/grcan.c
··· 27 27 #include <linux/interrupt.h> 28 28 #include <linux/netdevice.h> 29 29 #include <linux/delay.h> 30 + #include <linux/ethtool.h> 30 31 #include <linux/io.h> 31 32 #include <linux/can/dev.h> 32 33 #include <linux/spinlock.h> ··· 1562 1561 .ndo_change_mtu = can_change_mtu, 1563 1562 }; 1564 1563 1564 + static const struct ethtool_ops grcan_ethtool_ops = { 1565 + .get_ts_info = ethtool_op_get_ts_info, 1566 + }; 1567 + 1565 1568 static int grcan_setup_netdev(struct platform_device *ofdev, 1566 1569 void __iomem *base, 1567 1570 int irq, u32 ambafreq, bool txbug) ··· 1582 1577 dev->irq = irq; 1583 1578 dev->flags |= IFF_ECHO; 1584 1579 dev->netdev_ops = &grcan_netdev_ops; 1580 + dev->ethtool_ops = &grcan_ethtool_ops; 1585 1581 dev->sysfs_groups[0] = &sysfs_grcan_group; 1586 1582 1587 1583 priv = netdev_priv(dev);
+6
drivers/net/can/ifi_canfd/ifi_canfd.c
··· 13 13 14 14 #include <linux/clk.h> 15 15 #include <linux/delay.h> 16 + #include <linux/ethtool.h> 16 17 #include <linux/interrupt.h> 17 18 #include <linux/io.h> 18 19 #include <linux/kernel.h> ··· 926 925 .ndo_change_mtu = can_change_mtu, 927 926 }; 928 927 928 + static const struct ethtool_ops ifi_canfd_ethtool_ops = { 929 + .get_ts_info = ethtool_op_get_ts_info, 930 + }; 931 + 929 932 static int ifi_canfd_plat_probe(struct platform_device *pdev) 930 933 { 931 934 struct device *dev = &pdev->dev; ··· 967 962 ndev->irq = irq; 968 963 ndev->flags |= IFF_ECHO; /* we support local echo */ 969 964 ndev->netdev_ops = &ifi_canfd_netdev_ops; 965 + ndev->ethtool_ops = &ifi_canfd_ethtool_ops; 970 966 971 967 priv = netdev_priv(ndev); 972 968 priv->ndev = ndev;
+6
drivers/net/can/janz-ican3.c
··· 9 9 #include <linux/module.h> 10 10 #include <linux/interrupt.h> 11 11 #include <linux/delay.h> 12 + #include <linux/ethtool.h> 12 13 #include <linux/platform_device.h> 13 14 14 15 #include <linux/netdevice.h> ··· 1755 1754 .ndo_change_mtu = can_change_mtu, 1756 1755 }; 1757 1756 1757 + static const struct ethtool_ops ican3_ethtool_ops = { 1758 + .get_ts_info = ethtool_op_get_ts_info, 1759 + }; 1760 + 1758 1761 /* 1759 1762 * Low-level CAN Device 1760 1763 */ ··· 1930 1925 mod->free_page = DPM_FREE_START; 1931 1926 1932 1927 ndev->netdev_ops = &ican3_netdev_ops; 1928 + ndev->ethtool_ops = &ican3_ethtool_ops; 1933 1929 ndev->flags |= IFF_ECHO; 1934 1930 SET_NETDEV_DEV(ndev, &pdev->dev); 1935 1931
+6
drivers/net/can/m_can/m_can.c
··· 9 9 */ 10 10 11 11 #include <linux/bitfield.h> 12 + #include <linux/ethtool.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/io.h> 14 15 #include <linux/kernel.h> ··· 1830 1829 .ndo_change_mtu = can_change_mtu, 1831 1830 }; 1832 1831 1832 + static const struct ethtool_ops m_can_ethtool_ops = { 1833 + .get_ts_info = ethtool_op_get_ts_info, 1834 + }; 1835 + 1833 1836 static int register_m_can_dev(struct net_device *dev) 1834 1837 { 1835 1838 dev->flags |= IFF_ECHO; /* we support local echo */ 1836 1839 dev->netdev_ops = &m_can_netdev_ops; 1840 + dev->ethtool_ops = &m_can_ethtool_ops; 1837 1841 1838 1842 return register_candev(dev); 1839 1843 }
+5
drivers/net/can/mscan/mscan.c
··· 616 616 .ndo_change_mtu = can_change_mtu, 617 617 }; 618 618 619 + static const struct ethtool_ops mscan_ethtool_ops = { 620 + .get_ts_info = ethtool_op_get_ts_info, 621 + }; 622 + 619 623 int register_mscandev(struct net_device *dev, int mscan_clksrc) 620 624 { 621 625 struct mscan_priv *priv = netdev_priv(dev); ··· 680 676 priv = netdev_priv(dev); 681 677 682 678 dev->netdev_ops = &mscan_netdev_ops; 679 + dev->ethtool_ops = &mscan_ethtool_ops; 683 680 684 681 dev->flags |= IFF_ECHO; /* we support local echo */ 685 682
+6
drivers/net/can/pch_can.c
··· 6 6 7 7 #include <linux/interrupt.h> 8 8 #include <linux/delay.h> 9 + #include <linux/ethtool.h> 9 10 #include <linux/io.h> 10 11 #include <linux/module.h> 11 12 #include <linux/sched.h> ··· 939 938 .ndo_change_mtu = can_change_mtu, 940 939 }; 941 940 941 + static const struct ethtool_ops pch_can_ethtool_ops = { 942 + .get_ts_info = ethtool_op_get_ts_info, 943 + }; 944 + 942 945 static void pch_can_remove(struct pci_dev *pdev) 943 946 { 944 947 struct net_device *ndev = pci_get_drvdata(pdev); ··· 1193 1188 pci_set_drvdata(pdev, ndev); 1194 1189 SET_NETDEV_DEV(ndev, &pdev->dev); 1195 1190 ndev->netdev_ops = &pch_can_netdev_ops; 1191 + ndev->ethtool_ops = &pch_can_ethtool_ops; 1196 1192 priv->can.clock.freq = PCH_CAN_CLK; /* Hz */ 1197 1193 1198 1194 netif_napi_add_weight(ndev, &priv->napi, pch_can_poll, PCH_RX_OBJ_END);
+6
drivers/net/can/rcar/rcar_can.c
··· 10 10 #include <linux/types.h> 11 11 #include <linux/interrupt.h> 12 12 #include <linux/errno.h> 13 + #include <linux/ethtool.h> 13 14 #include <linux/netdevice.h> 14 15 #include <linux/platform_device.h> 15 16 #include <linux/can/dev.h> ··· 631 630 .ndo_change_mtu = can_change_mtu, 632 631 }; 633 632 633 + static const struct ethtool_ops rcar_can_ethtool_ops = { 634 + .get_ts_info = ethtool_op_get_ts_info, 635 + }; 636 + 634 637 static void rcar_can_rx_pkt(struct rcar_can_priv *priv) 635 638 { 636 639 struct net_device_stats *stats = &priv->ndev->stats; ··· 790 785 } 791 786 792 787 ndev->netdev_ops = &rcar_can_netdev_ops; 788 + ndev->ethtool_ops = &rcar_can_ethtool_ops; 793 789 ndev->irq = irq; 794 790 ndev->flags |= IFF_ECHO; 795 791 priv->ndev = ndev;
+6
drivers/net/can/rcar/rcar_canfd.c
··· 27 27 #include <linux/types.h> 28 28 #include <linux/interrupt.h> 29 29 #include <linux/errno.h> 30 + #include <linux/ethtool.h> 30 31 #include <linux/netdevice.h> 31 32 #include <linux/platform_device.h> 32 33 #include <linux/can/dev.h> ··· 1696 1695 .ndo_change_mtu = can_change_mtu, 1697 1696 }; 1698 1697 1698 + static const struct ethtool_ops rcar_canfd_ethtool_ops = { 1699 + .get_ts_info = ethtool_op_get_ts_info, 1700 + }; 1701 + 1699 1702 static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, 1700 1703 u32 fcan_freq) 1701 1704 { ··· 1716 1711 priv = netdev_priv(ndev); 1717 1712 1718 1713 ndev->netdev_ops = &rcar_canfd_netdev_ops; 1714 + ndev->ethtool_ops = &rcar_canfd_ethtool_ops; 1719 1715 ndev->flags |= IFF_ECHO; 1720 1716 priv->ndev = ndev; 1721 1717 priv->base = gpriv->base;
+6
drivers/net/can/sja1000/sja1000.c
··· 52 52 #include <linux/ptrace.h> 53 53 #include <linux/string.h> 54 54 #include <linux/errno.h> 55 + #include <linux/ethtool.h> 55 56 #include <linux/netdevice.h> 56 57 #include <linux/if_arp.h> 57 58 #include <linux/if_ether.h> ··· 655 654 .ndo_change_mtu = can_change_mtu, 656 655 }; 657 656 657 + static const struct ethtool_ops sja1000_ethtool_ops = { 658 + .get_ts_info = ethtool_op_get_ts_info, 659 + }; 660 + 658 661 int register_sja1000dev(struct net_device *dev) 659 662 { 660 663 int ret; ··· 668 663 669 664 dev->flags |= IFF_ECHO; /* we support local echo */ 670 665 dev->netdev_ops = &sja1000_netdev_ops; 666 + dev->ethtool_ops = &sja1000_ethtool_ops; 671 667 672 668 set_reset_mode(dev); 673 669 chipset_init(dev);
+1
drivers/net/can/slcan/slcan-ethtool.c
··· 57 57 .get_priv_flags = slcan_get_priv_flags, 58 58 .set_priv_flags = slcan_set_priv_flags, 59 59 .get_sset_count = slcan_get_sset_count, 60 + .get_ts_info = ethtool_op_get_ts_info, 60 61 };
+6
drivers/net/can/softing/softing_main.c
··· 5 5 * - Kurt Van Dijck, EIA Electronics 6 6 */ 7 7 8 + #include <linux/ethtool.h> 8 9 #include <linux/module.h> 9 10 #include <linux/interrupt.h> 10 11 #include <asm/io.h> ··· 612 611 .ndo_change_mtu = can_change_mtu, 613 612 }; 614 613 614 + static const struct ethtool_ops softing_ethtool_ops = { 615 + .get_ts_info = ethtool_op_get_ts_info, 616 + }; 617 + 615 618 static const struct can_bittiming_const softing_btr_const = { 616 619 .name = KBUILD_MODNAME, 617 620 .tseg1_min = 1, ··· 654 649 655 650 netdev->flags |= IFF_ECHO; 656 651 netdev->netdev_ops = &softing_netdev_ops; 652 + netdev->ethtool_ops = &softing_ethtool_ops; 657 653 priv->can.do_set_mode = softing_candev_set_mode; 658 654 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; 659 655
+6
drivers/net/can/spi/hi311x.c
··· 20 20 #include <linux/completion.h> 21 21 #include <linux/delay.h> 22 22 #include <linux/device.h> 23 + #include <linux/ethtool.h> 23 24 #include <linux/freezer.h> 24 25 #include <linux/interrupt.h> 25 26 #include <linux/io.h> ··· 803 802 .ndo_start_xmit = hi3110_hard_start_xmit, 804 803 }; 805 804 805 + static const struct ethtool_ops hi3110_ethtool_ops = { 806 + .get_ts_info = ethtool_op_get_ts_info, 807 + }; 808 + 806 809 static const struct of_device_id hi3110_of_match[] = { 807 810 { 808 811 .compatible = "holt,hi3110", ··· 861 856 goto out_free; 862 857 863 858 net->netdev_ops = &hi3110_netdev_ops; 859 + net->ethtool_ops = &hi3110_ethtool_ops; 864 860 net->flags |= IFF_ECHO; 865 861 866 862 priv = netdev_priv(net);
+6
drivers/net/can/spi/mcp251x.c
··· 26 26 #include <linux/completion.h> 27 27 #include <linux/delay.h> 28 28 #include <linux/device.h> 29 + #include <linux/ethtool.h> 29 30 #include <linux/freezer.h> 30 31 #include <linux/gpio.h> 31 32 #include <linux/gpio/driver.h> ··· 1249 1248 .ndo_change_mtu = can_change_mtu, 1250 1249 }; 1251 1250 1251 + static const struct ethtool_ops mcp251x_ethtool_ops = { 1252 + .get_ts_info = ethtool_op_get_ts_info, 1253 + }; 1254 + 1252 1255 static const struct of_device_id mcp251x_of_match[] = { 1253 1256 { 1254 1257 .compatible = "microchip,mcp2510", ··· 1318 1313 goto out_free; 1319 1314 1320 1315 net->netdev_ops = &mcp251x_netdev_ops; 1316 + net->ethtool_ops = &mcp251x_ethtool_ops; 1321 1317 net->flags |= IFF_ECHO; 1322 1318 1323 1319 priv = netdev_priv(net);
+6
drivers/net/can/sun4i_can.c
··· 53 53 #include <linux/can/error.h> 54 54 #include <linux/clk.h> 55 55 #include <linux/delay.h> 56 + #include <linux/ethtool.h> 56 57 #include <linux/interrupt.h> 57 58 #include <linux/init.h> 58 59 #include <linux/io.h> ··· 762 761 .ndo_start_xmit = sun4ican_start_xmit, 763 762 }; 764 763 764 + static const struct ethtool_ops sun4ican_ethtool_ops = { 765 + .get_ts_info = ethtool_op_get_ts_info, 766 + }; 767 + 765 768 static const struct sun4ican_quirks sun4ican_quirks_a10 = { 766 769 .has_reset = false, 767 770 }; ··· 856 851 } 857 852 858 853 dev->netdev_ops = &sun4ican_netdev_ops; 854 + dev->ethtool_ops = &sun4ican_ethtool_ops; 859 855 dev->irq = irq; 860 856 dev->flags |= IFF_ECHO; 861 857
+6
drivers/net/can/ti_hecc.c
··· 23 23 #include <linux/types.h> 24 24 #include <linux/interrupt.h> 25 25 #include <linux/errno.h> 26 + #include <linux/ethtool.h> 26 27 #include <linux/netdevice.h> 27 28 #include <linux/skbuff.h> 28 29 #include <linux/platform_device.h> ··· 842 841 .ndo_change_mtu = can_change_mtu, 843 842 }; 844 843 844 + static const struct ethtool_ops ti_hecc_ethtool_ops = { 845 + .get_ts_info = ethtool_op_get_ts_info, 846 + }; 847 + 845 848 static const struct of_device_id ti_hecc_dt_ids[] = { 846 849 { 847 850 .compatible = "ti,am3517-hecc", ··· 923 918 platform_set_drvdata(pdev, ndev); 924 919 SET_NETDEV_DEV(ndev, &pdev->dev); 925 920 ndev->netdev_ops = &ti_hecc_netdev_ops; 921 + ndev->ethtool_ops = &ti_hecc_ethtool_ops; 926 922 927 923 priv->clk = clk_get(&pdev->dev, "hecc_ck"); 928 924 if (IS_ERR(priv->clk)) {
+6
drivers/net/can/usb/ems_usb.c
··· 4 4 * 5 5 * Copyright (C) 2004-2009 EMS Dr. Thomas Wuensche 6 6 */ 7 + #include <linux/ethtool.h> 7 8 #include <linux/signal.h> 8 9 #include <linux/slab.h> 9 10 #include <linux/module.h> ··· 880 879 .ndo_change_mtu = can_change_mtu, 881 880 }; 882 881 882 + static const struct ethtool_ops ems_usb_ethtool_ops = { 883 + .get_ts_info = ethtool_op_get_ts_info, 884 + }; 885 + 883 886 static const struct can_bittiming_const ems_usb_bittiming_const = { 884 887 .name = KBUILD_MODNAME, 885 888 .tseg1_min = 1, ··· 995 990 dev->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; 996 991 997 992 netdev->netdev_ops = &ems_usb_netdev_ops; 993 + netdev->ethtool_ops = &ems_usb_ethtool_ops; 998 994 999 995 netdev->flags |= IFF_ECHO; /* we support local echo */ 1000 996
+6
drivers/net/can/usb/esd_usb.c
··· 5 5 * Copyright (C) 2010-2012 esd electronic system design gmbh, Matthias Fuchs <socketcan@esd.eu> 6 6 * Copyright (C) 2022 esd electronics gmbh, Frank Jungclaus <frank.jungclaus@esd.eu> 7 7 */ 8 + #include <linux/ethtool.h> 8 9 #include <linux/signal.h> 9 10 #include <linux/slab.h> 10 11 #include <linux/module.h> ··· 883 882 .ndo_change_mtu = can_change_mtu, 884 883 }; 885 884 885 + static const struct ethtool_ops esd_usb_ethtool_ops = { 886 + .get_ts_info = ethtool_op_get_ts_info, 887 + }; 888 + 886 889 static const struct can_bittiming_const esd_usb2_bittiming_const = { 887 890 .name = "esd_usb2", 888 891 .tseg1_min = ESD_USB2_TSEG1_MIN, ··· 1020 1015 netdev->flags |= IFF_ECHO; /* we support local echo */ 1021 1016 1022 1017 netdev->netdev_ops = &esd_usb_netdev_ops; 1018 + netdev->ethtool_ops = &esd_usb_ethtool_ops; 1023 1019 1024 1020 SET_NETDEV_DEV(netdev, &intf->dev); 1025 1021 netdev->dev_id = index;
+2
drivers/net/can/usb/gs_usb.c
··· 946 946 947 947 static const struct ethtool_ops gs_usb_ethtool_ops = { 948 948 .set_phys_id = gs_usb_set_phys_id, 949 + .get_ts_info = ethtool_op_get_ts_info, 949 950 }; 950 951 951 952 static struct gs_can *gs_make_candev(unsigned int channel, ··· 990 989 dev = netdev_priv(netdev); 991 990 992 991 netdev->netdev_ops = &gs_usb_netdev_ops; 992 + netdev->ethtool_ops = &gs_usb_ethtool_ops; 993 993 994 994 netdev->flags |= IFF_ECHO; /* we support full roundtrip echo */ 995 995
+6
drivers/net/can/usb/mcba_usb.c
··· 10 10 #include <linux/can.h> 11 11 #include <linux/can/dev.h> 12 12 #include <linux/can/error.h> 13 + #include <linux/ethtool.h> 13 14 #include <linux/module.h> 14 15 #include <linux/netdevice.h> 15 16 #include <linux/signal.h> ··· 759 758 .ndo_start_xmit = mcba_usb_start_xmit, 760 759 }; 761 760 761 + static const struct ethtool_ops mcba_ethtool_ops = { 762 + .get_ts_info = ethtool_op_get_ts_info, 763 + }; 764 + 762 765 /* Microchip CANBUS has hardcoded bittiming values by default. 763 766 * This function sends request via USB to change the speed and align bittiming 764 767 * values for presentation purposes only ··· 841 836 priv->can.do_set_bittiming = mcba_net_set_bittiming; 842 837 843 838 netdev->netdev_ops = &mcba_netdev_ops; 839 + netdev->ethtool_ops = &mcba_ethtool_ops; 844 840 845 841 netdev->flags |= IFF_ECHO; /* we support local echo */ 846 842
+6
drivers/net/can/usb/ucan.c
··· 28 28 #include <linux/can.h> 29 29 #include <linux/can/dev.h> 30 30 #include <linux/can/error.h> 31 + #include <linux/ethtool.h> 31 32 #include <linux/module.h> 32 33 #include <linux/netdevice.h> 33 34 #include <linux/signal.h> ··· 1234 1233 .ndo_change_mtu = can_change_mtu, 1235 1234 }; 1236 1235 1236 + static const struct ethtool_ops ucan_ethtool_ops = { 1237 + .get_ts_info = ethtool_op_get_ts_info, 1238 + }; 1239 + 1237 1240 /* Request to set bittiming 1238 1241 * 1239 1242 * This function generates an USB set bittiming message and transmits ··· 1517 1512 spin_lock_init(&up->context_lock); 1518 1513 spin_lock_init(&up->echo_skb_lock); 1519 1514 netdev->netdev_ops = &ucan_netdev_ops; 1515 + netdev->ethtool_ops = &ucan_ethtool_ops; 1520 1516 1521 1517 usb_set_intfdata(intf, up); 1522 1518 SET_NETDEV_DEV(netdev, &intf->dev);
+6
drivers/net/can/usb/usb_8dev.c
··· 12 12 * who were very cooperative and answered my questions. 13 13 */ 14 14 15 + #include <linux/ethtool.h> 15 16 #include <linux/signal.h> 16 17 #include <linux/slab.h> 17 18 #include <linux/module.h> ··· 871 870 .ndo_change_mtu = can_change_mtu, 872 871 }; 873 872 873 + static const struct ethtool_ops usb_8dev_ethtool_ops = { 874 + .get_ts_info = ethtool_op_get_ts_info, 875 + }; 876 + 874 877 static const struct can_bittiming_const usb_8dev_bittiming_const = { 875 878 .name = KBUILD_MODNAME, 876 879 .tseg1_min = 1, ··· 932 927 CAN_CTRLMODE_CC_LEN8_DLC; 933 928 934 929 netdev->netdev_ops = &usb_8dev_netdev_ops; 930 + netdev->ethtool_ops = &usb_8dev_ethtool_ops; 935 931 936 932 netdev->flags |= IFF_ECHO; /* we support local echo */ 937 933
+6
drivers/net/can/vcan.c
··· 40 40 41 41 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 42 42 43 + #include <linux/ethtool.h> 43 44 #include <linux/module.h> 44 45 #include <linux/init.h> 45 46 #include <linux/netdevice.h> ··· 149 148 .ndo_change_mtu = vcan_change_mtu, 150 149 }; 151 150 151 + static const struct ethtool_ops vcan_ethtool_ops = { 152 + .get_ts_info = ethtool_op_get_ts_info, 153 + }; 154 + 152 155 static void vcan_setup(struct net_device *dev) 153 156 { 154 157 dev->type = ARPHRD_CAN; ··· 168 163 dev->flags |= IFF_ECHO; 169 164 170 165 dev->netdev_ops = &vcan_netdev_ops; 166 + dev->ethtool_ops = &vcan_ethtool_ops; 171 167 dev->needs_free_netdev = true; 172 168 } 173 169
+6
drivers/net/can/vxcan.c
··· 9 9 * Copyright (c) 2017 Oliver Hartkopp <socketcan@hartkopp.net> 10 10 */ 11 11 12 + #include <linux/ethtool.h> 12 13 #include <linux/module.h> 13 14 #include <linux/init.h> 14 15 #include <linux/netdevice.h> ··· 147 146 .ndo_change_mtu = vxcan_change_mtu, 148 147 }; 149 148 149 + static const struct ethtool_ops vxcan_ethtool_ops = { 150 + .get_ts_info = ethtool_op_get_ts_info, 151 + }; 152 + 150 153 static void vxcan_setup(struct net_device *dev) 151 154 { 152 155 struct can_ml_priv *can_ml; ··· 162 157 dev->tx_queue_len = 0; 163 158 dev->flags = IFF_NOARP; 164 159 dev->netdev_ops = &vxcan_netdev_ops; 160 + dev->ethtool_ops = &vxcan_ethtool_ops; 165 161 dev->needs_free_netdev = true; 166 162 167 163 can_ml = netdev_priv(dev) + ALIGN(sizeof(struct vxcan_priv), NETDEV_ALIGN);
+6
drivers/net/can/xilinx_can.c
··· 12 12 #include <linux/bitfield.h> 13 13 #include <linux/clk.h> 14 14 #include <linux/errno.h> 15 + #include <linux/ethtool.h> 15 16 #include <linux/init.h> 16 17 #include <linux/interrupt.h> 17 18 #include <linux/io.h> ··· 1541 1540 .ndo_change_mtu = can_change_mtu, 1542 1541 }; 1543 1542 1543 + static const struct ethtool_ops xcan_ethtool_ops = { 1544 + .get_ts_info = ethtool_op_get_ts_info, 1545 + }; 1546 + 1544 1547 /** 1545 1548 * xcan_suspend - Suspend method for the driver 1546 1549 * @dev: Address of the device structure ··· 1826 1821 platform_set_drvdata(pdev, ndev); 1827 1822 SET_NETDEV_DEV(ndev, &pdev->dev); 1828 1823 ndev->netdev_ops = &xcan_netdev_ops; 1824 + ndev->ethtool_ops = &xcan_ethtool_ops; 1829 1825 1830 1826 /* Getting the CAN can_clk info */ 1831 1827 priv->can_clk = devm_clk_get(&pdev->dev, "can_clk");