Skip to content

Commit

Permalink
selftests: mptcp: join: reduce join_nr params
Browse files Browse the repository at this point in the history
chk_join_nr() currently takes 9 positional parameters, 6 of them are
optional. It makes it hard to read:

  chk_join_nr 1 1 1 1 0 1 1 0 4

Naming these vars helps to make it easier to read:

  join_csum_ns1=1 join_csum_ns2=0 \
    join_fail_nr=1 join_rst_nr=1 join_infi_nr=0 \
    join_corrupted_pkts=4 \
    chk_join_nr 1 1 1

It will then be easier to add new optional parameters.

Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20240902-net-next-mptcp-mib-mpjtx-misc-v1-4-d3e0f3773b90@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Matthieu Baerts (NGI0) authored and Jakub Kicinski committed Sep 3, 2024
1 parent 1bd1788 commit 1b2965a
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions tools/testing/selftests/net/mptcp/mptcp_join.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ unset sflags
unset fastclose
unset fullmesh
unset speed
unset join_csum_ns1
unset join_csum_ns2
unset join_fail_nr
unset join_rst_nr
unset join_infi_nr
unset join_corrupted_pkts

# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
# (ip6 && (ip6[74] & 0xf0) == 0x30)'"
Expand Down Expand Up @@ -1319,12 +1325,12 @@ chk_join_nr()
local syn_nr=$1
local syn_ack_nr=$2
local ack_nr=$3
local csum_ns1=${4:-0}
local csum_ns2=${5:-0}
local fail_nr=${6:-0}
local rst_nr=${7:-0}
local infi_nr=${8:-0}
local corrupted_pkts=${9:-0}
local csum_ns1=${join_csum_ns1:-0}
local csum_ns2=${join_csum_ns2:-0}
local fail_nr=${join_fail_nr:-0}
local rst_nr=${join_rst_nr:-0}
local infi_nr=${join_infi_nr:-0}
local corrupted_pkts=${join_corrupted_pkts:-0}
local count
local with_cookie

Expand Down Expand Up @@ -3164,7 +3170,8 @@ fastclose_tests()
MPTCP_LIB_SUBTEST_FLAKY=1
test_linkfail=1024 fastclose=server \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 0 0 0 1
join_rst_nr=1 \
chk_join_nr 0 0 0
chk_fclose_nr 1 1 invert
chk_rst_nr 1 1
fi
Expand All @@ -3183,7 +3190,10 @@ fail_tests()
MPTCP_LIB_SUBTEST_FLAKY=1
test_linkfail=128 \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 0 0 0 +1 +0 1 0 1 "$(pedit_action_pkts)"
join_csum_ns1=+1 join_csum_ns2=+0 \
join_fail_nr=1 join_rst_nr=0 join_infi_nr=1 \
join_corrupted_pkts="$(pedit_action_pkts)" \
chk_join_nr 0 0 0
chk_fail_nr 1 -1 invert
fi

Expand All @@ -3196,7 +3206,10 @@ fail_tests()
pm_nl_add_endpoint $ns2 10.0.2.2 dev ns2eth2 flags subflow
test_linkfail=1024 \
run_tests $ns1 $ns2 10.0.1.1
chk_join_nr 1 1 1 1 0 1 1 0 "$(pedit_action_pkts)"
join_csum_ns1=1 join_csum_ns2=0 \
join_fail_nr=1 join_rst_nr=1 join_infi_nr=0 \
join_corrupted_pkts="$(pedit_action_pkts)" \
chk_join_nr 1 1 1
fi
}

Expand Down

0 comments on commit 1b2965a

Please sign in to comment.