Skip to content

Packet Trimming: Drop Counters HLD#2033

Merged
prsunny merged 2 commits intosonic-net:masterfrom
nazariig:master-trim-counters
Sep 29, 2025
Merged

Packet Trimming: Drop Counters HLD#2033
prsunny merged 2 commits intosonic-net:masterfrom
nazariig:master-trim-counters

Conversation

@nazariig
Copy link
Collaborator

@nazariig nazariig commented Jul 7, 2025

Signed-off-by: Nazarii Hnydyn [email protected]

This document provides general information about Packet Trimming implementation in SONiC

In scope:

  1. Trimming counters
PR title state context
YANG Model GitHub issue/pull request detail GitHub pull request check contexts
DB Schema GitHub issue/pull request detail GitHub pull request check contexts
VS Library GitHub issue/pull request detail GitHub pull request check contexts
SWSS GitHub issue/pull request detail GitHub pull request check contexts
CLI GitHub issue/pull request detail GitHub pull request check contexts
Test Plan GitHub issue/pull request detail GitHub pull request check contexts
Test GitHub issue/pull request detail GitHub pull request check contexts

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@nazariig nazariig force-pushed the master-trim-counters branch from 845ff79 to 3032d05 Compare July 7, 2025 19:12
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@nazariig nazariig marked this pull request as ready for review July 15, 2025 16:52
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@nazariig
Copy link
Collaborator Author

@kperumalbfn / @r12f please review

r12f
r12f previously approved these changes Jul 28, 2025
Copy link
Contributor

@r12f r12f left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

having the same comment as Kumaresh on the LUA plugin, we should use flexcounter for all these stats. otherwise, looks good to me.

mssonicbld added a commit to Azure/sonic-swss-common.msft that referenced this pull request Aug 1, 2025
Signed-off-by: Nazarii Hnydyn <[email protected]>

**HLD:** sonic-net/SONiC#2033

#### A picture of a cute animal (not mandatory but encouraged)
```
 .---. .-----------
 / \ __ / ------
 / / \( )/ -----
 ////// ' \/ ` ---
 //// / // : : ---
 // / / /` '--
// //..\\
 ====UU====UU====
 '//||\\`
 ''``
```
mssonicbld added a commit to mssonicbld/sonic-buildimage-msft that referenced this pull request Aug 2, 2025
Signed-off-by: Nazarii Hnydyn <[email protected]>

<!--
     Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

     ** Make sure all your commits include a signature generated with `git commit -s` **

     If this is a bug fix, make sure your description includes "fixes #xxxx", or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->
**HLD:** sonic-net/SONiC#2033

#### Why I did it
* Added YANG model as part of Packet Trimming Drop Counters feature development

#### Work item tracking
* N/A

#### How I did it
* Added YANG model

#### How to verify it
<!--
If PR needs to be backported, then the PR must be tested against the base branch and the earliest backport release branch and provide tested image version on these two branches. For example, if the PR is requested for master, 202211 and 202012, then the requester needs to provide test results on master and 202012.
-->
1. Run Packet Trimming UTs

#### Which release branch to backport (provide reason below if selected)
<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211
- [ ] 202305
- [x] 202412
- [x] 202505

#### Tested branch (Please provide the tested image version)
<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [x] master <!-- image version 1 -->
- [x] 202412 <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->
* N/A

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->
* [sonic-trimming.yang](https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-trimming.yang)

#### A picture of a cute animal (not mandatory but encouraged)
```
      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``
```
r12f pushed a commit to Azure/sonic-buildimage-msft that referenced this pull request Aug 2, 2025
…del (#1445)

Signed-off-by: Nazarii Hnydyn <[email protected]>

<!--
Please make sure you've read and understood our contributing guidelines:
     https://github.com/Azure/SONiC/blob/gh-pages/CONTRIBUTING.md

** Make sure all your commits include a signature generated with `git
commit -s` **

If this is a bug fix, make sure your description includes "fixes #xxxx",
or
     "closes #xxxx" or "resolves #xxxx"

     Please provide the following information:
-->
**HLD:** sonic-net/SONiC#2033

#### Why I did it
* Added YANG model as part of Packet Trimming Drop Counters feature
development

#### Work item tracking
* N/A

#### How I did it
* Added YANG model

#### How to verify it
<!--
If PR needs to be backported, then the PR must be tested against the
base branch and the earliest backport release branch and provide tested
image version on these two branches. For example, if the PR is requested
for master, 202211 and 202012, then the requester needs to provide test
results on master and 202012.
-->
1. Run Packet Trimming UTs

#### Which release branch to backport (provide reason below if selected)
<!--
- Note we only backport fixes to a release branch, *not* features!
- Please also provide a reason for the backporting below.
- e.g.
- [x] 202006
-->

- [ ] 201811
- [ ] 201911
- [ ] 202006
- [ ] 202012
- [ ] 202106
- [ ] 202111
- [ ] 202205
- [ ] 202211
- [ ] 202305
- [x] 202412
- [x] 202505

#### Tested branch (Please provide the tested image version)
<!--
- Please provide tested image version
- e.g.
- [x] 20201231.100
-->

- [x] master <!-- image version 1 -->
- [x] 202412 <!-- image version 2 -->

#### Description for the changelog
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->
* N/A

#### Link to config_db schema for YANG module changes
<!--
Provide a link to config_db schema for the table for which YANG model
is defined
Link should point to correct section on
https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md
-->
*
[sonic-trimming.yang](https://github.com/sonic-net/sonic-buildimage/blob/master/src/sonic-yang-models/yang-models/sonic-trimming.yang)

#### A picture of a cute animal (not mandatory but encouraged)
```
      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``
```
@nazariig
Copy link
Collaborator Author

nazariig commented Aug 5, 2025

@kperumalbfn / @r12f please help to merge if no more comments

wen587 pushed a commit to wen587/sonic-swss-common that referenced this pull request Aug 5, 2025
mssonicbld added a commit to mssonicbld/sonic-sairedis.msft that referenced this pull request Aug 7, 2025
Signed-off-by: Nazarii Hnydyn <[email protected]>

**DEPENDS:**
1. sonic-net/sonic-swss-common#1055

**HLD:** sonic-net/SONiC#2033

Requires SAI API v1.16.2

#### A picture of a cute animal (not mandatory but encouraged)
```
      .---.        .-----------
     /     \  __  /    ------
    / /     \(  )/    -----
   //////   ' \/ `   ---
  //// / // :    : ---
 // /   /  /`    '--
//          //..\\
       ====UU====UU====
           '//||\\`
             ''``
```
mssonicbld added a commit to Azure/sonic-sairedis.msft that referenced this pull request Aug 7, 2025
Signed-off-by: Nazarii Hnydyn <[email protected]>

**DEPENDS:**
1. sonic-net/sonic-swss-common#1055

**HLD:** sonic-net/SONiC#2033

Requires SAI API v1.16.2

#### A picture of a cute animal (not mandatory but encouraged)
```
 .---. .-----------
 / \ __ / ------
 / / \( )/ -----
 ////// ' \/ ` ---
 //// / // : : ---
 // / / /` '--
// //..\\
 ====UU====UU====
 '//||\\`
 ''``
```
qiluo-msft pushed a commit to sonic-net/sonic-utilities that referenced this pull request Aug 11, 2025
HLD: sonic-net/SONiC#2033

What I did
Implemented CLI for Packet Trimming Drop Counters feature
How I did it
Integrated Packet Trimming Drop Counters interface into config and show CLI root
How to verify it
Run Packet Trimming CLI UTs
Previous command output (if the output of a command-line utility has changed)
admin@sonic:/home/admin# show interfaces counters trim Ethernet0
    IFACE    STATE    TRIM_PKTS
---------  -------  -----------
Ethernet0        U          100
New command output (if the output of a command-line utility has changed)
admin@sonic:/home/admin# show interfaces counters trim Ethernet0
    IFACE    STATE    TRIM_PKTS    TRIM_TX_PKTS    TRIM_DRP_PKTS
---------  -------  -----------  --------------  ---------------
Ethernet0        U          100              50               50
@nazariig
Copy link
Collaborator Author

@r12f / @kperumalbfn just a kind reminder - please help to merge

@nazariig
Copy link
Collaborator Author

@r12f / @kperumalbfn just a kind reminder

Signed-off-by: Nazarii Hnydyn <[email protected]>
@nazariig nazariig force-pushed the master-trim-counters branch from 7c08e1b to 1a7e3c3 Compare September 11, 2025 10:18
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@nazariig
Copy link
Collaborator Author

@kperumalbfn / @r12f please help to merge

@nazariig
Copy link
Collaborator Author

@prsunny would you please help to merge?

@prsunny prsunny merged commit 7382cb1 into sonic-net:master Sep 29, 2025
1 check passed
mssonicbld added a commit to mssonicbld/sonic-mgmt.msft that referenced this pull request Oct 23, 2025
### Summary: Add packet trimming counter testcase phase1

### Related PR
- Add packet trimming drop counter test plan
sonic-net/sonic-mgmt#19824
- Packet Trimming: Drop Counters HLD
sonic-net/SONiC#2033
- [trim]: Add Packet Trimming Drop Counters YANG model
sonic-net/sonic-buildimage#23422
- [trim]: Add Packet Trimming Drop Counters DB schema
sonic-net/sonic-swss-common#1055
- [trim]: Add Packet Trimming Drop Counters to VS lib
sonic-net/sonic-sairedis#1630
- [trim]: Add Packet Trimming Drop Counters to OA
sonic-net/sonic-swss#3777
- [trim]: Add Packet Trimming Drop Counters CLI
sonic-net/sonic-utilities#3993

### Type of change

<!--
- Fill x for your type of change.
- e.g.
- [x] Bug fix
-->

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
    - [ ] Skipped for non-supported platforms
- [ ] Test case improvement

### Back port request
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [x] 202505

### Approach
#### What is the motivation for this PR?

#### How did you do it?

#### How did you verify/test it?

#### Any platform specific information?

#### Supported testbed topology if it's a new test case?

### Documentation
<!--
(If it's a new feature, new test case)
Did you update documentation/Wiki relevant to your implementation?
Link to the wiki page?
-->
mssonicbld added a commit to Azure/sonic-mgmt.msft that referenced this pull request Oct 23, 2025
### Summary: Add packet trimming counter testcase phase1

### Related PR
- Add packet trimming drop counter test plan
sonic-net/sonic-mgmt#19824
- Packet Trimming: Drop Counters HLD
sonic-net/SONiC#2033
- [trim]: Add Packet Trimming Drop Counters YANG model
sonic-net/sonic-buildimage#23422
- [trim]: Add Packet Trimming Drop Counters DB schema
sonic-net/sonic-swss-common#1055
- [trim]: Add Packet Trimming Drop Counters to VS lib
sonic-net/sonic-sairedis#1630
- [trim]: Add Packet Trimming Drop Counters to OA
sonic-net/sonic-swss#3777
- [trim]: Add Packet Trimming Drop Counters CLI
sonic-net/sonic-utilities#3993

### Type of change

<!--
- Fill x for your type of change.
- e.g.
- [x] Bug fix
-->

- [ ] Bug fix
- [ ] Testbed and Framework(new/improvement)
- [ ] New Test case
 - [ ] Skipped for non-supported platforms
- [ ] Test case improvement

### Back port request
- [ ] 202205
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [x] 202505

### Approach
#### What is the motivation for this PR?

#### How did you do it?

#### How did you verify/test it?

#### Any platform specific information?

#### Supported testbed topology if it's a new test case?

### Documentation
<!--
(If it's a new feature, new test case)
Did you update documentation/Wiki relevant to your implementation?
Link to the wiki page?
-->
YairRaviv pushed a commit to YairRaviv/sonic-utilities that referenced this pull request Jan 12, 2026
HLD: sonic-net/SONiC#2033

What I did
Implemented CLI for Packet Trimming Drop Counters feature
How I did it
Integrated Packet Trimming Drop Counters interface into config and show CLI root
How to verify it
Run Packet Trimming CLI UTs
Previous command output (if the output of a command-line utility has changed)
admin@sonic:/home/admin# show interfaces counters trim Ethernet0
    IFACE    STATE    TRIM_PKTS
---------  -------  -----------
Ethernet0        U          100
New command output (if the output of a command-line utility has changed)
admin@sonic:/home/admin# show interfaces counters trim Ethernet0
    IFACE    STATE    TRIM_PKTS    TRIM_TX_PKTS    TRIM_DRP_PKTS
---------  -------  -----------  --------------  ---------------
Ethernet0        U          100              50               50
eddieruan-alibaba pushed a commit that referenced this pull request Mar 27, 2026
*This document provides general information about Packet Trimming implementation in SONiC

Signed-off-by: Eddie Ruan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants