Skip to content

Commit

Permalink
Policer Counter - version 1
Browse files Browse the repository at this point in the history
  • Loading branch information
shiraez committed Nov 25, 2024
1 parent 682eae9 commit 97c50eb
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions doc/policer_counter/PolicerCounter-HLD.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Counter Type:
CounterType::POLICER
```

PolicerOrch holds a new object of type FlexCounterManager and is initialized with ```StatsMode::READ```
PolicerOrch holds a new object of type FlexCounterManager and is initialized to ```StatsMode::READ```
and a default polling interval of 10 sec and disable by default:
```c++
FlexCounterManager m_pc_manager;
Expand All @@ -107,7 +107,7 @@ Added POLICER FC group support in syncd/FlexCounter.cpp.

### SAI API

No new SAI API is used.
No new SAI API is needed.

### COUNTERS DB

Expand Down Expand Up @@ -135,14 +135,14 @@ Counters table in COUNTERS DB:
; Defines information for policer counter
key = "COUNTERS:counter_oid" ; policer counter statistic
;field = value
SAI_POLICER_STAT_PACKETS = 1*10DIGIT ; packets
SAI_POLICER_STAT_ATTR_BYTES = 1*10DIGIT ; bytes
SAI_POLICER_STAT_GREEN_PACKETS = 1*10DIGIT ; packets
SAI_POLICER_STAT_GREEN_BYTES = 1*10DIGIT ; bytes
SAI_POLICER_STAT_YELLOW_PACKETS = 1*10DIGIT ; packets
SAI_POLICER_STAT_YELLOW_BYTES = 1*10DIGIT ; bytes
SAI_POLICER_STAT_RED_PACKETS = 1*10DIGIT ; packets
SAI_POLICER_STAT_RED_BYTES = 1*10DIGIT ; bytes
SAI_POLICER_STAT_PACKETS = number ; packets
SAI_POLICER_STAT_ATTR_BYTES = number ; uint64
SAI_POLICER_STAT_GREEN_PACKETS = number ; packets
SAI_POLICER_STAT_GREEN_BYTES = number ; uint64
SAI_POLICER_STAT_YELLOW_PACKETS = number ; packets
SAI_POLICER_STAT_YELLOW_BYTES = number ; uint64
SAI_POLICER_STAT_RED_PACKETS = number ; packets
SAI_POLICER_STAT_RED_BYTES = number ; uint64
```


Expand Down Expand Up @@ -200,7 +200,7 @@ E.g:

### CLI

*policerstat* utility is added to reads counters from the COUNTERS DB using the POLICER table in CONFIG DB and the COUNTERS_POLICER_NAME_MAP. It maps each POLICER to its VID and fetches counter values. If a map entry or VID is missing, it shows N/A, indicating either the POLICER was created without a counter, the policer/map entry isn't created yet, polling is disabled, or syncd hasn't updated the COUNTERS DB.
The *policerstat* utility is added to reads counters from the COUNTERS DB using the POLICER table in CONFIG DB and the COUNTERS_POLICER_NAME_MAP. It maps each POLICER to its VID and fetches counter values. If a map entry or VID is missing, it shows N/A, indicating either the POLICER was created without a counter, the policer/map entry isn't created yet, polling is disabled, or syncd hasn't updated the COUNTERS DB.

```
admin@sonic:~$ policerstat
Expand All @@ -210,7 +210,7 @@ span_policer 600 6144000 300 307200
```

Added a new CLI command
Added a new CLI command - uses the policerstat utility
```
show policer counter <policer_name>
sonic-clear policer counter <policer_name>
Expand Down Expand Up @@ -270,7 +270,8 @@ Flex Counter YANG model with POLICER group:
Counter polling is delayed at system startup.

### Restrictions/Limitations
N/A
* Policers must be supported
* Color based policing must be supported

### Testing Requirements/Design

Expand Down

0 comments on commit 97c50eb

Please sign in to comment.