On Wed. 27 Jul. 2022 at 17:10, Marc Kleine-Budde <mkl@xxxxxxxxxxxxxx> wrote: > On 26.07.2022 19:24:54, Vincent Mailhol wrote: > > Currently, userland has no method to query which timestamping features > > are supported by the peak_usb driver (aside maybe of getting RX > > messages and obseverse whever 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: Stephane Grosjean <s.grosjean@xxxxxxxxxxxxxxx> > > Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx> > > --- > > > > Hi Stéphane, as far as I understand, the pcan_usb and the pacn_usb_pro > ^^^^ > pcan > > > support hardware timestamps but the pcan_usb_fd doesn't. If not the > > case, let me know. > > > > This is not tested. If you find any issue or if you want to modify, > > feel free to pick up that patch and resend it. > > I have a: > > | Bus 002 Device 009: ID 0c72:0012 PEAK System PCAN-USB FD > > It supports hardware RX timestamps (Debian kernel 5.18.0-2-amd64) only: > > | (1970-01-01 01:00:00.000000) peakfd0 TX - - 002 [1] 01 > | (1970-01-01 02:17:09.473817) peakfd0 RX - - 002 [1] 3C > | (1970-01-01 01:00:00.000000) peakfd0 TX - - 002 [1] 02 > | (1970-01-01 02:17:09.673980) peakfd0 RX - - 002 [1] 3D Thanks for the confirmation. So this means that all Peak hardware supports the hardware timestamping. This will greatly simplify the logic. No need to have two different struct ethtool_ops. I will prepare a v4. Yours sincerely, Vincent Mailhol