Skip to content
Closed
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
36 changes: 28 additions & 8 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1637,10 +1637,19 @@ void PortsOrch::doPortTask(Consumer &consumer)
{
if (m_lanesAliasSpeedMap.find(it->first) == m_lanesAliasSpeedMap.end())
{
if (!removePort(it->second))
char *platform = getenv("platform");
if (platform && (strstr(platform, BFN_PLATFORM_SUBSTRING) || strstr(platform, MLNX_PLATFORM_SUBSTRING)))
{
throw runtime_error("PortsOrch initialization failure.");
if (!removePort(it->second))
{
throw runtime_error("PortsOrch initialization failure.");
}
}
else
{
SWSS_LOG_NOTICE("Failed to remove Port %" PRIx64 " due to missing SAI remove_port API.", it->second);
}

it = m_portListLaneMap.erase(it);
}
else
Expand All @@ -1655,11 +1664,22 @@ void PortsOrch::doPortTask(Consumer &consumer)

if (m_portListLaneMap.find(it->first) == m_portListLaneMap.end())
{
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
// work around to avoid syncd termination on SAI error due missing create_port SAI API
// can be removed when SAI redis return NotImplemented error
char *platform = getenv("platform");
if (platform && (strstr(platform, BFN_PLATFORM_SUBSTRING) || strstr(platform, MLNX_PLATFORM_SUBSTRING)))
{
throw runtime_error("PortsOrch initialization failure.");
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
{
throw runtime_error("PortsOrch initialization failure.");
}

port_created = true;
}
else
{
SWSS_LOG_NOTICE("Failed to create Port %s due to missing SAI create_port API.", get<0>(it->second).c_str());
}
port_created = true;
}
else
{
Expand Down Expand Up @@ -2723,7 +2743,7 @@ bool PortsOrch::removeVlan(Port vlan)
SWSS_LOG_ENTER();
if (m_port_ref_count[vlan.m_alias] > 0)
{
SWSS_LOG_ERROR("Failed to remove ref count %d VLAN %s",
SWSS_LOG_ERROR("Failed to remove ref count %d VLAN %s",
m_port_ref_count[vlan.m_alias],
vlan.m_alias.c_str());
return false;
Expand Down Expand Up @@ -2907,8 +2927,8 @@ bool PortsOrch::removeLag(Port lag)

if (m_port_ref_count[lag.m_alias] > 0)
{
SWSS_LOG_ERROR("Failed to remove ref count %d LAG %s",
m_port_ref_count[lag.m_alias],
SWSS_LOG_ERROR("Failed to remove ref count %d LAG %s",
m_port_ref_count[lag.m_alias],
lag.m_alias.c_str());
return false;
}
Expand Down