xref: /linux/drivers/net/can/c_can/c_can_ethtool.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
12722ac98SDario Binacchi // SPDX-License-Identifier: GPL-2.0-only
22722ac98SDario Binacchi /*
32722ac98SDario Binacchi  * Copyright 2021, Dario Binacchi <dariobin@libero.it>
42722ac98SDario Binacchi  */
52722ac98SDario Binacchi 
62722ac98SDario Binacchi #include <linux/ethtool.h>
72722ac98SDario Binacchi #include <linux/kernel.h>
82722ac98SDario Binacchi #include <linux/platform_device.h>
92722ac98SDario Binacchi #include <linux/netdevice.h>
102722ac98SDario Binacchi #include <linux/can/dev.h>
112722ac98SDario Binacchi 
122722ac98SDario Binacchi #include "c_can.h"
132722ac98SDario Binacchi 
c_can_get_ringparam(struct net_device * netdev,struct ethtool_ringparam * ring,struct kernel_ethtool_ringparam * kernel_ring,struct netlink_ext_ack * extack)142722ac98SDario Binacchi static void c_can_get_ringparam(struct net_device *netdev,
1574624944SHao Chen 				struct ethtool_ringparam *ring,
1674624944SHao Chen 				struct kernel_ethtool_ringparam *kernel_ring,
1774624944SHao Chen 				struct netlink_ext_ack *extack)
182722ac98SDario Binacchi {
192722ac98SDario Binacchi 	struct c_can_priv *priv = netdev_priv(netdev);
202722ac98SDario Binacchi 
212722ac98SDario Binacchi 	ring->rx_max_pending = priv->msg_obj_num;
222722ac98SDario Binacchi 	ring->tx_max_pending = priv->msg_obj_num;
232722ac98SDario Binacchi 	ring->rx_pending = priv->msg_obj_rx_num;
242722ac98SDario Binacchi 	ring->tx_pending = priv->msg_obj_tx_num;
252722ac98SDario Binacchi }
262722ac98SDario Binacchi 
270ccb3e0bSVincent Mailhol const struct ethtool_ops c_can_ethtool_ops = {
282722ac98SDario Binacchi 	.get_ringparam = c_can_get_ringparam,
29*409c188cSVincent Mailhol 	.get_ts_info = ethtool_op_get_ts_info,
302722ac98SDario Binacchi };
31