]> git.baikalelectronics.ru Git - kernel.git/commitdiff
selftests: mptcp: add MP_FAIL mibs check
authorGeliang Tang <geliangtang@xiaomi.com>
Tue, 24 Aug 2021 23:26:19 +0000 (16:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Aug 2021 10:02:35 +0000 (11:02 +0100)
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>
tools/testing/selftests/net/mptcp/mptcp_join.sh

index 7b3e6cc5693584d7d8603cf591b73e4467dd9387..255793c5ac4ffe189df68b0bd837404597c5c56f 100755 (executable)
@@ -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
 }