]> git.baikalelectronics.ru Git - kernel.git/commit
can: kvaser_pciefd: advertise timestamping capabilities and add ioctl support
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Wed, 27 Jul 2022 10:16:38 +0000 (19:16 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Thu, 28 Jul 2022 09:44:30 +0000 (11:44 +0200)
commit2bffa2216d8e74a440f361a53c2ec25840d65f37
tree8901fabf1ed801e1d0e468ae2bc3061c933bd4ca
parentaba51b75741c4fdb613e9b37651538d7cfe3513c
can: kvaser_pciefd: advertise timestamping capabilities and add ioctl support

Currently, userland has no method to query which timestamping features
are supported by the kvaser_pciefd 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
CC: Jimmy Assarsson <extja@kvaser.com>
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20220727101641.198847-12-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/kvaser_pciefd.c