Skip to content

Commit

Permalink
Add support for route flow counter (#2094)
Browse files Browse the repository at this point in the history
* Add support for route flow counter
  • Loading branch information
Junchao-Mellanox committed Apr 19, 2022
1 parent d8fadc6 commit 1fd1dbf
Show file tree
Hide file tree
Showing 24 changed files with 1,733 additions and 29 deletions.
2 changes: 1 addition & 1 deletion orchagent/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ orchagent_SOURCES = \
response_publisher.cpp \
nvgreorch.cpp

orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp flex_counter/flow_counter_handler.cpp
orchagent_SOURCES += flex_counter/flex_counter_manager.cpp flex_counter/flex_counter_stat_manager.cpp flex_counter/flow_counter_handler.cpp flex_counter/flowcounterrouteorch.cpp
orchagent_SOURCES += debug_counter/debug_counter.cpp debug_counter/drop_counter.cpp
orchagent_SOURCES += p4orch/p4orch.cpp \
p4orch/p4orch_util.cpp \
Expand Down
1 change: 1 addition & 0 deletions orchagent/flex_counter/flex_counter_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const unordered_map<CounterType, string> FlexCounterManager::counter_id_field_lo
{ CounterType::ACL_COUNTER, ACL_COUNTER_ATTR_ID_LIST },
{ CounterType::TUNNEL, TUNNEL_COUNTER_ID_LIST },
{ CounterType::HOSTIF_TRAP, FLOW_COUNTER_ID_LIST },
{ CounterType::ROUTE, FLOW_COUNTER_ID_LIST },
};

FlexManagerDirectory g_FlexManagerDirectory;
Expand Down
1 change: 1 addition & 0 deletions orchagent/flex_counter/flex_counter_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ enum class CounterType
ACL_COUNTER,
TUNNEL,
HOSTIF_TRAP,
ROUTE,
};

// FlexCounterManager allows users to manage a group of flex counters.
Expand Down
13 changes: 13 additions & 0 deletions orchagent/flex_counter/flow_counter_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,16 @@ void FlowCounterHandler::getGenericCounterStatIdList(std::unordered_set<std::str
counter_stats.emplace(sai_serialize_counter_stat(it));
}
}

bool FlowCounterHandler::queryRouteFlowCounterCapability()
{
sai_attr_capability_t capability;
sai_status_t status = sai_query_attribute_capability(gSwitchId, SAI_OBJECT_TYPE_ROUTE_ENTRY, SAI_ROUTE_ENTRY_ATTR_COUNTER_ID, &capability);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_WARN("Could not query route entry attribute SAI_ROUTE_ENTRY_ATTR_COUNTER_ID %d", status);
return false;
}

return capability.set_implemented;
}
1 change: 1 addition & 0 deletions orchagent/flex_counter/flow_counter_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class FlowCounterHandler
static bool createGenericCounter(sai_object_id_t &counter_id);
static bool removeGenericCounter(sai_object_id_t counter_id);
static void getGenericCounterStatIdList(std::unordered_set<std::string>& counter_stats);
static bool queryRouteFlowCounterCapability();
};
Loading

0 comments on commit 1fd1dbf

Please sign in to comment.