-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
With commit 132f2d4 ("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. Link: https://lore.kernel.org/r/20210514165549.14365-2-dariobin@libero.it Signed-off-by: Dario Binacchi <dariobin@libero.it> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
- Loading branch information
Dario Binacchi
authored and
Marc Kleine-Budde
committed
May 27, 2021
1 parent
c7b0f68
commit 2722ac9
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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_drvinfo(struct net_device *netdev, | ||
struct ethtool_drvinfo *info) | ||
{ | ||
struct c_can_priv *priv = netdev_priv(netdev); | ||
struct platform_device *pdev = to_platform_device(priv->device); | ||
|
||
strscpy(info->driver, "c_can", sizeof(info->driver)); | ||
strscpy(info->bus_info, pdev->name, sizeof(info->bus_info)); | ||
} | ||
|
||
static void c_can_get_ringparam(struct net_device *netdev, | ||
struct ethtool_ringparam *ring) | ||
{ | ||
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; | ||
} | ||
|
||
static const struct ethtool_ops c_can_ethtool_ops = { | ||
.get_drvinfo = c_can_get_drvinfo, | ||
.get_ringparam = c_can_get_ringparam, | ||
}; | ||
|
||
void c_can_set_ethtool_ops(struct net_device *netdev) | ||
{ | ||
netdev->ethtool_ops = &c_can_ethtool_ops; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters