Skip to content

Commit 8f69d5a

Browse files
authored
sonic-utilities: WRED stats feature changes on sonic-utilities (sonic-net#2807)
sonic-utilities: WRED stats feature changes
1 parent 9d273f1 commit 8f69d5a

File tree

14 files changed

+2483
-9
lines changed

14 files changed

+2483
-9
lines changed

clear/main.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,17 @@ def clear_pwm_pg_shared(namespace):
324324

325325
@cli.group()
326326
def queue():
327-
"""Clear queue WM"""
327+
"""Clear queue"""
328328
pass
329329

330+
331+
@queue.command()
332+
def wredcounters():
333+
"""Clear queue wredcounters"""
334+
command = ['wredstat', '-c']
335+
run_command(command)
336+
337+
330338
@queue.group()
331339
def watermark():
332340
"""Clear queue user WM. One does not simply clear WM, root is required"""

counterpoll/main.py

+81-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,6 @@ def disable(ctx):
395395
fc_info['FLEX_COUNTER_STATUS'] = 'disable'
396396
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "FLOW_CNT_ROUTE", fc_info)
397397

398-
399398
# ENI counter commands
400399
@click.group()
401400
@click.pass_context
@@ -433,6 +432,79 @@ def eni_disable(ctx):
433432
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", ENI, eni_info)
434433

435434

435+
# WRED queue counter commands
436+
@cli.group()
437+
@click.pass_context
438+
def wredqueue(ctx):
439+
""" WRED queue counter commands """
440+
ctx.obj = ConfigDBConnector()
441+
ctx.obj.connect()
442+
443+
444+
@wredqueue.command(name='interval')
445+
@click.argument('poll_interval', type=click.IntRange(100, 30000))
446+
@click.pass_context
447+
def wredqueue_interval(ctx, poll_interval):
448+
""" Set wred queue counter query interval """
449+
wred_queue_info = {}
450+
wred_queue_info['POLL_INTERVAL'] = poll_interval
451+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)
452+
453+
454+
@wredqueue.command(name='enable')
455+
@click.pass_context
456+
def wredqueue_enable(ctx):
457+
""" Enable wred queue counter query """
458+
wred_queue_info = {}
459+
wred_queue_info['FLEX_COUNTER_STATUS'] = 'enable'
460+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)
461+
462+
463+
@wredqueue.command(name='disable')
464+
@click.pass_context
465+
def wredqueue_disable(ctx):
466+
""" Disable wred queue counter query """
467+
wred_queue_info = {}
468+
wred_queue_info['FLEX_COUNTER_STATUS'] = 'disable'
469+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)
470+
471+
472+
# WRED port counter commands
473+
@cli.group()
474+
@click.pass_context
475+
def wredport(ctx):
476+
""" WRED port counter commands """
477+
ctx.obj = ConfigDBConnector()
478+
ctx.obj.connect()
479+
480+
481+
@wredport.command(name='interval')
482+
@click.argument('poll_interval', type=click.IntRange(100, 30000))
483+
@click.pass_context
484+
def wredport_interval(ctx, poll_interval):
485+
""" Set wred port counter query interval """
486+
wred_port_info = {}
487+
wred_port_info['POLL_INTERVAL'] = poll_interval
488+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)
489+
490+
491+
@wredport.command(name='enable')
492+
@click.pass_context
493+
def wredport_enable(ctx):
494+
""" Enable wred port counter query """
495+
wred_port_info = {}
496+
wred_port_info['FLEX_COUNTER_STATUS'] = 'enable'
497+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)
498+
499+
500+
@wredport.command(name='disable')
501+
@click.pass_context
502+
def wredport_disable(ctx):
503+
""" Disable wred port counter query """
504+
wred_port_info = {}
505+
wred_port_info['FLEX_COUNTER_STATUS'] = 'disable'
506+
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)
507+
436508
@cli.command()
437509
def show():
438510
""" Show the counter configuration """
@@ -451,6 +523,8 @@ def show():
451523
trap_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'FLOW_CNT_TRAP')
452524
route_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'FLOW_CNT_ROUTE')
453525
eni_info = configdb.get_entry('FLEX_COUNTER_TABLE', ENI)
526+
wred_queue_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'WRED_ECN_QUEUE')
527+
wred_port_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'WRED_ECN_PORT')
454528

455529
header = ("Type", "Interval (in ms)", "Status")
456530
data = []
@@ -479,6 +553,12 @@ def show():
479553
if route_info:
480554
data.append(["FLOW_CNT_ROUTE_STAT", route_info.get("POLL_INTERVAL", DEFLT_10_SEC),
481555
route_info.get("FLEX_COUNTER_STATUS", DISABLE)])
556+
if wred_queue_info:
557+
data.append(["WRED_ECN_QUEUE_STAT", wred_queue_info.get("POLL_INTERVAL", DEFLT_10_SEC),
558+
wred_queue_info.get("FLEX_COUNTER_STATUS", DISABLE)])
559+
if wred_port_info:
560+
data.append(["WRED_ECN_PORT_STAT", wred_port_info.get("POLL_INTERVAL", DEFLT_1_SEC),
561+
wred_port_info.get("FLEX_COUNTER_STATUS", DISABLE)])
482562

483563
if is_dpu(configdb) and eni_info:
484564
data.append(["ENI_STAT", eni_info.get("POLL_INTERVAL", DEFLT_10_SEC),

doc/Command-Reference.md

+131-2
Original file line numberDiff line numberDiff line change
@@ -4984,8 +4984,8 @@ The "current-mode" subcommand is used to display current breakout mode for all i
49844984

49854985
**show interfaces counters**
49864986

4987-
This show command displays packet counters for all interfaces since the last time the counters were cleared. To display l3 counters "rif" subcommand can be used. There is no facility to display counters for one specific l2 interface. For l3 interfaces a single interface output mode is present. Optional argument "-a" provides two additional columns - RX-PPS and TX_PPS.
4988-
Optional argument "-p" specify a period (in seconds) with which to gather counters over.
4987+
This show command displays packet counters for all interfaces(except the "show interface detailed" command) since the last time the counters were cleared. To display l3 counters "rif" subcommand can be used. There is no facility to display counters for one specific l2 interface. For l3 interfaces a single interface output mode is present. Optional argument "-a" provides two additional columns - RX-PPS and TX_PPS.
4988+
Optional argument "-p" specify a period (in seconds) with which to gather counters over. To display the detailed per-interface counters "detailed <interface-name>" subcommand can be used.
49894989

49904990
- Usage:
49914991
```
@@ -4995,6 +4995,7 @@ Optional argument "-p" specify a period (in seconds) with which to gather counte
49954995
show interfaces counters rif [-p|--period <period>] [-i <interface_name>]
49964996
show interfaces counters fec-histogram [-i <interface_name>]
49974997
show interfaces counters fec-stats
4998+
show interfaces counters detailed <interface_name>
49984999
```
49995000

50005001
- Example:
@@ -5100,6 +5101,56 @@ Optionally, you can specify a period (in seconds) with which to gather counters
51005101
Ethernet24 U 173 16.09 KB/s 0.00% 0 0 0 169 11.39 KB/s 0.00% 0 0 0
51015102
```
51025103

5104+
The "detailed" subcommand is used to display more detailed interface counters. Along with tx/rx counters, it also displays the WRED drop counters that are supported on the platform.
5105+
5106+
- Example:
5107+
```
5108+
admin@sonic:~$ show interfaces counters detailed Ethernet8
5109+
Packets Received 64 Octets..................... 0
5110+
Packets Received 65-127 Octets................. 0
5111+
Packets Received 128-255 Octets................ 0
5112+
Packets Received 256-511 Octets................ 0
5113+
Packets Received 512-1023 Octets............... 0
5114+
Packets Received 1024-1518 Octets.............. 0
5115+
Packets Received 1519-2047 Octets.............. 0
5116+
Packets Received 2048-4095 Octets.............. 0
5117+
Packets Received 4096-9216 Octets.............. 0
5118+
Packets Received 9217-16383 Octets............. 0
5119+
5120+
Total Packets Received Without Errors.......... 0
5121+
Unicast Packets Received....................... 0
5122+
Multicast Packets Received..................... 0
5123+
Broadcast Packets Received..................... 0
5124+
5125+
Jabbers Received............................... N/A
5126+
Fragments Received............................. N/A
5127+
Undersize Received............................. 0
5128+
Overruns Received.............................. 0
5129+
5130+
Packets Transmitted 64 Octets.................. 0
5131+
Packets Transmitted 65-127 Octets.............. 0
5132+
Packets Transmitted 128-255 Octets............. 0
5133+
Packets Transmitted 256-511 Octets............. 0
5134+
Packets Transmitted 512-1023 Octets............ 0
5135+
Packets Transmitted 1024-1518 Octets........... 0
5136+
Packets Transmitted 1519-2047 Octets........... 0
5137+
Packets Transmitted 2048-4095 Octets........... 0
5138+
Packets Transmitted 4096-9216 Octets........... 0
5139+
Packets Transmitted 9217-16383 Octets.......... 0
5140+
5141+
Total Packets Transmitted Successfully......... 0
5142+
Unicast Packets Transmitted.................... 0
5143+
Multicast Packets Transmitted.................. 0
5144+
Broadcast Packets Transmitted.................. 0
5145+
5146+
WRED Green Dropped Packets..................... 0
5147+
WRED Yellow Dropped Packets.................... 0
5148+
WRED Red Dropped Packets....................... 0
5149+
WRED Total Dropped Packets..................... 0
5150+
5151+
Time Since Counters Last Cleared............... None
5152+
```
5153+
51035154
- NOTE: Interface counters can be cleared by the user with the following command:
51045155

51055156
```
@@ -9435,6 +9486,7 @@ This sub-section explains the following queue parameters that can be displayed u
94359486
2) queue watermark
94369487
3) priority-group watermark
94379488
4) queue persistent-watermark
9489+
5) queue wredcounters
94389490

94399491

94409492
**show queue counters**
@@ -9628,6 +9680,83 @@ This command displays the user persistet-watermark for the queues (Egress shared
96289680
admin@sonic:~$ sonic-clear priority-group drop counters
96299681
```
96309682

9683+
**show queue wredcounters**
9684+
9685+
This command displays wred-drop packet/byte and ecn-marked packet/byte counters for all queues of all ports or one specific-port given as arguement.
9686+
This command can be used to clear the counters for all queues of all ports. Note that port specific clear is not supported.
9687+
9688+
- Usage:
9689+
```
9690+
show queue wredcounters [<interface_name>]
9691+
```
9692+
9693+
- Example:
9694+
```
9695+
admin@sonic:~$ show queue wredcounters
9696+
Port TxQ WredDrp/pkts WredDrp/bytes EcnMarked/pkts EcnMarked/bytes
9697+
--------- ----- -------------- --------------- --------------- ----------------
9698+
9699+
Ethernet0 UC0 0 0 0 0
9700+
Ethernet0 UC1 0 0 0 0
9701+
Ethernet0 UC2 0 0 0 0
9702+
Ethernet0 UC3 0 0 0 0
9703+
Ethernet0 UC4 0 0 0 0
9704+
Ethernet0 UC5 0 0 0 0
9705+
Ethernet0 UC6 0 0 0 0
9706+
Ethernet0 UC7 0 0 0 0
9707+
Ethernet0 UC8 0 0 0 0
9708+
Ethernet0 UC9 0 0 0 0
9709+
Ethernet0 MC0 0 0 0 0
9710+
Ethernet0 MC1 0 0 0 0
9711+
Ethernet0 MC2 0 0 0 0
9712+
Ethernet0 MC3 0 0 0 0
9713+
Ethernet0 MC4 0 0 0 0
9714+
Ethernet0 MC5 0 0 0 0
9715+
Ethernet0 MC6 0 0 0 0
9716+
Ethernet0 MC7 0 0 0 0
9717+
Ethernet0 MC8 0 0 0 0
9718+
Ethernet0 MC9 0 0 0 0
9719+
9720+
Port TxQ WredDrp/pkts WredDrp/bytes EcnMarked/pkts EcnMarked/bytes
9721+
--------- ----- -------------- --------------- --------------- ----------------
9722+
9723+
Ethernet4 UC0 0 0 0 0
9724+
Ethernet4 UC1 0 0 0 0
9725+
Ethernet4 UC2 0 0 0 0
9726+
Ethernet4 UC3 0 0 0 0
9727+
Ethernet4 UC4 0 0 0 0
9728+
Ethernet4 UC5 0 0 0 0
9729+
Ethernet4 UC6 0 0 0 0
9730+
Ethernet4 UC7 0 0 0 0
9731+
Ethernet4 UC8 0 0 0 0
9732+
Ethernet4 UC9 0 0 0 0
9733+
Ethernet4 MC0 0 0 0 0
9734+
Ethernet4 MC1 0 0 0 0
9735+
Ethernet4 MC2 0 0 0 0
9736+
Ethernet4 MC3 0 0 0 0
9737+
Ethernet4 MC4 0 0 0 0
9738+
Ethernet4 MC5 0 0 0 0
9739+
Ethernet4 MC6 0 0 0 0
9740+
Ethernet4 MC7 0 0 0 0
9741+
Ethernet4 MC8 0 0 0 0
9742+
Ethernet4 MC9 0 0 0 0
9743+
9744+
...
9745+
```
9746+
9747+
Optionally, you can specify an interface name in order to display only that particular interface
9748+
9749+
- Example:
9750+
```
9751+
admin@sonic:~$ show queue wredcounters Ethernet72
9752+
```
9753+
9754+
- NOTE: Queue counters can be cleared by the user with the following command:
9755+
```
9756+
admin@sonic:~$ sonic-clear queue wredcounters
9757+
```
9758+
9759+
96319760
#### Buffer Pool
96329761

96339762
This sub-section explains the following buffer pool parameters that can be displayed using "show buffer_pool" command.

0 commit comments

Comments
 (0)