-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sai-gen] Add counter id generation support on port level (#508)
## Problem Currently, whenever a counter is used in a control block and not associated to any tables, we won't be able to handle the SAI header generation for it, although we know this counter will be mostly used for tracking the DPU level counts. ## What we are doing in this change This change adds counter id generation support on port level. Whenever the above case happens, a new counter id attribute will be generated on port level. Take an example - if we add a counter to track total bytes in DASH as below: ![image](https://github.com/sonic-net/DASH/assets/1533278/3db8a8ca-50b6-46fb-ae7b-78e550288c35) ![image](https://github.com/sonic-net/DASH/assets/1533278/4bbebb50-feb5-4947-9d0b-e179d3aeaaaf) The following counter id attribute will be generated: ![image](https://github.com/sonic-net/DASH/assets/1533278/441a1723-5040-44c4-becb-e23250a91a41)
- Loading branch information
Showing
2 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% for counter in sai_counters %} | ||
/** | ||
* @brief DASH counter {{ counter.name | upper }} | ||
* | ||
* @type sai_object_id_t | ||
* @flags CREATE_AND_SET | ||
* @objects SAI_OBJECT_TYPE_COUNTER | ||
* @allownull true | ||
* @default SAI_NULL_OBJECT_ID | ||
*/ | ||
{% if is_first_attr == true %} | ||
SAI_{{ table_name | upper }}_ATTR_{{ counter.name | upper }} = SAI_{{ table_name | upper }}_ATTR_EXTENSIONS_RANGE_START, | ||
{% set is_first_attr = true %} | ||
{% else %} | ||
SAI_{{ table_name | upper }}_ATTR_{{ counter.name | upper }}, | ||
{% endif %} | ||
|
||
{% endfor %} |