* Update SFF-8024 Identifier constants.
* Fix SFF_8436_CC_EXT in SFF-8436 memory map. * Add SFF-8436/8636 bits (revision compliance/nominal bitrate). * Do some small style/type fixes.
This commit is contained in:
parent
8df65c37f2
commit
bd614cce8b
@ -182,6 +182,18 @@ static struct _nv eth_1040g[] = {
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
||||
/* SFF-8636 Rev. 2.5 table 6.3: Revision compliance */
|
||||
static struct _nv rev_compl[] = {
|
||||
{ 0x1, "SFF-8436 rev <=4.8" },
|
||||
{ 0x2, "SFF-8436 rev <=4.8" },
|
||||
{ 0x3, "SFF-8636 rev <=1.3" },
|
||||
{ 0x4, "SFF-8636 rev <=1.4" },
|
||||
{ 0x5, "SFF-8636 rev <=1.5" },
|
||||
{ 0x6, "SFF-8636 rev <=2.0" },
|
||||
{ 0x7, "SFF-8636 rev <=2.5" },
|
||||
{ 0x0, "Unspecified" }
|
||||
};
|
||||
|
||||
const char *
|
||||
find_value(struct _nv *x, int value)
|
||||
{
|
||||
@ -245,6 +257,19 @@ convert_sff_connector(char *buf, size_t size, uint8_t value)
|
||||
snprintf(buf, size, "%s", x);
|
||||
}
|
||||
|
||||
static void
|
||||
convert_sff_rev_compliance(char *buf, size_t size, uint8_t value)
|
||||
{
|
||||
const char *x;
|
||||
|
||||
if (value > 0x07)
|
||||
x = "Unallocated";
|
||||
else
|
||||
x = find_value(rev_compl, value);
|
||||
|
||||
snprintf(buf, size, "%s", x);
|
||||
}
|
||||
|
||||
static void
|
||||
get_sfp_identifier(struct i2c_info *ii, char *buf, size_t size)
|
||||
{
|
||||
@ -604,23 +629,50 @@ get_sfp_tx_power(struct i2c_info *ii, char *buf, size_t size)
|
||||
static void
|
||||
get_qsfp_rx_power(struct i2c_info *ii, char *buf, size_t size, int chan)
|
||||
{
|
||||
char xbuf[2];
|
||||
uint8_t xbuf[2];
|
||||
|
||||
memset(xbuf, 0, sizeof(xbuf));
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_RX_CH1_MSB + (chan - 1) * 2, 2, xbuf);
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_RX_CH1_MSB + (chan-1)*2, 2, xbuf);
|
||||
convert_sff_power(ii, buf, size, xbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
get_qsfp_tx_power(struct i2c_info *ii, char *buf, size_t size, int chan)
|
||||
{
|
||||
char xbuf[2];
|
||||
uint8_t xbuf[2];
|
||||
|
||||
memset(xbuf, 0, sizeof(xbuf));
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_TX_CH1_MSB + (chan -1) * 2, 2, xbuf);
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_TX_CH1_MSB + (chan-1)*2, 2, xbuf);
|
||||
convert_sff_power(ii, buf, size, xbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
get_qsfp_rev_compliance(struct i2c_info *ii, char *buf, size_t size)
|
||||
{
|
||||
uint8_t xbuf;
|
||||
|
||||
xbuf = 0;
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_STATUS, 1, &xbuf);
|
||||
convert_sff_rev_compliance(buf, size, xbuf);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
get_qsfp_br(struct i2c_info *ii)
|
||||
{
|
||||
uint8_t xbuf;
|
||||
uint32_t rate;
|
||||
|
||||
xbuf = 0;
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8436_BITRATE, 1, &xbuf);
|
||||
rate = xbuf * 100;
|
||||
if (xbuf == 0xFF) {
|
||||
read_i2c(ii, SFF_8436_BASE, SFF_8636_BITRATE, 1, &xbuf);
|
||||
rate = xbuf * 250;
|
||||
}
|
||||
|
||||
return (rate);
|
||||
}
|
||||
|
||||
/*
|
||||
* Reads i2c data from opened kernel socket.
|
||||
*/
|
||||
@ -689,6 +741,7 @@ print_qsfp_status(struct i2c_info *ii, int verbose)
|
||||
{
|
||||
char buf[80], buf2[40], buf3[40];
|
||||
uint8_t diag_type;
|
||||
uint32_t bitrate;
|
||||
int i;
|
||||
|
||||
/* Read diagnostic monitoring type */
|
||||
@ -715,6 +768,16 @@ print_qsfp_status(struct i2c_info *ii, int verbose)
|
||||
if (ii->error == 0)
|
||||
printf("\t%s\n", buf);
|
||||
|
||||
if (verbose > 1) {
|
||||
get_qsfp_rev_compliance(ii, buf, sizeof(buf));
|
||||
if (ii->error == 0)
|
||||
printf("\tcompliance level: %s\n", buf);
|
||||
|
||||
bitrate = get_qsfp_br(ii);
|
||||
if (ii->error == 0 && bitrate > 0)
|
||||
printf("\tnominal bitrate: %u Mbps\n", bitrate);
|
||||
}
|
||||
|
||||
/* Request current measurements if they are provided: */
|
||||
if (ii->do_diag != 0) {
|
||||
get_qsfp_temp(ii, buf, sizeof(buf));
|
||||
|
@ -202,7 +202,9 @@ enum {
|
||||
* optional features are implemented
|
||||
* (if any) in the transceiver
|
||||
* (see Table 42) */
|
||||
SFF_8436_CC_EXT = 222, /* Check code for the Extended ID
|
||||
SFF_8636_BITRATE = 222, /* Nominal bit rate per channel, units
|
||||
* of 250 Mbps */
|
||||
SFF_8436_CC_EXT = 223, /* Check code for the Extended ID
|
||||
* Fields (bytes 192-222 incl) */
|
||||
SFF_8436_VENDOR_RSRVD_START = 224,
|
||||
SFF_8436_VENDOR_RSRVD_END = 255,
|
||||
|
@ -377,7 +377,7 @@ enum {
|
||||
|
||||
/*
|
||||
* Table 3.2 Identifier values.
|
||||
* Identifier constants has taken from SFF-8024 rev 2.2 table 4.1
|
||||
* Identifier constants has taken from SFF-8024 rev 2.9 table 4.1
|
||||
* (as referenced by table 3.2 footer)
|
||||
* */
|
||||
enum {
|
||||
@ -400,28 +400,36 @@ enum {
|
||||
SFF_8024_ID_HD8X = 0x10, /* Shielded Mini Multilane HD 8X */
|
||||
SFF_8024_ID_QSFP28 = 0x11, /* QSFP28 */
|
||||
SFF_8024_ID_CXP2 = 0x12, /* CXP2 (aka CXP28) */
|
||||
SFF_8024_ID_LAST = SFF_8024_ID_CXP2
|
||||
SFF_8024_ID_CDFP = 0x13, /* CDFP (Style 1/Style 2) */
|
||||
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_CDFP3 = 0x16, /* CDFP (Style3) */
|
||||
SFF_8024_ID_LAST = SFF_8024_ID_CDFP3
|
||||
};
|
||||
|
||||
static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = {"Unknown",
|
||||
"GBIC",
|
||||
"SFF",
|
||||
"SFP/SFP+",
|
||||
"SFP/SFP+/SFP28",
|
||||
"XBI",
|
||||
"Xenpak",
|
||||
"XFP",
|
||||
"XFF",
|
||||
"XFP-E",
|
||||
"XPAk",
|
||||
"XPAK",
|
||||
"X2",
|
||||
"DWDM-SFP",
|
||||
"DWDM-SFP/SFP+",
|
||||
"QSFP",
|
||||
"QSFP+",
|
||||
"CXP",
|
||||
"HD4X",
|
||||
"HD8X",
|
||||
"QSFP28",
|
||||
"CXP2"};
|
||||
"CXP2",
|
||||
"CDFP",
|
||||
"SMM4",
|
||||
"SMM8",
|
||||
"CDFP3"};
|
||||
|
||||
/* Keep compability with old definitions */
|
||||
#define SFF_8472_ID_UNKNOWN SFF_8024_ID_UNKNOWN
|
||||
|
Loading…
x
Reference in New Issue
Block a user