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

fixed unsupported resource issue #1641

Merged
merged 2 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 8 additions & 2 deletions orchagent/crmorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,12 @@ void CrmOrch::getResAvailableCounters()

for (auto &res : m_resourcesMap)
{
// ignore unsupported resources
if (res.second.resStatus != CrmResourceStatus::CRM_RES_SUPPORTED)
{
continue;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PrabhuSreenivasan please use { } notation and move it at the beginning of the loop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nazariig , Thanks. I have made the suggested changes.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

sai_attribute_t attr;
attr.id = crmResSaiAvailAttrMap.at(res.first);

Expand All @@ -462,8 +468,8 @@ void CrmOrch::getResAvailableCounters()
SAI_STATUS_IS_ATTR_NOT_SUPPORTED(status) ||
SAI_STATUS_IS_ATTR_NOT_IMPLEMENTED(status))
{
// remove unsupported resources from map
m_resourcesMap.erase(res.first);
// mark unsupported resources
res.second.resStatus = CrmResourceStatus::CRM_RES_NOT_SUPPORTED;
SWSS_LOG_NOTICE("Switch attribute %u not supported", attr.id);
break;
}
Expand Down
7 changes: 7 additions & 0 deletions orchagent/crmorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ enum class CrmThresholdType
CRM_FREE,
};

enum class CrmResourceStatus
{
CRM_RES_SUPPORTED,
CRM_RES_NOT_SUPPORTED,
};

class CrmOrch : public Orch
{
public:
Expand Down Expand Up @@ -77,6 +83,7 @@ class CrmOrch : public Orch
std::map<std::string, CrmResourceCounter> countersMap;

uint32_t exceededLogCounter = 0;
CrmResourceStatus resStatus = CrmResourceStatus::CRM_RES_SUPPORTED;
};

std::chrono::seconds m_pollingInterval;
Expand Down