diff options
author | Bryan Whitehead <Bryan.Whitehead@microchip.com> | 2018-07-23 16:16:26 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-07-23 17:09:18 -0400 |
commit | 0cf632265d6753e9bcdf2bc196999ea40c02f2dd (patch) | |
tree | 6c2b2144cb5cb2f9fc000014a021dc64d3c22df3 | |
parent | 8760c4d6d5f7e5920edc34ee0785aeeda766842b (diff) |
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>
-rw-r--r-- | drivers/net/ethernet/microchip/Makefile | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/microchip/lan743x_ethtool.c | 21 | ||||
-rw-r--r-- | drivers/net/ethernet/microchip/lan743x_ethtool.h | 11 | ||||
-rw-r--r-- | drivers/net/ethernet/microchip/lan743x_main.c | 2 |
4 files changed, 35 insertions, 1 deletions
diff --git a/drivers/net/ethernet/microchip/Makefile b/drivers/net/ethernet/microchip/Makefile index 2e982cc249fb..43f47cb45fe2 100644 --- a/drivers/net/ethernet/microchip/Makefile +++ b/drivers/net/ethernet/microchip/Makefile | |||
@@ -6,4 +6,4 @@ obj-$(CONFIG_ENC28J60) += enc28j60.o | |||
6 | obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o | 6 | obj-$(CONFIG_ENCX24J600) += encx24j600.o encx24j600-regmap.o |
7 | obj-$(CONFIG_LAN743X) += lan743x.o | 7 | obj-$(CONFIG_LAN743X) += lan743x.o |
8 | 8 | ||
9 | lan743x-objs := lan743x_main.o | 9 | 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 index 000000000000..0e20758b54de --- /dev/null +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c | |||
@@ -0,0 +1,21 @@ | |||
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 | }; | ||
diff --git a/drivers/net/ethernet/microchip/lan743x_ethtool.h b/drivers/net/ethernet/microchip/lan743x_ethtool.h new file mode 100644 index 000000000000..d0d11a777a58 --- /dev/null +++ b/drivers/net/ethernet/microchip/lan743x_ethtool.h | |||
@@ -0,0 +1,11 @@ | |||
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 */ | ||
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index e1747a490066..ade3b04b2de6 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/rtnetlink.h> | 12 | #include <linux/rtnetlink.h> |
13 | #include <linux/iopoll.h> | 13 | #include <linux/iopoll.h> |
14 | #include "lan743x_main.h" | 14 | #include "lan743x_main.h" |
15 | #include "lan743x_ethtool.h" | ||
15 | 16 | ||
16 | static void lan743x_pci_cleanup(struct lan743x_adapter *adapter) | 17 | static void lan743x_pci_cleanup(struct lan743x_adapter *adapter) |
17 | { | 18 | { |
@@ -2689,6 +2690,7 @@ static int lan743x_pcidev_probe(struct pci_dev *pdev, | |||
2689 | goto cleanup_hardware; | 2690 | goto cleanup_hardware; |
2690 | 2691 | ||
2691 | adapter->netdev->netdev_ops = &lan743x_netdev_ops; | 2692 | adapter->netdev->netdev_ops = &lan743x_netdev_ops; |
2693 | adapter->netdev->ethtool_ops = &lan743x_ethtool_ops; | ||
2692 | adapter->netdev->features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM; | 2694 | adapter->netdev->features = NETIF_F_SG | NETIF_F_TSO | NETIF_F_HW_CSUM; |
2693 | adapter->netdev->hw_features = adapter->netdev->features; | 2695 | adapter->netdev->hw_features = adapter->netdev->features; |
2694 | 2696 | ||