selftests: mptcp: add MP_FAIL mibs check

This patch added a function chk_fail_nr to check the mibs for MP_FAIL.

Signed-off-by: Geliang Tang <geliangtang@xiaomi.com>
Signed-off-by: Mat Martineau <mathew.j.martineau@linux.intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Geliang Tang 2021-08-24 16:26:19 -07:00 committed by David S. Miller
parent eb7f33654d
commit 6bb3ab4913

View File

@ -578,6 +578,43 @@ chk_csum_nr()
fi
}
chk_fail_nr()
{
local mp_fail_nr_tx=$1
local mp_fail_nr_rx=$2
local count
local dump_stats
printf "%-39s %s" " " "ftx"
count=`ip netns exec $ns1 nstat -as | grep MPTcpExtMPFailTx | awk '{print $2}'`
[ -z "$count" ] && count=0
if [ "$count" != "$mp_fail_nr_tx" ]; then
echo "[fail] got $count MP_FAIL[s] TX expected $mp_fail_nr_tx"
ret=1
dump_stats=1
else
echo -n "[ ok ]"
fi
echo -n " - frx "
count=`ip netns exec $ns2 nstat -as | grep MPTcpExtMPFailRx | awk '{print $2}'`
[ -z "$count" ] && count=0
if [ "$count" != "$mp_fail_nr_rx" ]; then
echo "[fail] got $count MP_FAIL[s] RX expected $mp_fail_nr_rx"
ret=1
dump_stats=1
else
echo "[ ok ]"
fi
if [ "${dump_stats}" = 1 ]; then
echo Server ns stats
ip netns exec $ns1 nstat -as | grep MPTcp
echo Client ns stats
ip netns exec $ns2 nstat -as | grep MPTcp
fi
}
chk_join_nr()
{
local msg="$1"
@ -627,6 +664,7 @@ chk_join_nr()
fi
if [ $checksum -eq 1 ]; then
chk_csum_nr
chk_fail_nr 0 0
fi
}