Skip to content

Commit f521da3

Browse files
committed
Skip create port if the lane set isn't available in ASIC
Signed-off-by: Ze Gan <[email protected]>
1 parent 86b4ede commit f521da3

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

orchagent/portsorch.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
468468

469469
SWSS_LOG_NOTICE("Get port with lanes pid:%" PRIx64 " lanes:%s", port_list[i], tmp_lane_str.c_str());
470470
m_portListLaneMap[tmp_lane_set] = port_list[i];
471+
m_availablePortSet.insert(tmp_lane_set);
471472
}
472473

473474
/* Get default 1Q bridge and default VLAN */
@@ -2737,6 +2738,20 @@ void PortsOrch::doPortTask(Consumer &consumer)
27372738

27382739
for (auto it = m_lanesAliasSpeedMap.begin(); it != m_lanesAliasSpeedMap.end();)
27392740
{
2741+
if (m_availablePortSet.find(it->first) == m_availablePortSet.end())
2742+
{
2743+
string tmp_lane_str = "";
2744+
for (auto s : it->first)
2745+
{
2746+
tmp_lane_str += to_string(s) + " ";
2747+
}
2748+
tmp_lane_str = tmp_lane_str.substr(0, tmp_lane_str.size() - 1);
2749+
2750+
SWSS_LOG_WARN("The lane set %s isn't available in ASIC", tmp_lane_str.c_str());
2751+
it++;
2752+
continue;
2753+
}
2754+
27402755
if (m_portListLaneMap.find(it->first) == m_portListLaneMap.end())
27412756
{
27422757
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))

orchagent/portsorch.h

+3
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,11 @@ class PortsOrch : public Orch, public Subject
213213

214214
port_config_state_t m_portConfigState = PORT_CONFIG_MISSING;
215215
sai_uint32_t m_portCount;
216+
// m_portListLaneMap is the current enabled port list
216217
map<set<int>, sai_object_id_t> m_portListLaneMap;
217218
map<set<int>, tuple<string, uint32_t, int, string, int, string>> m_lanesAliasSpeedMap;
219+
// m_availablePortSet is the available port list read from ASIC by SAI
220+
set<set<int>> m_availablePortSet;
218221
map<string, Port> m_portList;
219222
unordered_map<sai_object_id_t, int> m_portOidToIndex;
220223
map<string, uint32_t> m_port_ref_count;

0 commit comments

Comments
 (0)