|
|
2a1b01 |
From 85023fa5dd7e79ce46a92ab567b4b675c3145775 Mon Sep 17 00:00:00 2001
|
|
|
2a1b01 |
From: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
Date: Tue, 12 Oct 2021 16:25:18 +0300
|
|
|
2a1b01 |
Subject: [PATCH 19/35] sff-8636: Use memory map during parsing
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Instead of passing one large buffer to the individual parsing functions,
|
|
|
2a1b01 |
use the memory map structure from the previous patch.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
This has the added benefit of checking which optional pages are actually
|
|
|
2a1b01 |
available and it will also allow us to consolidate the IOCTL and netlink
|
|
|
2a1b01 |
parsing code paths.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Tested by making sure that there are no differences in output in both
|
|
|
2a1b01 |
the IOCTL and netlink paths before and after the patch.
|
|
|
2a1b01 |
|
|
|
2a1b01 |
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
|
|
|
2a1b01 |
---
|
|
|
2a1b01 |
qsfp.c | 368 +++++++++++++++++++++++++++++++--------------------------
|
|
|
2a1b01 |
1 file changed, 201 insertions(+), 167 deletions(-)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
diff --git a/qsfp.c b/qsfp.c
|
|
|
2a1b01 |
index 80000d40f6e8..354b3b1ce9ff 100644
|
|
|
2a1b01 |
--- a/qsfp.c
|
|
|
2a1b01 |
+++ b/qsfp.c
|
|
|
2a1b01 |
@@ -205,20 +205,21 @@ static struct sff8636_aw_flags {
|
|
|
2a1b01 |
{ NULL, 0, 0 },
|
|
|
2a1b01 |
};
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_identifier(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_identifier(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
- sff8024_show_identifier(id, SFF8636_ID_OFFSET);
|
|
|
2a1b01 |
+ sff8024_show_identifier(map->lower_memory, SFF8636_ID_OFFSET);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_ext_identifier(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_ext_identifier(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
printf("\t%-41s : 0x%02x\n", "Extended identifier",
|
|
|
2a1b01 |
- id[SFF8636_EXT_ID_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_EXT_ID_OFFSET]);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
static const char *pfx =
|
|
|
2a1b01 |
"\tExtended identifier description :";
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- switch (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_PWR_CLASS_MASK) {
|
|
|
2a1b01 |
+ switch (map->page_00h[SFF8636_EXT_ID_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_EXT_ID_PWR_CLASS_MASK) {
|
|
|
2a1b01 |
case SFF8636_EXT_ID_PWR_CLASS_1:
|
|
|
2a1b01 |
printf("%s 1.5W max. Power consumption\n", pfx);
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
@@ -233,17 +234,18 @@ static void sff8636_show_ext_identifier(const __u8 *id)
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- if (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_TX_MASK)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_TX_MASK)
|
|
|
2a1b01 |
printf("%s CDR present in TX,", pfx);
|
|
|
2a1b01 |
else
|
|
|
2a1b01 |
printf("%s No CDR in TX,", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- if (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_RX_MASK)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_CDR_RX_MASK)
|
|
|
2a1b01 |
printf(" CDR present in RX\n");
|
|
|
2a1b01 |
else
|
|
|
2a1b01 |
printf(" No CDR in RX\n");
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- switch (id[SFF8636_EXT_ID_OFFSET] & SFF8636_EXT_ID_EPWR_CLASS_MASK) {
|
|
|
2a1b01 |
+ switch (map->page_00h[SFF8636_EXT_ID_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_EXT_ID_EPWR_CLASS_MASK) {
|
|
|
2a1b01 |
case SFF8636_EXT_ID_PWR_CLASS_LEGACY:
|
|
|
2a1b01 |
printf("%s", pfx);
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
@@ -257,18 +259,19 @@ static void sff8636_show_ext_identifier(const __u8 *id)
|
|
|
2a1b01 |
printf("%s 5.0W max. Power consumption, ", pfx);
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
- if (id[SFF8636_PWR_MODE_OFFSET] & SFF8636_HIGH_PWR_ENABLE)
|
|
|
2a1b01 |
+ if (map->lower_memory[SFF8636_PWR_MODE_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_HIGH_PWR_ENABLE)
|
|
|
2a1b01 |
printf(" High Power Class (> 3.5 W) enabled\n");
|
|
|
2a1b01 |
else
|
|
|
2a1b01 |
printf(" High Power Class (> 3.5 W) not enabled\n");
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_connector(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_connector(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
- sff8024_show_connector(id, SFF8636_CTOR_OFFSET);
|
|
|
2a1b01 |
+ sff8024_show_connector(map->page_00h, SFF8636_CTOR_OFFSET);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_transceiver(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_transceiver(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
static const char *pfx =
|
|
|
2a1b01 |
"\tTransceiver type :";
|
|
|
2a1b01 |
@@ -276,33 +279,41 @@ static void sff8636_show_transceiver(const __u8 *id)
|
|
|
2a1b01 |
printf("\t%-41s : 0x%02x 0x%02x 0x%02x " \
|
|
|
2a1b01 |
"0x%02x 0x%02x 0x%02x 0x%02x 0x%02x\n",
|
|
|
2a1b01 |
"Transceiver codes",
|
|
|
2a1b01 |
- id[SFF8636_ETHERNET_COMP_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_SONET_COMP_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_SAS_COMP_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_GIGE_COMP_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_FC_LEN_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_FC_TECH_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_FC_TRANS_MEDIA_OFFSET],
|
|
|
2a1b01 |
- id[SFF8636_FC_SPEED_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_ETHERNET_COMP_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_SONET_COMP_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_SAS_COMP_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_GIGE_COMP_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_FC_LEN_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_FC_TECH_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET],
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_FC_SPEED_OFFSET]);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* 10G/40G Ethernet Compliance Codes */
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_LRM)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_10G_LRM)
|
|
|
2a1b01 |
printf("%s 10G Ethernet: 10G Base-LRM\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_LR)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_10G_LR)
|
|
|
2a1b01 |
printf("%s 10G Ethernet: 10G Base-LR\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_10G_SR)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_10G_SR)
|
|
|
2a1b01 |
printf("%s 10G Ethernet: 10G Base-SR\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_CR4)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_40G_CR4)
|
|
|
2a1b01 |
printf("%s 40G Ethernet: 40G Base-CR4\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_SR4)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_40G_SR4)
|
|
|
2a1b01 |
printf("%s 40G Ethernet: 40G Base-SR4\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_LR4)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_40G_LR4)
|
|
|
2a1b01 |
printf("%s 40G Ethernet: 40G Base-LR4\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_40G_ACTIVE)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_40G_ACTIVE)
|
|
|
2a1b01 |
printf("%s 40G Ethernet: 40G Active Cable (XLPPI)\n", pfx);
|
|
|
2a1b01 |
/* Extended Specification Compliance Codes from SFF-8024 */
|
|
|
2a1b01 |
- if (id[SFF8636_ETHERNET_COMP_OFFSET] & SFF8636_ETHERNET_RSRVD) {
|
|
|
2a1b01 |
- switch (id[SFF8636_OPTION_1_OFFSET]) {
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_ETHERNET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_ETHERNET_RSRVD) {
|
|
|
2a1b01 |
+ switch (map->page_00h[SFF8636_OPTION_1_OFFSET]) {
|
|
|
2a1b01 |
case SFF8636_ETHERNET_UNSPECIFIED:
|
|
|
2a1b01 |
printf("%s (reserved or unknown)\n", pfx);
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
@@ -493,113 +504,122 @@ static void sff8636_show_transceiver(const __u8 *id)
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* SONET Compliance Codes */
|
|
|
2a1b01 |
- if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_40G_OTN))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SONET_COMP_OFFSET] &
|
|
|
2a1b01 |
+ (SFF8636_SONET_40G_OTN))
|
|
|
2a1b01 |
printf("%s 40G OTN (OTU3B/OTU3C)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_LR))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_LR))
|
|
|
2a1b01 |
printf("%s SONET: OC-48, long reach\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_IR))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_IR))
|
|
|
2a1b01 |
printf("%s SONET: OC-48, intermediate reach\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_SR))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SONET_COMP_OFFSET] & (SFF8636_SONET_OC48_SR))
|
|
|
2a1b01 |
printf("%s SONET: OC-48, short reach\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* SAS/SATA Compliance Codes */
|
|
|
2a1b01 |
- if (id[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_6G))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_6G))
|
|
|
2a1b01 |
printf("%s SAS 6.0G\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_3G))
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_SAS_COMP_OFFSET] & (SFF8636_SAS_3G))
|
|
|
2a1b01 |
printf("%s SAS 3.0G\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Ethernet Compliance Codes */
|
|
|
2a1b01 |
- if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_T)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_T)
|
|
|
2a1b01 |
printf("%s Ethernet: 1000BASE-T\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_CX)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_CX)
|
|
|
2a1b01 |
printf("%s Ethernet: 1000BASE-CX\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_LX)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_LX)
|
|
|
2a1b01 |
printf("%s Ethernet: 1000BASE-LX\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_SX)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_GIGE_COMP_OFFSET] & SFF8636_GIGE_1000_BASE_SX)
|
|
|
2a1b01 |
printf("%s Ethernet: 1000BASE-SX\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Fibre Channel link length */
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_VERY_LONG)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_VERY_LONG)
|
|
|
2a1b01 |
printf("%s FC: very long distance (V)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_SHORT)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_SHORT)
|
|
|
2a1b01 |
printf("%s FC: short distance (S)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_INT)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_INT)
|
|
|
2a1b01 |
printf("%s FC: intermediate distance (I)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_LONG)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_LONG)
|
|
|
2a1b01 |
printf("%s FC: long distance (L)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_MED)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_LEN_MED)
|
|
|
2a1b01 |
printf("%s FC: medium distance (M)\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Fibre Channel transmitter technology */
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_LONG_LC)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_LONG_LC)
|
|
|
2a1b01 |
printf("%s FC: Longwave laser (LC)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_ELEC_INTER)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_LEN_OFFSET] & SFF8636_FC_TECH_ELEC_INTER)
|
|
|
2a1b01 |
printf("%s FC: Electrical inter-enclosure (EL)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_ELEC_INTRA)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_ELEC_INTRA)
|
|
|
2a1b01 |
printf("%s FC: Electrical intra-enclosure (EL)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_SHORT_WO_OFC)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TECH_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TECH_SHORT_WO_OFC)
|
|
|
2a1b01 |
printf("%s FC: Shortwave laser w/o OFC (SN)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_SHORT_W_OFC)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_SHORT_W_OFC)
|
|
|
2a1b01 |
printf("%s FC: Shortwave laser with OFC (SL)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_LONG_LL)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TECH_OFFSET] & SFF8636_FC_TECH_LONG_LL)
|
|
|
2a1b01 |
printf("%s FC: Longwave laser (LL)\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Fibre Channel transmission media */
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TW)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_TW)
|
|
|
2a1b01 |
printf("%s FC: Twin Axial Pair (TW)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TP)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_TP)
|
|
|
2a1b01 |
printf("%s FC: Twisted Pair (TP)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_MI)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_MI)
|
|
|
2a1b01 |
printf("%s FC: Miniature Coax (MI)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_TV)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_TV)
|
|
|
2a1b01 |
printf("%s FC: Video Coax (TV)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_M6)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_M6)
|
|
|
2a1b01 |
printf("%s FC: Multimode, 62.5m (M6)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_M5)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_M5)
|
|
|
2a1b01 |
printf("%s FC: Multimode, 50m (M5)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_OM3)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_OM3)
|
|
|
2a1b01 |
printf("%s FC: Multimode, 50um (OM3)\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_TRANS_MEDIA_OFFSET] & SFF8636_FC_TRANS_MEDIA_SM)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_TRANS_MEDIA_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_FC_TRANS_MEDIA_SM)
|
|
|
2a1b01 |
printf("%s FC: Single Mode (SM)\n", pfx);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Fibre Channel speed */
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1200_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1200_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 1200 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_800_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_800_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 800 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1600_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_1600_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 1600 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_400_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_400_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 400 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_200_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_200_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 200 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
- if (id[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_100_MBPS)
|
|
|
2a1b01 |
+ if (map->page_00h[SFF8636_FC_SPEED_OFFSET] & SFF8636_FC_SPEED_100_MBPS)
|
|
|
2a1b01 |
printf("%s FC: 100 MBytes/sec\n", pfx);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_encoding(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_encoding(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
- sff8024_show_encoding(id, SFF8636_ENCODING_OFFSET, ETH_MODULE_SFF_8636);
|
|
|
2a1b01 |
+ sff8024_show_encoding(map->page_00h, SFF8636_ENCODING_OFFSET,
|
|
|
2a1b01 |
+ ETH_MODULE_SFF_8636);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_rate_identifier(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_rate_identifier(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
/* TODO: Need to fix rate select logic */
|
|
|
2a1b01 |
printf("\t%-41s : 0x%02x\n", "Rate identifier",
|
|
|
2a1b01 |
- id[SFF8636_EXT_RS_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_EXT_RS_OFFSET]);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_oui(const __u8 *id, int id_offset)
|
|
|
2a1b01 |
-{
|
|
|
2a1b01 |
- sff8024_show_oui(id, id_offset);
|
|
|
2a1b01 |
-}
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
-static void sff8636_show_wavelength_or_copper_compliance(const __u8 *id)
|
|
|
2a1b01 |
+static void
|
|
|
2a1b01 |
+sff8636_show_wavelength_or_copper_compliance(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
printf("\t%-41s : 0x%02x", "Transmitter technology",
|
|
|
2a1b01 |
- (id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK));
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_DEVICE_TECH_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_TRANS_TECH_MASK);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- switch (id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK) {
|
|
|
2a1b01 |
+ switch (map->page_00h[SFF8636_DEVICE_TECH_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_TRANS_TECH_MASK) {
|
|
|
2a1b01 |
case SFF8636_TRANS_850_VCSEL:
|
|
|
2a1b01 |
printf(" (850 nm VCSEL)\n");
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
@@ -650,31 +670,26 @@ static void sff8636_show_wavelength_or_copper_compliance(const __u8 *id)
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- if ((id[SFF8636_DEVICE_TECH_OFFSET] & SFF8636_TRANS_TECH_MASK)
|
|
|
2a1b01 |
- >= SFF8636_TRANS_COPPER_PAS_UNEQUAL) {
|
|
|
2a1b01 |
+ if ((map->page_00h[SFF8636_DEVICE_TECH_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_TRANS_TECH_MASK) >= SFF8636_TRANS_COPPER_PAS_UNEQUAL) {
|
|
|
2a1b01 |
printf("\t%-41s : %udb\n", "Attenuation at 2.5GHz",
|
|
|
2a1b01 |
- id[SFF8636_WAVELEN_HIGH_BYTE_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVELEN_HIGH_BYTE_OFFSET]);
|
|
|
2a1b01 |
printf("\t%-41s : %udb\n", "Attenuation at 5.0GHz",
|
|
|
2a1b01 |
- id[SFF8636_WAVELEN_LOW_BYTE_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVELEN_LOW_BYTE_OFFSET]);
|
|
|
2a1b01 |
printf("\t%-41s : %udb\n", "Attenuation at 7.0GHz",
|
|
|
2a1b01 |
- id[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET]);
|
|
|
2a1b01 |
printf("\t%-41s : %udb\n", "Attenuation at 12.9GHz",
|
|
|
2a1b01 |
- id[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET]);
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET]);
|
|
|
2a1b01 |
} else {
|
|
|
2a1b01 |
printf("\t%-41s : %.3lfnm\n", "Laser wavelength",
|
|
|
2a1b01 |
- (((id[SFF8636_WAVELEN_HIGH_BYTE_OFFSET] << 8) |
|
|
|
2a1b01 |
- id[SFF8636_WAVELEN_LOW_BYTE_OFFSET])*0.05));
|
|
|
2a1b01 |
+ (((map->page_00h[SFF8636_WAVELEN_HIGH_BYTE_OFFSET] << 8) |
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVELEN_LOW_BYTE_OFFSET]) * 0.05));
|
|
|
2a1b01 |
printf("\t%-41s : %.3lfnm\n", "Laser wavelength tolerance",
|
|
|
2a1b01 |
- (((id[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET] << 8) |
|
|
|
2a1b01 |
- id[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET])*0.005));
|
|
|
2a1b01 |
+ (((map->page_00h[SFF8636_WAVE_TOL_HIGH_BYTE_OFFSET] << 8) |
|
|
|
2a1b01 |
+ map->page_00h[SFF8636_WAVE_TOL_LOW_BYTE_OFFSET]) * 0.005));
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_revision_compliance(const __u8 *id)
|
|
|
2a1b01 |
-{
|
|
|
2a1b01 |
- sff_show_revision_compliance(id, SFF8636_REV_COMPLIANCE_OFFSET);
|
|
|
2a1b01 |
-}
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
/*
|
|
|
2a1b01 |
* 2-byte internal temperature conversions:
|
|
|
2a1b01 |
* First byte is a signed 8-bit integer, which is the temp decimal part
|
|
|
2a1b01 |
@@ -683,39 +698,65 @@ static void sff8636_show_revision_compliance(const __u8 *id)
|
|
|
2a1b01 |
#define SFF8636_OFFSET_TO_TEMP(offset) ((__s16)OFFSET_TO_U16(offset))
|
|
|
2a1b01 |
#define OFFSET_TO_U16_PTR(ptr, offset) (ptr[offset] << 8 | ptr[(offset) + 1])
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_dom_parse(const __u8 *id, const __u8 *page_three, struct sff_diags *sd)
|
|
|
2a1b01 |
+static void sff8636_dom_parse(const struct sff8636_memory_map *map,
|
|
|
2a1b01 |
+ struct sff_diags *sd)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
+ const __u8 *id = map->lower_memory;
|
|
|
2a1b01 |
int i = 0;
|
|
|
2a1b01 |
|
|
|
2a1b01 |
/* Monitoring Thresholds for Alarms and Warnings */
|
|
|
2a1b01 |
sd->sfp_voltage[MCURR] = OFFSET_TO_U16_PTR(id, SFF8636_VCC_CURR);
|
|
|
2a1b01 |
- sd->sfp_voltage[HALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_VCC_HALRM);
|
|
|
2a1b01 |
- sd->sfp_voltage[LALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_VCC_LALRM);
|
|
|
2a1b01 |
- sd->sfp_voltage[HWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_VCC_HWARN);
|
|
|
2a1b01 |
- sd->sfp_voltage[LWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_VCC_LWARN);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
sd->sfp_temp[MCURR] = SFF8636_OFFSET_TO_TEMP(SFF8636_TEMP_CURR);
|
|
|
2a1b01 |
- sd->sfp_temp[HALRM] = (__s16)OFFSET_TO_U16_PTR(page_three, SFF8636_TEMP_HALRM);
|
|
|
2a1b01 |
- sd->sfp_temp[LALRM] = (__s16)OFFSET_TO_U16_PTR(page_three, SFF8636_TEMP_LALRM);
|
|
|
2a1b01 |
- sd->sfp_temp[HWARN] = (__s16)OFFSET_TO_U16_PTR(page_three, SFF8636_TEMP_HWARN);
|
|
|
2a1b01 |
- sd->sfp_temp[LWARN] = (__s16)OFFSET_TO_U16_PTR(page_three, SFF8636_TEMP_LWARN);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- sd->bias_cur[HALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_BIAS_HALRM);
|
|
|
2a1b01 |
- sd->bias_cur[LALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_BIAS_LALRM);
|
|
|
2a1b01 |
- sd->bias_cur[HWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_BIAS_HWARN);
|
|
|
2a1b01 |
- sd->bias_cur[LWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_BIAS_LWARN);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- sd->tx_power[HALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_PWR_HALRM);
|
|
|
2a1b01 |
- sd->tx_power[LALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_PWR_LALRM);
|
|
|
2a1b01 |
- sd->tx_power[HWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_PWR_HWARN);
|
|
|
2a1b01 |
- sd->tx_power[LWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_TX_PWR_LWARN);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- sd->rx_power[HALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_RX_PWR_HALRM);
|
|
|
2a1b01 |
- sd->rx_power[LALRM] = OFFSET_TO_U16_PTR(page_three, SFF8636_RX_PWR_LALRM);
|
|
|
2a1b01 |
- sd->rx_power[HWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_RX_PWR_HWARN);
|
|
|
2a1b01 |
- sd->rx_power[LWARN] = OFFSET_TO_U16_PTR(page_three, SFF8636_RX_PWR_LWARN);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
|
|
|
2a1b01 |
+ if (!map->page_03h)
|
|
|
2a1b01 |
+ goto out;
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ sd->sfp_voltage[HALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_VCC_HALRM);
|
|
|
2a1b01 |
+ sd->sfp_voltage[LALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_VCC_LALRM);
|
|
|
2a1b01 |
+ sd->sfp_voltage[HWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_VCC_HWARN);
|
|
|
2a1b01 |
+ sd->sfp_voltage[LWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_VCC_LWARN);
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ sd->sfp_temp[HALRM] = (__s16)OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TEMP_HALRM);
|
|
|
2a1b01 |
+ sd->sfp_temp[LALRM] = (__s16)OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TEMP_LALRM);
|
|
|
2a1b01 |
+ sd->sfp_temp[HWARN] = (__s16)OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TEMP_HWARN);
|
|
|
2a1b01 |
+ sd->sfp_temp[LWARN] = (__s16)OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TEMP_LWARN);
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ sd->bias_cur[HALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_BIAS_HALRM);
|
|
|
2a1b01 |
+ sd->bias_cur[LALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_BIAS_LALRM);
|
|
|
2a1b01 |
+ sd->bias_cur[HWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_BIAS_HWARN);
|
|
|
2a1b01 |
+ sd->bias_cur[LWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_BIAS_LWARN);
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ sd->tx_power[HALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_PWR_HALRM);
|
|
|
2a1b01 |
+ sd->tx_power[LALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_PWR_LALRM);
|
|
|
2a1b01 |
+ sd->tx_power[HWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_PWR_HWARN);
|
|
|
2a1b01 |
+ sd->tx_power[LWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_TX_PWR_LWARN);
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+ sd->rx_power[HALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_HALRM);
|
|
|
2a1b01 |
+ sd->rx_power[LALRM] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_LALRM);
|
|
|
2a1b01 |
+ sd->rx_power[HWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_HWARN);
|
|
|
2a1b01 |
+ sd->rx_power[LWARN] = OFFSET_TO_U16_PTR(map->page_03h,
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_LWARN);
|
|
|
2a1b01 |
+
|
|
|
2a1b01 |
+out:
|
|
|
2a1b01 |
/* Channel Specific Data */
|
|
|
2a1b01 |
for (i = 0; i < MAX_CHANNEL_NUM; i++) {
|
|
|
2a1b01 |
u8 rx_power_offset, tx_bias_offset;
|
|
|
2a1b01 |
@@ -749,7 +790,7 @@ static void sff8636_dom_parse(const __u8 *id, const __u8 *page_three, struct sff
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_dom(const __u8 *id, const __u8 *page_three, __u32 eeprom_len)
|
|
|
2a1b01 |
+static void sff8636_show_dom(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
struct sff_diags sd = {0};
|
|
|
2a1b01 |
char *rx_power_string = NULL;
|
|
|
2a1b01 |
@@ -763,20 +804,15 @@ static void sff8636_show_dom(const __u8 *id, const __u8 *page_three, __u32 eepro
|
|
|
2a1b01 |
* and thresholds
|
|
|
2a1b01 |
* If pagging support exists, then supports_alarms is marked as 1
|
|
|
2a1b01 |
*/
|
|
|
2a1b01 |
+ if (map->page_03h)
|
|
|
2a1b01 |
+ sd.supports_alarms = 1;
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- if (eeprom_len == ETH_MODULE_SFF_8636_MAX_LEN) {
|
|
|
2a1b01 |
- if (!(id[SFF8636_STATUS_2_OFFSET] &
|
|
|
2a1b01 |
- SFF8636_STATUS_PAGE_3_PRESENT)) {
|
|
|
2a1b01 |
- sd.supports_alarms = 1;
|
|
|
2a1b01 |
- }
|
|
|
2a1b01 |
- }
|
|
|
2a1b01 |
+ sd.rx_power_type = map->page_00h[SFF8636_DIAG_TYPE_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_TYPE_MASK;
|
|
|
2a1b01 |
+ sd.tx_power_type = map->page_00h[SFF8636_DIAG_TYPE_OFFSET] &
|
|
|
2a1b01 |
+ SFF8636_RX_PWR_TYPE_MASK;
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- sd.rx_power_type = id[SFF8636_DIAG_TYPE_OFFSET] &
|
|
|
2a1b01 |
- SFF8636_RX_PWR_TYPE_MASK;
|
|
|
2a1b01 |
- sd.tx_power_type = id[SFF8636_DIAG_TYPE_OFFSET] &
|
|
|
2a1b01 |
- SFF8636_RX_PWR_TYPE_MASK;
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
- sff8636_dom_parse(id, page_three, &sd);
|
|
|
2a1b01 |
+ sff8636_dom_parse(map, &sd);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
PRINT_TEMP("Module temperature", sd.sfp_temp[MCURR]);
|
|
|
2a1b01 |
PRINT_VCC("Module voltage", sd.sfp_voltage[MCURR]);
|
|
|
2a1b01 |
@@ -819,7 +855,7 @@ static void sff8636_show_dom(const __u8 *id, const __u8 *page_three, __u32 eepro
|
|
|
2a1b01 |
if (sd.supports_alarms) {
|
|
|
2a1b01 |
for (i = 0; sff8636_aw_flags[i].str; ++i) {
|
|
|
2a1b01 |
printf("\t%-41s : %s\n", sff8636_aw_flags[i].str,
|
|
|
2a1b01 |
- id[sff8636_aw_flags[i].offset]
|
|
|
2a1b01 |
+ map->lower_memory[sff8636_aw_flags[i].offset]
|
|
|
2a1b01 |
& sff8636_aw_flags[i].value ? "On" : "Off");
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
@@ -827,39 +863,39 @@ static void sff8636_show_dom(const __u8 *id, const __u8 *page_three, __u32 eepro
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
-static void sff8636_show_page_zero(const __u8 *id)
|
|
|
2a1b01 |
+static void sff8636_show_page_zero(const struct sff8636_memory_map *map)
|
|
|
2a1b01 |
{
|
|
|
2a1b01 |
- sff8636_show_ext_identifier(id);
|
|
|
2a1b01 |
- sff8636_show_connector(id);
|
|
|
2a1b01 |
- sff8636_show_transceiver(id);
|
|
|
2a1b01 |
- sff8636_show_encoding(id);
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_BR_NOMINAL_OFFSET,
|
|
|
2a1b01 |
- "BR, Nominal", 100, "Mbps");
|
|
|
2a1b01 |
- sff8636_show_rate_identifier(id);
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_SM_LEN_OFFSET,
|
|
|
2a1b01 |
- "Length (SMF,km)", 1, "km");
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_OM3_LEN_OFFSET,
|
|
|
2a1b01 |
- "Length (OM3 50um)", 2, "m");
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_OM2_LEN_OFFSET,
|
|
|
2a1b01 |
- "Length (OM2 50um)", 1, "m");
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_OM1_LEN_OFFSET,
|
|
|
2a1b01 |
- "Length (OM1 62.5um)", 1, "m");
|
|
|
2a1b01 |
- sff_show_value_with_unit(id, SFF8636_CBL_LEN_OFFSET,
|
|
|
2a1b01 |
- "Length (Copper or Active cable)", 1, "m");
|
|
|
2a1b01 |
- sff8636_show_wavelength_or_copper_compliance(id);
|
|
|
2a1b01 |
- sff_show_ascii(id, SFF8636_VENDOR_NAME_START_OFFSET,
|
|
|
2a1b01 |
+ sff8636_show_ext_identifier(map);
|
|
|
2a1b01 |
+ sff8636_show_connector(map);
|
|
|
2a1b01 |
+ sff8636_show_transceiver(map);
|
|
|
2a1b01 |
+ sff8636_show_encoding(map);
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_BR_NOMINAL_OFFSET,
|
|
|
2a1b01 |
+ "BR, Nominal", 100, "Mbps");
|
|
|
2a1b01 |
+ sff8636_show_rate_identifier(map);
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_SM_LEN_OFFSET,
|
|
|
2a1b01 |
+ "Length (SMF,km)", 1, "km");
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_OM3_LEN_OFFSET,
|
|
|
2a1b01 |
+ "Length (OM3 50um)", 2, "m");
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_OM2_LEN_OFFSET,
|
|
|
2a1b01 |
+ "Length (OM2 50um)", 1, "m");
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_OM1_LEN_OFFSET,
|
|
|
2a1b01 |
+ "Length (OM1 62.5um)", 1, "m");
|
|
|
2a1b01 |
+ sff_show_value_with_unit(map->page_00h, SFF8636_CBL_LEN_OFFSET,
|
|
|
2a1b01 |
+ "Length (Copper or Active cable)", 1, "m");
|
|
|
2a1b01 |
+ sff8636_show_wavelength_or_copper_compliance(map);
|
|
|
2a1b01 |
+ sff_show_ascii(map->page_00h, SFF8636_VENDOR_NAME_START_OFFSET,
|
|
|
2a1b01 |
SFF8636_VENDOR_NAME_END_OFFSET, "Vendor name");
|
|
|
2a1b01 |
- sff8636_show_oui(id, SFF8636_VENDOR_OUI_OFFSET);
|
|
|
2a1b01 |
- sff_show_ascii(id, SFF8636_VENDOR_PN_START_OFFSET,
|
|
|
2a1b01 |
+ sff8024_show_oui(map->page_00h, SFF8636_VENDOR_OUI_OFFSET);
|
|
|
2a1b01 |
+ sff_show_ascii(map->page_00h, SFF8636_VENDOR_PN_START_OFFSET,
|
|
|
2a1b01 |
SFF8636_VENDOR_PN_END_OFFSET, "Vendor PN");
|
|
|
2a1b01 |
- sff_show_ascii(id, SFF8636_VENDOR_REV_START_OFFSET,
|
|
|
2a1b01 |
+ sff_show_ascii(map->page_00h, SFF8636_VENDOR_REV_START_OFFSET,
|
|
|
2a1b01 |
SFF8636_VENDOR_REV_END_OFFSET, "Vendor rev");
|
|
|
2a1b01 |
- sff_show_ascii(id, SFF8636_VENDOR_SN_START_OFFSET,
|
|
|
2a1b01 |
+ sff_show_ascii(map->page_00h, SFF8636_VENDOR_SN_START_OFFSET,
|
|
|
2a1b01 |
SFF8636_VENDOR_SN_END_OFFSET, "Vendor SN");
|
|
|
2a1b01 |
- sff_show_ascii(id, SFF8636_DATE_YEAR_OFFSET,
|
|
|
2a1b01 |
+ sff_show_ascii(map->page_00h, SFF8636_DATE_YEAR_OFFSET,
|
|
|
2a1b01 |
SFF8636_DATE_VENDOR_LOT_OFFSET + 1, "Date code");
|
|
|
2a1b01 |
- sff8636_show_revision_compliance(id);
|
|
|
2a1b01 |
-
|
|
|
2a1b01 |
+ sff_show_revision_compliance(map->lower_memory,
|
|
|
2a1b01 |
+ SFF8636_REV_COMPLIANCE_OFFSET);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
|
|
|
2a1b01 |
static void sff8636_memory_map_init_buf(struct sff8636_memory_map *map,
|
|
|
2a1b01 |
@@ -896,13 +932,13 @@ void sff8636_show_all_ioctl(const __u8 *id, __u32 eeprom_len)
|
|
|
2a1b01 |
|
|
|
2a1b01 |
sff8636_memory_map_init_buf(&map, id, eeprom_len);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- sff8636_show_identifier(id);
|
|
|
2a1b01 |
- switch (id[SFF8636_ID_OFFSET]) {
|
|
|
2a1b01 |
+ sff8636_show_identifier(&map);
|
|
|
2a1b01 |
+ switch (map.lower_memory[SFF8636_ID_OFFSET]) {
|
|
|
2a1b01 |
case SFF8024_ID_QSFP:
|
|
|
2a1b01 |
case SFF8024_ID_QSFP_PLUS:
|
|
|
2a1b01 |
case SFF8024_ID_QSFP28:
|
|
|
2a1b01 |
- sff8636_show_page_zero(id);
|
|
|
2a1b01 |
- sff8636_show_dom(id, id + 3 * 0x80, eeprom_len);
|
|
|
2a1b01 |
+ sff8636_show_page_zero(&map);
|
|
|
2a1b01 |
+ sff8636_show_dom(&map);
|
|
|
2a1b01 |
break;
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
@@ -939,9 +975,7 @@ void sff8636_show_all_nl(const struct ethtool_module_eeprom *page_zero,
|
|
|
2a1b01 |
|
|
|
2a1b01 |
sff8636_memory_map_init_pages(&map, page_zero, page_three);
|
|
|
2a1b01 |
|
|
|
2a1b01 |
- sff8636_show_identifier(page_zero->data);
|
|
|
2a1b01 |
- sff8636_show_page_zero(page_zero->data);
|
|
|
2a1b01 |
- if (page_three)
|
|
|
2a1b01 |
- sff8636_show_dom(page_zero->data, page_three->data - 0x80,
|
|
|
2a1b01 |
- ETH_MODULE_SFF_8636_MAX_LEN);
|
|
|
2a1b01 |
+ sff8636_show_identifier(&map);
|
|
|
2a1b01 |
+ sff8636_show_page_zero(&map);
|
|
|
2a1b01 |
+ sff8636_show_dom(&map);
|
|
|
2a1b01 |
}
|
|
|
2a1b01 |
--
|
|
|
2a1b01 |
2.35.1
|
|
|
2a1b01 |
|