Skip to content

Add packet trimming testplan#17850

Merged
yxieca merged 1 commit intosonic-net:masterfrom
SavchukRomanLv:packet_trimming_tp
Jul 24, 2025
Merged

Add packet trimming testplan#17850
yxieca merged 1 commit intosonic-net:masterfrom
SavchukRomanLv:packet_trimming_tp

Conversation

@SavchukRomanLv
Copy link

Description of PR

Summary:
Fixes # (issue)

Type of change

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

Back port request

  • 202012
  • 202205
  • 202305
  • 202311
  • 202405
  • 202411

Approach

What is the motivation for this PR?

Introduce packet trimming test plan

How did you do it?

Testplan document had been created

How did you verify/test it?

Any platform specific information?

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

Documentation

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@weiguo-nvidia
Copy link
Contributor

Hi @BYGX-wcr @kperumalbfn @xwjiang-ms ,

Could you help review the packet trimming test plan, thanks!

4) "48"
5) "queue_index"
6) "6"
```
Copy link
Collaborator

Choose a reason for hiding this comment

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

@SavchukRomanLv Good to see you :)

Please add a note on how the congestion is triggered as the base condition in PTF testing

Copy link
Contributor

Choose a reason for hiding this comment

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

We can block the egress queue to create congestion. I have add the steps in the test cases

1. Create scheduler and apply it to the egress queue.  
`sonic-db-cli CONFIG_DB hset "SCHEDULER|SCHEDULER_BLOCK_DATA_PLANE" "type" DWRR "weight" 15 "pir" 1`  
`sonic-db-cli CONFIG_DB hset 'QUEUE|Ethernet96|0' scheduler SCHEDULER_BLOCK_DATA_PLANE`
2. Send packets to make the buffer full.

2. Packet trimming only supports "Lossy Queue" and it is configured only on the egress queue.
3. Packet trimming only supports config reload and cold reboot, does not support warm/fast reboot.
4. After packet is trimmed, the `checksum` and `IP length` fields in IP header is not recalculated.
5. Trimmed packet counters for PORT/QUEUE levels are not supported.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why trim packet counters are not supported??

Copy link
Contributor

Choose a reason for hiding this comment

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

In show queue counters, we can see the packet counters, which include normal forwarded packets and trimmed packets.
But the counters can not distinguish which packets are trimmed and which are normally forwarded.

admin@router:~$ show queue counters Ethernet96
Last cached time was 2025-04-15T02:06:38.079938
Ethernet96 Last cached time was 2025-04-15T02:06:38.079938
      Port    TxQ    Counter/pkts    Counter/bytes    Drop/pkts    Drop/bytes
----------  -----  --------------  ---------------  -----------  ------------
Ethernet96    UC0               0                0       95,365           N/A   <<< Queue is full
Ethernet96    UC1               0                0            0           N/A
Ethernet96    UC2               0                0            0           N/A
Ethernet96    UC3               0                0            0           N/A
Ethernet96    UC4               0                0            0           N/A
Ethernet96    UC5               0                0            0           N/A
Ethernet96    UC6          95,365       24,794,900            0           N/A   <<< The trimmed packet are sent from another queue base on the config TRIM_QUEUE value
Ethernet96    UC7             184           17,230            0           N/A

Copy link
Collaborator

Choose a reason for hiding this comment

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

@weiguo-nvidia Some SKUs support trim counters, could you add the trim counter check for those SKUs?

Copy link
Contributor

Choose a reason for hiding this comment

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

@weiguo-nvidia Some SKUs support trim counters, could you add the trim counter check for those SKUs?

Added trim counter check in Test Case 2: Verify Packet Size After Trimming and added command and output examples.

1. Packet trimming ​only supports IPv4 and IPv6 unicast packets. The ARP/NDP/ECMP are ​not supported. Any encap/decap packets (e.g., VxLAN, GRE, MPLS) are ​not supported.
2. Packet trimming only supports "Lossy Queue" and it is configured only on the egress queue.
3. Packet trimming only supports config reload and cold reboot, does not support warm/fast reboot.
4. After packet is trimmed, the `checksum` and `IP length` fields in IP header is not recalculated.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add a condition check for queue drop counters and queue trim counters

Copy link
Contributor

Choose a reason for hiding this comment

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

I have added a step to check the queue counter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@weiguo-nvidia pls check the HLD - https://github.com/sonic-net/SONiC/pull/1898/files

show queue counters shows trim packets counters in the dropped queue.

Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for your reminding, I found the command portstat -i Ethernet0 --trim and updated the document.


---

## Test Case 9: Verify Trimming During Multiple Egress Port Admin Toggle
Copy link
Collaborator

Choose a reason for hiding this comment

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

Verify packet trimming config toggle from trim-->drop-->trim

Copy link
Contributor

Choose a reason for hiding this comment

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

I have updated the case to verify trimming function after each config toggle.


## Test Case 9: Verify Trimming During Multiple Egress Port Admin Toggle
**Objective**: Validate trimming functions when repeatedly enabling/disabling egress ports.
**Test Steps**:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Verify packet trimming functionality along with WRED ECN marking for queue tail drop packets.

Copy link
Contributor

@weiguo-nvidia weiguo-nvidia Apr 16, 2025

Choose a reason for hiding this comment

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

Will check this field

5) "queue_index"
6) "6"
```
4. Configure trimming via config_db.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Verify for both V4 and V6 traffic

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, all the test should cover ipv4_tcp / ipv4_udp / ipv6_tcp / ipv6_udp packets. I have added notes in the testcase

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

- Verify the SRv6 DECAP packet is trimmed, verify the trimmed packet size is correct.
- Verify SRv6 packet decapsulation success.
- Verify the DSCP value is not updated in the packet.
(The DSCP value of the outer header of the SRv6 packet is updated by trimming, and the DSCP value of the inner header is not updated. After decapsulation, the outer header is discarded, leaving only the inner packet. Therefore, the DSCP value of the inner header is not updated.)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add GCU test case to update the switch trim configs and queue profile update

Copy link
Collaborator

Choose a reason for hiding this comment

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

@weiguo-nvidia could you please add GCU test cases as well

Copy link
Contributor

Choose a reason for hiding this comment

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

@weiguo-nvidia could you please add GCU test cases as well

Add a new case to test the GCUs that have been added to the test plan.

5. Verify no crashes/core dumps observed.

---

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add snappi tests to include line rate packet trim testing

Copy link
Contributor

Choose a reason for hiding this comment

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

line rate packet trim testing

For functional test, it is hard to send line rate testing. Block the queue to simulate the scenario where the buffer is full.

1. Configure packet trimming in global level and set `packet_discard_action=trim` in buffer profile.
2. Create ACL rules to disable trimming action for specific flows.
```json
"ACL_RULE": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add for V6 ACLs as well

Copy link
Contributor

Choose a reason for hiding this comment

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

Add for V6 ACLs as well

Added IPv6 ACL config and sent IPv6 packet as well




# 3. Packet Flow
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please include that this test plan intends to cover only static DSCP and Queue mode.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please include that this test plan intends to cover only static DSCP and Queue mode.

Added the instructions.

4. Verify the packets are dropped (not trimmed).
5. Verify ACL disable trim action counter increments.
6. Send packets with src_ip `1.1.1.2` (not matched ACL rule) to DUT and exceeding buffer threshold.
7. Verfiy the packet is trimmed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

verify trim for same traffic matching ACL after deleting ACL rule or ACL table

Copy link
Contributor

Choose a reason for hiding this comment

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

verify trim for same traffic matching ACL after deleting ACL rule or ACL table

Added this step.

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@mssonicbld
Copy link
Collaborator

/azp run

@weiguo-nvidia
Copy link
Contributor

only traditional. You can have the test verify that this is the module and if not, do not run the test

Thanks! I will update the test script. No need update for the current test plan PR

@nhe-NV
Copy link
Contributor

nhe-NV commented Jun 27, 2025

Hi @kperumalbfn Can you help to review the PR again?

@weiguo-nvidia
Copy link
Contributor

Hi @r12f @bingwang-ms @yxieca
Could you help review the test plan again, thanks

@weiguo-nvidia weiguo-nvidia mentioned this pull request Jul 2, 2025
11 tasks
@bingwang-ms
Copy link
Collaborator

@r12f @kperumalbfn Can you please help review?

**Test Steps**:
1. Configure packet trimming in global level and set `"dscp_value": "48"`, `"size": "256"`.
2. Create a buffer profile setting `packet_discard_action=trim` and apply buffer profile.
3. Create egress queue congestion.
Copy link
Collaborator

Choose a reason for hiding this comment

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

By default, most of the trim eligible queues have WRED enabled. So most of the ingress traffic should be with ECN enabled. Please check.

Copy link
Contributor

@weiguo-nvidia weiguo-nvidia Jul 4, 2025

Choose a reason for hiding this comment

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

Yes, you are correct. I have added the notes If the queue has WRED enabled, the packet should have ECN enabled in the testplan


---

## Test Case 12: Verify Trimming in Generic Config Updater Test
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you also add one test case for strict queue configured on the trim queue?

Copy link
Contributor

Choose a reason for hiding this comment

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

@kperumalbfn This is a new reuqirements, not only to udpate the test plan, we also need to plan effort to update the test case. We will take into internal to review how and when could we commit it, and besides this one, do you still have some other comments? If not can we have merge this one, and update the new requirement later?

@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@kperumalbfn
Copy link
Collaborator

@yxieca Could you merge packet trimming testplan

@kperumalbfn
Copy link
Collaborator

@weiguo-nvidia In the next update, could you add test case to include 4K packet size.

@yxieca yxieca merged commit 1746537 into sonic-net:master Jul 24, 2025
4 checks passed
@weiguo-nvidia
Copy link
Contributor

@weiguo-nvidia In the next update, could you add test case to include 4K packet size.

The 4K trimmed packet test already exist in the "Test Case 2: Verify Packet Size After Trimming" of the test plan.

1. Update the trimming size value to 4084.
2. Send 5000B packets from PTF to DUT to test jumb packet trimming.
3. Capture egress packets and verify trimmed packet size is 4084B.

nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Aug 7, 2025
What is the motivation for this PR?
Introduce packet trimming test plan
ashutosh-agrawal pushed a commit to ashutosh-agrawal/sonic-mgmt that referenced this pull request Aug 14, 2025
What is the motivation for this PR?
Introduce packet trimming test plan
vidyac86 pushed a commit to vidyac86/sonic-mgmt that referenced this pull request Oct 23, 2025
What is the motivation for this PR?
Introduce packet trimming test plan
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
What is the motivation for this PR?
Introduce packet trimming test plan

Signed-off-by: opcoder0 <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
What is the motivation for this PR?
Introduce packet trimming test plan

Signed-off-by: Guy Shemesh <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
What is the motivation for this PR?
Introduce packet trimming test plan

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
What is the motivation for this PR?
Introduce packet trimming test plan

Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
What is the motivation for this PR?
Introduce packet trimming test plan
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Jan 26, 2026
What is the motivation for this PR?
Introduce packet trimming test plan

Signed-off-by: Guy Shemesh <[email protected]>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
What is the motivation for this PR?
Introduce packet trimming test plan

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants