Skip to content

Commit

Permalink
Fix error msg due to not supported "SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEM…
Browse files Browse the repository at this point in the history
…P_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.
  • Loading branch information
keboliu authored May 24, 2021
1 parent 278770d commit d1cd0fd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions orchagent/switchorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,14 +431,15 @@ void SwitchOrch::initSensorsTable()
m_numTempSensors = attr.value.u8;
m_numTempSensorsInitialized = true;
}
else if (status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED)
else if (SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) || SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status)
|| status == SAI_STATUS_NOT_SUPPORTED || status == SAI_STATUS_NOT_IMPLEMENTED)
{
m_numTempSensorsInitialized = true;
SWSS_LOG_INFO("ASIC sensors : SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS is not supported");
}
else
{
SWSS_LOG_ERROR("ASIC sensors : failed to get SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS: %d", status);
SWSS_LOG_ERROR("ASIC sensors : failed to get SAI_SWITCH_ATTR_MAX_NUMBER_OF_TEMP_SENSORS: 0x%x", status);
}
}

Expand Down

0 comments on commit d1cd0fd

Please sign in to comment.