Skip to content

Commit

Permalink
Remove the platform check for remove/add port action at init phase. (s…
Browse files Browse the repository at this point in the history
…onic-net#1006)

Signed-off-by: Zhenggen Xu <zxu@linkedin.com>
  • Loading branch information
zhenggen-xu authored and Tony Titus committed Jul 31, 2019
1 parent c39f6d2 commit 1e96972
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1639,19 +1639,10 @@ void PortsOrch::doPortTask(Consumer &consumer)
getPortSpeed(it->second, port_speed);
if ((m_lanesAliasSpeedMap.find(it->first) == m_lanesAliasSpeedMap.end()) || (get<1>(is->second) != port_speed))
{
char *platform = getenv("platform");
if (platform && (strstr(platform, BFN_PLATFORM_SUBSTRING) || strstr(platform, MLNX_PLATFORM_SUBSTRING) || strstr(platform, INVM_PLATFORM_SUBSTRING)))
if (!removePort(it->second))
{
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);
throw runtime_error("PortsOrch initialization failure.");
}

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

if (m_portListLaneMap.find(it->first) == m_portListLaneMap.end())
{
// 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) || strstr(platform, INVM_PLATFORM_SUBSTRING)))
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
{
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());
throw runtime_error("PortsOrch initialization failure.");
}
port_created = true;
}
else
{
Expand Down Expand Up @@ -2745,7 +2725,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 @@ -2929,8 +2909,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

0 comments on commit 1e96972

Please sign in to comment.