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 Apr 2, 2022
1 parent 5466fdc commit e40c736
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
12 changes: 6 additions & 6 deletions orchagent/flex_counter/flowcounterrouteorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ void FlowCounterRouteOrch::doTask(SelectableTimer &timer)
getRouteFlowCounterNameMapKey(vrf_id, route_pattern.ip_prefix, pattern);
prefixToPatternMap.emplace_back(nameMapKey, pattern);

insertOrUpdateRouterFlowCounterCache(route_pattern, ip_prefix, inner_iter->second, mBoundRouteCounters);
updateRouterFlowCounterCache(route_pattern, ip_prefix, inner_iter->second, mBoundRouteCounters);
inner_iter = it->second.erase(inner_iter);
}
else
Expand Down Expand Up @@ -558,7 +558,7 @@ void FlowCounterRouteOrch::pendingUpdateFlexDb(const RoutePattern &route_pattern
{
SWSS_LOG_ENTER();
bool was_empty = mPendingAddToFlexCntr.empty();
insertOrUpdateRouterFlowCounterCache(route_pattern, ip_prefix, counter_oid, mPendingAddToFlexCntr);
updateRouterFlowCounterCache(route_pattern, ip_prefix, counter_oid, mPendingAddToFlexCntr);
if (was_empty)
{
mFlexCounterUpdTimer->start();
Expand Down Expand Up @@ -648,12 +648,12 @@ void FlowCounterRouteOrch::createRouteFlowCounterByPattern(const RoutePattern &r

createRouteFlowCounterFromVnetRoutes(route_pattern, current_bound_count);

auto other_iter = mMiscRoutes.find(route_pattern.vrf_id);
if (other_iter != mMiscRoutes.end())
auto misc_iter = mMiscRoutes.find(route_pattern.vrf_id);
if (misc_iter != mMiscRoutes.end())
{
SWSS_LOG_NOTICE("Creating route flow counter for pattern %s for other type route entries", route_pattern.to_string().c_str());

for (auto ip_prefix : other_iter->second)
for (auto ip_prefix : misc_iter->second)
{
if (current_bound_count == route_pattern.max_match_count)
{
Expand Down Expand Up @@ -890,7 +890,7 @@ void FlowCounterRouteOrch::removeRouteFlowCounterFromDB(sai_object_id_t vrf_id,
mRouteFlowCounterMgr.clearCounterIdList(counter_oid);
}

void FlowCounterRouteOrch::insertOrUpdateRouterFlowCounterCache(
void FlowCounterRouteOrch::updateRouterFlowCounterCache(
const RoutePattern &route_pattern,
const IpPrefix &ip_prefix,
sai_object_id_t counter_oid,
Expand Down
9 changes: 1 addition & 8 deletions orchagent/flex_counter/flowcounterrouteorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,6 @@ struct RoutePattern
typedef std::set<RoutePattern> RoutePatternSet;
/* RoutePattern to <prefix, counter OID> */
typedef std::map<RoutePattern, std::map<IpPrefix, sai_object_id_t>> RouterFlowCounterCache;
/* RoutePattern to prefix set */
typedef std::map<RoutePattern, std::set<IpPrefix>> RouterPatternToPrefixMap;
/* IP2ME, MUX, VNET route entries */
typedef std::map<sai_object_id_t, std::set<IpPrefix>> MiscRouteEntryMap;

Expand Down Expand Up @@ -134,18 +132,13 @@ class FlowCounterRouteOrch : public Orch
std::unique_ptr<Table> mPrefixToCounterTable;
std::unique_ptr<Table> mPrefixToPatternTable;

// TODO: remove bulk support from this feature
bool mRouteFlowCounterSupported = false;
/* Route pattern set, store configured route patterns */
RoutePatternSet mRoutePatternSet;
/* Cache for those bound route flow counters*/
RouterFlowCounterCache mBoundRouteCounters;
/* Cache for those route flow counters pending update to FLEX DB */
RouterFlowCounterCache mPendingAddToFlexCntr;
/* Cache for those newly added routes which match pattern */
RouterPatternToPrefixMap mPendingBindRoutes;
/* Cache for those newly removed routes which match pattern */
RouterPatternToPrefixMap mPendingUnbindRoutes; // Used to cache newly added routes in doTask function
/* IP2ME, MUX */ // TODO: remove MUX support
MiscRouteEntryMap mMiscRoutes; // Save here for route flow counter
/* Flex counter manager for route flow counter */
Expand All @@ -161,7 +154,7 @@ class FlowCounterRouteOrch : public Orch
bool bindFlowCounter(const RoutePattern &route_pattern, sai_object_id_t vrf_id, const IpPrefix& ip_prefix);
void unbindFlowCounter(const RoutePattern &route_pattern, sai_object_id_t vrf_id, const IpPrefix& ip_prefix, sai_object_id_t counter_oid);
void pendingUpdateFlexDb(const RoutePattern &route_pattern, const IpPrefix &ip_prefix, sai_object_id_t counter_oid);
void insertOrUpdateRouterFlowCounterCache(
void updateRouterFlowCounterCache(
const RoutePattern &route_pattern,
const IpPrefix& ip_prefix,
sai_object_id_t counter_oid,
Expand Down

0 comments on commit e40c736

Please sign in to comment.