1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright 2021, Dario Binacchi <dariobin@libero.it>
4  */
5 
6 #include <linux/ethtool.h>
7 #include <linux/kernel.h>
8 #include <linux/platform_device.h>
9 #include <linux/netdevice.h>
10 #include <linux/can/dev.h>
11 
12 #include "c_can.h"
13 
14 static void c_can_get_ringparam(struct net_device *netdev,
15 				struct ethtool_ringparam *ring,
16 				struct kernel_ethtool_ringparam *kernel_ring,
17 				struct netlink_ext_ack *extack)
18 {
19 	struct c_can_priv *priv = netdev_priv(netdev);
20 
21 	ring->rx_max_pending = priv->msg_obj_num;
22 	ring->tx_max_pending = priv->msg_obj_num;
23 	ring->rx_pending = priv->msg_obj_rx_num;
24 	ring->tx_pending = priv->msg_obj_tx_num;
25 }
26 
27 const struct ethtool_ops c_can_ethtool_ops = {
28 	.get_ringparam = c_can_get_ringparam,
29 	.get_ts_info = ethtool_op_get_ts_info,
30 };
31