Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lan743x: Add support for ethtool get_drvinfo

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>

authored by

Bryan Whitehead and committed by
David S. Miller
0cf63226 8760c4d6

+35 -1
+1 -1
drivers/net/ethernet/microchip/Makefile
··· 6 6 obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o 7 7 obj-$(CONFIG_LAN743X) += lan743x.o 8 8 9 - lan743x-objs := lan743x_main.o 9 + lan743x-objs := lan743x_main.o lan743x_ethtool.o
+21
drivers/net/ethernet/microchip/lan743x_ethtool.c
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* Copyright (C) 2018 Microchip Technology Inc. */ 3 + 4 + #include <linux/netdevice.h> 5 + #include "lan743x_main.h" 6 + #include "lan743x_ethtool.h" 7 + #include <linux/pci.h> 8 + 9 + static void lan743x_ethtool_get_drvinfo(struct net_device *netdev, 10 + struct ethtool_drvinfo *info) 11 + { 12 + struct lan743x_adapter *adapter = netdev_priv(netdev); 13 + 14 + strlcpy(info->driver, DRIVER_NAME, sizeof(info->driver)); 15 + strlcpy(info->bus_info, 16 + pci_name(adapter->pdev), sizeof(info->bus_info)); 17 + } 18 + 19 + const struct ethtool_ops lan743x_ethtool_ops = { 20 + .get_drvinfo = lan743x_ethtool_get_drvinfo, 21 + };
+11
drivers/net/ethernet/microchip/lan743x_ethtool.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* Copyright (C) 2018 Microchip Technology Inc. */ 3 + 4 + #ifndef _LAN743X_ETHTOOL_H 5 + #define _LAN743X_ETHTOOL_H 6 + 7 + #include "linux/ethtool.h" 8 + 9 + extern const struct ethtool_ops lan743x_ethtool_ops; 10 + 11 + #endif /* _LAN743X_ETHTOOL_H */
+2
drivers/net/ethernet/microchip/lan743x_main.c
··· 12 12 #include <linux/rtnetlink.h> 13 13 #include <linux/iopoll.h> 14 14 #include "lan743x_main.h" 15 + #include "lan743x_ethtool.h" 15 16 16 17 static void lan743x_pci_cleanup(struct lan743x_adapter *adapter) 17 18 { ··· 2690 2689 goto cleanup_hardware; 2691 2690 2692 2691 adapter->netdev->netdev_ops = &lan743x_netdev_ops; 2692 + adapter->netdev->ethtool_ops = &lan743x_ethtool_ops; 2693 2693 adapter->netdev->features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM; 2694 2694 adapter->netdev->hw_features = adapter->netdev->features; 2695 2695