Skip to content

sonic-utilities: WRED stats feature changes on sonic-utilities #2807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion clear/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,17 @@ def clear_pwm_pg_shared(namespace):

@cli.group()
def queue():
"""Clear queue WM"""
"""Clear queue"""
pass


@queue.command()
def wredcounters():
"""Clear queue wredcounters"""
command = ['wredstat', '-c']
run_command(command)


@queue.group()
def watermark():
"""Clear queue user WM. One does not simply clear WM, root is required"""
Expand Down
82 changes: 81 additions & 1 deletion counterpoll/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ def disable(ctx):
fc_info['FLEX_COUNTER_STATUS'] = 'disable'
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "FLOW_CNT_ROUTE", fc_info)


# ENI counter commands
@click.group()
@click.pass_context
Expand Down Expand Up @@ -433,6 +432,79 @@ def eni_disable(ctx):
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", ENI, eni_info)


# WRED queue counter commands
@cli.group()
@click.pass_context
def wredqueue(ctx):
""" WRED queue counter commands """
ctx.obj = ConfigDBConnector()
ctx.obj.connect()


@wredqueue.command(name='interval')
@click.argument('poll_interval', type=click.IntRange(100, 30000))
@click.pass_context
def wredqueue_interval(ctx, poll_interval):
""" Set wred queue counter query interval """
wred_queue_info = {}
wred_queue_info['POLL_INTERVAL'] = poll_interval
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)


@wredqueue.command(name='enable')
@click.pass_context
def wredqueue_enable(ctx):
""" Enable wred queue counter query """
wred_queue_info = {}
wred_queue_info['FLEX_COUNTER_STATUS'] = 'enable'
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)


@wredqueue.command(name='disable')
@click.pass_context
def wredqueue_disable(ctx):
""" Disable wred queue counter query """
wred_queue_info = {}
wred_queue_info['FLEX_COUNTER_STATUS'] = 'disable'
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_QUEUE", wred_queue_info)


# WRED port counter commands
@cli.group()
@click.pass_context
def wredport(ctx):
""" WRED port counter commands """
ctx.obj = ConfigDBConnector()
ctx.obj.connect()


@wredport.command(name='interval')
@click.argument('poll_interval', type=click.IntRange(100, 30000))
@click.pass_context
def wredport_interval(ctx, poll_interval):
""" Set wred port counter query interval """
wred_port_info = {}
wred_port_info['POLL_INTERVAL'] = poll_interval
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)


@wredport.command(name='enable')
@click.pass_context
def wredport_enable(ctx):
""" Enable wred port counter query """
wred_port_info = {}
wred_port_info['FLEX_COUNTER_STATUS'] = 'enable'
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)


@wredport.command(name='disable')
@click.pass_context
def wredport_disable(ctx):
""" Disable wred port counter query """
wred_port_info = {}
wred_port_info['FLEX_COUNTER_STATUS'] = 'disable'
ctx.obj.mod_entry("FLEX_COUNTER_TABLE", "WRED_ECN_PORT", wred_port_info)

@cli.command()
def show():
""" Show the counter configuration """
Expand All @@ -451,6 +523,8 @@ def show():
trap_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'FLOW_CNT_TRAP')
route_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'FLOW_CNT_ROUTE')
eni_info = configdb.get_entry('FLEX_COUNTER_TABLE', ENI)
wred_queue_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'WRED_ECN_QUEUE')
wred_port_info = configdb.get_entry('FLEX_COUNTER_TABLE', 'WRED_ECN_PORT')

header = ("Type", "Interval (in ms)", "Status")
data = []
Expand Down Expand Up @@ -479,6 +553,12 @@ def show():
if route_info:
data.append(["FLOW_CNT_ROUTE_STAT", route_info.get("POLL_INTERVAL", DEFLT_10_SEC),
route_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if wred_queue_info:
data.append(["WRED_ECN_QUEUE_STAT", wred_queue_info.get("POLL_INTERVAL", DEFLT_10_SEC),
wred_queue_info.get("FLEX_COUNTER_STATUS", DISABLE)])
if wred_port_info:
data.append(["WRED_ECN_PORT_STAT", wred_port_info.get("POLL_INTERVAL", DEFLT_1_SEC),
wred_port_info.get("FLEX_COUNTER_STATUS", DISABLE)])

if is_dpu(configdb) and eni_info:
data.append(["ENI_STAT", eni_info.get("POLL_INTERVAL", DEFLT_10_SEC),
Expand Down
133 changes: 131 additions & 2 deletions doc/Command-Reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -4884,8 +4884,8 @@ The "current-mode" subcommand is used to display current breakout mode for all i

**show interfaces counters**

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.
Optional argument "-p" specify a period (in seconds) with which to gather counters over.
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.
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.

- Usage:
```
Expand All @@ -4895,6 +4895,7 @@ Optional argument "-p" specify a period (in seconds) with which to gather counte
show interfaces counters rif [-p|--period <period>] [-i <interface_name>]
show interfaces counters fec-histogram [-i <interface_name>]
show interfaces counters fec-stats
show interfaces counters detailed <interface_name>
```

- Example:
Expand Down Expand Up @@ -5000,6 +5001,56 @@ Optionally, you can specify a period (in seconds) with which to gather counters
Ethernet24 U 173 16.09 KB/s 0.00% 0 0 0 169 11.39 KB/s 0.00% 0 0 0
```

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.

- Example:
```
admin@sonic:~$ show interfaces counters detailed Ethernet8
Packets Received 64 Octets..................... 0
Packets Received 65-127 Octets................. 0
Packets Received 128-255 Octets................ 0
Packets Received 256-511 Octets................ 0
Packets Received 512-1023 Octets............... 0
Packets Received 1024-1518 Octets.............. 0
Packets Received 1519-2047 Octets.............. 0
Packets Received 2048-4095 Octets.............. 0
Packets Received 4096-9216 Octets.............. 0
Packets Received 9217-16383 Octets............. 0

Total Packets Received Without Errors.......... 0
Unicast Packets Received....................... 0
Multicast Packets Received..................... 0
Broadcast Packets Received..................... 0

Jabbers Received............................... N/A
Fragments Received............................. N/A
Undersize Received............................. 0
Overruns Received.............................. 0

Packets Transmitted 64 Octets.................. 0
Packets Transmitted 65-127 Octets.............. 0
Packets Transmitted 128-255 Octets............. 0
Packets Transmitted 256-511 Octets............. 0
Packets Transmitted 512-1023 Octets............ 0
Packets Transmitted 1024-1518 Octets........... 0
Packets Transmitted 1519-2047 Octets........... 0
Packets Transmitted 2048-4095 Octets........... 0
Packets Transmitted 4096-9216 Octets........... 0
Packets Transmitted 9217-16383 Octets.......... 0

Total Packets Transmitted Successfully......... 0
Unicast Packets Transmitted.................... 0
Multicast Packets Transmitted.................. 0
Broadcast Packets Transmitted.................. 0

WRED Green Dropped Packets..................... 0
WRED Yellow Dropped Packets.................... 0
WRED Red Dropped Packets....................... 0
WRED Total Dropped Packets..................... 0

Time Since Counters Last Cleared............... None
```

- NOTE: Interface counters can be cleared by the user with the following command:

```
Expand Down Expand Up @@ -9335,6 +9386,7 @@ This sub-section explains the following queue parameters that can be displayed u
2) queue watermark
3) priority-group watermark
4) queue persistent-watermark
5) queue wredcounters


**show queue counters**
Expand Down Expand Up @@ -9528,6 +9580,83 @@ This command displays the user persistet-watermark for the queues (Egress shared
admin@sonic:~$ sonic-clear priority-group drop counters
```

**show queue wredcounters**

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.
This command can be used to clear the counters for all queues of all ports. Note that port specific clear is not supported.

- Usage:
```
show queue wredcounters [<interface_name>]
```

- Example:
```
admin@sonic:~$ show queue wredcounters
Port TxQ WredDrp/pkts WredDrp/bytes EcnMarked/pkts EcnMarked/bytes
--------- ----- -------------- --------------- --------------- ----------------

Ethernet0 UC0 0 0 0 0
Ethernet0 UC1 0 0 0 0
Ethernet0 UC2 0 0 0 0
Ethernet0 UC3 0 0 0 0
Ethernet0 UC4 0 0 0 0
Ethernet0 UC5 0 0 0 0
Ethernet0 UC6 0 0 0 0
Ethernet0 UC7 0 0 0 0
Ethernet0 UC8 0 0 0 0
Ethernet0 UC9 0 0 0 0
Ethernet0 MC0 0 0 0 0
Ethernet0 MC1 0 0 0 0
Ethernet0 MC2 0 0 0 0
Ethernet0 MC3 0 0 0 0
Ethernet0 MC4 0 0 0 0
Ethernet0 MC5 0 0 0 0
Ethernet0 MC6 0 0 0 0
Ethernet0 MC7 0 0 0 0
Ethernet0 MC8 0 0 0 0
Ethernet0 MC9 0 0 0 0

Port TxQ WredDrp/pkts WredDrp/bytes EcnMarked/pkts EcnMarked/bytes
--------- ----- -------------- --------------- --------------- ----------------

Ethernet4 UC0 0 0 0 0
Ethernet4 UC1 0 0 0 0
Ethernet4 UC2 0 0 0 0
Ethernet4 UC3 0 0 0 0
Ethernet4 UC4 0 0 0 0
Ethernet4 UC5 0 0 0 0
Ethernet4 UC6 0 0 0 0
Ethernet4 UC7 0 0 0 0
Ethernet4 UC8 0 0 0 0
Ethernet4 UC9 0 0 0 0
Ethernet4 MC0 0 0 0 0
Ethernet4 MC1 0 0 0 0
Ethernet4 MC2 0 0 0 0
Ethernet4 MC3 0 0 0 0
Ethernet4 MC4 0 0 0 0
Ethernet4 MC5 0 0 0 0
Ethernet4 MC6 0 0 0 0
Ethernet4 MC7 0 0 0 0
Ethernet4 MC8 0 0 0 0
Ethernet4 MC9 0 0 0 0

...
```

Optionally, you can specify an interface name in order to display only that particular interface

- Example:
```
admin@sonic:~$ show queue wredcounters Ethernet72
```

- NOTE: Queue counters can be cleared by the user with the following command:
```
admin@sonic:~$ sonic-clear queue wredcounters
```


#### Buffer Pool

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