Skip to content

Commit c3c636f

Browse files
vadymhlushko-mlnxabdosi
authored andcommitted
[fec] added logic that put port down before applying fec onfiguration (sonic-net#1399)
Signed-off-by: Vadym Hlushko <[email protected]>
1 parent aa12551 commit c3c636f

File tree

1 file changed

+35
-7
lines changed

1 file changed

+35
-7
lines changed

orchagent/portsorch.cpp

+35-7
Original file line numberDiff line numberDiff line change
@@ -2003,17 +2003,45 @@ void PortsOrch::doPortTask(Consumer &consumer)
20032003
/* reset fec mode upon mode change */
20042004
if (p.m_fec_mode != fec_mode_map[fec_mode])
20052005
{
2006-
p.m_fec_mode = fec_mode_map[fec_mode];
2007-
if (setPortFec(p.m_port_id, p.m_fec_mode))
2006+
if (p.m_admin_state_up)
20082007
{
2009-
m_portList[alias] = p;
2010-
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2008+
/* Bring port down before applying fec mode*/
2009+
if (!setPortAdminStatus(p, false))
2010+
{
2011+
SWSS_LOG_ERROR("Failed to set port %s admin status DOWN to set fec mode", alias.c_str());
2012+
it++;
2013+
continue;
2014+
}
2015+
2016+
p.m_admin_state_up = false;
2017+
p.m_fec_mode = fec_mode_map[fec_mode];
2018+
2019+
if (setPortFec(p, p.m_fec_mode))
2020+
{
2021+
m_portList[alias] = p;
2022+
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2023+
}
2024+
else
2025+
{
2026+
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2027+
it++;
2028+
continue;
2029+
}
20112030
}
20122031
else
20132032
{
2014-
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2015-
it++;
2016-
continue;
2033+
/* Port is already down, setting fec mode*/
2034+
if (setPortFec(p, p.m_fec_mode))
2035+
{
2036+
m_portList[alias] = p;
2037+
SWSS_LOG_NOTICE("Set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2038+
}
2039+
else
2040+
{
2041+
SWSS_LOG_ERROR("Failed to set port %s fec to %s", alias.c_str(), fec_mode.c_str());
2042+
it++;
2043+
continue;
2044+
}
20172045
}
20182046
}
20192047
}

0 commit comments

Comments
 (0)