Decode the compliance codes added by SFF-8472 Rev 12.5a and
SFF-8636 Rev 2.12, as ethtool does since its commits
057c4fdd85b5 ("sfpid: add support for newer SFF-8472 compliance codes")
and 75d62323302b ("qsfp: add support for newer SFF-8636 compliance codes"):- SFF-8472 byte 10: Fibre Channel 1600 and 3200 MBytes/s. - SFF-8636 byte 133: SAS 24.0G, and SAS 12.0G which was defined but not reported. - SFF-8636 byte 138: Fibre Channel 3200 MBytes/s. Also decode the SFF-8472 Fibre Channel Speed 2 byte 62, which byte 10 bit 1 refers to: 64GFC, reported as 6400 MBytes/s like the other Fibre Channel speeds. ethtool does not decode it. Signed-off-by: Roman Khromenok <[email protected]> --- v2: - report 64GFC as "FC: 6400 MBytes/sec", like the other Fibre Channel speeds - refer to the ethtool commits with 12 character hashes and their subjects - 2/2: set one bit at a time in the tests and check that the other code of the same byte is absent Checked against SFF-8472 Rev 12.5a (Table 5-3) and SFF-8636 Rev 2.12 (Table 6-17). Based on next-net/for-main. lib/ethdev/sff_8079.c | 7 +++++++ lib/ethdev/sff_8636.c | 6 ++++++ lib/ethdev/sff_8636.h | 2 ++ 3 files changed, 15 insertions(+) diff --git a/lib/ethdev/sff_8079.c b/lib/ethdev/sff_8079.c index 9632a26af3..c8db5c0975 100644 --- a/lib/ethdev/sff_8079.c +++ b/lib/ethdev/sff_8079.c @@ -173,10 +173,17 @@ static void sff_8079_show_transceiver(const uint8_t *data, struct sff_output *d) sff_output_field(d, name, "FC: 1200 MBytes/sec"); if (data[10] & (1 << 6)) sff_output_field(d, name, "FC: 800 MBytes/sec"); + if (data[10] & (1 << 5)) + sff_output_field(d, name, "FC: 1600 MBytes/sec"); if (data[10] & (1 << 4)) sff_output_field(d, name, "FC: 400 MBytes/sec"); + if (data[10] & (1 << 3)) + sff_output_field(d, name, "FC: 3200 MBytes/sec"); if (data[10] & (1 << 2)) sff_output_field(d, name, "FC: 200 MBytes/sec"); + /* bit 1 refers to the Fibre Channel Speed 2 byte */ + if ((data[10] & (1 << 1)) && (data[62] & (1 << 0))) + sff_output_field(d, name, "FC: 6400 MBytes/sec"); if (data[10] & (1 << 0)) sff_output_field(d, name, "FC: 100 MBytes/sec"); diff --git a/lib/ethdev/sff_8636.c b/lib/ethdev/sff_8636.c index ad36927540..5e77f1b855 100644 --- a/lib/ethdev/sff_8636.c +++ b/lib/ethdev/sff_8636.c @@ -364,6 +364,10 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d) sff_output_field(d, name, "SONET: OC-48, short reach"); /* SAS/SATA Compliance Codes */ + if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_24G) + sff_output_field(d, name, "SAS 24.0G"); + if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_12G) + sff_output_field(d, name, "SAS 12.0G"); if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_6G) sff_output_field(d, name, "SAS 6.0G"); if (data[SFF_8636_SAS_COMP_OFFSET] & SFF_8636_SAS_3G) @@ -432,6 +436,8 @@ static void sff_8636_show_transceiver(const uint8_t *data, struct sff_output *d) sff_output_field(d, name, "FC: 1600 MBytes/sec"); if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_400_MBPS) sff_output_field(d, name, "FC: 400 MBytes/sec"); + if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_3200_MBPS) + sff_output_field(d, name, "FC: 3200 MBytes/sec"); if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_200_MBPS) sff_output_field(d, name, "FC: 200 MBytes/sec"); if (data[SFF_8636_FC_SPEED_OFFSET] & SFF_8636_FC_SPEED_100_MBPS) diff --git a/lib/ethdev/sff_8636.h b/lib/ethdev/sff_8636.h index d2a923a7c0..9b15636c0c 100644 --- a/lib/ethdev/sff_8636.h +++ b/lib/ethdev/sff_8636.h @@ -294,6 +294,7 @@ /* SAS/SATA Complaince Codes - 133 */ #define SFF_8636_SAS_COMP_OFFSET 0x85 +#define SFF_8636_SAS_24G RTE_BIT32(7) #define SFF_8636_SAS_12G RTE_BIT32(6) #define SFF_8636_SAS_6G RTE_BIT32(5) #define SFF_8636_SAS_3G RTE_BIT32(4) @@ -346,6 +347,7 @@ #define SFF_8636_FC_SPEED_800_MBPS RTE_BIT32(6) #define SFF_8636_FC_SPEED_1600_MBPS RTE_BIT32(5) #define SFF_8636_FC_SPEED_400_MBPS RTE_BIT32(4) +#define SFF_8636_FC_SPEED_3200_MBPS RTE_BIT32(3) #define SFF_8636_FC_SPEED_200_MBPS RTE_BIT32(2) #define SFF_8636_FC_SPEED_100_MBPS RTE_BIT32(0) -- 2.47.3

