我们正在努力从 Supermicro 服务器中的 10G SFP 读取激光 rx/tx 级别。
ethtool -m(或 --modinfo 或 --dump-module-eeprom)应该提供该信息,并且它确实有效……有点类似。
问题:
- 什么原因导致 ethtool 以十六进制形式提供完整的 eeprom 数据,但(显然)截断文本输出?
- 是否有任何已知的 ethtool 替代品?
- 我们可以将 ethtool 的十六进制输出输入到任何其他已知的解析器/转换器中吗?
Supermicro Box(SYS-110D-8C-FRAN8TP)、Ubuntu、Intel NIC、ice 内核模块。
$ uname -a
Linux s01-chgva1-evrw 5.15.0-102-generic #112-Ubuntu SMP Tue Mar 5 16:50:32 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 22.04.3 LTS \n \l
和
$ ethtool --version
ethtool version 5.16
和
$ modinfo ice
filename: /lib/modules/5.15.0-102-generic/kernel/drivers/net/ethernet/intel/ice/ice.ko
firmware: intel/ice/ddp/ice.pkg
license: GPL v2
description: Intel(R) Ethernet Connection E800 Series Linux Driver
author: Intel Corporation, <[email protected]>
srcversion: E7701886AAC16AD41A71F0E
alias: pci:v00008086d0000151Dsv*sd*bc*sc*i*
[...]
alias: pci:v00008086d00001591sv*sd*bc*sc*i*
depends:
retpoline: Y
intree: Y
name: ice
vermagic: 5.15.0-102-generic SMP mod_unload modversions
sig_id: PKCS#7
signer: Build time autogenerated kernel key
sig_key: 2E:23:16:41:BE:E2:75:E4:E8:36:37:AE:9D:F0:67:4D:5A:8B:52:0F
sig_hashalgo: sha512
signature: 4F:BE:D8:FA:E5:7C:3D:AC:99:43:2A:10:33:35:A3:4D:BE:95:66:DA:
[...]
E2:2F:13:EC:31:01:FE:A8:F2:C2:
CB:05:DB:4B:4C:D6:76:C2:92:01:FD:D0
parm: debug:netif level (0=none,...,16=all) (int)
在另一个装有 ubuntu 的超微型盒子上,ethtool -m 从同一个 SFP+ 提供完整信息,请参见底部。
ethtool -m 的文本输出。这不可能是完整的,不幸的是,有趣的部分丢失了。
$ sudo ethtool --dump-module-eeprom enp137s0f0
Identifier : 0x03 (SFP)
Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID)
Connector : 0x07 (LC)
Transceiver codes : 0x20 0x00 0x00 0x00 0x22 0x00 0x01 0x00 0x00
Transceiver type : 10G Ethernet: 10G Base-LR
Transceiver type : FC: intermediate distance (I)
Transceiver type : FC: Longwave laser (LC)
Transceiver type : FC: Single Mode (SM)
Encoding : 0x06 (64B/66B)
BR, Nominal : 10300MBd
Rate identifier : 0x00 (unspecified)
Length (SMF,km) : 10km
Length (SMF) : 10000m
Length (50um) : 0m
Length (62.5um) : 0m
Length (Copper) : 0m
Length (OM3) : 0m
Laser wavelength : 1310nm
Vendor name : FS
Vendor OUI : 00:00:00
Vendor PN : SFP-10GLR-31
Vendor rev :
Option values : 0x00 0x1a
Option : RX_LOS implemented
Option : TX_FAULT implemented
Option : TX_DISABLE implemented
BR margin, max : 14%
BR margin, min : 88%
Vendor SN : G2208169504
Date code : 220831
我们花了相当多的时间通过各种服务器、NIC 和思科交换机交换模块(同一系列),并得到了不同的结果 - 有时是完整输出(见下文),有时被截断Date Code
(见上文)。
然而,在主盒上,有点令人惊讶的是,ethtool -m hex on根据 SFF-8472,显示预期的 2 页,每页 256 字节https://members.snia.org/document/dl/25916(参见第 9.8 条),以及第二页的第 102 至 105 字节中的非零值。
因此数据是在那里,ethtool 可以检索它,但由于某种原因不会解析/显示它 - 但为什么?
$ sudo ethtool --dump-module-eeprom enp137s0f0 hex on
Offset Values
------ ------
0x0000: 03 04 07 20 00 00 00 22 00 01 00 06 67 00 0a 64
0x0010: 00 00 00 00 46 53 20 20 20 20 20 20 20 20 20 20
0x0020: 20 20 20 20 00 00 00 00 53 46 50 2d 31 30 47 4c
0x0030: 52 2d 33 31 20 20 20 20 20 20 20 20 05 1e 00 95
0x0040: 00 1a 0e 58 47 32 32 30 38 31 36 39 35 30 34 20
0x0050: 20 20 20 20 32 32 30 38 33 31 20 20 68 f0 03 37
0x0060: 00 00 08 14 a3 bf 9f 74 e0 4b 30 bb ba 21 df e8
0x0070: 2f bf cc 00 00 00 00 00 00 00 00 00 1f a7 65 af
0x0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0100: 4b 00 fb 00 46 00 00 00 8d cc 74 04 87 5a 7a 76
0x0110: d6 d8 01 f4 c3 50 03 e8 57 73 02 5b 2b d4 05 ea
0x0120: 57 73 00 91 2b d4 01 6b 00 00 00 00 00 00 00 00
0x0130: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0140: 00 00 00 00 3f 80 00 00 00 00 00 00 01 00 00 00
0x0150: 01 00 00 00 01 00 00 00 01 00 00 00 00 00 00 6d
0x0160: 21 8e 82 44 34 e6*16 38*07 0a*00 00 00 00 00 00 0x1638 | 0x070a
0x0170: 00 00 00 00 00 00 01 00 ff ff ff ff ff ff ff 01
0x0180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x0190: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
0x01f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
此处报告的值是 16 位无符号整数,步长为 0.1µW:
TX: Bytes 102 and 103 0x1638 568,8µW roughly -2.5 dBm
RX: Bytes 104 and 105 0x070a 108,2µW roughly -7.5 dBm
...这对于获取这些值的情况来说是完全合理的:来自同一供应商和同一系列的两个 SFP、一条 3 米长的电缆以及每根光纤中一个 -5dB 的衰减器。
另一个 Linux Box 中的相同模块(也是 Ubuntu,也是 Supermicro,但使用 ixgbe 而不是 ice;目前无法提供内核、模块或 ethtool 十六进制转储的详细信息。
# ethtool -m enp1s0f1
Identifier : 0x03 (SFP)
Extended identifier : 0x04 (GBIC/SFP defined by 2-wire interface ID)
Connector : 0x07 (LC)
Transceiver codes : 0x20 0x00 0x00 0x00 0x22 0x00 0x01 0x00 0x00
Transceiver type : 10G Ethernet: 10G Base-LR
Transceiver type : FC: intermediate distance (I)
Transceiver type : FC: Longwave laser (LC)
Transceiver type : FC: Single Mode (SM)
Encoding : 0x06 (64B/66B)
BR, Nominal : 10300MBd
Rate identifier : 0x00 (unspecified)
Length (SMF,km) : 10km
Length (SMF) : 10000m
Length (50um) : 0m
Length (62.5um) : 0m
Length (Copper) : 0m
Length (OM3) : 0m
Laser wavelength : 1310nm
Vendor name : FS
Vendor OUI : 00:00:00
Vendor PN : SFP-10GLR-31
Vendor rev :
Option values : 0x00 0x1a
Option : RX_LOS implemented
Option : TX_FAULT implemented
Option : TX_DISABLE implemented
BR margin, max : 14%
BR margin, min : 88%
Vendor SN : G2208169504
Date code : 220831
Optical diagnostics support : Yes
Laser bias current : 27.648 mA
Laser output power : 0.5673 mW / -2.46 dBm
Receiver signal average optical power : 0.2037 mW / -6.91 dBm
Module temperature : 35.80 degrees C / 96.44 degrees F
Module voltage : 3.3300 V
Alarm/warning flags implemented : Yes
Laser bias current high alarm : Off
Laser bias current low alarm : Off
Laser bias current high warning : Off
Laser bias current low warning : Off
Laser output power high alarm : Off
Laser output power low alarm : Off
Laser output power high warning : Off
Laser output power low warning : Off
Module temperature high alarm : Off
Module temperature low alarm : Off
Module temperature high warning : Off
Module temperature low warning : Off
Module voltage high alarm : Off
Module voltage low alarm : Off
Module voltage high warning : Off
Module voltage low warning : Off
Laser rx power high alarm : Off
Laser rx power low alarm : Off
Laser rx power high warning : Off
Laser rx power low warning : Off
Laser bias current high alarm threshold : 110.000 mA
Laser bias current low alarm threshold : 1.000 mA
Laser bias current high warning threshold : 100.000 mA
Laser bias current low warning threshold : 2.000 mA
Laser output power high alarm threshold : 2.2387 mW / 3.50 dBm
Laser output power low alarm threshold : 0.0603 mW / -12.20 dBm
Laser output power high warning threshold : 1.1220 mW / 0.50 dBm
Laser output power low warning threshold : 0.1514 mW / -8.20 dBm
Module temperature high alarm threshold : 75.00 degrees C / 167.00 degrees F
Module temperature low alarm threshold : -5.00 degrees C / 23.00 degrees F
Module temperature high warning threshold : 70.00 degrees C / 158.00 degrees F
Module temperature low warning threshold : 0.00 degrees C / 32.00 degrees F
Module voltage high alarm threshold : 3.6300 V
答案1
(部分)回答我自己的问题:
是否有任何已知的 ethtool 替代品?
真的不需要。ethtool -m <interface> hex on
可以提供数据;只需要提取它。
我们可以将 ethtool 的十六进制输出输入到任何其他已知的解析器/转换器中吗?
总有脑力劳动:
- 找到十六进制转储的第二个 256 字节页面的字节 102-105(行
0x0160
从字节 #96 开始) - 将字节 102-103 读取为一个 16 位无符号整数
- 使用任何工具将十六进制转换为十进制(Windows 自带的 calc.exe 就可以)
- 将值除以 10 可得到光 TX 功率(单位为 µW)
- 十进制转换为 mW,然后执行10 * log(P-in-mW)获取以 dBm 为单位的 TX 功率(或使用可用的在线转换器之一)
和..
- 重复第 104 和 105 字节以获取 RX 功率
虽然不是很酷,但是在需要的时候还是很有用的。