From: Zhu Yanjun <yanjun.zhu@oracle.com>
To: jeffrey.t.kirsher@intel.com, broonie@kernel.org,
davem@davemloft.net, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org
Subject: [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status
Date: Wed, 8 Feb 2017 22:03:27 -0500 [thread overview]
Message-ID: <1486609408-6770-1-git-send-email-yanjun.zhu@oracle.com> (raw)
When the ixgbe fiber transceiver is external, it is necessary to get
the present/absent status of this external ixgbe fiber transceiver.
The steps to get the present/absent status:
The enp1s0f0 is an external ixgbe fiber NIC.
ethtool enp1s0f0
...
Port: FIBRE
PHYAD: 0
Transceiver: external(present) <---The transceiver is present.
Auto-negotiation: on
Supports Wake-on: d
...
Or
...
Port: FIBRE
PHYAD: 0
Transceiver: external(absent) <---The transceiver is absent
Auto-negotiation: on
Supports Wake-on: d
...
Signed-off-by: Zhu Yanjun <yanjun.zhu@oracle.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c | 15 +++++++++++++++
include/uapi/linux/ethtool.h | 4 ++++
2 files changed, 19 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
index fd192bf..b3f86f4 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c
@@ -313,6 +313,21 @@ static int ixgbe_get_settings(struct net_device *netdev,
break;
}
+ /* When the tranceiver is external, the following is meaningful.
+ * ecmd->reserved[0] has 3 values:
+ * 0x0: tranceiver absent
+ * 0x4: tranceiver present
+ * others: not support
+ */
+ if (ecmd->port == PORT_FIBRE) {
+ u32 status = IXGBE_READ_REG(hw, IXGBE_ESDP) & IXGBE_ESDP_SDP2;
+
+ if (status == 0x4)
+ ecmd->transceiver = XCVR_EXTERNAL_PRESENT;
+ if (status == 0x0)
+ ecmd->transceiver = XCVR_EXTERNAL_ABSENT;
+ }
+
/* Indicate pause support */
ecmd->supported |= SUPPORTED_Pause;
diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
index 3dc91a4..8e8225a 100644
--- a/include/uapi/linux/ethtool.h
+++ b/include/uapi/linux/ethtool.h
@@ -1541,6 +1541,10 @@ static inline int ethtool_validate_duplex(__u8 duplex)
#define XCVR_DUMMY2 0x03
#define XCVR_DUMMY3 0x04
+/* The fiber transceiver status */
+#define XCVR_EXTERNAL_ABSENT 0x05
+#define XCVR_EXTERNAL_PRESENT 0x06
+
/* Enable or disable autonegotiation. */
#define AUTONEG_DISABLE 0x00
#define AUTONEG_ENABLE 0x01
--
2.7.4
next reply other threads:[~2017-02-09 5:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-09 3:03 Zhu Yanjun [this message]
2017-02-09 3:03 ` [PATCH 1/1] ethtool: add the external transceiver status of the ixgbe fiber Zhu Yanjun
2017-02-09 10:49 ` [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status Sergei Shtylyov
2017-02-09 19:08 ` Tantilov, Emil S
2017-02-10 2:43 ` Yanjun Zhu
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=1486609408-6770-1-git-send-email-yanjun.zhu@oracle.com \
--to=yanjun.zhu@oracle.com \
--cc=broonie@kernel.org \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).