Skip to content

Commit 01fc353

Browse files
committed
Add base argument and tx_fir_pre3/post3
1 parent 20318cf commit 01fc353

File tree

3 files changed

+8
-22
lines changed

3 files changed

+8
-22
lines changed

orchagent/portsorch.cpp

+5-20
Original file line numberDiff line numberDiff line change
@@ -6633,7 +6633,8 @@ void PortsOrch::removePortSerdesAttribute(sai_object_id_t port_id)
66336633
}
66346634

66356635
void PortsOrch::getPortSerdesVal(const std::string& val_str,
6636-
std::vector<uint32_t> &lane_values)
6636+
std::vector<uint32_t> &lane_values,
6637+
int base)
66376638
{
66386639
SWSS_LOG_ENTER();
66396640

@@ -6643,23 +6644,7 @@ void PortsOrch::getPortSerdesVal(const std::string& val_str,
66436644

66446645
while (std::getline(iss, lane_str, ','))
66456646
{
6646-
lane_val = (uint32_t)std::stoul(lane_str, NULL, 16);
6647-
lane_values.push_back(lane_val);
6648-
}
6649-
}
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);
6647+
lane_val = (uint32_t)std::stoul(lane_str, NULL, base);
66636648
lane_values.push_back(lane_val);
66646649
}
66656650
}
@@ -7041,7 +7026,7 @@ bool PortsOrch::initGearboxPort(Port &port)
70417026
for (auto pair: tx_fir_strings_system_side) {
70427027
if (m_gearboxInterfaceMap[port.m_index].tx_firs.find(pair.first) != m_gearboxInterfaceMap[port.m_index].tx_firs.end() ) {
70437028
attr_val.clear();
7044-
getPortSerdesValBase10(m_gearboxInterfaceMap[port.m_index].tx_firs[pair.first], attr_val);
7029+
getPortSerdesVal(m_gearboxInterfaceMap[port.m_index].tx_firs[pair.first], attr_val, 10);
70457030
serdes_attr.insert(serdes_attr_pair(pair.second, attr_val));
70467031
}
70477032
}
@@ -7061,7 +7046,7 @@ bool PortsOrch::initGearboxPort(Port &port)
70617046
for (auto pair: tx_fir_strings_line_side) {
70627047
if (m_gearboxInterfaceMap[port.m_index].tx_firs.find(pair.first) != m_gearboxInterfaceMap[port.m_index].tx_firs.end() ) {
70637048
attr_val.clear();
7064-
getPortSerdesValBase10(m_gearboxInterfaceMap[port.m_index].tx_firs[pair.first], attr_val);
7049+
getPortSerdesVal(m_gearboxInterfaceMap[port.m_index].tx_firs[pair.first], attr_val, 10);
70657050
serdes_attr.insert(serdes_attr_pair(pair.second, attr_val));
70667051
}
70677052
}

orchagent/portsorch.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ class PortsOrch : public Orch, public Subject
395395
void refreshPortStateAutoNeg(const Port &port);
396396
void refreshPortStateLinkTraining(const Port &port);
397397

398-
void getPortSerdesVal(const std::string& s, std::vector<uint32_t> &lane_values);
399-
void getPortSerdesValBase10(const std::string& s, std::vector<uint32_t> &lane_values);
398+
void getPortSerdesVal(const std::string& s, std::vector<uint32_t> &lane_values, int base = 16);
400399
bool getPortAdvSpeedsVal(const std::string &s, std::vector<uint32_t> &speed_values);
401400
bool getPortInterfaceTypeVal(const std::string &s, sai_port_interface_type_t &interface_type);
402401
bool getPortAdvInterfaceTypesVal(const std::string &s, std::vector<uint32_t> &type_values);

tests/test_gearbox.py

+2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ def __init__(self, db_id: int, connector: str, gearbox: Gearbox):
104104
("SAI_PORT_SERDES_ATTR_TX_FIR_MAIN", "tx_fir_main"),
105105
("SAI_PORT_SERDES_ATTR_TX_FIR_PRE1", "tx_fir_pre1"),
106106
("SAI_PORT_SERDES_ATTR_TX_FIR_PRE2", "tx_fir_pre2"),
107+
("SAI_PORT_SERDES_ATTR_TX_FIR_PRE3", "tx_fir_pre3"),
107108
("SAI_PORT_SERDES_ATTR_TX_FIR_POST1", "tx_fir_post1"),
108109
("SAI_PORT_SERDES_ATTR_TX_FIR_POST2", "tx_fir_post2"),
110+
("SAI_PORT_SERDES_ATTR_TX_FIR_POST3", "tx_fir_post3"),
109111
]:
110112
if asic_db_key not in fvs:
111113
continue

0 commit comments

Comments
 (0)