Skip to contentSkip to conversation

can: c_can: add ethtool support

PATCH In review Dario Binacchi 3 participants 3 messages May 14, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 can: c_can: add ethtool support

With commit 132f2d45fb23 ("can: c_can: add support to 64 message objects") the number of message objects used for reception / transmission depends on FIFO size.
The ethtools API support allows you to retrieve this info. Driver info has been added too.

---

Changes in v3:
- Remove the version info so that ethtool will return the version of the kernel the driver is actually being used in.

Changes in v2:
- Use get_ringparam instead of get_channels.

 drivers/net/can/c_can/Makefile                |  3 ++
 drivers/net/can/c_can/c_can.h                 |  2 +
 drivers/net/can/c_can/c_can_ethtool.c         | 43 +++++++++++++++++++
 .../net/can/c_can/{c_can.c => c_can_main.c}   |  1 +
 4 files changed, 49 insertions(+)
 create mode 100644 drivers/net/can/c_can/c_can_ethtool.c
 rename drivers/net/can/c_can/{c_can.c => c_can_main.c} (99%)
drivers/net/can/c_can/Makefile +3 -0
index e6a94c948531..ac2bca39d6ff 100644
@@ -4,5 +4,8 @@
 #
 
 obj-$(CONFIG_CAN_C_CAN) += c_can.o
+
+c_can-objs := c_can_main.o c_can_ethtool.o
+
 obj-$(CONFIG_CAN_C_CAN_PLATFORM) += c_can_platform.o
 obj-$(CONFIG_CAN_C_CAN_PCI) += c_can_pci.o
drivers/net/can/c_can/c_can.h +2 -0
index 06045f610f0e..f9001072514a 100644
@@ -219,4 +219,6 @@ int c_can_power_up(struct net_device *dev);
 int c_can_power_down(struct net_device *dev);
 #endif
 
+void c_can_set_ethtool_ops(struct net_device *dev);
+
 #endif /* C_CAN_H */
drivers/net/can/c_can/c_can_ethtool.c new file +43 -0

43 lines not on this page · raw message

drivers/net/can/c_can/c_can_main.c renamed from drivers/net/can/c_can/c_can.c +1 -0
similarity index 99%
rename from drivers/net/can/c_can/c_can.c
rename to drivers/net/can/c_can/c_can_main.c
index 313793f6922d..1903b87d5384 100644
@@ -1335,6 +1335,7 @@ int register_c_can_dev(struct net_device *dev)
 
 	dev->flags |= IFF_ECHO;	/* we support local echo */
 	dev->netdev_ops = &c_can_netdev_ops;
+	c_can_set_ethtool_ops(dev);
 
 	err = register_candev(dev);
 	if (!err)
Signature · 1 line
2.17.1
Reviewed-by on v3 1/2
#1 lore raw
Quoted 7 lines · Dario Binacchi

With commit 132f2d45fb23 ("can: c_can: add support to 64 message objects") the number of message objects used for reception / transmission depends on FIFO size.
The ethtools API support allows you to retrieve this info. Driver info has been added too.

Andrew

#2 lore raw
In reply to Dario Binacchi
Quoted 7 lines · Dario Binacchi

With commit 132f2d45fb23 ("can: c_can: add support to 64 message objects") the number of message objects used for reception / transmission depends on FIFO size.
The ethtools API support allows you to retrieve this info. Driver info has been added too.

Applied to linux-can-next/testing

Thanks,
Marc

Signature · 4 lines
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |