xref: /linux/drivers/net/ethernet/broadcom/bnge/bnge_ethtool.c (revision a339dd699a7aa01bce4b38c8d81def310cf2bca0)
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2025 Broadcom.
3 
4 #include <linux/unaligned.h>
5 #include <linux/pci.h>
6 #include <linux/types.h>
7 #include <net/devlink.h>
8 #include <linux/ethtool.h>
9 #include <linux/etherdevice.h>
10 #include <linux/ethtool_netlink.h>
11 
12 #include "bnge.h"
13 #include "bnge_ethtool.h"
14 
15 static void bnge_get_drvinfo(struct net_device *dev,
16 			     struct ethtool_drvinfo *info)
17 {
18 	struct bnge_net *bn = netdev_priv(dev);
19 	struct bnge_dev *bd = bn->bd;
20 
21 	strscpy(info->driver, DRV_NAME, sizeof(info->driver));
22 	strscpy(info->fw_version, bd->fw_ver_str, sizeof(info->fw_version));
23 	strscpy(info->bus_info, pci_name(bd->pdev), sizeof(info->bus_info));
24 }
25 
26 static const struct ethtool_ops bnge_ethtool_ops = {
27 	.get_drvinfo		= bnge_get_drvinfo,
28 };
29 
30 void bnge_set_ethtool_ops(struct net_device *dev)
31 {
32 	dev->ethtool_ops = &bnge_ethtool_ops;
33 }
34