All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bryan Whitehead <Bryan.Whitehead@microchip.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <UNGLinuxDriver@microchip.com>,
	<richardcochran@gmail.com>
Subject: [PATCH v2 net-next 1/9] lan743x: Add support for ethtool get_drvinfo
Date: Thu, 12 Jul 2018 15:04:58 -0400	[thread overview]
Message-ID: <1531422306-6547-2-git-send-email-Bryan.Whitehead@microchip.com> (raw)
In-Reply-To: <1531422306-6547-1-git-send-email-Bryan.Whitehead@microchip.com>

Implement ethtool get_drvinfo

Signed-off-by: Bryan Whitehead <Bryan.Whitehead@microchip.com>
---
 drivers/net/ethernet/microchip/Makefile          |  2 +-
 drivers/net/ethernet/microchip/lan743x_ethtool.c | 21 +++++++++++++++++++++
 drivers/net/ethernet/microchip/lan743x_ethtool.h | 11 +++++++++++
 drivers/net/ethernet/microchip/lan743x_main.c    |  2 ++
 4 files changed, 35 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ethernet/microchip/lan743x_ethtool.c
 create mode 100644 drivers/net/ethernet/microchip/lan743x_ethtool.h

diff --git a/drivers/net/ethernet/microchip/Makefile b/drivers/net/ethernet/microchip/Makefile
index 2e982cc..43f47cb 100644
--- a/drivers/net/ethernet/microchip/Makefile
+++ b/drivers/net/ethernet/microchip/Makefile
@@ -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
index 0000000..0e20758
--- /dev/null
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.c
@@ -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
index 0000000..d0d11a7
--- /dev/null
+++ b/drivers/net/ethernet/microchip/lan743x_ethtool.h
@@ -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 */
diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c
index e1747a4..ade3b04 100644
--- a/drivers/net/ethernet/microchip/lan743x_main.c
+++ b/drivers/net/ethernet/microchip/lan743x_main.c
@@ -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;
 
-- 
2.7.4

  reply	other threads:[~2018-07-12 19:19 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 19:04 [PATCH v2 net-next 0/9] lan743x: Add features to lan743x driver Bryan Whitehead
2018-07-12 19:04 ` Bryan Whitehead [this message]
2018-07-12 22:28   ` [PATCH v2 net-next 1/9] lan743x: Add support for ethtool get_drvinfo Andrew Lunn
2018-07-12 19:04 ` [PATCH v2 net-next 2/9] lan743x: Add support for ethtool link settings Bryan Whitehead
2018-07-12 22:29   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 3/9] lan743x: Add support for ethtool statistics Bryan Whitehead
2018-07-12 22:31   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 4/9] lan743x: Add support for ethtool message level Bryan Whitehead
2018-07-12 22:31   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 5/9] lan743x: Add support for ethtool eeprom access Bryan Whitehead
2018-07-12 22:35   ` Andrew Lunn
2018-07-12 19:05 ` [PATCH v2 net-next 6/9] lan743x: Add power management support Bryan Whitehead
2018-07-12 22:42   ` Andrew Lunn
2018-07-18 20:05     ` Bryan.Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 7/9] lan743x: Add EEE support Bryan Whitehead
2018-07-12 22:49   ` Andrew Lunn
2018-07-13 16:35     ` Bryan.Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 8/9] lan743x: Add RSS support Bryan Whitehead
2018-07-12 19:05 ` [PATCH v2 net-next 9/9] lan743x: Add PTP support Bryan Whitehead
2018-07-13  3:31   ` Richard Cochran
2018-07-18 20:04     ` Bryan.Whitehead
2018-07-18 20:55       ` Richard Cochran
2018-07-18 21:05         ` Bryan.Whitehead

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1531422306-6547-2-git-send-email-Bryan.Whitehead@microchip.com \
    --to=bryan.whitehead@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.