Skip to content

Commit 68d9cea

Browse files
pmachatadavem330
authored andcommitted
selftests: forwarding: lib: Parameterize NUM_NETIFS in two functions
setup_wait() and tc_offload_check() both assume that all NUM_NETIFS interfaces are relevant for a given test. However, the scale test script acts as an umbrella for a number of sub-tests, some of which may not require all the interfaces. Thus it's suboptimal for tc_offload_check() to query all the interfaces. In case of setup_wait() it's incorrect, because the sub-test in question of course doesn't configure any interfaces beyond what it needs, and setup_wait() then ends up waiting indefinitely for the extraneous interfaces to come up. For that reason, give setup_wait() and tc_offload_check() an optional parameter with a number of interfaces to probe. Fall back to global NUM_NETIFS if the parameter is not given. Signed-off-by: Petr Machata <petrm@mellanox.com> Reviewed-by: Yuval Mintz <yuvalm@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 96fa91d commit 68d9cea

File tree

1 file changed

+6
-2
lines changed
  • tools/testing/selftests/net/forwarding

1 file changed

+6
-2
lines changed

tools/testing/selftests/net/forwarding/lib.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,9 @@ setup_wait_dev()
220220

221221
setup_wait()
222222
{
223-
for i in $(eval echo {1..$NUM_NETIFS}); do
223+
local num_netifs=${1:-$NUM_NETIFS}
224+
225+
for ((i = 1; i <= num_netifs; ++i)); do
224226
setup_wait_dev ${NETIFS[p$i]}
225227
done
226228

@@ -481,7 +483,9 @@ forwarding_restore()
481483

482484
tc_offload_check()
483485
{
484-
for i in $(eval echo {1..$NUM_NETIFS}); do
486+
local num_netifs=${1:-$NUM_NETIFS}
487+
488+
for ((i = 1; i <= num_netifs; ++i)); do
485489
ethtool -k ${NETIFS[p$i]} \
486490
| grep "hw-tc-offload: on" &> /dev/null
487491
if [[ $? -ne 0 ]]; then

0 commit comments

Comments
 (0)