[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20091117161748.11411.74316.stgit@localhost.localdomain>
Date: Tue, 17 Nov 2009 08:17:48 -0800
From: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
To: jeff@...zik.org, davem@...emloft.net, shemminger@...tta.com
Cc: netdev@...r.kernel.org, gospo@...hat.com,
Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@...el.com>,
Jeff Kirsher <jeffrey.t.kirsher@...el.com>
Subject: [PATCH] ethtool: Support passing the PHY info through get_drvinfo
From: PJ Waskiewicz <peter.p.waskiewicz.jr@...el.com>
This allows drivers to provide a PHY type to dump_drvinfo when
ethtool -i ethX is executed.
Signed-off-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@...el.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@...el.com>
---
ethtool-copy.h | 25 ++++++++++++++++++++++++-
ethtool.c | 30 ++++++++++++++++++++++++++++--
2 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3ca4e2c..db29c5a 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -53,7 +53,8 @@ struct ethtool_drvinfo {
char bus_info[ETHTOOL_BUSINFO_LEN]; /* Bus info for this IF. */
/* For PCI devices, use pci_name(pci_dev). */
char reserved1[32];
- char reserved2[12];
+ char reserved2[11];
+ __u8 phy_type; /* PHY type present on the NIC */
__u32 n_priv_flags; /* number of flags valid in ETHTOOL_GPFLAGS */
__u32 n_stats; /* number of u64's from ETHTOOL_GSTATS */
__u32 testinfo_len;
@@ -285,6 +286,28 @@ enum ethtool_flags {
ETH_FLAG_LRO = (1 << 15), /* LRO is enabled */
};
+/*
+ * PHY types supported
+ *
+ * 0 - No PHY specified
+ * 1 - SFP/SFP+ Fiber (SR and LR)
+ * 2 - XFP Fiber (SR and LR)
+ * 3 - SFP+ Direct Attach (TwinAX)
+ * 4 - BASE-T (RJ-45)
+ * MAX - PHY not present
+ */
+enum ethtool_phy_type {
+ ETH_PHY_UNSPECIFIED = 0,
+ ETH_PHY_SFP_FIBER,
+ ETH_PHY_XFP_FIBER,
+ ETH_PHY_DA_TWINAX,
+ ETH_PHY_BASE_T,
+
+ /* This must be the last entry */
+ ETH_PHY_NOT_PRESENT,
+};
+#define ETH_MAX_PHY_STR_LEN 32
+
struct ethtool_rxnfc {
__u32 cmd;
__u32 flow_type;
diff --git a/ethtool.c b/ethtool.c
index 0110682..8baa429 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -969,15 +969,41 @@ static int dump_ecmd(struct ethtool_cmd *ep)
static int dump_drvinfo(struct ethtool_drvinfo *info)
{
+ char phy_type[ETH_MAX_PHY_STR_LEN];
+
+ switch (info->phy_type) {
+ case ETH_PHY_NOT_PRESENT:
+ sprintf(phy_type, "PHY not present");
+ break;
+ case ETH_PHY_SFP_FIBER:
+ sprintf(phy_type, "SFP/SFP+ Fiber (SR/LR)");
+ break;
+ case ETH_PHY_XFP_FIBER:
+ sprintf(phy_type, "XFP Fiber (SR/LR)");
+ break;
+ case ETH_PHY_DA_TWINAX:
+ sprintf(phy_type, "SFP+ DA TwinAX");
+ break;
+ case ETH_PHY_BASE_T:
+ sprintf(phy_type, "BASE-T Copper");
+ break;
+ case ETH_PHY_UNSPECIFIED:
+ default:
+ sprintf(phy_type, "PHY unspecified");
+ break;
+ };
+
fprintf(stdout,
"driver: %s\n"
"version: %s\n"
"firmware-version: %s\n"
- "bus-info: %s\n",
+ "bus-info: %s\n"
+ "phy-type: %s\n",
info->driver,
info->version,
info->fw_version,
- info->bus_info);
+ info->bus_info,
+ phy_type);
return 0;
}
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists