The tc command from iproute2 changed its rounding behavior in commit
d947f365602b ("tc: Fix rounding in tc_calc_xmittime and tc_calc_xmitsize.").
This caused QoS tests to be fragile because they were matching exact burst
and cburst values in tc output.

The rounding fix means that burst and cburst values may differ slightly
from previous versions. For example, values that were previously 620000
might now be 618750 or similar variations.

To maintain compatibility with both old and new versions of tc, the test
assertions now use pattern matching that:
- Matches the most significant digit(s) of the value
- Ensures all characters are numeric
- Maintains the correct total number of digits
- Preserves the unit suffix (e.g., 'b' for bytes)

For example, '375000b' now matches '3[0-9][0-9][0-9][0-9][0-9]b' which
accepts any 6-digit value starting with 3, allowing for rounding
differences while still validating the general magnitude is correct.

This follows the same approach as the related OVN patch:
https://patchwork.ozlabs.org/project/ovn/patch/[email protected]/

Reported-at: https://launchpad.net/bugs/2129005
Assisted-by: GitHub Copilot <[email protected]>
Signed-off-by: Frode Nordahl <[email protected]>
---

github copilot cli prompt BEGIN:
Context
=======
The current working directory contains a bootstrapped and built copy of the
Open vSwitch (OVS) project, which is also publicly available from
https://github.com/openvswitch/ovs.git.

The OVS an Open Virtual Network (OVN) projects are closely related, recently
a fix was proposed to OVN to adjust tests to new behavior of tc.

Take a look at the patch proposed for OVN which also contains a prompt:
https://patchwork.ozlabs.org/project/ovn/patch/[email protected]/

You can execute tests using:

    sudo make check-kernel TESTSUITEFLAGS="-j1" 

The entire system testsuite takes a while, so by correlating test name and
number in the built autotest scripts (tests/system-kmod-testsuite) and add
the specific test numbers to the TESTSUITEFLAGS variable you can execute
only the tests you are interested in.

Assignment
==========

Locate any tests that require adapting in the OVS tree and follow a similar
approach as the referenced OVN patch and prompt.

Make sure to read the section on AI-assisted Contributions in 
Documentation/internals/contributing/submitting-patches.rst,
as our previous patch used an incorrect tag in the proposed commit message.
END
github copilot cli transcript: 
https://gist.github.com/fnordahl/43fb3c169c8acf2d0efa765f6b6b2d7a

 tests/system-traffic.at | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 58a46af0a..80d6cd67f 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -3141,8 +3141,8 @@ OVS_WAIT_UNTIL([tc qdisc show dev ovs-tap0 | grep -q htb])
 OVS_WAIT_UNTIL([tc qdisc show dev ovs-tap1 | grep -q htb])
 
 dnl Check the configuration.
-m4_define([HTB_CONF0], [rate 2Mbit ceil 3Mbit burst 375000b cburst 375000b])
-m4_define([HTB_CONF1], [rate 4Mbit ceil 5Gbit burst 500000b cburst 500000b])
+m4_define([HTB_CONF0], [rate 2Mbit ceil 3Mbit burst 
3[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b cburst 
3[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b])
+m4_define([HTB_CONF1], [rate 4Mbit ceil 5Gbit burst 
5[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b cburst 
5[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b])
 AT_CHECK([tc class show dev ovs-tap0 | grep -q 'class htb .* HTB_CONF0'])
 AT_CHECK([tc class show dev ovs-tap0 | grep -q 'class htb .* HTB_CONF1'])
 AT_CHECK([tc class show dev ovs-tap1 | grep -q 'class htb .* HTB_CONF0'])
@@ -3172,7 +3172,7 @@ AT_CHECK([ovs-vsctl set port ovs-p0 qos=@qos -- set port 
ovs-p1 qos=@qos dnl
 OVS_WAIT_UNTIL([tc qdisc show dev ovs-p0 | grep -q htb])
 OVS_WAIT_UNTIL([tc qdisc show dev ovs-p1 | grep -q htb])
 
-m4_define([HTB_CONF], [rate 40Gbit ceil 50Gbit burst 620000b cburst 618750b])
+m4_define([HTB_CONF], [rate 40Gbit ceil 50Gbit burst 
6[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b cburst 
6[[0-9]][[0-9]][[0-9]][[0-9]][[0-9]]b])
 AT_CHECK([tc class show dev ovs-p0 | grep -q 'class htb .* HTB_CONF'])
 AT_CHECK([tc class show dev ovs-p1 | grep -q 'class htb .* HTB_CONF'])
 
-- 
2.43.0

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to