Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround getSwitchType failure due to NPU SAI not yet supporting it #647

Merged
merged 1 commit into from
Jul 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions syncd/SaiSwitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ void SaiSwitch::getDefaultMacAddress(
sai_switch_type_t SaiSwitch::getSwitchType() const
{
SWSS_LOG_ENTER();

sai_attribute_t attr;

attr.id = SAI_SWITCH_ATTR_TYPE;
Expand All @@ -149,10 +148,12 @@ sai_switch_type_t SaiSwitch::getSwitchType() const

if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_THROW("failed to get switch type");
SWSS_LOG_ERROR("failed to get switch type with status:0x%x. Assume default SAI_SWITCH_TYPE_NPU", status);
// Set to SAI_SWITCH_TYPE_NPU and move on
attr.value.s32 = SAI_SWITCH_TYPE_NPU;
}

SWSS_LOG_ERROR("switch type: '%s'", (attr.value.s32 == SAI_SWITCH_TYPE_NPU ? "SAI_SWITCH_TYPE_NPU" : "SAI_SWITCH_TYPE_PHY"));
SWSS_LOG_INFO("switch type: '%s'", (attr.value.s32 == SAI_SWITCH_TYPE_NPU ? "SAI_SWITCH_TYPE_NPU" : "SAI_SWITCH_TYPE_PHY"));

return (sai_switch_type_t) attr.value.s32;
}
Expand Down