Skip to content

Commit d1cd0fd

Browse files
authored
Fix error msg due to not supported "SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS" attributes (sonic-net#1745)
**What I did** 1. Add more conditions to capture SAI return code due to not supported SAI attributes. Original code only judge: `status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED` Add more conditions: `SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status)` 2. Print the error code in hex instead of dec to make it more readable. **Why I did it** To eliminate below error msg on the platform which not support "SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS" `May 10 13:02:59.806194 sonic ERR swss#orchagent: :- initSensorsTable: ASIC sensors : failed to get SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS: -196608` **How I verified it** On the Mellanox platform, in the reboot process, the above error msg will not be observed.
1 parent 278770d commit d1cd0fd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

orchagent/switchorch.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -431,14 +431,15 @@ void SwitchOrch::initSensorsTable()
431431
m_numTempSensors = attr.value.u8;
432432
m_numTempSensorsInitialized = true;
433433
}
434-
else if (status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED)
434+
else if (SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status)
435+
|| status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED)
435436
{
436437
m_numTempSensorsInitialized = true;
437438
SWSS_LOG_INFO("ASIC sensors : SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS is not supported");
438439
}
439440
else
440441
{
441-
SWSS_LOG_ERROR("ASIC sensors : failed to get SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS: %d", status);
442+
SWSS_LOG_ERROR("ASIC sensors : failed to get SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS: 0x%x", status);
442443
}
443444
}
444445

0 commit comments

Comments
 (0)