Added shmem support for get port ecc counters Fixes JIRA https://jirasw.nvidia.com/browse/DGXOPENBMC-15778
diff --git a/nsmd/nsmPort/nsmPort.cpp b/nsmd/nsmPort/nsmPort.cpp index e4f6a35..7e18179 100644 --- a/nsmd/nsmPort/nsmPort.cpp +++ b/nsmd/nsmPort/nsmPort.cpp
@@ -1584,7 +1584,11 @@ std::shared_ptr<PortECCIntf> portECCIntf) : NsmSensorAggregator(name, type), objPath(inventoryObjPath), portNumber(portNumber), portECCIntf(portECCIntf) -{} +{ +#ifdef NVIDIA_SHMEM + updateMetricOnSharedMemory(); +#endif +} std::optional<std::vector<uint8_t>> NsmGetPortECCCounters::genRequestMsg(eid_t eid, uint8_t instanceId) @@ -1653,9 +1657,48 @@ } } portECCIntf->perLaneRawErrors(rawErrorsPerLane); + + updateMetricOnSharedMemory(); return NSM_SUCCESS; } +void NsmGetPortECCCounters::updateMetricOnSharedMemory() +{ +#ifdef NVIDIA_SHMEM + auto ifaceName = std::string(portECCIntf->interface); + std::vector<uint8_t> smbusData = {}; + + // Update SymbolErrors + { + nv::sensor_aggregation::DbusVariantType symbolErrorsValue{ + portECCIntf->symbolErrors()}; + std::string symbolErrorsProp = "SymbolErrors"; + nsm_shmem_utils::updateSharedMemoryOnSuccess( + objPath, ifaceName, symbolErrorsProp, smbusData, symbolErrorsValue); + } + + // Update CorrectedBits + { + nv::sensor_aggregation::DbusVariantType correctedBitsValue{ + portECCIntf->correctedBits()}; + std::string correctedBitsProp = "CorrectedBits"; + nsm_shmem_utils::updateSharedMemoryOnSuccess( + objPath, ifaceName, correctedBitsProp, smbusData, + correctedBitsValue); + } + + // Update PerLaneRawErrors + { + nv::sensor_aggregation::DbusVariantType perLaneRawErrorsValue{ + portECCIntf->perLaneRawErrors()}; + std::string perLaneRawErrorsProp = "PerLaneRawErrors"; + nsm_shmem_utils::updateSharedMemoryOnSuccess( + objPath, ifaceName, perLaneRawErrorsProp, smbusData, + perLaneRawErrorsValue); + } +#endif +} + static requester::Coroutine createNsmPortSensor(SensorManager& manager, const std::string& interface, const std::string& objPath,
diff --git a/nsmd/nsmPort/nsmPort.hpp b/nsmd/nsmPort/nsmPort.hpp index 83b4d46..3d2f72b 100644 --- a/nsmd/nsmPort/nsmPort.hpp +++ b/nsmd/nsmPort/nsmPort.hpp
@@ -230,6 +230,7 @@ std::optional<std::vector<uint8_t>> genRequestMsg(eid_t eid, uint8_t instanceId) override; int handleSamples(const std::vector<TelemetrySample>& samples) override; + void updateMetricOnSharedMemory() override; private: std::string objPath;