]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
selftests: mlxsw: qos_defprio: Convert from lldptool to dcb
authorPetr Machata <petrm@nvidia.com>
Mon, 30 Jan 2023 16:40:03 +0000 (17:40 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Feb 2023 05:02:11 +0000 (21:02 -0800)
Set up default port priority through the iproute2 dcb tool, which is easier
to understand and manage.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/mlxsw/qos_defprio.sh

index 71066bc4b886dfa7aff7ecf41a650cf4c2ee04a3..5492fa5550d763a937a4f9f0178c7d3c02b6ea4b 100755 (executable)
@@ -5,18 +5,18 @@
 # prioritized according to the default priority specified at the port.
 # rx_octets_prio_* counters are used to verify the prioritization.
 #
-# +-----------------------+
-# | H1                    |
-# |    + $h1              |
-# |    | 192.0.2.1/28     |
-# +----|------------------+
+# +----------------------------------+
+# | H1                               |
+# |    + $h1                         |
+# |    | 192.0.2.1/28                |
+# +----|-----------------------------+
 #      |
-# +----|------------------+
-# | SW |                  |
-# |    + $swp1            |
-# |      192.0.2.2/28     |
-# |      APP=<prio>,1,0   |
-# +-----------------------+
+# +----|-----------------------------+
+# | SW |                             |
+# |    + $swp1                       |
+# |      192.0.2.2/28                |
+# |      dcb app default-prio <prio> |
+# +----------------------------------+
 
 ALL_TESTS="
        ping_ipv4
@@ -29,42 +29,6 @@ NUM_NETIFS=2
 : ${HIT_TIMEOUT:=1000} # ms
 source $lib_dir/lib.sh
 
-declare -a APP
-
-defprio_install()
-{
-       local dev=$1; shift
-       local prio=$1; shift
-       local app="app=$prio,1,0"
-
-       lldptool -T -i $dev -V APP $app >/dev/null
-       lldpad_app_wait_set $dev
-       APP[$prio]=$app
-}
-
-defprio_uninstall()
-{
-       local dev=$1; shift
-       local prio=$1; shift
-       local app=${APP[$prio]}
-
-       lldptool -T -i $dev -V APP -d $app >/dev/null
-       lldpad_app_wait_del
-       unset APP[$prio]
-}
-
-defprio_flush()
-{
-       local dev=$1; shift
-       local prio
-
-       if ((${#APP[@]})); then
-               lldptool -T -i $dev -V APP -d ${APP[@]} >/dev/null
-       fi
-       lldpad_app_wait_del
-       APP=()
-}
-
 h1_create()
 {
        simple_if_init $h1 192.0.2.1/28
@@ -83,7 +47,7 @@ switch_create()
 
 switch_destroy()
 {
-       defprio_flush $swp1
+       dcb app flush dev $swp1 default-prio
        ip addr del dev $swp1 192.0.2.2/28
        ip link set dev $swp1 down
 }
@@ -124,7 +88,7 @@ __test_defprio()
 
        RET=0
 
-       defprio_install $swp1 $prio_install
+       dcb app add dev $swp1 default-prio $prio_install
 
        local t0=$(ethtool_stats_get $swp1 rx_frames_prio_$prio_observe)
        mausezahn -q $h1 -d 100m -c 10 -t arp reply
@@ -134,7 +98,7 @@ __test_defprio()
        check_err $? "Default priority $prio_install/$prio_observe: Expected to capture 10 packets, got $((t1 - t0))."
        log_test "Default priority $prio_install/$prio_observe"
 
-       defprio_uninstall $swp1 $prio_install
+       dcb app del dev $swp1 default-prio $prio_install
 }
 
 test_defprio()
@@ -145,7 +109,7 @@ test_defprio()
                __test_defprio $prio $prio
        done
 
-       defprio_install $swp1 3
+       dcb app add dev $swp1 default-prio 3
        __test_defprio 0 3
        __test_defprio 1 3
        __test_defprio 2 3
@@ -153,7 +117,7 @@ test_defprio()
        __test_defprio 5 5
        __test_defprio 6 6
        __test_defprio 7 7
-       defprio_uninstall $swp1 3
+       dcb app del dev $swp1 default-prio 3
 }
 
 trap cleanup EXIT