E810光模块温度获取

// 此模板仅供参考,如果不适用可以修改

问题描述

社区已经支持E810网卡的光模块温度获取,实测发现温度获取不到,如何排查

        -- 光模块温度
        OpticalTemp = {
            protocol = 'ncsi_standard',
            action = 'on_schedule',
            period_in_sec = 2,
            request = {
                packet_type = 0x50,
                expect_rsp_packet_type = 0xD0,
                data = '\x00\x00\x01\x57\x4B\x02'
            },
            response = function(data)
                local r = bs.new([[<<
                    rsp_code:16,
                    reason_code:16,
                    manu_id:32,
                    intel_cmd:8,
                    intel_prams:8,
                    reserved:16,
                    alarm_temp:16,
                    warning_temp:16,
                    current_temp:16/big
                >>]]):unpack(data, true)

                if r and r.current_temp then
                    r.current_temp = math.floor(r.current_temp / 256)
                end

                return r.current_temp
            end
        }
~ ~ # mdbctl lsprop OpticalModule_0_0101010105
bmc.kepler.Inventory.Hardware
  AssetName=""
  AssetTag=""
  AssetType=""
  FirmwareVersion=""
  ManufactureDate=""
  Manufacturer=""
  Model=""
  PCBVersion=""
  PartNumber=""
  SerialNumber=""
  Slot=""
  UUID=""
bmc.kepler.Object.Properties
  ClassName="OpticalModule"
  ObjectIdentifier=[1,"1","1","0101010105"]
  ObjectName="OpticalModule_0_0101010105"
  TraceSamplingRate=0
bmc.kepler.Systems.OpticalModule
  Accessible=0
  ChannelNum=0
  ConnectorType=""
  FaultState=0
  FiberConnectionType=""
  Health=0
  HostSNR=[]
  Id=255
  Identifier=""
  IsSupportedType=0
  Manufacturer=""
  MediaSNR=[]
  MediumType=""
  ModuleState=255
  Name=""
  PartNumber=""
  PowerState=0
  Presence=0
  ProductionDate=""
  RelatedNetworkPorts=[]
  RevisionNumber=""
  RxLossState=false
  RxSNR=[]
  SerialNumber=""
  SilkText=""
  SpeedMatch=true
  SupportedSpeedsMbps=[]
  TemperatureCelsius=65535
  TransceiverType=""
  TransmissionDistance=""
  TxFaultState=false
  TxLossState=false
  Type=""
  TypeMatch=true
  WaveLengthNanometer=""
bmc.kepler.Systems.OpticalModule.BiasCurrent
  BiasCurrentTXLowerThresholdWarning=65535
  BiasCurrentTXUpperThresholdWarning=65535
  TXBiasCurrent1MilliAmps=0
  TXBiasCurrent2MilliAmps=0
  TXBiasCurrent3MilliAmps=0
  TXBiasCurrent4MilliAmps=0
  TXBiasCurrent5MilliAmps=0
  TXBiasCurrent6MilliAmps=0
  TXBiasCurrent7MilliAmps=0
  TXBiasCurrent8MilliAmps=0
  TXBiasCurrentMilliAmps=[]
  TXBiasCurrentStatus=0
  TXLowerThresholdCritical=65535
  TXUpperThresholdCritical=65535
bmc.kepler.Systems.OpticalModule.Diagnose
  ContaminationDetectionSupported=false
  FiberDirtyDetected=false
  FiberLoosenessDetected=false
  HostInterfaceFaultStatus=0
  LaserRuntimeSeconds=0
  LaserTemperatureCelsius=0
  MediaInterfaceFaultStatus=0
  OdspDieTemperatureCelsius=0
  OdspHighTempRuntimeSeconds=0
  PRBSTestSupported=false
  PowerOnCount=0
  PowerStatus=0
  RxLoS=0
  RxLossOfLock=0
  SelfTestStatus=0
  TxFault=0
  TxLoS=0
  TxLossOfLock=0
  UptimeSeconds=0
bmc.kepler.Systems.OpticalModule.Power
  PowerCapacityWatts=0
  PowerClass=255
  PowerRXLowerThresholdWarning=65535
  PowerRXUpperThresholdWarning=65535
  PowerTXLowerThresholdWarning=65535
  PowerTXUpperThresholdWarning=65535
  RXInputPowerMilliWatts=[]
  RXInputPowerStatus=0
  RXLowerThresholdCritical=65535
  RXUpperThresholdCritical=65535
  TXLowerThresholdCritical=65535
  TXOutputPowerMilliWatts=[]
  TXOutputPowerStatus=0
  TXUpperThresholdCritical=65535
bmc.kepler.Systems.OpticalModule.RelatedItems
  NetworkPortLanes=[]
bmc.kepler.Systems.OpticalModule.Temperature
  LowerThresholdCritical=65535
  ReadingCelsius=65535
  TemperatureLowerThresholdCritical=65535
  TemperatureLowerThresholdWarning=65535
  TemperatureUpperThresholdCritical=65535
  TemperatureUpperThresholdWarning=65535
  UpperThresholdCritical=125
bmc.kepler.Systems.OpticalModule.Voltage
  LowerThresholdCritical=65535
  SupplyVoltage=65535
  UpperThresholdCritical=65535
  VoltageLowerThresholdCritical=65535
  VoltageLowerThresholdWarning=65535
  VoltageUpperThresholdCritical=65535
  VoltageUpperThresholdWarning=65535
Private
  CreatedByDeviceObject=false
  LogicalId=255
  NetworkAdapterId="PCIeCard5(E810CQDA2G2P5)"
  PfID=255
  PortID=0

~ ~ # mdbctl lsprop OpticalModule_1_0101010105
bmc.kepler.Inventory.Hardware
  AssetName=""
  AssetTag=""
  AssetType=""
  FirmwareVersion=""
  ManufactureDate=""
  Manufacturer=""
  Model=""
  PCBVersion=""
  PartNumber=""
  SerialNumber=""
  Slot=""
  UUID=""
bmc.kepler.Object.Properties
  ClassName="OpticalModule"
  ObjectIdentifier=[1,"1","1","0101010105"]
  ObjectName="OpticalModule_1_0101010105"
  TraceSamplingRate=0
bmc.kepler.Systems.OpticalModule
  Accessible=0
  ChannelNum=0
  ConnectorType=""
  FaultState=0
  FiberConnectionType=""
  Health=0
  HostSNR=[]
  Id=255
  Identifier=""
  IsSupportedType=0
  Manufacturer=""
  MediaSNR=[]
  MediumType=""
  ModuleState=255
  Name=""
  PartNumber=""
  PowerState=0
  Presence=0
  ProductionDate=""
  RelatedNetworkPorts=[]
  RevisionNumber=""
  RxLossState=false
  RxSNR=[]
  SerialNumber=""
  SilkText=""
  SpeedMatch=true
  SupportedSpeedsMbps=[]
  TemperatureCelsius=65535
  TransceiverType=""
  TransmissionDistance=""
  TxFaultState=false
  TxLossState=false
  Type=""
  TypeMatch=true
  WaveLengthNanometer=""
bmc.kepler.Systems.OpticalModule.BiasCurrent
  BiasCurrentTXLowerThresholdWarning=65535
  BiasCurrentTXUpperThresholdWarning=65535
  TXBiasCurrent1MilliAmps=0
  TXBiasCurrent2MilliAmps=0
  TXBiasCurrent3MilliAmps=0
  TXBiasCurrent4MilliAmps=0
  TXBiasCurrent5MilliAmps=0
  TXBiasCurrent6MilliAmps=0
  TXBiasCurrent7MilliAmps=0
  TXBiasCurrent8MilliAmps=0
  TXBiasCurrentMilliAmps=[]
  TXBiasCurrentStatus=0
  TXLowerThresholdCritical=65535
  TXUpperThresholdCritical=65535
bmc.kepler.Systems.OpticalModule.Diagnose
  ContaminationDetectionSupported=false
  FiberDirtyDetected=false
  FiberLoosenessDetected=false
  HostInterfaceFaultStatus=0
  LaserRuntimeSeconds=0
  LaserTemperatureCelsius=0
  MediaInterfaceFaultStatus=0
  OdspDieTemperatureCelsius=0
  OdspHighTempRuntimeSeconds=0
  PRBSTestSupported=false
  PowerOnCount=0
  PowerStatus=0
  RxLoS=0
  RxLossOfLock=0
  SelfTestStatus=0
  TxFault=0
  TxLoS=0
  TxLossOfLock=0
  UptimeSeconds=0
bmc.kepler.Systems.OpticalModule.Power
  PowerCapacityWatts=0
  PowerClass=255
  PowerRXLowerThresholdWarning=65535
  PowerRXUpperThresholdWarning=65535
  PowerTXLowerThresholdWarning=65535
  PowerTXUpperThresholdWarning=65535
  RXInputPowerMilliWatts=[]
  RXInputPowerStatus=0
  RXLowerThresholdCritical=65535
  RXUpperThresholdCritical=65535
  TXLowerThresholdCritical=65535
  TXOutputPowerMilliWatts=[]
  TXOutputPowerStatus=0
  TXUpperThresholdCritical=65535
bmc.kepler.Systems.OpticalModule.RelatedItems
  NetworkPortLanes=[]
bmc.kepler.Systems.OpticalModule.Temperature
  LowerThresholdCritical=65535
  ReadingCelsius=65535
  TemperatureLowerThresholdCritical=65535
  TemperatureLowerThresholdWarning=65535
  TemperatureUpperThresholdCritical=65535
  TemperatureUpperThresholdWarning=65535
  UpperThresholdCritical=125
bmc.kepler.Systems.OpticalModule.Voltage
  LowerThresholdCritical=65535
  SupplyVoltage=65535
  UpperThresholdCritical=65535
  VoltageLowerThresholdCritical=65535
  VoltageLowerThresholdWarning=65535
  VoltageUpperThresholdCritical=65535
  VoltageUpperThresholdWarning=65535
Private
  CreatedByDeviceObject=false
  LogicalId=255
  NetworkAdapterId="PCIeCard5(E810CQDA2G2P5)"
  PfID=255
  PortID=1

环境信息

  • 软件版本:OpenUBMC2512SP1

答案内容由AI生成,仅供参考:
根据您提供的信息,E810光模块温度获取不到的问题可以从以下方面进行排查。以下内容严格基于知识库中的案例、接口定义和属性描述。


问题分析

mdbctl lsprop 输出可见:

  • OpticalModule_0OpticalModule_1Presence = 0Accessible = 0
  • TemperatureCelsiusReadingCelsius 均为 65535(无效值)

这表明系统未能正确识别光模块,温度读取自然失败。知识库指出 “光模块温度值作为主要检测信号判断光模块是否物理存在”,当前 Presence=0 说明模块未被检测到,是温度获取失败的根因。


排查方向

1. 确认光模块硬件连接与兼容性

  • 检查光模块是否物理插入端口,与 E810 网卡(型号 E810CQDA2G2P5)是否兼容。
  • 尝试更换已知完好的光模块,排除硬件故障。

2. 检查 NCSI 协议配置是否正确

  • 当前代码使用 protocol = 'ncsi_standard',但知识库中 bmc.kepler.Systems.OpticalModule.Temperature 接口通常通过 SMBusncsi_huawei 协议获取温度。需确认 E810 网卡是否确实支持 ncsi_standard 标准协议。
  • 参考文档2:适配网讯网卡时需跳过不应有的 extra_cmd(Mellanox 私有协议)。若 E810 非 Mellanox,需确保未误用私有命令,请求的 data 内容(\x00\x00\x01\x57\x4B\x02)应与厂商文档严格匹配。
  • 建议在代码中添加日志,打印 NCSI 请求的完整报文和响应,验证协议交互是否正常。

3. 排查通讯时序与驱动问题

  • 文档1(SF200HT 网卡温度获取不到)指出 SMBus 主从切换时序问题 导致 MCTP endpoint 无法上树、温度获取失败,解决方案是 在 BMC 侧增加 10s 延时 或使用支持主从切换的固件。若 E810 光模块通过 SMBus 或类似总线通信,需检查是否存在时序冲突。
  • 文档4、5(NPU 卡温度概率获取失败)提到 驱动未加载或芯片访问时延过短 导致温度读取失败,建议调整 DrvWriteDelay(例如从 0ms 改为 100ms)。光模块温度获取也可能依赖 OS 驱动或带外接口的初始化时序。

4. 检查资源树同步与状态绑定

  • 文档10 指出网卡温度值从资源树同步时,下电后温度值不更新,需将温度状态与网卡上下电状态关联。当前 ReadingCelsius=65535 可能因模块未上电或资源树未正确更新。参考方案:在 VPD 表达式中添加 "ReadingStatus": " expr($1 == 'OFF' ? 1 : $2)"
  • 观察 PrivateNetworkAdapterId="PCIeCard5(E810CQDA2G2P5)",确认该 PCIe 设备是否正常工作(可通过 mdbctl 查看其电源状态)。

5. 利用诊断接口获取更多信息

  • 知识库中 bmc.kepler.Systems.OpticalModule.Diagnose 提供了 LaserTemperatureCelsius(当前 0)、FaultStateSelfTestStatus 等属性,可进一步判断模块健康状态。执行:
    mdbctl lsprop OpticalModule_0_0101010105 | grep -i diagnose
    
    重点关注 FaultStateSelfTestStatus

6. 验证回退函数是否被调用

  • 知识库提到 Get_Optical_Temp 是当标识符获取失败时的回退函数。检查是否存在 OpticalGetIdentifier 失败,导致温度获取路径未正确执行。查看相关日志(如 app.logcompute 组件日志)确认 NCSI 响应状态码。

7. 检查固件及版本兼容性

  • 文档5 强调 NPU 卡温度获取与 固件版本和驱动版本 相关。建议确认 E810 网卡及光模块的固件是否与 openUBMC 25.12 SP1 兼容,必要时联系厂商获取适配信息。

建议排查步骤

  1. 物理确认:更换光模块,观察 PresenceAccessible 是否变为非零值。
  2. 日志分析:在 BMC 侧增加 NCSI 请求/响应的详细日志,定位是 请求未发出响应超时 还是 响应数据异常
  3. 协议调整:尝试将 protocol 改为 ncsi_huawei 或按照 E810 厂商文档修改 data 字段。
  4. 时序调整:如果涉及 SMBus,参考文档1增加适当延时(如启动后等待 10s 再读取)。
  5. 状态绑定:参考文档10,在配置中将温度读取与网卡上电状态关联,避免下电留值。
  6. 驱动检查:确认 E810 网卡驱动已加载且光模块枚举成功(可通过 lspci -vvv 或 BMC 侧驱动日志验证)。

以上排查路径均来源于知识库中的案例和接口定义,可根据实际环境灵活执行。若问题仍未解决,建议补充更详细的 NCSI 交互日志和光模块硬件信息以便进一步定位。