Skip to content

Commit

Permalink
[fec] added logic that put port down before applying fec onfiguration (
Browse files Browse the repository at this point in the history
…sonic-net#1399)

Signed-off-by: Vadym Hlushko <[email protected]>
  • Loading branch information
vadymhlushko-mlnx authored Aug 16, 2020
1 parent 0790a5f commit 90df31d
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2358,17 +2358,45 @@ void PortsOrch::doPortTask(Consumer &consumer)
/* reset fec mode upon mode change */
if (p.m_fec_mode != fec_mode_map[fec_mode])
{
p.m_fec_mode = fec_mode_map[fec_mode];
if (setPortFec(p, p.m_fec_mode))
if (p.m_admin_state_up)
{
m_portList[alias] = p;
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
/* Bring port down before applying fec mode*/
if (!setPortAdminStatus(p, false))
{
SWSS_LOG_ERROR("Failed to set port %s admin status DOWN to set fec mode", alias.c_str());
it++;
continue;
}

p.m_admin_state_up = false;
p.m_fec_mode = fec_mode_map[fec_mode];

if (setPortFec(p, p.m_fec_mode))
{
m_portList[alias] = p;
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
}
else
{
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
it++;
continue;
}
}
else
{
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
it++;
continue;
/* Port is already down, setting fec mode*/
if (setPortFec(p, p.m_fec_mode))
{
m_portList[alias] = p;
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
}
else
{
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
it++;
continue;
}
}
}
}
Expand Down

0 comments on commit 90df31d

Please sign in to comment.