diff mbox series

[v2,mptcp-next,15/16] selftests: mptcp: enable checksum in mptcp_connect.sh

Message ID fa2e5e2e8eee03798175cc42e73810518b47d29b.1617014019.git.geliangtang@gmail.com
State Superseded, archived
Delegated to: Mat Martineau
Headers show
Series data checksum support | expand

Commit Message

Geliang Tang March 29, 2021, 10:54 a.m. UTC
This patch added a new argument "C" for mptcp_connect.sh script to
set the sysctl checksum_enabled to 1 to enable the data checksum.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

Comments

Mat Martineau March 30, 2021, 12:50 a.m. UTC | #1
On Mon, 29 Mar 2021, Geliang Tang wrote:

> This patch added a new argument "C" for mptcp_connect.sh script to
> set the sysctl checksum_enabled to 1 to enable the data checksum.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

In addition to the "-C" flag for adding checksums to most test cases, it 
would help to have a few more test cases added that verify the checksum 
handshake:

  * Sender and listener both have checksums off
  * Sender and listener both have checksums on
  * Sender checksums off, listener checksums on
  * Sender checksums on, listener checksums off

Those could run the same with or without "-C", but the rest of the tests 
would only enable checksums when "-C" was used.


Thanks,

Mat


> ---
> tools/testing/selftests/net/mptcp/mptcp_connect.sh | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> index 385cdc98aed8..c769f1e962bd 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
> @@ -3,7 +3,7 @@
>
> time_start=$(date +%s)
>
> -optstring="S:R:d:e:l:r:h4cm:f:t"
> +optstring="S:R:d:e:l:r:h4cm:f:tC"
> ret=0
> sin=""
> sout=""
> @@ -22,6 +22,7 @@ sndbuf=0
> rcvbuf=0
> options_log=true
> do_tcp=0
> +checksum=false
> filesize=0
>
> if [ $tc_loss -eq 100 ];then
> @@ -47,6 +48,7 @@ usage() {
> 	echo -e "\t-R: set rcvbuf value (default: use kernel default)"
> 	echo -e "\t-m: test mode (poll, sendfile; default: poll)"
> 	echo -e "\t-t: also run tests with TCP (use twice to non-fallback tcp)"
> +	echo -e "\t-C: enable the MPTCP data checksum"
> }
>
> while getopts "$optstring" option;do
> @@ -104,6 +106,9 @@ while getopts "$optstring" option;do
> 	"t")
> 		do_tcp=$((do_tcp+1))
> 		;;
> +	"C")
> +		checksum=true
> +		;;
> 	"?")
> 		usage $0
> 		exit 1
> @@ -200,6 +205,12 @@ ip -net "$ns4" route add default via dead:beef:3::2
> # use TCP syn cookies, even if no flooding was detected.
> ip netns exec "$ns2" sysctl -q net.ipv4.tcp_syncookies=2
>
> +if $checksum; then
> +	for i in "$ns1" "$ns2" "$ns3" "$ns4";do
> +		ip netns exec $i sysctl -q net.mptcp.checksum_enabled=1
> +	done
> +fi
> +
> set_ethtool_flags() {
> 	local ns="$1"
> 	local dev="$2"
> -- 
> 2.30.2
>
>
>

--
Mat Martineau
Intel
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 385cdc98aed8..c769f1e962bd 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -3,7 +3,7 @@ 
 
 time_start=$(date +%s)
 
-optstring="S:R:d:e:l:r:h4cm:f:t"
+optstring="S:R:d:e:l:r:h4cm:f:tC"
 ret=0
 sin=""
 sout=""
@@ -22,6 +22,7 @@  sndbuf=0
 rcvbuf=0
 options_log=true
 do_tcp=0
+checksum=false
 filesize=0
 
 if [ $tc_loss -eq 100 ];then
@@ -47,6 +48,7 @@  usage() {
 	echo -e "\t-R: set rcvbuf value (default: use kernel default)"
 	echo -e "\t-m: test mode (poll, sendfile; default: poll)"
 	echo -e "\t-t: also run tests with TCP (use twice to non-fallback tcp)"
+	echo -e "\t-C: enable the MPTCP data checksum"
 }
 
 while getopts "$optstring" option;do
@@ -104,6 +106,9 @@  while getopts "$optstring" option;do
 	"t")
 		do_tcp=$((do_tcp+1))
 		;;
+	"C")
+		checksum=true
+		;;
 	"?")
 		usage $0
 		exit 1
@@ -200,6 +205,12 @@  ip -net "$ns4" route add default via dead:beef:3::2
 # use TCP syn cookies, even if no flooding was detected.
 ip netns exec "$ns2" sysctl -q net.ipv4.tcp_syncookies=2
 
+if $checksum; then
+	for i in "$ns1" "$ns2" "$ns3" "$ns4";do
+		ip netns exec $i sysctl -q net.mptcp.checksum_enabled=1
+	done
+fi
+
 set_ethtool_flags() {
 	local ns="$1"
 	local dev="$2"