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 the "QoS - basic configuration", "QoS - 64bit" and
"Ingress Policing - 64-bit" tests to fail because they were matching exact
burst and cburst values in tc output.For consistency and as a proactive measure in case of further changes to tc, the following tests are also updated, although they are currently not directly affected: "offloads - set ingress_policing_rate and ingress_policing_burst - offloads disabled" "offloads - set ingress_policing_rate and ingress_policing_burst - offloads enabled" The rounding fix means that burst and cburst values may differ slightly from previous versions. For example, values that were previously 750000 might now be 749999 or similar variations. To maintain compatibility with both old and new versions of tc, the test assertions now use pattern matching with dots that: - Matches the most significant digit of the value - Uses dots to match any character for remaining digits - Maintains the correct total number of digits - Preserves the unit suffix (e.g., 'b' for bytes) For example, '375000b' now matches '3.....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://mail.openvswitch.org/pipermail/ovs-dev/2025-December/428593.html Reported-at: https://launchpad.net/bugs/2129005 Assisted-by: claude-sonnet-4.5, GitHub Copilot CLI Signed-off-by: Frode Nordahl <[email protected]> --- tests/system-offloads-traffic.at | 14 ++++++-------- tests/system-traffic.at | 12 ++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/system-offloads-traffic.at b/tests/system-offloads-traffic.at index 492d5b689..e38221101 100644 --- a/tests/system-offloads-traffic.at +++ b/tests/system-offloads-traffic.at @@ -106,11 +106,10 @@ AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10]) AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl other_config : {hw-offload="false"} ]) +m4_define([POLICE_CONF], [rate 100Kbit burst 1...b]) AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress | - sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'], - [0],[dnl -rate 100Kbit burst 1280b -]) + sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' | + grep POLICE_CONF]) AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | grep -E "basic|matchall" > /dev/null], [0]) OVS_TRAFFIC_VSWITCHD_STOP @@ -128,11 +127,10 @@ AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=10]) AT_CHECK([ovs-vsctl --columns=other_config list open], [0], [dnl other_config : {hw-offload="true"} ]) +m4_define([POLICE_CONF], [rate 100Kbit burst 1...b]) AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress | - sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'], - [0],[dnl -rate 100Kbit burst 1280b -]) + sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' | + grep POLICE_CONF]) AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress | grep matchall | sed -n 's/.*\(matchall\).*/\1/; T; p; q'], [0], [dnl matchall diff --git a/tests/system-traffic.at b/tests/system-traffic.at index 58a46af0a..93264e8ce 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.....b cburst 3.....b]) +m4_define([HTB_CONF1], [rate 4Mbit ceil 5Gbit burst 5.....b cburst 5.....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.....b cburst 6.....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']) @@ -3189,10 +3189,10 @@ ADD_VETH(p0, ns0, br0, "10.1.1.1/24") AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_rate=50000000]) AT_CHECK([ovs-vsctl set interface ovs-p0 ingress_policing_burst=400000]) +m4_define([POLICE_CONF], [rate 50Gbit burst 7.......b]) AT_CHECK([tc -o -s -d filter show dev ovs-p0 ingress | - sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q'], - [0],[dnl -rate 50Gbit burst 74500000b + sed -n 's/.*\(rate [[0-9]]*[[a-zA-Z]]* burst [[0-9]]*[[a-zA-Z]]*\).*/\1/; T; p; q' | + grep POLICE_CONF]) ]) AT_CHECK([tc -s -d filter show dev ovs-p0 ingress | -- 2.51.0 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
