The SFF-8472 decoder shows the digital diagnostics of SFP modules, but not whether the module detects a loss of the received signal or a transmitter fault.
Report the Rx_LOS and TX_FAULT state from the status byte 110 of page A2h, each one only if the module advertises the soft monitoring of it in the enhanced options of page A0h. Unlike the SFF-8636 channel status flags, these bits reflect the current state of the pins and are not latched. Signed-off-by: Roman Khromenok <[email protected]> --- doc/guides/rel_notes/release_26_11.rst | 1 + lib/ethdev/sff_8472.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst index 08c554cedb..601233d6ac 100644 --- a/doc/guides/rel_notes/release_26_11.rst +++ b/doc/guides/rel_notes/release_26_11.rst @@ -86,6 +86,7 @@ New Features such as the Linux ethtool ``ETHTOOL_GMODULEEEPROM`` ioctl. The SFF-8636 decoder also reports the per-lane loss of signal, loss of lock and Tx fault flags. + The SFF-8472 decoder reports the Rx loss of signal and Tx fault state. * **Updated AF_XDP driver.** diff --git a/lib/ethdev/sff_8472.c b/lib/ethdev/sff_8472.c index 88d1f4a0a5..f9fd668731 100644 --- a/lib/ethdev/sff_8472.c +++ b/lib/ethdev/sff_8472.c @@ -25,6 +25,8 @@ #define SFF_A0_DOM_PWRT RTE_BIT32(3) #define SFF_A0_OPTIONS_AW RTE_BIT32(7) +#define SFF_A0_OPTIONS_SOFT_TX_FAULT RTE_BIT32(5) +#define SFF_A0_OPTIONS_SOFT_RX_LOS RTE_BIT32(4) /* * This is the offset at which the A2 page is in the EEPROM @@ -63,6 +65,10 @@ #define SFF_A2_RX_PWR_HWARN 36 #define SFF_A2_RX_PWR_LWARN 38 +#define SFF_A2_STATUS 110 +#define SFF_A2_STATUS_TX_FAULT RTE_BIT32(2) +#define SFF_A2_STATUS_RX_LOS RTE_BIT32(1) + #define SFF_A2_ALRM_FLG 112 #define SFF_A2_WARN_FLG 116 @@ -302,6 +308,16 @@ void sff_8472_show_all(const uint8_t *data, struct sff_output *d) SFF_SPRINT_VCC(val_string, sd.sfp_voltage[SFF_MCURR]); sff_output_field(d, "Module voltage", val_string); + /* Real-time state of the pins, unlike the latched SFF-8636 flags */ + if (data[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_SOFT_RX_LOS) + sff_output_field(d, "Rx loss of signal", + data[SFF_A2_BASE + SFF_A2_STATUS] & SFF_A2_STATUS_RX_LOS ? + "Yes" : "No"); + if (data[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_SOFT_TX_FAULT) + sff_output_field(d, "Tx fault", + data[SFF_A2_BASE + SFF_A2_STATUS] & SFF_A2_STATUS_TX_FAULT ? + "Yes" : "No"); + sff_output_field(d, "Alarm/warning flags implemented", (sd.supports_alarms ? "Yes" : "No")); -- 2.47.3

