[2/2] lib/tst_net.sh: use SO_BINDTODEVICE in tst_netload()
diff mbox series

Message ID 1551198213-10024-2-git-send-email-alexey.kodanev@oracle.com
State New
Delegated to: Alexey Kodanev
Headers show
Series
  • [1/2] lib/tst_net.sh: don't treat TWARN/TCONF as failure in tst_netload()
Related show

Commit Message

Alexey Kodanev Feb. 26, 2019, 4:23 p.m. UTC
Since we have the information about the device, enable the
usage of the option, when starting netstress.

It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
---
 testcases/lib/tst_net.sh |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Comments

Petr Vorel Feb. 26, 2019, 6:27 p.m. UTC | #1
Hi Alexey,

> Since we have the information about the device, enable the
> usage of the option, when starting netstress.

> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

Acked-by: Petr Vorel <pvorel@suse.cz>


Kind regards,
Petr
Petr Vorel March 14, 2019, 1:33 p.m. UTC | #2
Hi Alexey,

> > Since we have the information about the device, enable the
> > usage of the option, when starting netstress.

> > It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

Having any reason not to push this patch?

Kind regards,
Petr
Alexey Kodanev March 14, 2019, 2:37 p.m. UTC | #3
Hi Petr,
On 3/14/19 4:33 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>> Since we have the information about the device, enable the
>>> usage of the option, when starting netstress.
> 
>>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
> 
> Having any reason not to push this patch?
> 

Yes, at least this patch breaks mpls and ipsec/vti tests.

For mpls the fix can be:

diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh
index 84b3236..4ac7995 100755
--- a/testcases/network/mpls/mpls_lib.sh
+++ b/testcases/network/mpls/mpls_lib.sh
@@ -8,7 +8,7 @@ TST_NEEDS_ROOT=1
 TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel mpls_gso"
 TST_NEEDS_CMDS="sysctl modprobe"
 TST_TEST_DATA="icmp tcp udp"
-
+TST_NETLOAD_BINDTODEVICE=0
 . tst_net.sh


For ipsec/vti we have to set the vti device:

diff --git a/testcases/network/stress/sctp/sctp_ipsec_vti.sh b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
index fe6135a..9c57471 100755
--- a/testcases/network/stress/sctp/sctp_ipsec_vti.sh
+++ b/testcases/network/stress/sctp/sctp_ipsec_vti.sh
@@ -17,7 +17,7 @@ do_test()

        [ "$2" != "$rand_opt" ] && opts="-A $rand_opt"
        tst_netload -H $ip_rmt_tun -T sctp $opts -r $IPSEC_REQUESTS \
-               -S $ip_loc_tun
+               -S $ip_loc_tun -D $tst_vti
 }



Moreover, since the "-D" is rather optional, may be it would be good
to control it with TST_NELOAD_BINDTODEVICE too?

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7e16d58..e017321 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -565,7 +565,7 @@ tst_netload()
                f) cs_opts="${cs_opts}-f " ;;
                F) cs_opts="${cs_opts}-F " ;;
                e) expect_res="$OPTARG" ;;
-               D) cs_opts="${cs_opts}-D $OPTARG "
+               D) [ "$TST_NETLOAD_BINDTODEVICE" = 1 ] && cs_opts="${cs_opts}-D $OPTARG "
                   bind_to_device=0 ;;
                *) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;;
                esac



> Kind regards,
> Petr
>
Petr Vorel March 14, 2019, 4:20 p.m. UTC | #4
Hi Alexey,

> >>> Since we have the information about the device, enable the
> >>> usage of the option, when starting netstress.

> >>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.

> > Having any reason not to push this patch?


> Yes, at least this patch breaks mpls and ipsec/vti tests.
Right, all but mpls01 are broken, haven't noticed this.
Any idea why?

Kind regards,
Petr
Alexey Kodanev March 14, 2019, 5:27 p.m. UTC | #5
On 3/14/19 7:20 PM, Petr Vorel wrote:
> Hi Alexey,
> 
>>>>> Since we have the information about the device, enable the
>>>>> usage of the option, when starting netstress.
> 
>>>>> It can be disabled with TST_NETLOAD_BINDTODEVICE=0.
> 
>>> Having any reason not to push this patch?
> 
> 
>> Yes, at least this patch breaks mpls and ipsec/vti tests.
> Right, all but mpls01 are broken, haven't noticed this.
> Any idea why?

mpls01 just creates/deletes routes, checks options - it's not using tst_netload().


> 
> Kind regards,
> Petr
>

Patch
diff mbox series

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 7625c51..9e26cee 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -537,6 +537,7 @@  tst_netload()
 	# number of server replies after which TCP connection is closed
 	local s_replies="${TST_NETLOAD_MAX_SRV_REPLIES:-500000}"
 	local s_opts=
+	local bind_to_device=1
 
 	if [ ! "$TST_NEEDS_TMPDIR" = 1 ]; then
 		tst_brk_ TBROK "Using tst_netload requires setting TST_NEEDS_TMPDIR=1"
@@ -564,7 +565,8 @@  tst_netload()
 		f) cs_opts="${cs_opts}-f " ;;
 		F) cs_opts="${cs_opts}-F " ;;
 		e) expect_res="$OPTARG" ;;
-		D) cs_opts="${cs_opts}-D $OPTARG " ;;
+		D) cs_opts="${cs_opts}-D $OPTARG "
+		   bind_to_device=0 ;;
 		*) tst_brk_ TBROK "tst_netload: unknown option: $OPTARG" ;;
 		esac
 	done
@@ -572,6 +574,11 @@  tst_netload()
 
 	[ "$setup_srchost" = 1 ] && s_opts="${s_opts}-S $hostopt "
 
+	if [ "$bind_to_device" = 1 -a "$TST_NETLOAD_BINDTODEVICE" = 1 ]; then
+		c_opts="${c_opts}-D $(tst_iface) "
+		s_opts="${s_opts}-D $(tst_iface rhost) "
+	fi
+
 	local expect_ret=0
 	[ "$expect_res" != "pass" ] && expect_ret=3
 
@@ -788,6 +795,7 @@  fi
 
 export TST_NETLOAD_CLN_REQUESTS="${TST_NETLOAD_CLN_REQUESTS:-10000}"
 export TST_NETLOAD_CLN_NUMBER="${TST_NETLOAD_CLN_NUMBER:-2}"
+export TST_NETLOAD_BINDTODEVICE="${TST_NETLOAD_BINDTODEVICE:-1}"
 export HTTP_DOWNLOAD_DIR="${HTTP_DOWNLOAD_DIR:-/var/www/html}"
 export FTP_DOWNLOAD_DIR="${FTP_DOWNLOAD_DIR:-/var/ftp}"
 export FTP_UPLOAD_DIR="${FTP_UPLOAD_DIR:-/var/ftp/pub}"