@@ -3703,7 +3703,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
3703
3703
p.m_preemphasis = serdes_attr;
3704
3704
m_portList[alias] = p;
3705
3705
}
3706
- else if (setPortSerdesAttribute (p.m_port_id , serdes_attr))
3706
+ else if (setPortSerdesAttribute (p.m_port_id , gSwitchId , serdes_attr))
3707
3707
{
3708
3708
SWSS_LOG_NOTICE (" Set port %s preemphasis is success" , alias.c_str ());
3709
3709
p.m_preemphasis = serdes_attr;
@@ -6530,7 +6530,7 @@ bool PortsOrch::removeAclTableGroup(const Port &p)
6530
6530
return true ;
6531
6531
}
6532
6532
6533
- bool PortsOrch::setPortSerdesAttribute (sai_object_id_t port_id,
6533
+ bool PortsOrch::setPortSerdesAttribute (sai_object_id_t port_id, sai_object_id_t switch_id,
6534
6534
map<sai_port_serdes_attr_t , vector<uint32_t >> &serdes_attr)
6535
6535
{
6536
6536
SWSS_LOG_ENTER ();
@@ -6582,7 +6582,7 @@ bool PortsOrch::setPortSerdesAttribute(sai_object_id_t port_id,
6582
6582
port_serdes_attr.value .u32list .list = it->second .data ();
6583
6583
attr_list.emplace_back (port_serdes_attr);
6584
6584
}
6585
- status = sai_port_api->create_port_serdes (&port_serdes_id, gSwitchId ,
6585
+ status = sai_port_api->create_port_serdes (&port_serdes_id, switch_id ,
6586
6586
static_cast <uint32_t >(serdes_attr.size ()+1 ),
6587
6587
attr_list.data ());
6588
6588
@@ -6648,6 +6648,22 @@ void PortsOrch::getPortSerdesVal(const std::string& val_str,
6648
6648
}
6649
6649
}
6650
6650
6651
+ void PortsOrch::getPortSerdesValBase10 (const std::string& val_str,
6652
+ std::vector<uint32_t > &lane_values)
6653
+ {
6654
+ SWSS_LOG_ENTER ();
6655
+
6656
+ uint32_t lane_val;
6657
+ std::string lane_str;
6658
+ std::istringstream iss (val_str);
6659
+
6660
+ while (std::getline (iss, lane_str, ' ,' ))
6661
+ {
6662
+ lane_val = (uint32_t )std::stoul (lane_str, NULL , 10 );
6663
+ lane_values.push_back (lane_val);
6664
+ }
6665
+ }
6666
+
6651
6667
bool PortsOrch::getPortAdvSpeedsVal (const std::string &val_str,
6652
6668
std::vector<uint32_t > &speed_values)
6653
6669
{
@@ -7017,6 +7033,50 @@ bool PortsOrch::initGearboxPort(Port &port)
7017
7033
7018
7034
fields[0 ] = FieldValueTuple (port.m_alias + " _line" , sai_serialize_object_id (linePort));
7019
7035
m_gbcounterTable->set (" " , fields);
7036
+
7037
+ /* Set serdes tx taps on system and line side */
7038
+ map<sai_port_serdes_attr_t , vector<uint32_t >> serdes_attr;
7039
+ typedef pair<sai_port_serdes_attr_t , vector<uint32_t >> serdes_attr_pair;
7040
+ vector<uint32_t > attr_val;
7041
+ for (auto pair: tx_fir_strings_system_side) {
7042
+ if (m_gearboxInterfaceMap[port.m_index ].tx_firs .find (pair.first ) != m_gearboxInterfaceMap[port.m_index ].tx_firs .end () ) {
7043
+ attr_val.clear ();
7044
+ getPortSerdesValBase10 (m_gearboxInterfaceMap[port.m_index ].tx_firs [pair.first ], attr_val);
7045
+ serdes_attr.insert (serdes_attr_pair (pair.second , attr_val));
7046
+ }
7047
+ }
7048
+ if (serdes_attr.size () != 0 )
7049
+ {
7050
+ if (setPortSerdesAttribute (systemPort, phyOid, serdes_attr))
7051
+ {
7052
+ SWSS_LOG_NOTICE (" Set port %s system side preemphasis is success" , port.m_alias .c_str ());
7053
+ }
7054
+ else
7055
+ {
7056
+ SWSS_LOG_ERROR (" Failed to set port %s system side pre-emphasis" , port.m_alias .c_str ());
7057
+ return false ;
7058
+ }
7059
+ }
7060
+ serdes_attr.clear ();
7061
+ for (auto pair: tx_fir_strings_line_side) {
7062
+ if (m_gearboxInterfaceMap[port.m_index ].tx_firs .find (pair.first ) != m_gearboxInterfaceMap[port.m_index ].tx_firs .end () ) {
7063
+ attr_val.clear ();
7064
+ getPortSerdesValBase10 (m_gearboxInterfaceMap[port.m_index ].tx_firs [pair.first ], attr_val);
7065
+ serdes_attr.insert (serdes_attr_pair (pair.second , attr_val));
7066
+ }
7067
+ }
7068
+ if (serdes_attr.size () != 0 )
7069
+ {
7070
+ if (setPortSerdesAttribute (linePort, phyOid, serdes_attr))
7071
+ {
7072
+ SWSS_LOG_NOTICE (" Set port %s line side preemphasis is success" , port.m_alias .c_str ());
7073
+ }
7074
+ else
7075
+ {
7076
+ SWSS_LOG_ERROR (" Failed to set port %s line side pre-emphasis" , port.m_alias .c_str ());
7077
+ return false ;
7078
+ }
7079
+ }
7020
7080
}
7021
7081
}
7022
7082
0 commit comments