]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
can: mcp251xfd: advertise timestamping capabilities and add ioctl support
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Wed, 27 Jul 2022 10:16:36 +0000 (19:16 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 28 Jul 2022 09:44:30 +0000 (11:44 +0200)
commitb1f6b93e678fb0ce2cecb0032709fc17c6526299
treef70e90ce0ee83f3acf37f28a2e6f052798ddc002
parent90f942c5a6d775bad1be33ba214755314105da4a
can: mcp251xfd: advertise timestamping capabilities and add ioctl support

Currently, userland has no methods to query which timestamping
features are supported by the mcp251xfd driver (aside maybe of getting
RX messages and observe whether or not hardware timestamps stay at
zero).

The canonical way for a network driver to advertise what kind of
timestamping it supports is to implement
ethtool_ops::get_ts_info(). Here, we use the CAN specific
can_ethtool_op_get_ts_info_hwts() function to achieve this.

In addition, the driver currently does not support the hardware
timestamps ioctls. According to [1], SIOCSHWTSTAMP is "must" and
SIOCGHWTSTAMP is "should". This patch fills up that gap by
implementing net_device_ops::ndo_eth_ioctl() using the CAN specific
function can_eth_ioctl_hwts().

[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
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20220727101641.198847-10-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c
drivers/net/can/spi/mcp251xfd/mcp251xfd-ethtool.c