diff mbox series

[2/4] lib/tst_net.sh: add new TST_NET_MAX_PKT env variable

Message ID 1550587673-7995-3-git-send-email-alexey.kodanev@oracle.com
State Accepted
Headers show
Series network: new random message size test-cases | expand

Commit Message

Alexey Kodanev Feb. 19, 2019, 2:47 p.m. UTC
This is critical for performance tests, which compare virtual
devices with the real ones. Trigger the fragmentation but keep
the number of fragments at the minimum for those cases.

Also improve the test timing if MTU is not large.

The previous numbers can be restored with TST_NET_MAX_PKT
environment variable.

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. 20, 2019, 8:15 a.m. UTC | #1
Hi Alexey,

> This is critical for performance tests, which compare virtual
> devices with the real ones. Trigger the fragmentation but keep
> the number of fragments at the minimum for those cases.

> Also improve the test timing if MTU is not large.

> The previous numbers can be restored with TST_NET_MAX_PKT
> environment variable.

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

Kind regards,
Petr
diff mbox series

Patch

diff --git a/testcases/lib/tst_net.sh b/testcases/lib/tst_net.sh
index 06b8ad6..3148643 100644
--- a/testcases/lib/tst_net.sh
+++ b/testcases/lib/tst_net.sh
@@ -710,6 +710,13 @@  tst_cleanup_rhost()
 	tst_rhost_run -c "rm -rf $TST_TMPDIR"
 }
 
+tst_default_max_pkt()
+{
+	local mtu="$(cat /sys/class/net/$(tst_iface)/mtu)"
+
+	echo "$((mtu + mtu / 10))"
+}
+
 # Management Link
 [ -z "$RHOST" ] && TST_USE_NETNS="yes"
 export RHOST="$RHOST"
@@ -797,7 +804,8 @@  export MCASTNUM_HEAVY="${MCASTNUM_HEAVY:-4000}"
 # want to use more ifaces.
 export LHOST_IFACES="${LHOST_IFACES:-eth0}"
 export RHOST_IFACES="${RHOST_IFACES:-eth0}"
-
+# Maximum payload size for 'virt' performance tests, by default eqauls to 1.1 * MTU
+export TST_NET_MAX_PKT="${TST_NET_MAX_PKT:-$(tst_default_max_pkt)}"
 # Set corresponding HW addresses, e.g. "00:00:00:00:00:01 00:00:00:00:00:02"
 export LHOST_HWADDRS="${LHOST_HWADDRS:-$(tst_get_hwaddrs lhost)}"
 export RHOST_HWADDRS="${RHOST_HWADDRS:-$(tst_get_hwaddrs rhost)}"