1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-19 02:29:40 +00:00

ifconfig(8): Display extended compliance code string for SFP transceivers

- Updates tables in affected files with new entries from newer spec
revisions of SFF-8472, SFF-8024, and SFF-8636

- Change ifconfig to read and display the extended compliance code for
SFP media if the extended compliance code is not 0. This was being displayed
for QSFP transceivers only, but SFP28 media uses this to report 25G
capability.

Reviewed by:	melifaro, sbruno
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D13286
This commit is contained in:
Eric Joyner 2017-12-05 18:42:07 +00:00
parent 8b9fd94981
commit b0f3e715fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=326571
2 changed files with 45 additions and 28 deletions

View File

@ -69,7 +69,7 @@ struct _nv {
const char *find_value(struct _nv *x, int value); const char *find_value(struct _nv *x, int value);
const char *find_zero_bit(struct _nv *x, int value, int sz); const char *find_zero_bit(struct _nv *x, int value, int sz);
/* SFF-8472 Rev. 11.4 table 3.4: Connector values */ /* SFF-8024 Rev. 4.1 Table 4-3: Connector Types */
static struct _nv conn[] = { static struct _nv conn[] = {
{ 0x00, "Unknown" }, { 0x00, "Unknown" },
{ 0x01, "SC" }, { 0x01, "SC" },
@ -87,7 +87,8 @@ static struct _nv conn[] = {
{ 0x20, "HSSDC II" }, { 0x20, "HSSDC II" },
{ 0x21, "Copper pigtail" }, { 0x21, "Copper pigtail" },
{ 0x22, "RJ45" }, { 0x22, "RJ45" },
{ 0x23, "No separate connector" }, /* SFF-8436 */ { 0x23, "No separable connector" },
{ 0x24, "MXC 2x16" },
{ 0, NULL } { 0, NULL }
}; };
@ -183,10 +184,17 @@ static struct _nv eth_1040g[] = {
}; };
#define SFF_8636_EXT_COMPLIANCE 0x80 #define SFF_8636_EXT_COMPLIANCE 0x80
/* SFF-8024 Rev. 3.4 table 4.4: Extended Specification Compliance */ /* SFF-8024 Rev. 4.2 table 4-4: Extended Specification Compliance */
static struct _nv eth_extended_comp[] = { static struct _nv eth_extended_comp[] = {
{ 0xFF, "Reserved" }, { 0xFF, "Reserved" },
{ 0x1A, "2 lambda DWDM 100G" }, { 0x21, "100G PAM4 BiDi" },
{ 0x20, "100G SWDM4" },
{ 0x1F, "40G SWDM4" },
{ 0x1E, "2.5GBASE-T" },
{ 0x1D, "5GBASE-T" },
{ 0x1C, "10GBASE-T Short Reach" },
{ 0x1B, "100G 1550nm WDM" },
{ 0x1A, "100GE-DWDM2" },
{ 0x19, "100G ACC or 25GAUI C2M ACC" }, { 0x19, "100G ACC or 25GAUI C2M ACC" },
{ 0x18, "100G AOC or 25GAUI C2M AOC" }, { 0x18, "100G AOC or 25GAUI C2M AOC" },
{ 0x17, "100G CLR4" }, { 0x17, "100G CLR4" },
@ -198,23 +206,24 @@ static struct _nv eth_extended_comp[] = {
{ 0x11, "4 x 10GBASE-SR" }, { 0x11, "4 x 10GBASE-SR" },
{ 0x10, "40GBASE-ER4" }, { 0x10, "40GBASE-ER4" },
{ 0x0F, "Reserved" }, { 0x0F, "Reserved" },
{ 0x0E, "Reserved" },
{ 0x0D, "25GBASE-CR CA-N" }, { 0x0D, "25GBASE-CR CA-N" },
{ 0x0C, "25GBASE-CR CA-S" }, { 0x0C, "25GBASE-CR CA-S" },
{ 0x0B, "100GBASE-CR4 or 25GBASE-CR CA-L" }, { 0x0B, "100GBASE-CR4 or 25GBASE-CR CA-L" },
{ 0x0A, "Reserved" }, { 0x0A, "Reserved" },
{ 0x09, "100G CWDM4 MSA without FEC" }, { 0x09, "Obsolete" },
{ 0x08, "100G ACC (Active Copper Cable)" }, { 0x08, "100G ACC (Active Copper Cable) or 25GAUI C2M ACC" },
{ 0x07, "100G PSM4 Parallel SMF" }, { 0x07, "100G PSM4 Parallel SMF" },
{ 0x06, "100G CWDM4 MSA with FEC" }, { 0x06, "100G CWDM4" },
{ 0x05, "100GBASE-SR10" }, { 0x05, "100GBASE-SR10" },
{ 0x04, "100GBASE-ER4" }, { 0x04, "100GBASE-ER4 or 25GBASE-ER" },
{ 0x03, "100GBASE-LR4" }, { 0x03, "100GBASE-LR4 or 25GBASE-LR" },
{ 0x02, "100GBASE-SR4" }, { 0x02, "100GBASE-SR4 or 25GBASE-SR" },
{ 0x01, "100G AOC (Active Optical Cable) or 25GAUI C2M ACC" }, { 0x01, "100G AOC (Active Optical Cable) or 25GAUI C2M AOC" },
{ 0x00, "Unspecified" } { 0x00, "Unspecified" }
}; };
/* SFF-8636 Rev. 2.5 table 6.3: Revision compliance */ /* SFF-8636 Rev. 2.9 table 6.3: Revision compliance */
static struct _nv rev_compl[] = { static struct _nv rev_compl[] = {
{ 0x1, "SFF-8436 rev <=4.8" }, { 0x1, "SFF-8436 rev <=4.8" },
{ 0x2, "SFF-8436 rev <=4.8" }, { 0x2, "SFF-8436 rev <=4.8" },
@ -222,7 +231,8 @@ static struct _nv rev_compl[] = {
{ 0x4, "SFF-8636 rev <=1.4" }, { 0x4, "SFF-8636 rev <=1.4" },
{ 0x5, "SFF-8636 rev <=1.5" }, { 0x5, "SFF-8636 rev <=1.5" },
{ 0x6, "SFF-8636 rev <=2.0" }, { 0x6, "SFF-8636 rev <=2.0" },
{ 0x7, "SFF-8636 rev <=2.5" }, { 0x7, "SFF-8636 rev <=2.7" },
{ 0x8, "SFF-8636 rev >=2.8" },
{ 0x0, "Unspecified" } { 0x0, "Unspecified" }
}; };
@ -378,17 +388,20 @@ get_sfp_transceiver_class(struct i2c_info *ii, char *buf, size_t size)
const char *tech_class; const char *tech_class;
uint8_t code; uint8_t code;
unsigned char qbuf[8]; /* Use extended compliance code if it's valid */
read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 8, (uint8_t *)qbuf); read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS, 1, &code);
if (code != 0)
/* Check 10G Ethernet/IB first */ tech_class = find_value(eth_extended_comp, code);
read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, &code); else {
tech_class = find_zero_bit(eth_10g, code, 1); /* Next, check 10G Ethernet/IB CCs */
if (tech_class == NULL) { read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START, 1, &code);
/* No match. Try Ethernet 1G */ tech_class = find_zero_bit(eth_10g, code, 1);
read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3, if (tech_class == NULL) {
1, (caddr_t)&code); /* No match. Try Ethernet 1G */
tech_class = find_zero_bit(eth_compat, code, 1); read_i2c(ii, SFF_8472_BASE, SFF_8472_TRANS_START + 3,
1, (caddr_t)&code);
tech_class = find_zero_bit(eth_compat, code, 1);
}
} }
if (tech_class == NULL) if (tech_class == NULL)

View File

@ -379,7 +379,7 @@ enum {
/* /*
* Table 3.2 Identifier values. * Table 3.2 Identifier values.
* Identifier constants has taken from SFF-8024 rev 2.9 table 4.1 * Identifier constants has taken from SFF-8024 rev 4.2 table 4.1
* (as referenced by table 3.2 footer) * (as referenced by table 3.2 footer)
* */ * */
enum { enum {
@ -400,13 +400,15 @@ enum {
SFF_8024_ID_CXP = 0xE, /* CXP */ SFF_8024_ID_CXP = 0xE, /* CXP */
SFF_8024_ID_HD4X = 0xF, /* Shielded Mini Multilane HD 4X */ SFF_8024_ID_HD4X = 0xF, /* Shielded Mini Multilane HD 4X */
SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */ SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */
SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 */ SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 or later */
SFF_8024_ID_CXP2 = 0x12, /* CXP2 (aka CXP28) */ SFF_8024_ID_CXP2 = 0x12, /* CXP2 (aka CXP28) */
SFF_8024_ID_CDFP = 0x13, /* CDFP (Style 1/Style 2) */ SFF_8024_ID_CDFP = 0x13, /* CDFP (Style 1/Style 2) */
SFF_8024_ID_SMM4 = 0x14, /* Shielded Mini Multilate HD 4X Fanout */ SFF_8024_ID_SMM4 = 0x14, /* Shielded Mini Multilate HD 4X Fanout */
SFF_8024_ID_SMM8 = 0x15, /* Shielded Mini Multilate HD 8X Fanout */ SFF_8024_ID_SMM8 = 0x15, /* Shielded Mini Multilate HD 8X Fanout */
SFF_8024_ID_CDFP3 = 0x16, /* CDFP (Style3) */ SFF_8024_ID_CDFP3 = 0x16, /* CDFP (Style3) */
SFF_8024_ID_LAST = SFF_8024_ID_CDFP3 SFF_8024_ID_MICROQSFP = 0x17, /* microQSFP */
SFF_8024_ID_QSFP_DD = 0x18, /* QSFP-DD 8X Pluggable Transceiver */
SFF_8024_ID_LAST = SFF_8024_ID_QSFP_DD
}; };
static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown", static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
@ -431,7 +433,9 @@ static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
"CDFP", "CDFP",
"SMM4", "SMM4",
"SMM8", "SMM8",
"CDFP3"}; "CDFP3",
"microQSFP",
"QSFP-DD"};
/* Keep compatibility with old definitions */ /* Keep compatibility with old definitions */
#define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN #define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN