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 <vadymh@mellanox.com>
  • Loading branch information
vadymhlushko-mlnx authored and abdosi committed Aug 19, 2020
1 parent aa12551 commit c3c636f
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 @@ -2003,17 +2003,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.m_port_id, 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 c3c636f

Please sign in to comment.