409c188c57
Currently, some CAN drivers support hardware timestamping, some do not. But userland has no method to query which features are supported (aside maybe of getting RX messages and observe whether or not hardware timestamps stay at zero). The canonical way for a network driver to advertised what kind of timestamping it supports is to implement ethtool_ops::get_ts_info(). This patch only targets the CAN drivers which *do not* support hardware timestamping. For each of those CAN drivers, implement the get_ts_info() using the generic ethtool_op_get_ts_info(). This way, userland can do: | $ ethtool --show-time-stamping canX to confirm the device timestamping capacities. N.B. the drivers which support hardware timestamping will be migrated in separate patches. Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Link: https://lore.kernel.org/all/20220727101641.198847-6-mailhol.vincent@wanadoo.fr [mkl: mscan: add missing mscan_ethtool_ops] Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
31 lines
803 B
C
31 lines
803 B
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright 2021, Dario Binacchi <dariobin@libero.it>
|
|
*/
|
|
|
|
#include <linux/ethtool.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/can/dev.h>
|
|
|
|
#include "c_can.h"
|
|
|
|
static void c_can_get_ringparam(struct net_device *netdev,
|
|
struct ethtool_ringparam *ring,
|
|
struct kernel_ethtool_ringparam *kernel_ring,
|
|
struct netlink_ext_ack *extack)
|
|
{
|
|
struct c_can_priv *priv = netdev_priv(netdev);
|
|
|
|
ring->rx_max_pending = priv->msg_obj_num;
|
|
ring->tx_max_pending = priv->msg_obj_num;
|
|
ring->rx_pending = priv->msg_obj_rx_num;
|
|
ring->tx_pending = priv->msg_obj_tx_num;
|
|
}
|
|
|
|
const struct ethtool_ops c_can_ethtool_ops = {
|
|
.get_ringparam = c_can_get_ringparam,
|
|
.get_ts_info = ethtool_op_get_ts_info,
|
|
};
|