diff options
author | Simone Bortolin <simonebortolin@users.noreply.github.com> | 2024-02-25 22:03:34 +0100 |
---|---|---|
committer | Simone Bortolin <simonebortolin@users.noreply.github.com> | 2024-02-25 22:03:34 +0100 |
commit | 89986a2a32e46a1c4ff83153adf720d2208af53d (patch) | |
tree | f75db2af9c182428eb3efe21323b28bcebd5aad9 | |
parent | refactor (diff) | |
download | hack-gpon.github.io-ethtool-eeprom-parser.tar hack-gpon.github.io-ethtool-eeprom-parser.tar.gz hack-gpon.github.io-ethtool-eeprom-parser.tar.bz2 hack-gpon.github.io-ethtool-eeprom-parser.tar.lz hack-gpon.github.io-ethtool-eeprom-parser.tar.xz hack-gpon.github.io-ethtool-eeprom-parser.tar.zst hack-gpon.github.io-ethtool-eeprom-parser.zip |
-rw-r--r-- | assets/js/vue/vue-lantiq-eeprom.vue | 191 |
1 files changed, 145 insertions, 46 deletions
diff --git a/assets/js/vue/vue-lantiq-eeprom.vue b/assets/js/vue/vue-lantiq-eeprom.vue index 35176d4..098cca6 100644 --- a/assets/js/vue/vue-lantiq-eeprom.vue +++ b/assets/js/vue/vue-lantiq-eeprom.vue @@ -8,8 +8,8 @@ <template v-if="type === 'eeprom-lantiq'"> <div class="form-floating mb-3"> <select class="form-control" placeholder="Select EEPROM" id="eeprom-type" v-model="eeprom_switch"> - <option value="0">EEPROM A0</option> - <option value="1">EEPROM A2</option> + <option value="A0">EEPROM A0</option> + <option value="A2">EEPROM A2</option> </select> <label for="eeprom-type">Select EEPROM A0 or A2</label> </div> @@ -43,8 +43,8 @@ <template v-if="type === 'eeprom-ethtool'"> <div class="form-floating mb-3"> <select class="form-control" placeholder="Select EEPROM" id="eeprom-type" v-model="eeprom_switch"> - <option value="0">EEPROM A0</option> - <option value="1">EEPROM A2</option> + <option value="A0">EEPROM A0</option> + <option value="A2">EEPROM A2</option> </select> <label for="eeprom-type">Select EEPROM A0 or A2</label> </div> @@ -122,8 +122,8 @@ export default { eeprom_decode: null, lantiq_0: null, lantiq_last: null, - eeprom_table: [ - [ + eeprom_table: { + "A0":[ { "address": "", "size": "", @@ -135,21 +135,21 @@ export default { "size": "1", "name": "Identifier", "description": "Type of transceiver", - "parse": "table_3_2" + "parse": "table_identifier_values" }, { "address": "1", "size": "1", "name": "Ext identifier", "description": "Additional information about the transceiver", - "parse": "table_3_3" + "parse": "table_phy_device_identifier_value" }, { "address": "2", "size": "1", "name": "Connector", "description": "Type of media connector", - "parse": "table_3_4" + "parse": "table_connector_value" }, { "address": "3-10", @@ -162,7 +162,7 @@ export default { "size": "1", "name": "Encoding", "description": "High speed serial encoding algorithm", - "parse": "table_3_6" + "parse": "table_encoding_value" }, { "address": "12", @@ -230,7 +230,8 @@ export default { "address": "36", "size": "1", "name": "Transceiver", - "description": "Code for optical compatibility" + "description": "Code for optical compatibility", + "parse":"table_extended_specification_compliance_codeds" }, { "address": "37-39", @@ -313,21 +314,21 @@ export default { "size": "1", "name": "Diagnostic Monitoring Type", "description": "Indicates which type of diagnostic monitoring is implemented", - "parse":"table_3_9" + "parse":"table_diagnostic_monitoring_type" }, { "address": "93", "size": "1", "name": "Enhanced Options", "description": "Indicates which optional enhanced features are implemented", - "parse":"table_3_10" + "parse":"table_enhanced_options" }, { "address": "94", "size": "1", "name": "SFF-8472 Compliance", "description": "Indicates which revision of SFF-8472 the transceiver complies with", - "parse":"table_3_12" + "parse":"table_compliance" }, { "address": "95", @@ -367,7 +368,7 @@ export default { "description": "Reserved" } ], - [ + "A2":[ { "address": "", "size": "", @@ -688,7 +689,7 @@ export default { "size": "1", "name": "Status/Control", "description": "Optional Status and Control Bits", - "parse": "table_3_17" + "parse": "table_real_time_diagnostic_and_control" }, { "address": "111", @@ -701,26 +702,29 @@ export default { "size": "2", "name": "Alarm Flags", "description": "Diagnostic Alarm Flag Status Bits", - "parse": "table_3_18" + "parse": "table_alarm_and_warning" }, { "address": "114", "size": "1", "name": "Tx Input EQ control", - "description": "Tx Input equalization level control" + "description": "Tx Input equalization level control", + "parse": "hex_to_dBm" + }, { "address": "115", "size": "1", "name": "Rx Out Emphasis control", - "description": "Rx Output emphasis level control" + "description": "Rx Output emphasis level control", + "parse": "hex_to_dBm" }, { "address": "116-117", "size": "2", "name": "Warning Flags", "description": "Diagnostic Warning Flag Status Bits", - "parse": "table_3_18" + "parse": "table_alarm_and_warning" }, { "address": "118-119", @@ -843,17 +847,17 @@ export default { "description": "Reserved" } ] - ], - eeprom_switch: 0 + }, + eeprom_switch: "A0" } }, props: ['type'], computed: { revision: { get() { - if (this.eeprom_switch === 0) { + if (this.eeprom_switch === "A0") { var rev = this.getPart(94, 94); - return rev !== "00" ? this.table_3_12(rev).slice(0, -1) ?? "SFF-8472" : "SFF-8472"; + return rev !== "00" ? this.table_compliance(rev).slice(0, -1) ?? "SFF-8472" : "SFF-8472"; } return "SFF-8472"; } @@ -878,10 +882,10 @@ export default { var lantiq_array = val.split('@'); this.lantiq_0 = lantiq_array.shift(); if(this.lantiq_0.includes("sfp_a2_info")) { - this.eeprom_switch = 1; + this.eeprom_switch = "A2"; } else if(this.lantiq_0.includes("sfp_a0_low_128")) { - this.eeprom_switch = 0; + this.eeprom_switch = "A0"; } this.lantiq_last = lantiq_array.slice(-2); var lantiq_decode = lantiq_array.map(it => this.base64ToHex(it)).join(''); @@ -900,13 +904,15 @@ export default { }; this.eeprom_decode = [...eeprom_decode]; var ethtool_0 = val.split('\n')[0]; - var conditions0 = ['-m','--dump-module-eeprom','--module-info']; - var conditions1 = ['-e','--eeprom-dump']; - if(conditions0.some(el => ethtool_0.includes(el))) { - this.eeprom_switch = 0; - } - else if(conditions1.some(el => ethtool_0.includes(el))) { - this.eeprom_switch = 1; + const conditions = { + "A0": ['-m', '--dump-module-eeprom', '--module-info'], + "A2": ['-e', '--eeprom-dump'] + }; + for (const [key, value] of Object.entries(conditions)) { + if (value.some(el => ethtool_0.includes(el))) { + this.eeprom_switch = key; + break; + } } } }, @@ -1146,6 +1152,9 @@ export default { hexToMac: function(hex) { return hex ? this.chunk(hex).join(':') : ""; }, + hex_to_dBm: function(hex) { + return hex ? `${parseInt(hex, 16)}dBm` : ""; + }, hex_suWTo_dBm: function(hex) { return hex ? `${(10 * Math.log10(parseInt(hex, 16) / 10000)).toFixed(2)}dBm` : ""; }, @@ -1188,13 +1197,15 @@ export default { } return list; }, - table_3_2: function (hex) { + table_identifier_values: function (hex) { var table = { - "03":"SFP", + "01":"GBIC", + "02":"Module soldered to motherboard (ex: SFF)", + "03":"SFP/SFP+/SFP28" } return hex ? table[hex] ?? `See ${this.revision} Table 3.2` : ""; }, - table_3_3: function (hex) { + table_phy_device_identifier_value: function (hex) { var table = { "00":"GBIC definition is not specified or the GBIC definition is not compliant with a defined MOD_DEF. See product specification for details", "01":"GBIC is compliant with MOD_DEF 1", @@ -1207,16 +1218,24 @@ export default { } return hex ? table[hex] ?? `See ${this.revision} Table 3.3` : ""; }, - table_3_4: function (hex) { + table_connector_value: function (hex) { var table = { "00":"Unknown or unspecified", - "01":"SC", - "07":"LC", - "22":"RJ45", + "01":"SC (Subscriber Connector)", + "02":"Fibre Channel Style 1 copper connector", + "03":"Fibre Channel Style 2 copper connector", + "04":"BNC/TNC (Bayonet/Threaded Neill-Concelman)", + "05":"Fibre Channel coax headers", + "06":"Fiber Jack", + "07":"LC (Lucent Connector)", + "08":"MT-RJ (Mechanical Transfer - Registered Jack)", + "09":"MU (Multiple Optical)", + "21":"Copper pigtail", + "22":"RJ45 (Registered Jack)" } return hex ? table[hex] ?? `See ${this.revision} Table 3.4` : ""; }, - table_3_6: function (hex) { + table_encoding_value: function (hex) { var table = { "00":"Unspecified", "01":"8B/10B", @@ -1228,7 +1247,7 @@ export default { } return hex ? table[hex] ?? `See ${this.revision} Table 3.6` : ""; }, - table_3_17: function(hex) { + table_real_time_diagnostic_and_control: function(hex) { var table = { 128:"TX Disable State", 64:"Soft TX Disable", @@ -1241,7 +1260,7 @@ export default { } return hex ? this.flagDecoder(hex, table)?.join(', ') : ""; }, - table_3_18: function(hex) { + table_alarm_and_warning: function(hex) { var table = [{ 128:"Temp High", 64:"Temp Low", @@ -1257,7 +1276,7 @@ export default { }] return hex ? this.chunk(hex)?.flatMap((element, index) => this.flagDecoder(element, table[index]))?.join(', ') : ""; }, - table_3_9: function(hex) { + table_diagnostic_monitoring_type: function(hex) { var table = { 64:"Digital diagnostic monitoring implemented", 32:"Internally calibrated", @@ -1272,7 +1291,7 @@ export default { } return hex ? this.flagDecoder(hex, table, not_table)?.join(', ') : ""; }, - table_3_10: function(hex) { + table_enhanced_options: function(hex) { var table = { 128:"Alarm/warning flags implemented for all monitored quantities", 64:"Soft TX_DISABLE control and monitoring implemented", @@ -1284,7 +1303,7 @@ export default { } return hex ? this.flagDecoder(hex, table)?.join(', ') : ""; }, - table_3_12: function(hex) { + table_compliance: function(hex) { var table = { "00":"Digital diagnostic functionality not included or undefined.", "01":"Rev 9.3 of SFF-8472.", @@ -1299,6 +1318,86 @@ export default { } return hex ? table[hex] ?? "" : ""; }, + table_extended_specification_compliance_codeds: function(hex) { + var table = { + "00":"Unspecified.", + "01":"100G AOC (Active Optical Cable), retimed or 25GAUI C2M AOC. Providing a worst BER of 5 × 10-5.", + "02":"100GBASE-SR4 or 25GBASE-SR.", + "03":"100GBASE-LR4 or 25GBASE-LR.", + "04":"100GBASE-ER4 or 25GBASE-ER.", + "05":"100GBASE-SR10.", + "06":"100G CWDM4.", + "07":"100G PSM4 Parallel SMF.", + "08":"100G ACC (Active Copper Cable), retimed or 25GAUI C2M ACC. Providing a worst BER of 5 × 10-5.", + "09":"Obsolete (assigned before 100G CWDM4 MSA required FEC).", + "0A":"Reserved.", + "0B":"100GBASE-CR4, 25GBASE-CR CA-25G-L or 50GBASE-CR2 with RS (Clause91) FEC.", + "0C":"25GBASE-CR CA-25G-S or 50GBASE-CR2 with BASE-R (Clause 74 Fire code) FEC.", + "0D":"25GBASE-CR CA-25G-N or 50GBASE-CR2 with no FEC.", + "0E":"10 Mb/s Single Pair Ethernet (802.3cg, Clause 146/147, 1000 m copper).", + "10":"40GBASE-ER4.", + "11":"4 x 10GBASE-SR.", + "12":"40G PSM4 Parallel SMF.", + "13":"G959.1 profile P1I1-2D1 (10709 MBd, 2km, 1310 nm SM).", + "14":"G959.1 profile P1S1-2D2 (10709 MBd, 40km, 1550 nm SM).", + "15":"G959.1 profile P1L1-2D2 (10709 MBd, 80km, 1550 nm SM).", + "16":"10GBASE-T with SFI electrical interface.", + "17":"100G CLR4.", + "18":"100G AOC, retimed or 25GAUI C2M AOC. Providing a worst BER of 10-12 or below.", + "19":"100G ACC, retimed or 25GAUI C2M ACC. Providing a worst BER of 10-12 or below.", + "1A":"100GE-DWDM2 (DWDM transceiver using 2 wavelengths on a 1550 nm DWDM grid with a reach up to 80 km).", + "1B":"100G 1550nm WDM (4 wavelengths).", + "1C":"10GBASE-T Short Reach (30 meters).", + "1D":"5GBASE-T.", + "1E":"2.5GBASE-T.", + "1F":"40G SWDM4.", + "20":"100G SWDM4.", + "21":"100G PAM4 BiDi.", + "37":"10GBASE-BR (Clause 158).", + "38":"25GBASE-BR (Clause 159).", + "39":"50GBASE-BR (Clause 160).", + "22":"4WDM-10 MSA (10km version of 100G CWDM4 with same RS(528,514) FEC in host system).", + "23":"4WDM-20 MSA (20km version of 100GBASE-LR4 with RS(528,514) FEC in host system).", + "24":"4WDM-40 MSA (40km reach with APD receiver and RS(528,514) FEC in host system).", + "25":"100GBASE-DR (Clause 140), CAUI-4 (no FEC).", + "26":"100G-FR or 100GBASE-FR1 (Clause 140), CAUI-4 (no FEC on host interface).", + "27":"100G-LR or 100GBASE-LR1 (Clause 140), CAUI-4 (no FEC on host interface).", + "28":"100GBASE-SR1 (802.3, Clause 167), CAUI-4 (no FEC on host interface).", + "3A":"100GBASE-VR1 (802.3, Clause 167), CAUI-4 (no FEC on host interface).", + "29":"100GBASE-SR1, 200GBASE-SR2 or 400GBASE-SR4 (802.3, Clause 167).", + "36":"100GBASE-VR1, 200GBASE-VR2 or 400GBASE-VR4 (802.3, Clause 167).", + "2A":"100GBASE-FR1 (802.3, Clause 140) or 400GBASE-DR4-2 (P802.3df, Clause 124).", + "2B":"100GBASE-LR1 (802.3, Clause 140).", + "2C":"100G-LR1-20 MSA, CAUI-4 (no FEC on host interface).", + "2D":"100G-ER1-30 MSA, CAUI-4 (no FEC on host interface).", + "2E":"100G-ER1-40 MSA, CAUI-4 (no FEC on host interface).", + "2F":"100G-LR1-20 MSA.", + "34":"100G-ER1-30 MSA.", + "35":"100G-ER1-40 MSA.", + "30":"Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below.", + "31":"Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 10-6 or below.", + "32":"Active Copper Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for ACC, 10-5 for AUI, or below.", + "33":"Active Optical Cable with 50GAUI, 100GAUI-2 or 200GAUI-4 C2M. Providing a worst BER of 2.6x10-4 for AOC, 10-5 for AUI, or below.", + "3F":"100GBASE-CR1, 200GBASE-CR2 or 400GBASE-CR4 (P802.3ck, Clause 162).", + "40":"50GBASE-CR, 100GBASE-CR2, or 200GBASE-CR4.", + "41":"50GBASE-SR, 100GBASE-SR2, or 200GBASE-SR4.", + "42":"50GBASE-FR or 200GBASE-DR4.", + "4A":"50GBASE-ER (IEEE 802.3, Clause 139).", + "43":"200GBASE-FR4.", + "44":"200G 1550 nm PSM4.", + "45":"50GBASE-LR.", + "46":"200GBASE-LR4.", + "47":"400GBASE-DR4 (802.3, Clause 124), 400GAUI-4 C2M (Annex 120G).", + "48":"400GBASE-FR4 (802.3, Clause 151).", + "49":"400GBASE-LR4-6 (802.3, Clause 151).", + "4B":"400G-LR4-10.", + "4C":"400GBASE-ZR (P802.3cw, Clause 156).", + "7F":"256GFC-SW4 (FC-PI-7P).", + "80":"64GFC (FC-PI-7).", + "81":"128GFC (FC-PI-8)." + } + return hex ? table[hex] ?? "" : ""; + }, asciiToHex: function(str) { return ([...str].map((_, n) => Number(str.charCodeAt(n)).toString(16)).join('')); }, |