Skip to content

Commit

Permalink
Restore pre-emphasis when LT is transitioned from ON to OFF
Browse files Browse the repository at this point in the history
Signed-off-by: Dante Su <dante.su@broadcom.com>
  • Loading branch information
ds952811 committed May 19, 2022
1 parent 09a9b33 commit 1c6bda8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions orchagent/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ class Port
sai_object_id_t m_switch_id = 0;
sai_object_id_t m_line_side_id = 0;

/* pre-emphasis */
std::map<sai_port_serdes_attr_t, std::vector<uint32_t>> m_preemphasis;

bool m_fec_cfg = false;
bool m_an_cfg = false;
bool m_port_cap_lt = false; /* Port Capability - LinkTraining */
Expand Down
19 changes: 16 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3100,6 +3100,12 @@ void PortsOrch::doPortTask(Consumer &consumer)
p.m_link_training = lt;
m_portList[alias] = p;
updatePortStatePoll(p, PORT_STATE_POLL_LT, (lt > 0));

// Restore pre-emphasis when LT is transitioned from ON to OFF
if ((p.m_link_training < 1) && (serdes_attr.size() == 0))
{
serdes_attr = p.m_preemphasis;
}
}
}

Expand Down Expand Up @@ -3440,17 +3446,24 @@ void PortsOrch::doPortTask(Consumer &consumer)

if (serdes_attr.size() != 0)
{
if (setPortSerdesAttribute(p.m_port_id, serdes_attr))
if (p.m_link_training > 0)
{
SWSS_LOG_NOTICE("Save port %s preemphasis for LT", alias.c_str());
p.m_preemphasis = serdes_attr;
m_portList[alias] = p;
}
else if (setPortSerdesAttribute(p.m_port_id, serdes_attr))
{
SWSS_LOG_NOTICE("Set port %s preemphasis is success", alias.c_str());
SWSS_LOG_NOTICE("Set port %s preemphasis is success", alias.c_str());
p.m_preemphasis = serdes_attr;
m_portList[alias] = p;
}
else
{
SWSS_LOG_ERROR("Failed to set port %s pre-emphasis", alias.c_str());
it++;
continue;
}

}

/* Last step set port admin status */
Expand Down

0 comments on commit 1c6bda8

Please sign in to comment.