Skip to content

Commit 30233ae

Browse files
Update cpu_queues_stats.md
1 parent afc40d7 commit 30233ae

File tree

1 file changed

+78
-9
lines changed

1 file changed

+78
-9
lines changed

doc/cpu_queues_stats.md

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Network switches and routers typically have one port connected to the CPU (where
44

55
The knowledge of various queue statistics help us identify the current health and reason for any packet drops. SONiC already has commands to examine port and queue statistics associated with front panel ports. The same is extended to examine the CPU queue stats. The watermark commands can also be extended to display the buffer utilization associated with these CPU queues (not included in this HLD).
66

7-
For example the command *show queue counters <port-name>* which displays the below given statistics starts to display CPU queue statistics as well.
7+
The command *show queue counters <port-name>* displays the below given statistics for a given front panel port.
88

99
```
1010
root@sonic:/home/admin# show queue counters Ethernet0
@@ -39,7 +39,7 @@ root@sonic:/home/admin# show queue counters CPU
3939
Port doesn't exist! CPU
4040
```
4141

42-
The proposed changes make the command return the actual supported CPU queues and its stats.
42+
The proposed changes make the command *show queue counters CPU* return the actual supported CPU queues and its stats.
4343

4444
```
4545
root@L15:/home/admin# show queue counters CPU
@@ -96,24 +96,93 @@ root@L15:/home/admin# show queue counters CPU
9696
```
9797

9898

99-
The following COUNTER_DB maps include details for the CPU port and queues.
99+
SONiC DB changes:
100+
The following COUNTER_DB maps are changed to include details for the CPU port and its queues.
101+
```
100102
COUNTERS_PORT_NAME_MAP
101103
COUNTERS_QUEUE_NAME_MAP
102104
COUNTERS_QUEUE_PORT_MAP
103105
COUNTERS_QUEUE_TYPE_MAP
104106
COUNTERS_QUEUE_INDEX_MAP
107+
```
105108

106109
Port and queue counters:
107-
COUNTERS:oid:<port-oid>
108-
COUNTERS:oid:<queue-oid>
110+
```
111+
COUNTERS:oid:<portOid>
112+
COUNTERS:oid:<queueOid>
113+
```
109114

115+
Code changes:
116+
Minor code changes are made on *sonic-swss* repo to fetch the supported queues on CPU port and update the flex counters-db maps to include CPU port and its queues.
117+
Single line changes are made to *sonic-py-swsssdk*, *sonic-snmpagent* and *sonic-utilities* repos to ignore the newly added CPU port while iterating over the front panel ports(*COUNTERS_PORT_NAME_MAP*).
118+
*sonic-sairedis* repo changes are made to enable cpu queues on vslib.
110119

120+
SAI calls:
121+
SAI API *get_port_attribute()* with attribute *SAI_PORT_ATTR_QOS_NUMBER_OF_QUEUES* is called to fetch the number of CPU queues supported by switch.
122+
SAI API *get_port_attribute()* with attribute *SAI_PORT_ATTR_QOS_QUEUE_LIST* to fetch the CPU queue list.
111123

112-
Minor code changes are made on *sonic-swss* repo to fetch the supported queues on CPU port and update the flex counters-db maps to include CPU port and its queues. Single line changes were made to *sonic-py-swsssdk*, *sonic-snmpagent* and *sonic-utilities* repos to ignore the newly added CPU port while iterating over the front panel ports. *sonic-sairedis* repo changes are made to enable cpu queues on vslib.
113-
Syncd periodically fetches the CPU port stats, CPU queues stats along with other flex counter stats and updates the counters-DB.
124+
Flex counters:
125+
Along with other flex counter stats, Syncd periodically fetches the CPU port and queue stats to update the counters-DB.
114126

115-
SAI calls:
116-
get_port_attribute() API with attribute *SAI_PORT_ATTR_QOS_NUMBER_OF_QUEUES* to fetch the number of CPU queues supported by switch and *SAI_PORT_ATTR_QOS_QUEUE_LIST* to fetch the list of CPU queues.
127+
Flex Counter attributes:
128+
```
129+
const vector<sai_port_stat_t> port_stat_ids =
130+
{
131+
SAI_PORT_STAT_IF_IN_OCTETS,
132+
SAI_PORT_STAT_IF_IN_UCAST_PKTS,
133+
SAI_PORT_STAT_IF_IN_NON_UCAST_PKTS,
134+
SAI_PORT_STAT_IF_IN_DISCARDS,
135+
SAI_PORT_STAT_IF_IN_ERRORS,
136+
SAI_PORT_STAT_IF_IN_UNKNOWN_PROTOS,
137+
SAI_PORT_STAT_IF_OUT_OCTETS,
138+
SAI_PORT_STAT_IF_OUT_UCAST_PKTS,
139+
SAI_PORT_STAT_IF_OUT_NON_UCAST_PKTS,
140+
SAI_PORT_STAT_IF_OUT_DISCARDS,
141+
SAI_PORT_STAT_IF_OUT_ERRORS,
142+
SAI_PORT_STAT_IF_OUT_QLEN,
143+
SAI_PORT_STAT_IF_IN_MULTICAST_PKTS,
144+
SAI_PORT_STAT_IF_IN_BROADCAST_PKTS,
145+
SAI_PORT_STAT_IF_OUT_MULTICAST_PKTS,
146+
SAI_PORT_STAT_IF_OUT_BROADCAST_PKTS,
147+
SAI_PORT_STAT_ETHER_RX_OVERSIZE_PKTS,
148+
SAI_PORT_STAT_ETHER_TX_OVERSIZE_PKTS,
149+
SAI_PORT_STAT_PFC_0_TX_PKTS,
150+
SAI_PORT_STAT_PFC_1_TX_PKTS,
151+
SAI_PORT_STAT_PFC_2_TX_PKTS,
152+
SAI_PORT_STAT_PFC_3_TX_PKTS,
153+
SAI_PORT_STAT_PFC_4_TX_PKTS,
154+
SAI_PORT_STAT_PFC_5_TX_PKTS,
155+
SAI_PORT_STAT_PFC_6_TX_PKTS,
156+
SAI_PORT_STAT_PFC_7_TX_PKTS,
157+
SAI_PORT_STAT_PFC_0_RX_PKTS,
158+
SAI_PORT_STAT_PFC_1_RX_PKTS,
159+
SAI_PORT_STAT_PFC_2_RX_PKTS,
160+
SAI_PORT_STAT_PFC_3_RX_PKTS,
161+
SAI_PORT_STAT_PFC_4_RX_PKTS,
162+
SAI_PORT_STAT_PFC_5_RX_PKTS,
163+
SAI_PORT_STAT_PFC_6_RX_PKTS,
164+
SAI_PORT_STAT_PFC_7_RX_PKTS,
165+
SAI_PORT_STAT_PAUSE_RX_PKTS,
166+
SAI_PORT_STAT_PAUSE_TX_PKTS,
167+
SAI_PORT_STAT_ETHER_STATS_TX_NO_ERRORS,
168+
SAI_PORT_STAT_IP_IN_UCAST_PKTS,
169+
SAI_PORT_STAT_ETHER_IN_PKTS_128_TO_255_OCTETS,
170+
};
171+
172+
173+
static const vector<sai_queue_stat_t> queue_stat_ids =
174+
{
175+
SAI_QUEUE_STAT_PACKETS,
176+
SAI_QUEUE_STAT_BYTES,
177+
SAI_QUEUE_STAT_DROPPED_PACKETS,
178+
SAI_QUEUE_STAT_DROPPED_BYTES,
179+
};
180+
181+
static const vector<sai_queue_stat_t> queueWatermarkStatIds =
182+
{
183+
SAI_QUEUE_STAT_SHARED_WATERMARK_BYTES,
184+
};
185+
```
117186

118187
List of PRs associated with this change:
119188
https://github.com/Azure/sonic-swss/pull/1544

0 commit comments

Comments
 (0)