mirror of
https://github.com/torvalds/linux.git
synced 2026-05-22 06:01:53 +02:00
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>
This commit is contained in:
parent
1d46efa000
commit
fa5cc7e115
|
|
@ -9,6 +9,7 @@
|
|||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/can/dev.h>
|
||||
#include <linux/timer.h>
|
||||
|
|
@ -919,10 +920,15 @@ static void kvaser_pciefd_bec_poll_timer(struct timer_list *data)
|
|||
static const struct net_device_ops kvaser_pciefd_netdev_ops = {
|
||||
.ndo_open = kvaser_pciefd_open,
|
||||
.ndo_stop = kvaser_pciefd_stop,
|
||||
.ndo_eth_ioctl = can_eth_ioctl_hwts,
|
||||
.ndo_start_xmit = kvaser_pciefd_start_xmit,
|
||||
.ndo_change_mtu = can_change_mtu,
|
||||
};
|
||||
|
||||
static const struct ethtool_ops kvaser_pciefd_ethtool_ops = {
|
||||
.get_ts_info = can_ethtool_op_get_ts_info_hwts,
|
||||
};
|
||||
|
||||
static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie)
|
||||
{
|
||||
int i;
|
||||
|
|
@ -939,6 +945,7 @@ static int kvaser_pciefd_setup_can_ctrls(struct kvaser_pciefd *pcie)
|
|||
|
||||
can = netdev_priv(netdev);
|
||||
netdev->netdev_ops = &kvaser_pciefd_netdev_ops;
|
||||
netdev->ethtool_ops = &kvaser_pciefd_ethtool_ops;
|
||||
can->reg_base = pcie->reg_base + KVASER_PCIEFD_KCAN0_BASE +
|
||||
i * KVASER_PCIEFD_KCAN_BASE_OFFSET;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user