* [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault
@ 2023-06-13 5:05 Jakub Kicinski
2023-06-13 5:05 ` [PATCH ethtool-next v2 2/2] cmis: " Jakub Kicinski
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jakub Kicinski @ 2023-06-13 5:05 UTC (permalink / raw)
To: mkubecek, idosch
Cc: danieller, netdev, vladyslavt, linux, andrew, Jakub Kicinski
Report whether Loss of Lock, of Signal and Tx Faults were detected.
Print "None" in case no lane has the problem, and per-lane "Yes" /
"No" if at least one of the lanes reports true.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2: fix Rx / Tx for the "implemented" bit
v1: https://lore.kernel.org/all/20230609004400.1276734-1-kuba@kernel.org/
---
qsfp.c | 30 ++++++++++++++++++++++++++++++
qsfp.h | 8 ++++++++
sff-common.c | 17 +++++++++++++++++
sff-common.h | 2 ++
4 files changed, 57 insertions(+)
diff --git a/qsfp.c b/qsfp.c
index 1fe5de1a863f..5a535c5c092b 100644
--- a/qsfp.c
+++ b/qsfp.c
@@ -872,6 +872,35 @@ static void sff8636_show_dom(const struct sff8636_memory_map *map)
}
}
+static void sff8636_show_signals(const struct sff8636_memory_map *map)
+{
+ unsigned int v;
+
+ /* There appears to be no Rx LOS support bit, use Tx for both */
+ if (map->page_00h[SFF8636_OPTION_4_OFFSET] & SFF8636_O4_TX_LOS) {
+ v = map->lower_memory[SFF8636_LOS_AW_OFFSET] & 0xf;
+ sff_show_lane_status("Rx loss of signal", 4, "Yes", "No", v);
+ v = map->lower_memory[SFF8636_LOS_AW_OFFSET] >> 4;
+ sff_show_lane_status("Tx loss of signal", 4, "Yes", "No", v);
+ }
+
+ v = map->lower_memory[SFF8636_LOL_AW_OFFSET] & 0xf;
+ if (map->page_00h[SFF8636_OPTION_3_OFFSET] & SFF8636_O3_RX_LOL)
+ sff_show_lane_status("Rx loss of lock", 4, "Yes", "No", v);
+
+ v = map->lower_memory[SFF8636_LOL_AW_OFFSET] >> 4;
+ if (map->page_00h[SFF8636_OPTION_3_OFFSET] & SFF8636_O3_TX_LOL)
+ sff_show_lane_status("Tx loss of lock", 4, "Yes", "No", v);
+
+ v = map->lower_memory[SFF8636_FAULT_AW_OFFSET] & 0xf;
+ if (map->page_00h[SFF8636_OPTION_4_OFFSET] & SFF8636_O4_TX_FAULT)
+ sff_show_lane_status("Tx fault", 4, "Yes", "No", v);
+
+ v = map->lower_memory[SFF8636_FAULT_AW_OFFSET] >> 4;
+ if (map->page_00h[SFF8636_OPTION_2_OFFSET] & SFF8636_O2_TX_EQ_AUTO)
+ sff_show_lane_status("Tx adaptive eq fault", 4, "Yes", "No", v);
+}
+
static void sff8636_show_page_zero(const struct sff8636_memory_map *map)
{
sff8636_show_ext_identifier(map);
@@ -905,6 +934,7 @@ static void sff8636_show_page_zero(const struct sff8636_memory_map *map)
SFF8636_DATE_VENDOR_LOT_OFFSET + 1, "Date code");
sff_show_revision_compliance(map->lower_memory,
SFF8636_REV_COMPLIANCE_OFFSET);
+ sff8636_show_signals(map);
}
static void sff8636_show_all_common(const struct sff8636_memory_map *map)
diff --git a/qsfp.h b/qsfp.h
index aabf09fdc623..9f0cb0f7d55d 100644
--- a/qsfp.h
+++ b/qsfp.h
@@ -55,6 +55,8 @@
#define SFF8636_TX2_FAULT_AW (1 << 1)
#define SFF8636_TX1_FAULT_AW (1 << 0)
+#define SFF8636_LOL_AW_OFFSET 0x05
+
/* Module Monitor Interrupt Flags - 6-8 */
#define SFF8636_TEMP_AW_OFFSET 0x06
#define SFF8636_TEMP_HALARM_STATUS (1 << 7)
@@ -525,9 +527,15 @@
/* 56h-5Fh reserved */
#define SFF8636_OPTION_2_OFFSET 0xC1
+/* Tx input equalizers auto-adaptive */
+#define SFF8636_O2_TX_EQ_AUTO (1 << 3)
/* Rx output amplitude */
#define SFF8636_O2_RX_OUTPUT_AMP (1 << 0)
#define SFF8636_OPTION_3_OFFSET 0xC2
+/* Tx CDR Loss of Lock */
+#define SFF8636_O3_TX_LOL (1 << 5)
+/* Rx CDR Loss of Lock */
+#define SFF8636_O3_RX_LOL (1 << 4)
/* Rx Squelch Disable */
#define SFF8636_O3_RX_SQL_DSBL (1 << 3)
/* Rx Output Disable capable */
diff --git a/sff-common.c b/sff-common.c
index e951cf15c1d6..a5c1510302a6 100644
--- a/sff-common.c
+++ b/sff-common.c
@@ -53,6 +53,23 @@ void sff_show_ascii(const __u8 *id, unsigned int first_reg,
printf("\n");
}
+void sff_show_lane_status(const char *name, unsigned int lane_cnt,
+ const char *yes, const char *no, unsigned int value)
+{
+ printf("\t%-41s : ", name);
+ if (!value) {
+ printf("None\n");
+ return;
+ }
+
+ printf("[");
+ while (lane_cnt--) {
+ printf(" %s%c", value & 1 ? yes : no, lane_cnt ? ',': ' ');
+ value >>= 1;
+ }
+ printf("]\n");
+}
+
void sff8024_show_oui(const __u8 *id, int id_offset)
{
printf("\t%-41s : %02x:%02x:%02x\n", "Vendor OUI",
diff --git a/sff-common.h b/sff-common.h
index dd12dda7bbce..57bcc4a415fe 100644
--- a/sff-common.h
+++ b/sff-common.h
@@ -198,6 +198,8 @@ void sff_show_value_with_unit(const __u8 *id, unsigned int reg,
const char *unit);
void sff_show_ascii(const __u8 *id, unsigned int first_reg,
unsigned int last_reg, const char *name);
+void sff_show_lane_status(const char *name, unsigned int lane_cnt,
+ const char *yes, const char *no, unsigned int value);
void sff_show_thresholds(struct sff_diags sd);
void sff8024_show_oui(const __u8 *id, int id_offset);
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH ethtool-next v2 2/2] cmis: report LOL / LOS / Tx Fault 2023-06-13 5:05 [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault Jakub Kicinski @ 2023-06-13 5:05 ` Jakub Kicinski 2023-06-13 7:32 ` Ido Schimmel 2023-06-13 7:06 ` [PATCH ethtool-next v2 1/2] sff-8636: " Ido Schimmel 2023-06-14 18:50 ` patchwork-bot+netdevbpf 2 siblings, 1 reply; 6+ messages in thread From: Jakub Kicinski @ 2023-06-13 5:05 UTC (permalink / raw) To: mkubecek, idosch Cc: danieller, netdev, vladyslavt, linux, andrew, Jakub Kicinski Report whether Loss of Lock, of Signal and Tx Faults were detected. Print "None" in case no lane has the problem, and per-lane "Yes" / "No" if at least one of the lanes reports true. Signed-off-by: Jakub Kicinski <kuba@kernel.org> --- Turns out I don't have access to any host with CMIS optics at this point so untested. I can only confirm it correctly shows nothing with a DAC... --- cmis.c | 39 +++++++++++++++++++++++++++++++++++++++ cmis.h | 17 +++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/cmis.c b/cmis.c index d0b62728e998..531932ee7eeb 100644 --- a/cmis.c +++ b/cmis.c @@ -139,6 +139,44 @@ static void cmis_show_rev_compliance(const struct cmis_memory_map *map) printf("\t%-41s : Rev. %d.%d\n", "Revision compliance", major, minor); } +static void +cmis_show_signals_one(const struct cmis_memory_map *map, const char *name, + int off, int ioff, unsigned int imask) +{ + unsigned int v; + int i; + + if (!map->page_01h) + return; + + v = 0; + for (i = 0; i < CMIS_MAX_BANKS && map->upper_memory[i][0x11]; i++) + v |= map->upper_memory[i][0x11][off] << (i * 8); + + if (map->page_01h[ioff] & imask) + sff_show_lane_status(name, i * 8, "Yes", "No", v); +} + +static void cmis_show_signals(const struct cmis_memory_map *map) +{ + cmis_show_signals_one(map, "Rx loss of signal", CMIS_RX_LOS_OFFSET, + CMIS_DIAG_FLAGS_RX_OFFSET, CMIS_DIAG_FL_RX_LOS); + cmis_show_signals_one(map, "Tx loss of signal", CMIS_TX_LOS_OFFSET, + CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_LOS); + + cmis_show_signals_one(map, "Rx loss of lock", CMIS_RX_LOL_OFFSET, + CMIS_DIAG_FLAGS_RX_OFFSET, CMIS_DIAG_FL_RX_LOL); + cmis_show_signals_one(map, "Tx loss of lock", CMIS_TX_LOL_OFFSET, + CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_LOL); + + cmis_show_signals_one(map, "Tx fault", CMIS_TX_FAIL_OFFSET, + CMIS_DIAG_FLAGS_TX_OFFSET, CMIS_DIAG_FL_TX_FAIL); + + cmis_show_signals_one(map, "Tx adaptive eq fault", + CMIS_TX_EQ_FAIL_OFFSET, CMIS_DIAG_FLAGS_TX_OFFSET, + CMIS_DIAG_FL_TX_ADAPTIVE_EQ_FAIL); +} + /** * Print information about the device's power consumption. * Relevant documents: @@ -857,6 +895,7 @@ static void cmis_show_all_common(const struct cmis_memory_map *map) cmis_show_link_len(map); cmis_show_vendor_info(map); cmis_show_rev_compliance(map); + cmis_show_signals(map); cmis_show_mod_state(map); cmis_show_mod_fault_cause(map); cmis_show_mod_lvl_controls(map); diff --git a/cmis.h b/cmis.h index 46797081f13c..8d66f92dd971 100644 --- a/cmis.h +++ b/cmis.h @@ -158,6 +158,17 @@ #define CMIS_DIAG_TYPE_OFFSET 0x97 #define CMIS_RX_PWR_TYPE_MASK 0x10 +/* Supported Flags Advertisement (Page 1) */ +#define CMIS_DIAG_FLAGS_TX_OFFSET 0x9d +#define CMIS_DIAG_FL_TX_ADAPTIVE_EQ_FAIL (1 << 3) +#define CMIS_DIAG_FL_TX_LOL (1 << 2) +#define CMIS_DIAG_FL_TX_LOS (1 << 1) +#define CMIS_DIAG_FL_TX_FAIL (1 << 0) + +#define CMIS_DIAG_FLAGS_RX_OFFSET 0x9e +#define CMIS_DIAG_FL_RX_LOL (1 << 2) +#define CMIS_DIAG_FL_RX_LOS (1 << 1) + /* Supported Monitors Advertisement (Page 1) */ #define CMIS_DIAG_CHAN_ADVER_OFFSET 0xA0 #define CMIS_TX_BIAS_MON_MASK 0x01 @@ -207,6 +218,10 @@ */ /* Media Lane-Specific Flags (Page 0x11) */ +#define CMIS_TX_FAIL_OFFSET 0x87 +#define CMIS_TX_LOS_OFFSET 0x88 +#define CMIS_TX_LOL_OFFSET 0x89 +#define CMIS_TX_EQ_FAIL_OFFSET 0x8a #define CMIS_TX_PWR_AW_HALARM_OFFSET 0x8B #define CMIS_TX_PWR_AW_LALARM_OFFSET 0x8C #define CMIS_TX_PWR_AW_HWARN_OFFSET 0x8D @@ -215,6 +230,8 @@ #define CMIS_TX_BIAS_AW_LALARM_OFFSET 0x90 #define CMIS_TX_BIAS_AW_HWARN_OFFSET 0x91 #define CMIS_TX_BIAS_AW_LWARN_OFFSET 0x92 +#define CMIS_RX_LOS_OFFSET 0x93 +#define CMIS_RX_LOL_OFFSET 0x94 #define CMIS_RX_PWR_AW_HALARM_OFFSET 0x95 #define CMIS_RX_PWR_AW_LALARM_OFFSET 0x96 #define CMIS_RX_PWR_AW_HWARN_OFFSET 0x97 -- 2.40.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH ethtool-next v2 2/2] cmis: report LOL / LOS / Tx Fault 2023-06-13 5:05 ` [PATCH ethtool-next v2 2/2] cmis: " Jakub Kicinski @ 2023-06-13 7:32 ` Ido Schimmel 2023-06-13 16:48 ` Jakub Kicinski 0 siblings, 1 reply; 6+ messages in thread From: Ido Schimmel @ 2023-06-13 7:32 UTC (permalink / raw) To: Jakub Kicinski; +Cc: mkubecek, danieller, netdev, linux, andrew On Mon, Jun 12, 2023 at 10:05:07PM -0700, Jakub Kicinski wrote: > Report whether Loss of Lock, of Signal and Tx Faults were detected. > Print "None" in case no lane has the problem, and per-lane "Yes" / > "No" if at least one of the lanes reports true. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Tested-by: Ido Schimmel <idosch@nvidia.com> > --- > Turns out I don't have access to any host with CMIS optics at this > point so untested. I can only confirm it correctly shows nothing > with a DAC... I'm not sure why, but the module I have reports two banks and therefore 16 lanes. "Tx fault" and "Tx adaptive eq fault" are not supported. When both are up: # ethtool -m swp11 | grep "Rx loss of signal" -A 4 Rx loss of signal : None Tx loss of signal : None Rx loss of lock : None Tx loss of lock : None Module State : 0x03 (ModuleReady) When I bring the other side down: # ip link set dev swp12 down # ethtool -m swp11 | grep "Rx loss of signal" -A 4 Rx loss of signal : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes ] Tx loss of signal : None Rx loss of lock : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes ] Tx loss of lock : None Module State : 0x03 (ModuleReady) When I bring the interface itself down: # ip link set dev swp11 down # ethtool -m swp11 | grep "Rx loss of signal" -A 4 Rx loss of signal : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes ] Tx loss of signal : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, No, No, No, No, No, No, No, No ] Rx loss of lock : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, No, No, No, No, No, No, No, No ] Tx loss of lock : [ Yes, Yes, Yes, Yes, Yes, Yes, Yes, Yes, No, No, No, No, No, No, No, No ] Module State : 0x03 (ModuleReady) And I don't see these fields on PC: # ethtool -m swp1 | grep "Rx loss of signal" -A 4 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH ethtool-next v2 2/2] cmis: report LOL / LOS / Tx Fault 2023-06-13 7:32 ` Ido Schimmel @ 2023-06-13 16:48 ` Jakub Kicinski 0 siblings, 0 replies; 6+ messages in thread From: Jakub Kicinski @ 2023-06-13 16:48 UTC (permalink / raw) To: Ido Schimmel; +Cc: mkubecek, danieller, netdev, linux, andrew On Tue, 13 Jun 2023 10:32:05 +0300 Ido Schimmel wrote: > On Mon, Jun 12, 2023 at 10:05:07PM -0700, Jakub Kicinski wrote: > > Report whether Loss of Lock, of Signal and Tx Faults were detected. > > Print "None" in case no lane has the problem, and per-lane "Yes" / > > "No" if at least one of the lanes reports true. > > > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > > Reviewed-by: Ido Schimmel <idosch@nvidia.com> > Tested-by: Ido Schimmel <idosch@nvidia.com> Thank you! ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault 2023-06-13 5:05 [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault Jakub Kicinski 2023-06-13 5:05 ` [PATCH ethtool-next v2 2/2] cmis: " Jakub Kicinski @ 2023-06-13 7:06 ` Ido Schimmel 2023-06-14 18:50 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 6+ messages in thread From: Ido Schimmel @ 2023-06-13 7:06 UTC (permalink / raw) To: Jakub Kicinski; +Cc: mkubecek, danieller, netdev, linux, andrew On Mon, Jun 12, 2023 at 10:05:06PM -0700, Jakub Kicinski wrote: > Report whether Loss of Lock, of Signal and Tx Faults were detected. > Print "None" in case no lane has the problem, and per-lane "Yes" / > "No" if at least one of the lanes reports true. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> Reviewed-by: Ido Schimmel <idosch@nvidia.com> Tested-by: Ido Schimmel <idosch@nvidia.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault 2023-06-13 5:05 [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault Jakub Kicinski 2023-06-13 5:05 ` [PATCH ethtool-next v2 2/2] cmis: " Jakub Kicinski 2023-06-13 7:06 ` [PATCH ethtool-next v2 1/2] sff-8636: " Ido Schimmel @ 2023-06-14 18:50 ` patchwork-bot+netdevbpf 2 siblings, 0 replies; 6+ messages in thread From: patchwork-bot+netdevbpf @ 2023-06-14 18:50 UTC (permalink / raw) To: Jakub Kicinski Cc: mkubecek, idosch, danieller, netdev, vladyslavt, linux, andrew Hello: This series was applied to ethtool/ethtool.git (master) by Michal Kubecek <mkubecek@suse.cz>: On Mon, 12 Jun 2023 22:05:06 -0700 you wrote: > Report whether Loss of Lock, of Signal and Tx Faults were detected. > Print "None" in case no lane has the problem, and per-lane "Yes" / > "No" if at least one of the lanes reports true. > > Signed-off-by: Jakub Kicinski <kuba@kernel.org> > --- > v2: fix Rx / Tx for the "implemented" bit > v1: https://lore.kernel.org/all/20230609004400.1276734-1-kuba@kernel.org/ > > [...] Here is the summary with links: - [ethtool-next,v2,1/2] sff-8636: report LOL / LOS / Tx Fault https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=045d8dbe4c52 - [ethtool-next,v2,2/2] cmis: report LOL / LOS / Tx Fault https://git.kernel.org/pub/scm/network/ethtool/ethtool.git/commit/?id=b3e341c1a81b You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-06-14 18:50 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-06-13 5:05 [PATCH ethtool-next v2 1/2] sff-8636: report LOL / LOS / Tx Fault Jakub Kicinski 2023-06-13 5:05 ` [PATCH ethtool-next v2 2/2] cmis: " Jakub Kicinski 2023-06-13 7:32 ` Ido Schimmel 2023-06-13 16:48 ` Jakub Kicinski 2023-06-13 7:06 ` [PATCH ethtool-next v2 1/2] sff-8636: " Ido Schimmel 2023-06-14 18:50 ` patchwork-bot+netdevbpf
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).