Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[portorch]: Skip to create port if the lane set isn't available in ASIC #1923

Merged
merged 7 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,7 @@ PortsOrch::PortsOrch(DBConnector *db, DBConnector *stateDb, vector<table_name_wi
for (j = 0; j < attr.value.u32list.count; j++)
{
tmp_lane_set.insert(attr.value.u32list.list[j]);
m_availableLanes.insert(attr.value.u32list.list[j]);
lguohan marked this conversation as resolved.
Show resolved Hide resolved
}

string tmp_lane_str = "";
Expand Down Expand Up @@ -2737,6 +2738,29 @@ void PortsOrch::doPortTask(Consumer &consumer)

for (auto it = m_lanesAliasSpeedMap.begin(); it != m_lanesAliasSpeedMap.end();)
{
bool lane_set_is_available = true;
for (auto lane: it->first)
{
if (m_availableLanes.find(lane) == m_availableLanes.end())
{
lane_set_is_available = false;
break;
}
}
if (!lane_set_is_available)
{
string tmp_lane_str = "";
for (auto s : it->first)
{
tmp_lane_str += to_string(s) + " ";
}
tmp_lane_str = tmp_lane_str.substr(0, tmp_lane_str.size() - 1);

SWSS_LOG_WARN("The lane set %s isn't available in ASIC", tmp_lane_str.c_str());
lguohan marked this conversation as resolved.
Show resolved Hide resolved
it++;
continue;
}

if (m_portListLaneMap.find(it->first) == m_portListLaneMap.end())
{
if (!addPort(it->first, get<1>(it->second), get<2>(it->second), get<3>(it->second)))
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ class PortsOrch : public Orch, public Subject
sai_uint32_t m_portCount;
map<set<int>, sai_object_id_t> m_portListLaneMap;
map<set<int>, tuple<string, uint32_t, int, string, int, string>> m_lanesAliasSpeedMap;
set<int> m_availableLanes;
map<string, Port> m_portList;
unordered_map<sai_object_id_t, int> m_portOidToIndex;
map<string, uint32_t> m_port_ref_count;
Expand Down