Skip to content

Commit 1c6bda8

Browse files
committed
Restore pre-emphasis when LT is transitioned from ON to OFF
Signed-off-by: Dante Su <[email protected]>
1 parent 09a9b33 commit 1c6bda8

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

orchagent/port.h

+3
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,9 @@ class Port
174174
sai_object_id_t m_switch_id = 0;
175175
sai_object_id_t m_line_side_id = 0;
176176

177+
/* pre-emphasis */
178+
std::map<sai_port_serdes_attr_t, std::vector<uint32_t>> m_preemphasis;
179+
177180
bool m_fec_cfg = false;
178181
bool m_an_cfg = false;
179182
bool m_port_cap_lt = false; /* Port Capability - LinkTraining */

orchagent/portsorch.cpp

+16-3
Original file line numberDiff line numberDiff line change
@@ -3100,6 +3100,12 @@ void PortsOrch::doPortTask(Consumer &consumer)
31003100
p.m_link_training = lt;
31013101
m_portList[alias] = p;
31023102
updatePortStatePoll(p, PORT_STATE_POLL_LT, (lt > 0));
3103+
3104+
// Restore pre-emphasis when LT is transitioned from ON to OFF
3105+
if ((p.m_link_training < 1) && (serdes_attr.size() == 0))
3106+
{
3107+
serdes_attr = p.m_preemphasis;
3108+
}
31033109
}
31043110
}
31053111

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

34413447
if (serdes_attr.size() != 0)
34423448
{
3443-
if (setPortSerdesAttribute(p.m_port_id, serdes_attr))
3449+
if (p.m_link_training > 0)
3450+
{
3451+
SWSS_LOG_NOTICE("Save port %s preemphasis for LT", alias.c_str());
3452+
p.m_preemphasis = serdes_attr;
3453+
m_portList[alias] = p;
3454+
}
3455+
else if (setPortSerdesAttribute(p.m_port_id, serdes_attr))
34443456
{
3445-
SWSS_LOG_NOTICE("Set port %s preemphasis is success", alias.c_str());
3457+
SWSS_LOG_NOTICE("Set port %s preemphasis is success", alias.c_str());
3458+
p.m_preemphasis = serdes_attr;
3459+
m_portList[alias] = p;
34463460
}
34473461
else
34483462
{
34493463
SWSS_LOG_ERROR("Failed to set port %s pre-emphasis", alias.c_str());
34503464
it++;
34513465
continue;
34523466
}
3453-
34543467
}
34553468

34563469
/* Last step set port admin status */

0 commit comments

Comments
 (0)