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. They use the same field names and format as the SFF-8636 lane status flags, with a single lane: "None" or "[ Yes ]". 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 | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/doc/guides/rel_notes/release_26_11.rst b/doc/guides/rel_notes/release_26_11.rst index c3f8ccdccf..6ca8efd98f 100644 --- a/doc/guides/rel_notes/release_26_11.rst +++ b/doc/guides/rel_notes/release_26_11.rst @@ -88,6 +88,7 @@ New Features uses it to display the decoded module EEPROM. The SFF-8636 decoder also reports the per-lane loss of signal, loss of lock and Tx fault flags. + The SFF-8472 decoder also 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..ae37fee0fd 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 @@ -272,6 +278,7 @@ void sff_8472_show_all(const uint8_t *data, struct sff_output *d) struct sff_diags sd = {0}; const char *rx_power_string = NULL; char val_string[SFF_ITEM_VAL_COMPOSE_SIZE]; + uint8_t status; int i; sff_8472_parse_eeprom(data, &sd); @@ -302,6 +309,18 @@ 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, + * reported in the same single lane format. + */ + status = data[SFF_A2_BASE + SFF_A2_STATUS]; + if (data[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_SOFT_RX_LOS) + sff_show_lane_status("Rx loss of signal", 1, + !!(status & SFF_A2_STATUS_RX_LOS), d); + if (data[SFF_A0_OPTIONS] & SFF_A0_OPTIONS_SOFT_TX_FAULT) + sff_show_lane_status("Tx fault", 1, + !!(status & SFF_A2_STATUS_TX_FAULT), d); + sff_output_field(d, "Alarm/warning flags implemented", (sd.supports_alarms ? "Yes" : "No")); -- 2.47.3

