Skip to content

Commit

Permalink
Make minor fixes for code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
royyi8 committed May 15, 2024
1 parent 02c641e commit 208cf4e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions orchagent/port/porthlpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ static const std::unordered_map<std::string, Port::Role> portRoleMap =
{ PORT_ROLE_DPC, Port::Role::Dpc }
};

static const std::unordered_map<std::string, sai_redis_link_event_damping_algorithm_t> linkEventDampingAlgorithmMap =
static const std::unordered_map<std::string, sai_redis_link_event_damping_algorithm_t> g_linkEventDampingAlgorithmMap =
{
{ "disabled", SAI_REDIS_LINK_EVENT_DAMPING_ALGORITHM_DISABLED },
{ "aied", SAI_REDIS_LINK_EVENT_DAMPING_ALGORITHM_AIED }
Expand Down Expand Up @@ -240,7 +240,7 @@ std::string PortHelper::getAdminStatusStr(const PortConfig &port) const
return this->getFieldValueStr(port, PORT_ADMIN_STATUS);
}

std::string PortHelper::getDampingAlgoStr(const PortConfig &port) const
std::string PortHelper::getDampingAlgorithm(const PortConfig &port) const
{
return this->getFieldValueStr(port, PORT_DAMPING_ALGO);
}
Expand Down Expand Up @@ -771,8 +771,8 @@ bool PortHelper::parsePortLinkEventDampingAlgorithm(PortConfig &port, const std:
return false;
}

const auto &cit = linkEventDampingAlgorithmMap.find(value);
if (cit == linkEventDampingAlgorithmMap.cend())
const auto &cit = g_linkEventDampingAlgorithmMap.find(value);
if (cit == g_linkEventDampingAlgorithmMap.cend())
{
SWSS_LOG_ERROR("Failed to parse field(%s): invalid value(%s)", field.c_str(), value.c_str());
return false;
Expand Down
2 changes: 1 addition & 1 deletion orchagent/port/porthlpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class PortHelper final
std::string getLearnModeStr(const PortConfig &port) const;
std::string getLinkTrainingStr(const PortConfig &port) const;
std::string getAdminStatusStr(const PortConfig &port) const;
std::string getDampingAlgoStr(const PortConfig &port) const;
std::string getDampingAlgoritm(const PortConfig &port) const;

bool parsePortConfig(PortConfig &port) const;
bool validatePortConfig(PortConfig &port) const;
Expand Down
7 changes: 4 additions & 3 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3003,7 +3003,8 @@ task_process_status PortsOrch::setPortLinkTraining(const Port &port, bool state)
}

ReturnCode PortsOrch::setPortLinkEventDampingAlgorithm(Port &port,
sai_redis_link_event_damping_algorithm_t &link_event_damping_algorithm) {
sai_redis_link_event_damping_algorithm_t &link_event_damping_algorithm)
{
SWSS_LOG_ENTER();
sai_attribute_t attr;
attr.id = SAI_REDIS_PORT_ATTR_LINK_EVENT_DAMPING_ALGORITHM;
Expand Down Expand Up @@ -3915,7 +3916,7 @@ void PortsOrch::doPortTask(Consumer &consumer)
{
SWSS_LOG_ERROR(
"Failed to set port %s link event damping algorithm to %s",
p.m_alias.c_str(), m_portHlpr.getDampingAlgoStr(pCfg).c_str()
p.m_alias.c_str(), m_portHlpr.getDampingAlgorithm(pCfg).c_str()
);
it = taskMap.erase(it);
continue;
Expand All @@ -3926,7 +3927,7 @@ void PortsOrch::doPortTask(Consumer &consumer)

SWSS_LOG_NOTICE(
"Set port %s link event damping algorithm to %s",
p.m_alias.c_str(), m_portHlpr.getDampingAlgoStr(pCfg).c_str()
p.m_alias.c_str(), m_portHlpr.getDampingAlgorithm(pCfg).c_str()
);
}
}
Expand Down

0 comments on commit 208cf4e

Please sign in to comment.