]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
lan743x: Add support for ethtool get_drvinfo
authorBryan Whitehead <Bryan.Whitehead@microchip.com>
Mon, 23 Jul 2018 20:16:26 +0000 (16:16 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 23 Jul 2018 21:09:18 +0000 (14:09 -0700)
Implement ethtool get_drvinfo

Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/microchip/Makefile
drivers/net/ethernet/microchip/lan743x_ethtool.c [new file with mode: 0644]
drivers/net/ethernet/microchip/lan743x_ethtool.h [new file with mode: 0644]
drivers/net/ethernet/microchip/lan743x_main.c

index 2e982cc249fbb59b76b54057576f989d7be7ee0b..43f47cb45fe2cee55e372d2381cd5be8a8767284 100644 (file)
@@ -6,4 +6,4 @@ obj-$(CONFIG_ENC28J60) += enc28j60.o
 obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o
 obj-$(CONFIG_LAN743X) += lan743x.o
 
-lan743x-objs := lan743x_main.o
+lan743x-objs := lan743x_main.o lan743x_ethtool.o
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.c b/drivers/net/ethernet/microchip/lan743x_ethtool.c
new file mode 100644 (file)
index 0000000..0e20758
--- /dev/null
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Copyright (C) 2018 Microchip Technology Inc. */
+
+#include <linux/netdevice.h>
+#include "lan743x_main.h"
+#include "lan743x_ethtool.h"
+#include <linux/pci.h>
+
+static void lan743x_ethtool_get_drvinfo(struct net_device *netdev,
+                                       struct ethtool_drvinfo *info)
+{
+       struct lan743x_adapter *adapter = netdev_priv(netdev);
+
+       strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strlcpy(info->bus_info,
+               pci_name(adapter->pdev), sizeof(info->bus_info));
+}
+
+const struct ethtool_ops lan743x_ethtool_ops = {
+       .get_drvinfo = lan743x_ethtool_get_drvinfo,
+};
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.h b/drivers/net/ethernet/microchip/lan743x_ethtool.h
new file mode 100644 (file)
index 0000000..d0d11a7
--- /dev/null
@@ -0,0 +1,11 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/* Copyright (C) 2018 Microchip Technology Inc. */
+
+#ifndef _LAN743X_ETHTOOL_H
+#define _LAN743X_ETHTOOL_H
+
+#include "linux/ethtool.h"
+
+extern const struct ethtool_ops lan743x_ethtool_ops;
+
+#endif /* _LAN743X_ETHTOOL_H */
index e1747a4900666ac0a27db42cbeb87b4d0ac7e06e..ade3b04b2de61ba20a2086aa97589877be22e1f7 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/iopoll.h>
 #include "lan743x_main.h"
+#include "lan743x_ethtool.h"
 
 static void lan743x_pci_cleanup(struct lan743x_adapter *adapter)
 {
@@ -2689,6 +2690,7 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev,
                goto cleanup_hardware;
 
        adapter->netdev->netdev_ops = &lan743x_netdev_ops;
+       adapter->netdev->ethtool_ops = &lan743x_ethtool_ops;
        adapter->netdev->features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM;
        adapter->netdev->hw_features = adapter->netdev->features;