xref: /openbmc/linux/drivers/net/ethernet/broadcom/asp2/bcmasp_ethtool.c (revision 490cb412007de593e07c1d3e2b1ec4233886707c)
1 // SPDX-License-Identifier: GPL-2.0
2 #define pr_fmt(fmt)				"bcmasp_ethtool: " fmt
3 
4 #include <linux/ethtool.h>
5 #include <linux/netdevice.h>
6 #include <linux/platform_device.h>
7 
8 #include "bcmasp.h"
9 #include "bcmasp_intf_defs.h"
10 
11 static void bcmasp_get_drvinfo(struct net_device *dev,
12 			       struct ethtool_drvinfo *info)
13 {
14 	strscpy(info->driver, "bcmasp", sizeof(info->driver));
15 	strscpy(info->bus_info, dev_name(dev->dev.parent),
16 		sizeof(info->bus_info));
17 }
18 
19 static u32 bcmasp_get_msglevel(struct net_device *dev)
20 {
21 	struct bcmasp_intf *intf = netdev_priv(dev);
22 
23 	return intf->msg_enable;
24 }
25 
26 static void bcmasp_set_msglevel(struct net_device *dev, u32 level)
27 {
28 	struct bcmasp_intf *intf = netdev_priv(dev);
29 
30 	intf->msg_enable = level;
31 }
32 
33 const struct ethtool_ops bcmasp_ethtool_ops = {
34 	.get_drvinfo		= bcmasp_get_drvinfo,
35 	.get_link		= ethtool_op_get_link,
36 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
37 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
38 	.get_msglevel		= bcmasp_get_msglevel,
39 	.set_msglevel		= bcmasp_set_msglevel,
40 };
41