selftests: lib: tc_rule_stats_get(): Move default to argument definition
authorPetr Machata <petrm@nvidia.com>
Thu, 27 Jun 2024 14:48:40 +0000 (16:48 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 28 Jun 2024 09:55:36 +0000 (10:55 +0100)
The argument $dir has a fallback value of "ingress". Move the fallback from
the usage site to the argument definition block to make the fact clearer.

Signed-off-by: Petr Machata <petrm@nvidia.com>
Reviewed-by: Danielle Ratson <danieller@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/lib.sh

index 915f319..d021903 100644 (file)
@@ -199,10 +199,10 @@ tc_rule_stats_get()
 {
        local dev=$1; shift
        local pref=$1; shift
-       local dir=$1; shift
+       local dir=${1:-ingress}; shift
        local selector=${1:-.packets}; shift
 
-       tc -j -s filter show dev $dev ${dir:-ingress} pref $pref \
+       tc -j -s filter show dev $dev $dir pref $pref \
            | jq ".[1].options.actions[].stats$selector"
 }