* [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status
@ 2017-02-09 3:03 Zhu Yanjun
2017-02-09 3:03 ` [PATCH 1/1] ethtool: add the external transceiver status of the ixgbe fiber Zhu Yanjun
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zhu Yanjun @ 2017-02-09 3:03 UTC (permalink / raw)
To: jeffrey.t.kirsher, broonie, davem, intel-wired-lan, netdev
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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/1] ethtool: add the external transceiver status of the ixgbe fiber
2017-02-09 3:03 [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status Zhu Yanjun
@ 2017-02-09 3:03 ` 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
2 siblings, 0 replies; 5+ messages in thread
From: Zhu Yanjun @ 2017-02-09 3:03 UTC (permalink / raw)
To: jeffrey.t.kirsher, broonie, davem, intel-wired-lan, netdev
When the the fiber transceiver of the ixgbe NIC is external, sometimes
it is necessary to get the present/absent status of the fiber transceiver
of the ixgbe NIC.
The steps to get the present/absent status:
The NIC 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>
---
ethtool-copy.h | 2 ++
ethtool.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/ethtool-copy.h b/ethtool-copy.h
index 3d299e3..1c6db9a 100644
--- a/ethtool-copy.h
+++ b/ethtool-copy.h
@@ -1536,6 +1536,8 @@ static __inline__ int ethtool_validate_duplex(__u8 duplex)
#define XCVR_DUMMY1 0x02
#define XCVR_DUMMY2 0x03
#define XCVR_DUMMY3 0x04
+#define XCVR_EXTERNAL_ABSENT 0x05
+#define XCVR_EXTERNAL_PRESENT 0x06
/* Enable or disable autonegotiation. */
#define AUTONEG_DISABLE 0x00
diff --git a/ethtool.c b/ethtool.c
index 7af039e..85cf5a2 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -811,6 +811,12 @@ dump_link_usettings(const struct ethtool_link_usettings *link_usettings)
case XCVR_EXTERNAL:
fprintf(stdout, "external\n");
break;
+ case XCVR_EXTERNAL_PRESENT:
+ fprintf(stdout, "external(present)\n");
+ break;
+ case XCVR_EXTERNAL_ABSENT:
+ fprintf(stdout, "external(absent)\n");
+ break;
default:
fprintf(stdout, "Unknown!\n");
break;
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status
2017-02-09 3:03 [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status Zhu Yanjun
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 ` Sergei Shtylyov
2017-02-09 19:08 ` Tantilov, Emil S
2 siblings, 0 replies; 5+ messages in thread
From: Sergei Shtylyov @ 2017-02-09 10:49 UTC (permalink / raw)
To: Zhu Yanjun, jeffrey.t.kirsher, broonie, davem, intel-wired-lan,
netdev
Hello!
On 2/9/2017 6:03 AM, Zhu Yanjun wrote:
> 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)
*else* *if*. Although *switch* would match better instead...
> + ecmd->transceiver = XCVR_EXTERNAL_ABSENT;
> + }
> +
> /* Indicate pause support */
> ecmd->supported |= SUPPORTED_Pause;
>
[...]
MBR, Sergei
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status
2017-02-09 3:03 [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status Zhu Yanjun
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
2 siblings, 1 reply; 5+ messages in thread
From: Tantilov, Emil S @ 2017-02-09 19:08 UTC (permalink / raw)
To: Zhu Yanjun, Kirsher, Jeffrey T, broonie@kernel.org,
davem@davemloft.net, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org
>-----Original Message-----
>From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
>Behalf Of Zhu Yanjun
>Sent: Wednesday, February 08, 2017 7:03 PM
>To: Kirsher, Jeffrey T <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
>
>When the ixgbe fiber transceiver is external, it is necessary to get
>the present/absent status of this external ixgbe fiber transceiver.
The transceiver field was deprecated in the old ethtool API and is being
removed in the new. This patch will not apply at all once those changes are made:
http://patchwork.ozlabs.org/patch/725081/
Thanks,
Emil
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status
2017-02-09 19:08 ` Tantilov, Emil S
@ 2017-02-10 2:43 ` Yanjun Zhu
0 siblings, 0 replies; 5+ messages in thread
From: Yanjun Zhu @ 2017-02-10 2:43 UTC (permalink / raw)
To: Tantilov, Emil S, Kirsher, Jeffrey T, broonie@kernel.org,
davem@davemloft.net, intel-wired-lan@lists.osuosl.org,
netdev@vger.kernel.org
On 2017/2/10 3:08, Tantilov, Emil S wrote:
>> -----Original Message-----
>> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
>> Behalf Of Zhu Yanjun
>> Sent: Wednesday, February 08, 2017 7:03 PM
>> To: Kirsher, Jeffrey T <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
>>
>> When the ixgbe fiber transceiver is external, it is necessary to get
>> the present/absent status of this external ixgbe fiber transceiver.
> The transceiver field was deprecated in the old ethtool API and is being
> removed in the new. This patch will not apply at all once those changes are made:
>
> http://patchwork.ozlabs.org/patch/725081/
Thanks for your kind reply. I will change this patch based on the above
changes.
Zhu Yanjun
>
> Thanks,
> Emil
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-02-10 2:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09 3:03 [PATCH 1/1] ixgbe: add the external ixgbe fiber transceiver status Zhu Yanjun
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
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).