Skip to content

Commit

Permalink
Support split counter IDs based on prefix
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Sun <[email protected]>
  • Loading branch information
stephenxs committed Dec 13, 2024
1 parent 33283ac commit bb10cfc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions orchagent/flexcounterorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,10 @@ void FlexCounterOrch::doTask(Consumer &consumer)
{
setFlexCounterGroupBulkChunkSize(flexCounterGroupMap[key], value, false);
}
else if (field == BULK_CHUNK_SIZE_PER_PREFIX_FIELD)
{
setFlexCounterGroupBulkChunkSizePerPrefix(flexCounterGroupMap[key], value, false);
}
else
{
SWSS_LOG_NOTICE("Unsupported field %s", field.c_str());
Expand Down
19 changes: 19 additions & 0 deletions orchagent/saihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,7 @@ static inline void initSaiRedisCounterEmptyParameter(sai_redis_flex_counter_grou
initSaiRedisCounterEmptyParameter(flex_counter_group_param.plugin_name);
initSaiRedisCounterEmptyParameter(flex_counter_group_param.plugins);
initSaiRedisCounterEmptyParameter(flex_counter_group_param.bulk_chunk_size);
initSaiRedisCounterEmptyParameter(flex_counter_group_param.bulk_chunk_size_per_prefix);
}

static inline void initSaiRedisCounterParameterFromString(sai_s8_list_t &sai_s8_list, const std::string &str)
Expand Down Expand Up @@ -940,6 +941,7 @@ void setFlexCounterGroupParameter(const string &group,
attr.value.ptr = &flex_counter_group_param;

initSaiRedisCounterEmptyParameter(flex_counter_group_param.bulk_chunk_size);
initSaiRedisCounterEmptyParameter(flex_counter_group_param.bulk_chunk_size_per_prefix);
initSaiRedisCounterParameterFromString(flex_counter_group_param.counter_group_name, group);
initSaiRedisCounterParameterFromString(flex_counter_group_param.poll_interval, poll_interval);
initSaiRedisCounterParameterFromString(flex_counter_group_param.operation, operation);
Expand Down Expand Up @@ -1036,6 +1038,23 @@ void setFlexCounterGroupBulkChunkSize(const std::string &group,
notifySyncdCounterOperation(is_gearbox, attr);
}

void setFlexCounterGroupBulkChunkSizePerPrefix(const std::string &group,
const std::string &bulk_chunk_size_per_prefix,
bool is_gearbox)
{
sai_attribute_t attr;
sai_redis_flex_counter_group_parameter_t flex_counter_group_param;

attr.id = SAI_REDIS_SWITCH_ATTR_FLEX_COUNTER_GROUP;
attr.value.ptr = &flex_counter_group_param;

initSaiRedisCounterEmptyParameter(flex_counter_group_param);
initSaiRedisCounterParameterFromString(flex_counter_group_param.counter_group_name, group);
initSaiRedisCounterParameterFromString(flex_counter_group_param.bulk_chunk_size_per_prefix, bulk_chunk_size_per_prefix);

notifySyncdCounterOperation(is_gearbox, attr);
}

void delFlexCounterGroup(const std::string &group,
bool is_gearbox)
{
Expand Down
4 changes: 4 additions & 0 deletions orchagent/saihelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ void setFlexCounterGroupBulkChunkSize(const std::string &group,
const std::string &bulk_size,
bool is_gearbox);

void setFlexCounterGroupBulkChunkSizePerPrefix(const std::string &group,
const std::string &bulk_chunk_size_per_prefix,
bool is_gearbox);

void delFlexCounterGroup(const std::string &group,
bool is_gearbox=false);

Expand Down

0 comments on commit bb10cfc

Please sign in to comment.