Skip to content

Commit

Permalink
Fix review comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Junchao-Mellanox committed Oct 18, 2021
1 parent fb932d6 commit de99b0f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions orchagent/copporch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,7 +1152,7 @@ bool CoppOrch::bindTrapCounter(sai_object_id_t hostif_trap_id, sai_hostif_trap_t
return false;
}

if (m_trap_id_name_map.count(hostif_trap_id) > 0)
if (m_trap_obj_name_map.count(hostif_trap_id) > 0)
{
return true;
}
Expand Down Expand Up @@ -1186,16 +1186,16 @@ bool CoppOrch::bindTrapCounter(sai_object_id_t hostif_trap_id, sai_hostif_trap_t

// Update FLEX_COUNTER table
std::unordered_set<std::string> counter_stats;
FlowCounterHandler::getGenericCounterIdList(counter_stats);
FlowCounterHandler::getGenericCounterStatIdList(counter_stats);
m_trap_counter_manager.setCounterIdList(counter_id, CounterType::HOSTIF_TRAP, counter_stats);
m_trap_id_name_map.emplace(hostif_trap_id, trap_name);
m_trap_obj_name_map.emplace(hostif_trap_id, trap_name);
return true;
}

void CoppOrch::unbindTrapCounter(sai_object_id_t hostif_trap_id)
{
auto iter = m_trap_id_name_map.find(hostif_trap_id);
if (iter == m_trap_id_name_map.end())
auto iter = m_trap_obj_name_map.find(hostif_trap_id);
if (iter == m_trap_obj_name_map.end())
{
return;
}
Expand All @@ -1208,7 +1208,7 @@ void CoppOrch::unbindTrapCounter(sai_object_id_t hostif_trap_id)
sai_deserialize_object_id(counter_oid_str, counter_id);
m_trap_counter_manager.clearCounterIdList(counter_id);

// Remmove trap from COUNTERS_TRAP_NAME_MAP
// Remove trap from COUNTERS_TRAP_NAME_MAP
m_counter_table->hdel("", iter->second);

// Unbind generic counter to trap
Expand All @@ -1224,7 +1224,7 @@ void CoppOrch::unbindTrapCounter(sai_object_id_t hostif_trap_id)
// Remove generic counter
FlowCounterHandler::removeGenericCounter(counter_id);

m_trap_id_name_map.erase(iter);
m_trap_obj_name_map.erase(iter);
}

void CoppOrch::generateHostIfTrapCounterIdList()
Expand Down
4 changes: 2 additions & 2 deletions orchagent/copporch.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef std::map<sai_hostif_trap_type_t, sai_object_id_t> TrapIdHostIfTableMap;
/* Trap group to trap ID attributes */
typedef std::map<std::string, TrapIdAttribs> TrapGroupTrapIdAttribs;
/* Trap OID to trap name*/
typedef std::map<sai_object_id_t, std::string> TrapIdNameMap;
typedef std::map<sai_object_id_t, std::string> TrapObjectTrapNameMap;

class CoppOrch : public Orch
{
Expand All @@ -73,7 +73,7 @@ class CoppOrch : public Orch
TrapGroupHostIfMap m_trap_group_hostif_map;
TrapIdHostIfTableMap m_trapid_hostif_table_map;
TrapGroupTrapIdAttribs m_trap_group_trap_id_attrs;
TrapIdNameMap m_trap_id_name_map;
TrapObjectTrapNameMap m_trap_obj_name_map;

std::shared_ptr<DBConnector> m_counter_db;
std::shared_ptr<DBConnector> m_flex_db;
Expand Down
2 changes: 1 addition & 1 deletion orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ unordered_map<string, string> flexCounterGroupMap =
{
{"PORT", PORT_STAT_COUNTER_FLEX_COUNTER_GROUP},
{"PORT_RATES", PORT_RATE_COUNTER_FLEX_COUNTER_GROUP},
{"PORT_BUFFER_DROP", PORT_BUFFER_DROP_STAT_FLEX_COUNTER_GROUP},
{"PORT_BUFFER_DROP", PORT_STAT_COUNTER_FLEX_COUNTER_GROUP},
{"QUEUE", QUEUE_STAT_COUNTER_FLEX_COUNTER_GROUP},
{"PFCWD", PFC_WD_FLEX_COUNTER_GROUP},
{"QUEUE_WATERMARK", QUEUE_WATERMARK_STAT_COUNTER_FLEX_COUNTER_GROUP},
Expand Down
2 changes: 1 addition & 1 deletion orchagent/flow_counter/flow_counter_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ bool FlowCounterHandler::removeGenericCounter(sai_object_id_t counter_id)
return true;
}

void FlowCounterHandler::getGenericCounterIdList(std::unordered_set<std::string>& counter_stats)
void FlowCounterHandler::getGenericCounterStatIdList(std::unordered_set<std::string>& counter_stats)
{
for (const auto& it: generic_counter_stat_ids)
{
Expand Down
2 changes: 1 addition & 1 deletion orchagent/flow_counter/flow_counter_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ class FlowCounterHandler
public:
static bool createGenericCounter(sai_object_id_t &counter_id);
static bool removeGenericCounter(sai_object_id_t counter_id);
static void getGenericCounterIdList(std::unordered_set<std::string>& counter_stats);
static void getGenericCounterStatIdList(std::unordered_set<std::string>& counter_stats);
};

0 comments on commit de99b0f

Please sign in to comment.