All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 00/24] can: add ethtool support and reporting of timestamping capabilities
@ 2022-07-25 13:31 Vincent Mailhol
  2022-07-25 13:31 ` [PATCH v1 01/24] can: can327: use KBUILD_MODNAME instead of hard coded name Vincent Mailhol
                   ` (27 more replies)
  0 siblings, 28 replies; 92+ messages in thread
From: Vincent Mailhol @ 2022-07-25 13:31 UTC (permalink / raw)
  To: linux-can, Marc Kleine-Budde
  Cc: Stephane Grosjean, Jimmy Assarsson, Oliver Hartkopp,
	Dario Binacchi, Max Staudt, Vincent Mailhol

This series revolves around ethtool and timestamping. Its ultimate
goal is that the timestamping implementation within socketCAN meets
the specification of other network drivers in the kernel. This way,
tcpdump or other tools derived from libpcap can be used to do
timestamping on CAN devices.

*Example on a device with hardware timestamp support *

Before this series:
| # tcpdump -j adapter_unsynced -i can0
| tcpdump: WARNING: When trying to set timestamp type
| 'adapter_unsynced' on can0: That type of time stamp is not supported
| by that device

After applying this series, the warning disappears and tcpdump can be
used to get RX hardware timestamps.


This series is articulated in five major parts.

* Part 1: Report driver information through ethtool

This first part implements ethtool_ops::get_drvinfo() for all
drivers. The actual change is made in the 10th patch. The patches 1 to
8 get rid of any hardcoded string and instead relies on either
KBUILD_MODNAME or DRV_NAME macros to get the device name. Patch 9
removes the DRV_VERSION macro so that ethtool can instead rely on the
kernel version.


* Part 2: Add TX software timestamps and report the software
  timestamping capabilities through ethtool.

All the drivers using can_put_echo_skb() already support TX software
timestamps. However, the five drivers not using this function (namely
can327, janz-ican3, slcan, vcan and vxcan) lack such support. Patch 11
to 14 adds this support.  Finally, patch 15 advertises the timesamping
capabilities of all drivers not support hardware timestamps.

* Part 3: add TX hardware timestapms

This part is a single patch. In SocetCAN TX hardware is equal to the
RX hardware timestamps of the corresponding loopback frame. Reuse the
TX hardware timestamp to populate the RX hardware timestamp. While the
need of this feature can be debatable, we implement it here so that
generic timestamping tools which are agnostic of the specificity of
SocketCAN can still obtain the value. For example, tcpdump expects for
both TX and RX hardware timestamps to be supported in order to do:
| # tcpdump -j adapter_unsynced -i canX

* Part 4: report the hardware timestamping capabilities and implement
  the hardware timestamps ioctls.

The kernel documentation specifies in [1] that, for the drivers which
support hardware timestamping, SIOCSHWTSTAMP ioctl must be supported
and that SIOCGHWTSTAMP ioctl should be supported. Currently, none of
the CAN drivers do so. This is a gap.

Furthermore, even if not specified, the tools based on libpcap
(e.g. tcpdump) also expect ethtool_ops::get_ts_info to be implemented.

This last part first adds some generic implementation of
net_device_ops::ndo_eth_ioctl and ethtool_ops::get_ts_info which can
be used by the drivers with hardware timestamping capabilities.

It then uses those generic functions to add ioctl and reporting
functionalities to the drivers with hardware timestamping support
(namely: mcp251xfd, etas_es58x, kvaser_{pciefd,usb}, peak_{canfd,usb})


[1] Kernel doc: Timestamping, section 3.1 "Hardware Timestamping
Implementation: Device Drivers"
Link: https://docs.kernel.org/networking/timestamping.html#hardware-timestamping-implementation-device-drivers

Vincent Mailhol (24):
  can: can327: use KBUILD_MODNAME instead of hard coded name
  can: ems_ubs: use KBUILD_MODNAME instead of hard coded name
  can: slcan: add DRV_NAME and define pr_fmt to replace hardcoded names
  can: softing: add DRV_NAME to replace hardcoded names
  can: esd_usb: use KBUILD_MODNAME instead of hard coded name
  can: gs_ubs: use KBUILD_MODNAME instead of hard coded name
  can: softing: add DRV_NAME to replace hardcoded names
  can: ubs_8dev: use KBUILD_MODNAME instead of hard coded name
  can: etas_es58x: remove DRV_VERSION
  can: tree-wide: implement ethtool_ops::get_drvinfo()
  can: can327: add software tx timestamps
  can: janz-ican3: add software tx timestamp
  can: slcan: add software tx timestamps
  can: v(x)can: add software tx timestamps
  can: tree-wide: advertise software timestamping capabilities
  can: dev: add hardware TX timestamp
  can: dev: add generic function can_ethtool_op_get_ts_info_hwts()
  can: dev: add generic function can_eth_ioctl_hwts()
  can: mcp251xfd: advertise timestamping capabilities and add ioctl
    support
  can: etas_es58x: advertise timestamping capabilities and add ioctl
    support
  can: kvaser_pciefd: advertise timestamping capabilities and add ioctl
    support
  can: kvaser_usb: advertise timestamping capabilities and add ioctl
    support
  can: peak_canfd: advertise timestamping capabilities and add ioctl
    support
  can: peak_usb: advertise timestamping capabilities and add ioctl
    support

 drivers/net/can/at91_can.c                    | 13 +++++
 drivers/net/can/c_can/c_can_main.c            | 13 +++++
 drivers/net/can/can327.c                      | 18 ++++++-
 drivers/net/can/cc770/cc770.c                 | 13 +++++
 drivers/net/can/ctucanfd/ctucanfd_base.c      | 13 +++++
 drivers/net/can/dev/dev.c                     | 50 +++++++++++++++++++
 drivers/net/can/dev/skb.c                     |  6 +++
 drivers/net/can/flexcan/flexcan-core.c        | 13 +++++
 drivers/net/can/grcan.c                       | 13 +++++
 drivers/net/can/ifi_canfd/ifi_canfd.c         | 13 +++++
 drivers/net/can/janz-ican3.c                  | 15 ++++++
 drivers/net/can/kvaser_pciefd.c               | 14 ++++++
 drivers/net/can/m_can/m_can.c                 | 13 +++++
 drivers/net/can/mscan/mscan.c                 |  1 +
 drivers/net/can/pch_can.c                     | 13 +++++
 drivers/net/can/peak_canfd/peak_canfd.c       | 14 ++++++
 drivers/net/can/rcar/rcar_can.c               | 13 +++++
 drivers/net/can/rcar/rcar_canfd.c             | 13 +++++
 drivers/net/can/sja1000/sja1000.c             | 13 +++++
 drivers/net/can/slcan/slcan-core.c            | 30 ++++++++---
 drivers/net/can/softing/softing_main.c        | 18 ++++++-
 drivers/net/can/spi/hi311x.c                  | 13 +++++
 drivers/net/can/spi/mcp251x.c                 | 13 +++++
 .../net/can/spi/mcp251xfd/mcp251xfd-core.c    | 14 ++++++
 drivers/net/can/sun4i_can.c                   | 13 +++++
 drivers/net/can/ti_hecc.c                     | 13 +++++
 drivers/net/can/usb/ems_usb.c                 | 17 ++++++-
 drivers/net/can/usb/esd_usb.c                 | 15 +++++-
 drivers/net/can/usb/etas_es58x/es58x_core.c   | 23 ++++++---
 drivers/net/can/usb/gs_usb.c                  | 15 ++++--
 drivers/net/can/usb/kvaser_usb/kvaser_usb.h   |  1 +
 .../net/can/usb/kvaser_usb/kvaser_usb_core.c  | 39 +++++++++++++--
 drivers/net/can/usb/mcba_usb.c                | 13 +++++
 drivers/net/can/usb/peak_usb/pcan_usb.c       |  3 ++
 drivers/net/can/usb/peak_usb/pcan_usb_core.c  | 18 ++++++-
 drivers/net/can/usb/peak_usb/pcan_usb_core.h  |  6 +++
 drivers/net/can/usb/peak_usb/pcan_usb_fd.c    |  3 ++
 drivers/net/can/usb/peak_usb/pcan_usb_pro.c   |  3 ++
 drivers/net/can/usb/ucan.c                    | 13 +++++
 drivers/net/can/usb/usb_8dev.c                | 17 ++++++-
 drivers/net/can/vcan.c                        | 15 ++++++
 drivers/net/can/vxcan.c                       | 15 ++++++
 drivers/net/can/xilinx_can.c                  | 13 +++++
 include/linux/can/dev.h                       |  4 ++
 44 files changed, 592 insertions(+), 29 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 92+ messages in thread

end of thread, other threads:[~2022-07-28 13:36 UTC | newest]

Thread overview: 92+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-25 13:31 [PATCH v1 00/24] can: add ethtool support and reporting of timestamping capabilities Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 01/24] can: can327: use KBUILD_MODNAME instead of hard coded name Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 02/24] can: ems_ubs: " Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 03/24] can: slcan: add DRV_NAME and define pr_fmt to replace hardcoded names Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 04/24] can: softing: add DRV_NAME " Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 05/24] can: esd_usb: use KBUILD_MODNAME instead of hard coded name Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 06/24] can: gs_ubs: " Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 07/24] can: softing: add DRV_NAME to replace hardcoded names Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 08/24] can: ubs_8dev: use KBUILD_MODNAME instead of hard coded name Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 09/24] can: etas_es58x: remove DRV_VERSION Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 10/24] can: tree-wide: implement ethtool_ops::get_drvinfo() Vincent Mailhol
2022-07-25 14:09   ` Marc Kleine-Budde
2022-07-25 14:29     ` Vincent MAILHOL
2022-07-26  7:29   ` Dario Binacchi
2022-07-26  8:42     ` Vincent MAILHOL
2022-07-26  9:21       ` Dario Binacchi
2022-07-26  9:59         ` Vincent MAILHOL
2022-07-27  8:19           ` Marc Kleine-Budde
2022-07-27  9:05             ` Vincent MAILHOL
2022-07-27 11:19               ` Marc Kleine-Budde
2022-07-25 13:31 ` [PATCH v1 11/24] can: can327: add software tx timestamps Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 12/24] can: janz-ican3: add software tx timestamp Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 13/24] can: slcan: add software tx timestamps Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 14/24] can: v(x)can: " Vincent Mailhol
2022-07-25 13:31 ` [PATCH v1 15/24] can: tree-wide: advertise software timestamping capabilities Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 16/24] can: dev: add hardware TX timestamp Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 17/24] can: dev: add generic function can_ethtool_op_get_ts_info_hwts() Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 18/24] can: dev: add generic function can_eth_ioctl_hwts() Vincent Mailhol
2022-07-25 14:22   ` Marc Kleine-Budde
2022-07-25 14:41     ` Vincent MAILHOL
2022-07-25 16:19       ` Marc Kleine-Budde
2022-07-25 13:32 ` [PATCH v1 19/24] can: mcp251xfd: advertise timestamping capabilities and add ioctl support Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 20/24] can: etas_es58x: " Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 21/24] can: kvaser_pciefd: " Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 22/24] can: kvaser_usb: " Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 23/24] can: peak_canfd: " Vincent Mailhol
2022-07-25 13:32 ` [PATCH v1 24/24] can: peak_usb: " Vincent Mailhol
2022-07-25 13:53 ` [PATCH v1 00/24] can: add ethtool support and reporting of timestamping capabilities Vincent MAILHOL
2022-07-25 15:53 ` [PATCH v2 00/14] " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 01/14] can: can327: add software tx timestamps Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 02/14] can: janz-ican3: add software tx timestamp Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 03/14] can: slcan: add software tx timestamps Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 04/14] can: v(x)can: " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 05/14] can: tree-wide: advertise software timestamping capabilities Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 06/14] can: dev: add hardware TX timestamp Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 07/14] can: dev: add generic function can_ethtool_op_get_ts_info_hwts() Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 08/14] can: dev: add generic function can_eth_ioctl_hwts() Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 09/14] can: mcp251xfd: advertise timestamping capabilities and add ioctl support Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 10/14] can: etas_es58x: " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 11/14] can: kvaser_pciefd: " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 12/14] can: kvaser_usb: " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 13/14] can: peak_canfd: " Vincent Mailhol
2022-07-25 15:53   ` [PATCH v2 14/14] can: peak_usb: " Vincent Mailhol
2022-07-26 10:24 ` [PATCH v3 00/14] Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 01/14] can: can327: add software tx timestamps Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 02/14] can: janz-ican3: add software tx timestamp Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 03/14] can: slcan: add software tx timestamps Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 04/14] can: v(x)can: " Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 05/14] can: tree-wide: advertise software timestamping capabilities Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 06/14] can: dev: add hardware TX timestamp Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 07/14] can: dev: add generic function can_ethtool_op_get_ts_info_hwts() Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 08/14] can: dev: add generic function can_eth_ioctl_hwts() Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 09/14] can: mcp251xfd: advertise timestamping capabilities and add ioctl support Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 10/14] can: etas_es58x: " Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 11/14] can: kvaser_pciefd: " Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 12/14] can: kvaser_usb: " Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 13/14] can: peak_canfd: " Vincent Mailhol
2022-07-26 10:24   ` [PATCH v3 14/14] can: peak_usb: " Vincent Mailhol
2022-07-27  8:06     ` Marc Kleine-Budde
2022-07-27  8:29       ` Vincent MAILHOL
2022-07-27  8:42         ` Marc Kleine-Budde
2022-07-27  9:17           ` Vincent MAILHOL
2022-07-27 10:16 ` [PATCH v4 00/14] can: add ethtool support and reporting of timestamping capabilities Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 01/14] can: can327: add software tx timestamps Vincent Mailhol
2022-07-27 20:24     ` Max Staudt
2022-07-27 10:16   ` [PATCH v4 02/14] can: janz-ican3: add software tx timestamp Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 03/14] can: slcan: add software tx timestamps Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 04/14] can: v(x)can: " Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 05/14] can: tree-wide: advertise software timestamping capabilities Vincent Mailhol
2022-07-28  9:38     ` Marc Kleine-Budde
2022-07-28 13:28       ` Vincent MAILHOL
2022-07-28 13:35         ` Marc Kleine-Budde
2022-07-27 10:16   ` [PATCH v4 06/14] can: dev: add hardware TX timestamp Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 07/14] can: dev: add generic function can_ethtool_op_get_ts_info_hwts() Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 08/14] can: dev: add generic function can_eth_ioctl_hwts() Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 09/14] can: mcp251xfd: advertise timestamping capabilities and add ioctl support Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 10/14] can: etas_es58x: " Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 11/14] can: kvaser_pciefd: " Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 12/14] can: kvaser_usb: " Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 13/14] can: peak_canfd: " Vincent Mailhol
2022-07-27 10:16   ` [PATCH v4 14/14] can: peak_usb: " Vincent Mailhol
2022-07-28 10:09   ` [PATCH v4 00/14] can: add ethtool support and reporting of timestamping capabilities Marc Kleine-Budde

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.