Skip to content

Commit b5faa57

Browse files
authored
Cherry-pick of Master PR: #1814 in v1.10
Cherry-pick of Master PR: #1814 in v1.10 Signed-off-by: Abhishek Dosi <[email protected]>
1 parent 161f9f7 commit b5faa57

File tree

1 file changed

+32
-9
lines changed

1 file changed

+32
-9
lines changed

test/saithrift/src/switch_sai_rpc_server.cpp

+32-9
Original file line numberDiff line numberDiff line change
@@ -1685,13 +1685,29 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf {
16851685
port_lane_list_attribute.value.u32list.count = 8;
16861686
port_api->get_port_attribute(port_list_object_attribute.value.objlist.list[i], 1, &port_lane_list_attribute);
16871687

1688-
std::set<int> port_lanes;
16891688
uint32_t laneCnt = port_lane_list_attribute.value.u32list.count;
1690-
for (int j=0 ; j<laneCnt; j++){
1691-
port_lanes.insert(port_lane_list_attribute.value.u32list.list[j]);
1689+
uint32_t laneMatchCount = 0;
1690+
1691+
for (gPortMapIt = gPortMap.begin(); gPortMapIt != gPortMap.end(); gPortMapIt++)
1692+
{
1693+
laneMatchCount = 0;
1694+
for (int j=0; j<laneCnt; j++)
1695+
{
1696+
if (gPortMapIt->first.count(port_lane_list_attribute.value.u32list.list[j]))
1697+
{
1698+
laneMatchCount++;
1699+
}
1700+
else
1701+
{
1702+
break;
1703+
}
1704+
}
1705+
if (laneMatchCount == laneCnt)
1706+
{
1707+
break;
1708+
}
16921709
}
16931710

1694-
gPortMapIt = gPortMap.find(port_lanes);
16951711
if (gPortMapIt != gPortMap.end()){
16961712
std::string front_port_alias = gPortMapIt->second.c_str();
16971713
std::string front_port_number;
@@ -1774,13 +1790,20 @@ class switch_sai_rpcHandler : virtual public switch_sai_rpcIf {
17741790
port_lane_list_attribute.value.u32list.count = 8;
17751791
port_api->get_port_attribute(port_list_object_attribute.value.objlist.list[i], 1, &port_lane_list_attribute);
17761792

1777-
std::set<int> port_lanes;
17781793
uint32_t laneCnt = port_lane_list_attribute.value.u32list.count;
1779-
for (int j=0 ; j<laneCnt; j++){
1780-
port_lanes.insert(port_lane_list_attribute.value.u32list.list[j]);
1794+
uint32_t laneMatchCount = 0;
1795+
for (int j=0 ; j<laneCnt; j++)
1796+
{
1797+
if (lane_set.count(port_lane_list_attribute.value.u32list.list[j]))
1798+
{
1799+
laneMatchCount++;
1800+
}
1801+
else
1802+
{
1803+
break;
1804+
}
17811805
}
1782-
1783-
if (port_lanes == lane_set){
1806+
if (laneCnt == laneMatchCount){
17841807
port_id = (sai_thrift_object_id_t) port_list_object_attribute.value.objlist.list[i];
17851808
free(port_list_object_attribute.value.objlist.list);
17861809
free(port_lane_list_attribute.value.u32list.list);

0 commit comments

Comments
 (0)