From 27e11adac63fad85284ca096f596583bcbee8be1 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 19 Sep 2020 07:58:51 -0600 Subject: [PATCH 01/19] interface-file: remap properties used by both debian and ifupdown2 ethtool addons to the ethtool- namespace --- libifupdown/interface-file.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index 7589841..0828826 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -27,13 +27,38 @@ struct remap_token { /* this list must be in alphabetical order for bsearch */ static const struct remap_token tokens[] = { + {"driver-message-level", "ethtool-msglvl"}, /* Debian ethtool integration */ {"endpoint", "tunnel-remote"}, /* legacy ifupdown */ + {"ethernet-autoneg", "ethtool-ethernet-autoneg"}, /* Debian ethtool integration */ + {"ethernet-pause-autoneg", "ethtool-pause-autoneg"}, /* Debian ethtool integration */ + {"ethernet-pause-rx", "ethtool-pause-rx"}, /* Debian ethtool integration */ + {"ethernet-pause-tx", "ethtool-pause-tx"}, /* Debian ethtool integration */ + {"ethernet-port", "ethtool-ethernet-port"}, /* Debian ethtool integration */ + {"ethernet-wol", "ethtool-ethernet-wol"}, /* Debian ethtool integration */ + {"gro-offload", "ethtool-offload-gro"}, /* ifupdown2 */ + {"gso-offload", "ethtool-offload-gso"}, /* ifupdown2 */ + {"link-duplex", "ethtool-link-duplex"}, /* Debian ethtool integration */ + {"link-fec", "ethtool-link-fec"}, /* ifupdown2 */ + {"link-speed", "ethtool-link-speed"}, /* Debian ethtool integration */ {"local", "tunnel-local"}, /* legacy ifupdown */ + {"lro-offload", "ethtool-offload-lro"}, /* ifupdown2 */ {"mode", "tunnel-mode"}, /* legacy ifupdown */ + {"offload-gro", "ethtool-offload-gro"}, /* Debian ethtool integration */ + {"offload-gso", "ethtool-offload-gso"}, /* Debian ethtool integration */ + {"offload-lro", "ethtool-offload-lro"}, /* Debian ethtool integration */ + {"offload-rx", "ethtool-offload-rx"}, /* Debian ethtool integration */ + {"offload-sg", "ethtool-offload-sg"}, /* Debian ethtool integration */ + {"offload-tso", "ethtool-offload-tso"}, /* Debian ethtool integration */ + {"offload-tx", "ethtool-offload-tx"}, /* Debian ethtool integration */ + {"offload-ufo", "ethtool-offload-ufo"}, /* Debian ethtool integration */ {"provider", "ppp-provider"}, /* legacy ifupdown, ifupdown2 */ + {"rx-offload", "ethtool-offload-rx"}, /* ifupdown2 */ + {"tso-offload", "ethtool-offload-tso"}, /* ifupdown2 */ {"ttl", "tunnel-ttl"}, /* legacy ifupdown */ {"tunnel-endpoint", "tunnel-remote"}, /* ifupdown2 */ {"tunnel-physdev", "tunnel-dev"}, /* ifupdown2 */ + {"tx-offload", "ethtool-offload-tx"}, /* ifupdown2 */ + {"ufo-offload", "ethtool-offload-ufo"}, /* ifupdown2 */ {"vrf", "vrf-member"}, /* ifupdown2 */ }; From a8fcf5502f453a910f5de895e6a0ddb024f1c348 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Sat, 19 Sep 2020 08:07:32 -0600 Subject: [PATCH 02/19] add a missing translation --- libifupdown/interface-file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index 0828826..5441abd 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -37,6 +37,7 @@ static const struct remap_token tokens[] = { {"ethernet-wol", "ethtool-ethernet-wol"}, /* Debian ethtool integration */ {"gro-offload", "ethtool-offload-gro"}, /* ifupdown2 */ {"gso-offload", "ethtool-offload-gso"}, /* ifupdown2 */ + {"link-autoneg", "ethtool-ethernet-autoneg"}, /* ifupdown2 */ {"link-duplex", "ethtool-link-duplex"}, /* Debian ethtool integration */ {"link-fec", "ethtool-link-fec"}, /* ifupdown2 */ {"link-speed", "ethtool-link-speed"}, /* Debian ethtool integration */ From 63ec8d4b3b4786ca21863c63725539bc2d905575 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:04:10 -0600 Subject: [PATCH 03/19] begin ethtool executor-script (as part of EXECUTOR_SCRIPTS_OPT). --- Makefile | 3 ++- executor-scripts/linux/ethtool | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100755 executor-scripts/linux/ethtool diff --git a/Makefile b/Makefile index 4c57959..cb4fa94 100644 --- a/Makefile +++ b/Makefile @@ -89,7 +89,8 @@ EXECUTOR_SCRIPTS_OPT ?= \ vrf \ tunnel \ gre \ - wireguard + wireguard \ + ethtool EXECUTOR_SCRIPTS ?= ${EXECUTOR_SCRIPTS_CORE} ${EXECUTOR_SCRIPTS_OPT} diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool new file mode 100755 index 0000000..d37118b --- /dev/null +++ b/executor-scripts/linux/ethtool @@ -0,0 +1,2 @@ +#!/bin/sh +set -e From b0480a3343a72be08639491df89c742d8b25b22a Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:20:43 -0600 Subject: [PATCH 04/19] ethtool: add pre-up settings to the executor --- executor-scripts/linux/ethtool | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index d37118b..30b4f5c 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -1,2 +1,13 @@ #!/bin/sh set -e + +case "$PHASE" in +pre-up) + settings= + [ -n "$IF_ETHTOOL_ETHERNET_PORT" ] && settings="port $IF_ETHTOOL_ETHERNET_PORT" + [ -n "$IF_ETHTOOL_MSGLVL" ] && settings="msglvl $IF_ETHTOOL_MSGLVL" + [ -z "$settings" ] || ethtool --change "$IFACE" $settings + ;; +up) + ;; +esac From 72277e51e235fde07273c58bed99f52c6b8ff87f Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:31:20 -0600 Subject: [PATCH 05/19] ethtool: add support for basic ethernet link settings --- executor-scripts/linux/ethtool | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 30b4f5c..20ec63f 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -3,11 +3,34 @@ set -e case "$PHASE" in pre-up) - settings= - [ -n "$IF_ETHTOOL_ETHERNET_PORT" ] && settings="port $IF_ETHTOOL_ETHERNET_PORT" - [ -n "$IF_ETHTOOL_MSGLVL" ] && settings="msglvl $IF_ETHTOOL_MSGLVL" - [ -z "$settings" ] || ethtool --change "$IFACE" $settings + settings="\ + ${IF_ETHTOOL_ETHERNET_PORT:+ port $IF_ETHTOOL_ETHERNET_PORT} + ${IF_ETHTOOL_MSGLVL:+ msglvl $IF_ETHTOOL_MSGLVL} + " + [ -z "$settings" ] || $MOCK ethtool --change "$IFACE" $settings ;; up) + # first do the link settings. + link_settings="\ + ${IF_ETHTOOL_LINK_SPEED:+ speed $IF_ETHTOOL_LINK_SPEED} + ${IF_ETHTOOL_LINK_DUPLEX:+ duplex $IF_ETHTOOL_LINK_DUPLEX} + " + + # ethernet-wol can have a second arg (key), split into $1 and $2 + set -- $IF_ETHTOOL_ETHERNET_WOL + link_settings="$link_settings${1:+ wol $1}${2:+ sopass $2}" + + # handle ethtool-ethernet-autoneg like Debian would + case "$IF_ETHTOOL_ETHERNET_AUTONEG" in + on|off) + link_settings="$link_settings autoneg $IF_ETHTOOL_ETHERNET_AUTONEG" + ;; + *) + link_settings="$link_settings autoneg on advertise $IF_ETHTOOL_ETHERNET_AUTONEG" + ;; + esac + + [ -z "$link_settings" ] || $MOCK ethtool --change "$IFACE" $link_settings + ;; esac From e4b4d8b70ab99c3bbd3e3b100f12786cb5588653 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:36:34 -0600 Subject: [PATCH 06/19] ethtool: add pause and offload settings support --- executor-scripts/linux/ethtool | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 20ec63f..4f735b5 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -1,6 +1,20 @@ #!/bin/sh set -e +# gather params for a given prefix, based on executor-scripts/linux/tunnel. +gather_params() { + set | sed -E " + s/^IF_${1}_([A-Z0-9_]+)=(.+)/\1\n\2/ + ta + d + :a + h + y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + P + g + s/.*\n//" +} + case "$PHASE" in pre-up) settings="\ @@ -32,5 +46,10 @@ up) [ -z "$link_settings" ] || $MOCK ethtool --change "$IFACE" $link_settings + pause_settings=$(gather_params IF_ETHTOOL_ETHERNET_PAUSE) + [ -z "$pause_settings" ] || $MOCK ethtool --pause "$IFACE" $pause_settings + + offload_settings=$(gather_params IF_ETHTOOL_OFFLOAD) + [ -z "$offload_settings" ] || $MOCK ethtool --offload "$IFACE" $offload_settings ;; esac From 0a58383ed8df6aa00c2d6b28302233f0185fdc5b Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:55:20 -0600 Subject: [PATCH 07/19] tests: ethtool: add tests for basic link settings, wol and autoneg --- tests/linux/Kyuafile | 1 + tests/linux/ethtool_test | 84 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) create mode 100755 tests/linux/ethtool_test diff --git a/tests/linux/Kyuafile b/tests/linux/Kyuafile index 050c55d..4e1c304 100644 --- a/tests/linux/Kyuafile +++ b/tests/linux/Kyuafile @@ -11,3 +11,4 @@ atf_test_program{name='ppp_test'} atf_test_program{name='tunnel_test'} atf_test_program{name='gre_test'} atf_test_program{name='wireguard_test'} +atf_test_program{name='ethtool_test'} diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test new file mode 100755 index 0000000..584eaad --- /dev/null +++ b/tests/linux/ethtool_test @@ -0,0 +1,84 @@ +#!/usr/bin/env atf-sh + +. $(atf_get_srcdir)/../test_env.sh +EXECUTOR="$(atf_get_srcdir)/../../executor-scripts/linux/ethtool" + +tests_init \ + pre_up_msglvl \ + pre_up_ethernet_port \ + up_speed \ + up_duplex \ + up_wol \ + up_wol_sopass \ + up_autoneg_simple \ + up_autoneg_mask + +pre_up_msglvl_body() { + export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'msglvl debug on' \ + ${EXECUTOR} +} + +pre_up_ethernet_port_body() { + export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_ETHERNET_PORT="4" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'port 4' \ + ${EXECUTOR} +} + +up_speed_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_SPEED="1000" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'speed 1000' \ + ${EXECUTOR} +} + +up_duplex_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_LINK_DUPLEX="full" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'duplex full' \ + ${EXECUTOR} +} + +up_wol_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="g" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'wol g' \ + ${EXECUTOR} +} + +up_wol_sopass_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_WOL="s abc123" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'wol s sopass abc123' \ + ${EXECUTOR} +} + +up_autoneg_simple_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'autoneg on' \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'autoneg off' \ + ${EXECUTOR} +} + +up_autoneg_mask_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_ETHERNET_AUTONEG="1000/full" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --change eth0' \ + -o match:'autoneg on advertise 1000/full' \ + ${EXECUTOR} +} From 4e78d7e5d5d7e8445462c04b0a91f4fa7a9489af Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 08:59:13 -0600 Subject: [PATCH 08/19] ethtool: pause parameters are IF_ETHTOOL_PAUSE_FOO, not IF_ETHTOOL_ETHERNET_PAUSE_FOO. --- executor-scripts/linux/ethtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 4f735b5..562493b 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -46,7 +46,7 @@ up) [ -z "$link_settings" ] || $MOCK ethtool --change "$IFACE" $link_settings - pause_settings=$(gather_params IF_ETHTOOL_ETHERNET_PAUSE) + pause_settings=$(gather_params IF_ETHTOOL_PAUSE) [ -z "$pause_settings" ] || $MOCK ethtool --pause "$IFACE" $pause_settings offload_settings=$(gather_params IF_ETHTOOL_OFFLOAD) From 6ae3414329ff3372ff804cf88d779311c8e03196 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:08:17 -0600 Subject: [PATCH 09/19] ethtool: fix up gather_params() calls a bit --- executor-scripts/linux/ethtool | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 562493b..f3dad2d 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -25,10 +25,7 @@ pre-up) ;; up) # first do the link settings. - link_settings="\ - ${IF_ETHTOOL_LINK_SPEED:+ speed $IF_ETHTOOL_LINK_SPEED} - ${IF_ETHTOOL_LINK_DUPLEX:+ duplex $IF_ETHTOOL_LINK_DUPLEX} - " + link_settings="${IF_ETHTOOL_LINK_SPEED:+ speed $IF_ETHTOOL_LINK_SPEED}${IF_ETHTOOL_LINK_DUPLEX:+ duplex $IF_ETHTOOL_LINK_DUPLEX}" # ethernet-wol can have a second arg (key), split into $1 and $2 set -- $IF_ETHTOOL_ETHERNET_WOL @@ -36,6 +33,8 @@ up) # handle ethtool-ethernet-autoneg like Debian would case "$IF_ETHTOOL_ETHERNET_AUTONEG" in + '') + ;; on|off) link_settings="$link_settings autoneg $IF_ETHTOOL_ETHERNET_AUTONEG" ;; @@ -46,10 +45,10 @@ up) [ -z "$link_settings" ] || $MOCK ethtool --change "$IFACE" $link_settings - pause_settings=$(gather_params IF_ETHTOOL_PAUSE) + pause_settings=$(gather_params ETHTOOL_PAUSE) [ -z "$pause_settings" ] || $MOCK ethtool --pause "$IFACE" $pause_settings - offload_settings=$(gather_params IF_ETHTOOL_OFFLOAD) + offload_settings=$(gather_params ETHTOOL_OFFLOAD) [ -z "$offload_settings" ] || $MOCK ethtool --offload "$IFACE" $offload_settings ;; esac From e8a2aab7e173c760e945a9f77417ad998c6b8730 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:10:01 -0600 Subject: [PATCH 10/19] tests: ethtool: add tests for pause parameters --- tests/linux/ethtool_test | 47 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test index 584eaad..4486923 100755 --- a/tests/linux/ethtool_test +++ b/tests/linux/ethtool_test @@ -11,7 +11,10 @@ tests_init \ up_wol \ up_wol_sopass \ up_autoneg_simple \ - up_autoneg_mask + up_autoneg_mask \ + up_pause_autoneg \ + up_pause_tx \ + up_pause_rx pre_up_msglvl_body() { export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo" @@ -82,3 +85,45 @@ up_autoneg_mask_body() { -o match:'autoneg on advertise 1000/full' \ ${EXECUTOR} } + +up_pause_autoneg_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"autoneg 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"autoneg 'off'" \ + ${EXECUTOR} +} + +up_pause_tx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"tx 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"tx 'off'" \ + ${EXECUTOR} +} + +up_pause_rx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"rx 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --pause eth0' \ + -o match:"rx 'off'" \ + ${EXECUTOR} +} From c19def376484a2c0fa87d6ffd71dd273aa12560d Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:18:08 -0600 Subject: [PATCH 11/19] tests: ethtool: add offload tests --- tests/linux/ethtool_test | 122 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 121 insertions(+), 1 deletion(-) diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test index 4486923..3d7f219 100755 --- a/tests/linux/ethtool_test +++ b/tests/linux/ethtool_test @@ -14,7 +14,15 @@ tests_init \ up_autoneg_mask \ up_pause_autoneg \ up_pause_tx \ - up_pause_rx + up_pause_rx \ + up_offload_gro \ + up_offload_gso \ + up_offload_lro \ + up_offload_rx \ + up_offload_sg \ + up_offload_tso \ + up_offload_tx \ + up_offload_ufo pre_up_msglvl_body() { export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo" @@ -127,3 +135,115 @@ up_pause_rx_body() { -o match:"rx 'off'" \ ${EXECUTOR} } + +up_offload_gro_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"gro 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"gro 'off'" \ + ${EXECUTOR} +} + +up_offload_gso_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"gso 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"gso 'off'" \ + ${EXECUTOR} +} + +up_offload_lro_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"lro 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"lro 'off'" \ + ${EXECUTOR} +} + +up_offload_rx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"rx 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"rx 'off'" \ + ${EXECUTOR} +} + +up_offload_sg_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"sg 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"sg 'off'" \ + ${EXECUTOR} +} + +up_offload_tso_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"tso 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"tso 'off'" \ + ${EXECUTOR} +} + +up_offload_tx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"tx 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"tx 'off'" \ + ${EXECUTOR} +} + +up_offload_ufo_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"ufo 'on'" \ + ${EXECUTOR} + + export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="off" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --offload eth0' \ + -o match:"ufo 'off'" \ + ${EXECUTOR} +} From 2078f63e62ac8af66af6334a6c06c68eeb63118c Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:30:12 -0600 Subject: [PATCH 12/19] interface-file: remap debian hardware DMA ring terms to ethtool-dma namespace --- libifupdown/interface-file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index 5441abd..084e2b2 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -37,6 +37,10 @@ static const struct remap_token tokens[] = { {"ethernet-wol", "ethtool-ethernet-wol"}, /* Debian ethtool integration */ {"gro-offload", "ethtool-offload-gro"}, /* ifupdown2 */ {"gso-offload", "ethtool-offload-gso"}, /* ifupdown2 */ + {"hardware-dma-ring-rx", "ethtool-dma-ring-rx"}, /* Debian ethtool integration */ + {"hardware-dma-ring-rx-jumbo", "ethtool-dma-ring-rx-jumbo"}, /* Debian ethtool integration */ + {"hardware-dma-ring-rx-mini", "ethtool-dma-ring-rx-mini"}, /* Debian ethtool integration */ + {"hardware-dma-ring-tx", "ethtool-dma-ring-tx"}, /* Debian ethtool integration */ {"link-autoneg", "ethtool-ethernet-autoneg"}, /* ifupdown2 */ {"link-duplex", "ethtool-link-duplex"}, /* Debian ethtool integration */ {"link-fec", "ethtool-link-fec"}, /* ifupdown2 */ From 3e7125aca0284ffd09666fbe18cc4aa451fd4c94 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:32:37 -0600 Subject: [PATCH 13/19] ethtool: add support for the ethtool-dma namespace --- executor-scripts/linux/ethtool | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index f3dad2d..3f8d284 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -50,5 +50,8 @@ up) offload_settings=$(gather_params ETHTOOL_OFFLOAD) [ -z "$offload_settings" ] || $MOCK ethtool --offload "$IFACE" $offload_settings + + dma_settings=$(gather_params ETHTOOL_DMA_RING) + [ -z "$dma_settings" ] || $MOCK ethtool --set-ring "$IFACE" $dma_settings ;; esac From a69c81b6be126a8d38fdec300e68a92e75f1f01c Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:38:39 -0600 Subject: [PATCH 14/19] tests: ethtool: add dma ring tests --- executor-scripts/linux/ethtool | 2 +- tests/linux/ethtool_test | 38 +++++++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 3f8d284..8ad8593 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -12,7 +12,7 @@ gather_params() { y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ P g - s/.*\n//" + s/.*\n//" | sed -E "s/_/-/g" } case "$PHASE" in diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test index 3d7f219..197ca2e 100755 --- a/tests/linux/ethtool_test +++ b/tests/linux/ethtool_test @@ -22,7 +22,11 @@ tests_init \ up_offload_sg \ up_offload_tso \ up_offload_tx \ - up_offload_ufo + up_offload_ufo \ + up_dma_ring_rx \ + up_dma_ring_rx_jumbo \ + up_dma_ring_rx_mini \ + up_dma_ring_tx pre_up_msglvl_body() { export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo" @@ -247,3 +251,35 @@ up_offload_ufo_body() { -o match:"ufo 'off'" \ ${EXECUTOR} } + +up_dma_ring_rx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --set-ring eth0' \ + -o match:"rx '1024'" \ + ${EXECUTOR} +} + +up_dma_ring_rx_jumbo_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_JUMBO="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --set-ring eth0' \ + -o match:"rx-jumbo '1024'" \ + ${EXECUTOR} +} + +up_dma_ring_rx_mini_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_MINI="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --set-ring eth0' \ + -o match:"rx-mini '1024'" \ + ${EXECUTOR} +} + +up_dma_ring_tx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_TX="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --set-ring eth0' \ + -o match:"tx '1024'" \ + ${EXECUTOR} +} From f96cb273a03790adfc8b91f4c7805765fe5c33f0 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 09:56:48 -0600 Subject: [PATCH 15/19] interface-file: remap hardware-irq-coalesce- namespace to ethtool-coalesce- namespace --- libifupdown/interface-file.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libifupdown/interface-file.c b/libifupdown/interface-file.c index 084e2b2..32f7a7c 100644 --- a/libifupdown/interface-file.c +++ b/libifupdown/interface-file.c @@ -41,6 +41,28 @@ static const struct remap_token tokens[] = { {"hardware-dma-ring-rx-jumbo", "ethtool-dma-ring-rx-jumbo"}, /* Debian ethtool integration */ {"hardware-dma-ring-rx-mini", "ethtool-dma-ring-rx-mini"}, /* Debian ethtool integration */ {"hardware-dma-ring-tx", "ethtool-dma-ring-tx"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-adaptive-rx", "ethtool-coalesce-adaptive-rx"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-adaptive-tx", "ethtool-coalesce-adaptive-tx"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-pkt-rate-high", "ethtool-coalesce-pkt-rate-high"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-pkt-rate-low", "ethtool-coalesce-pkt-rate-low"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-frames", "ethtool-coalesce-rx-frames"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-frames-high", "ethtool-coalesce-rx-frames-high"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-frames-irq", "ethtool-coalesce-rx-frames-irq"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-frames-low", "ethtool-coalesce-rx-frames-low"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-usecs", "ethtool-coalesce-rx-usecs"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-usecs-high", "ethtool-coalesce-rx-usecs-high"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-usecs-irq", "ethtool-coalesce-rx-usecs-irq"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-rx-usecs-low", "ethtool-coalesce-rx-usecs-low"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-sample-interval", "ethtool-coalesce-sample-interval"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-stats-block-usecs", "ethtool-coalesce-stats-block-usecs"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-frames", "ethtool-coalesce-tx-frames"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-frames-high", "ethtool-coalesce-tx-frames-high"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-frames-irq", "ethtool-coalesce-tx-frames-irq"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-frames-low", "ethtool-coalesce-tx-frames-low"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-usecs", "ethtool-coalesce-tx-usecs"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-usecs-high", "ethtool-coalesce-tx-usecs-high"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-usecs-irq", "ethtool-coalesce-tx-usecs-irq"}, /* Debian ethtool integration */ + {"hardware-irq-coalesce-tx-usecs-low", "ethtool-coalesce-tx-usecs-low"}, /* Debian ethtool integration */ {"link-autoneg", "ethtool-ethernet-autoneg"}, /* ifupdown2 */ {"link-duplex", "ethtool-link-duplex"}, /* Debian ethtool integration */ {"link-fec", "ethtool-link-fec"}, /* ifupdown2 */ From 3cb635b4431d84f7b0d93c9978f8465f9a06d0e8 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 10:06:58 -0600 Subject: [PATCH 16/19] ethtool: set coalesce settings from ethtool-coalesce- term namespace --- executor-scripts/linux/ethtool | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 8ad8593..55ad32a 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -53,5 +53,8 @@ up) dma_settings=$(gather_params ETHTOOL_DMA_RING) [ -z "$dma_settings" ] || $MOCK ethtool --set-ring "$IFACE" $dma_settings + + coalesce_settings=$(gather_params ETHTOOL_COALESCE) + [ -z "$coalesce_settings" ] || $MOCK ethtool --coalesce "$IFACE" $coalesce_settings ;; esac From 566732321db5e719a22aee2d93cc726bcb0b2981 Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Mon, 21 Sep 2020 10:21:43 -0600 Subject: [PATCH 17/19] tests: ethtool: add tests for coalesce settings --- tests/linux/ethtool_test | 200 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 199 insertions(+), 1 deletion(-) diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test index 197ca2e..a9e27cd 100755 --- a/tests/linux/ethtool_test +++ b/tests/linux/ethtool_test @@ -26,7 +26,29 @@ tests_init \ up_dma_ring_rx \ up_dma_ring_rx_jumbo \ up_dma_ring_rx_mini \ - up_dma_ring_tx + up_dma_ring_tx \ + up_coalesce_adaptive_rx \ + up_coalesce_adaptive_tx \ + up_coalesce_pkt_rate_low \ + up_coalesce_pkt_rate_high \ + up_coalesce_sample_interval \ + up_coalesce_stats_block_usecs \ + up_coalesce_rx_frames \ + up_coalesce_rx_frames_low \ + up_coalesce_rx_frames_irq \ + up_coalesce_rx_frames_high \ + up_coalesce_rx_usecs \ + up_coalesce_rx_usecs_low \ + up_coalesce_rx_usecs_irq \ + up_coalesce_rx_usecs_high \ + up_coalesce_tx_frames \ + up_coalesce_tx_frames_low \ + up_coalesce_tx_frames_irq \ + up_coalesce_tx_frames_high \ + up_coalesce_tx_usecs \ + up_coalesce_tx_usecs_low \ + up_coalesce_tx_usecs_irq \ + up_coalesce_tx_usecs_high pre_up_msglvl_body() { export IFACE="eth0" PHASE="pre-up" IF_ETHTOOL_MSGLVL="debug on" MOCK="echo" @@ -283,3 +305,179 @@ up_dma_ring_tx_body() { -o match:"tx '1024'" \ ${EXECUTOR} } + +up_coalesce_adaptive_rx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_RX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"adaptive-rx 'on'" \ + ${EXECUTOR} +} + +up_coalesce_adaptive_tx_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_TX="on" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"adaptive-tx 'on'" \ + ${EXECUTOR} +} + +up_coalesce_pkt_rate_low_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_LOW="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"pkt-rate-low '1024'" \ + ${EXECUTOR} +} + +up_coalesce_pkt_rate_high_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_HIGH="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"pkt-rate-high '1024'" \ + ${EXECUTOR} +} + +up_coalesce_sample_interval_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_SAMPLE_INTERVAL="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"sample-interval '1024'" \ + ${EXECUTOR} +} + +up_coalesce_stats_block_usecs_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_STATS_BLOCK_USECS="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"stats-block-usecs '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_frames_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-frames '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_frames_low_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_LOW="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-frames-low '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_frames_irq_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_IRQ="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-frames-irq '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_frames_high_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_HIGH="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-frames-high '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_usecs_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-usecs '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_usecs_low_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_LOW="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-usecs-low '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_usecs_irq_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_IRQ="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-usecs-irq '1024'" \ + ${EXECUTOR} +} + +up_coalesce_rx_usecs_high_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_HIGH="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"rx-usecs-high '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_frames_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-frames '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_frames_low_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_LOW="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-frames-low '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_frames_irq_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_IRQ="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-frames-irq '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_frames_high_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_HIGH="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-frames-high '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_usecs_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-usecs '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_usecs_low_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_LOW="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-usecs-low '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_usecs_irq_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_IRQ="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-usecs-irq '1024'" \ + ${EXECUTOR} +} + +up_coalesce_tx_usecs_high_body() { + export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_HIGH="1024" MOCK="echo" + atf_check -s exit:0 \ + -o match:'ethtool --coalesce eth0' \ + -o match:"tx-usecs-high '1024'" \ + ${EXECUTOR} +} From 2e81234df15e9fa4be139585562214f45fd01fb7 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Wed, 23 Sep 2020 01:24:56 +0200 Subject: [PATCH 18/19] ethtool: Call 'env' instead of 'set' to get environment 'set' will output environment variables with ' around them which will confuse ethtool. Signed-off-by: Maximilian Wilhelm --- executor-scripts/linux/ethtool | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor-scripts/linux/ethtool b/executor-scripts/linux/ethtool index 55ad32a..ef0dde9 100755 --- a/executor-scripts/linux/ethtool +++ b/executor-scripts/linux/ethtool @@ -3,7 +3,7 @@ set -e # gather params for a given prefix, based on executor-scripts/linux/tunnel. gather_params() { - set | sed -E " + env | sed -E " s/^IF_${1}_([A-Z0-9_]+)=(.+)/\1\n\2/ ta d From 0a0252d21899d82e4c2660a2ac023926df010b03 Mon Sep 17 00:00:00 2001 From: Maximilian Wilhelm Date: Wed, 23 Sep 2020 01:43:25 +0200 Subject: [PATCH 19/19] ethtool: Fix tests Signed-off-by: Maximilian Wilhelm --- tests/linux/ethtool_test | 96 ++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 48 deletions(-) diff --git a/tests/linux/ethtool_test b/tests/linux/ethtool_test index a9e27cd..d12d64a 100755 --- a/tests/linux/ethtool_test +++ b/tests/linux/ethtool_test @@ -124,13 +124,13 @@ up_pause_autoneg_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"autoneg 'on'" \ + -o match:"autoneg on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_AUTONEG="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"autoneg 'off'" \ + -o match:"autoneg off" \ ${EXECUTOR} } @@ -138,13 +138,13 @@ up_pause_tx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"tx 'on'" \ + -o match:"tx on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_TX="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"tx 'off'" \ + -o match:"tx off" \ ${EXECUTOR} } @@ -152,13 +152,13 @@ up_pause_rx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"rx 'on'" \ + -o match:"rx on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_PAUSE_RX="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --pause eth0' \ - -o match:"rx 'off'" \ + -o match:"rx off" \ ${EXECUTOR} } @@ -166,13 +166,13 @@ up_offload_gro_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"gro 'on'" \ + -o match:"gro on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GRO="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"gro 'off'" \ + -o match:"gro off" \ ${EXECUTOR} } @@ -180,13 +180,13 @@ up_offload_gso_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"gso 'on'" \ + -o match:"gso on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_GSO="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"gso 'off'" \ + -o match:"gso off" \ ${EXECUTOR} } @@ -194,13 +194,13 @@ up_offload_lro_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"lro 'on'" \ + -o match:"lro on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_LRO="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"lro 'off'" \ + -o match:"lro off" \ ${EXECUTOR} } @@ -208,13 +208,13 @@ up_offload_rx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"rx 'on'" \ + -o match:"rx on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_RX="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"rx 'off'" \ + -o match:"rx off" \ ${EXECUTOR} } @@ -222,13 +222,13 @@ up_offload_sg_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"sg 'on'" \ + -o match:"sg on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_SG="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"sg 'off'" \ + -o match:"sg off" \ ${EXECUTOR} } @@ -236,13 +236,13 @@ up_offload_tso_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"tso 'on'" \ + -o match:"tso on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TSO="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"tso 'off'" \ + -o match:"tso off" \ ${EXECUTOR} } @@ -250,13 +250,13 @@ up_offload_tx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"tx 'on'" \ + -o match:"tx on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_TX="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"tx 'off'" \ + -o match:"tx off" \ ${EXECUTOR} } @@ -264,13 +264,13 @@ up_offload_ufo_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"ufo 'on'" \ + -o match:"ufo on" \ ${EXECUTOR} export IFACE="eth0" PHASE="up" IF_ETHTOOL_OFFLOAD_UFO="off" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --offload eth0' \ - -o match:"ufo 'off'" \ + -o match:"ufo off" \ ${EXECUTOR} } @@ -278,7 +278,7 @@ up_dma_ring_rx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --set-ring eth0' \ - -o match:"rx '1024'" \ + -o match:"rx 1024" \ ${EXECUTOR} } @@ -286,7 +286,7 @@ up_dma_ring_rx_jumbo_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_JUMBO="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --set-ring eth0' \ - -o match:"rx-jumbo '1024'" \ + -o match:"rx-jumbo 1024" \ ${EXECUTOR} } @@ -294,7 +294,7 @@ up_dma_ring_rx_mini_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_RX_MINI="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --set-ring eth0' \ - -o match:"rx-mini '1024'" \ + -o match:"rx-mini 1024" \ ${EXECUTOR} } @@ -302,7 +302,7 @@ up_dma_ring_tx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_DMA_RING_TX="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --set-ring eth0' \ - -o match:"tx '1024'" \ + -o match:"tx 1024" \ ${EXECUTOR} } @@ -310,7 +310,7 @@ up_coalesce_adaptive_rx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_RX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"adaptive-rx 'on'" \ + -o match:"adaptive-rx on" \ ${EXECUTOR} } @@ -318,7 +318,7 @@ up_coalesce_adaptive_tx_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_ADAPTIVE_TX="on" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"adaptive-tx 'on'" \ + -o match:"adaptive-tx on" \ ${EXECUTOR} } @@ -326,7 +326,7 @@ up_coalesce_pkt_rate_low_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_LOW="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"pkt-rate-low '1024'" \ + -o match:"pkt-rate-low 1024" \ ${EXECUTOR} } @@ -334,7 +334,7 @@ up_coalesce_pkt_rate_high_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_PKT_RATE_HIGH="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"pkt-rate-high '1024'" \ + -o match:"pkt-rate-high 1024" \ ${EXECUTOR} } @@ -342,7 +342,7 @@ up_coalesce_sample_interval_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_SAMPLE_INTERVAL="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"sample-interval '1024'" \ + -o match:"sample-interval 1024" \ ${EXECUTOR} } @@ -350,7 +350,7 @@ up_coalesce_stats_block_usecs_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_STATS_BLOCK_USECS="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"stats-block-usecs '1024'" \ + -o match:"stats-block-usecs 1024" \ ${EXECUTOR} } @@ -358,7 +358,7 @@ up_coalesce_rx_frames_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-frames '1024'" \ + -o match:"rx-frames 1024" \ ${EXECUTOR} } @@ -366,7 +366,7 @@ up_coalesce_rx_frames_low_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_LOW="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-frames-low '1024'" \ + -o match:"rx-frames-low 1024" \ ${EXECUTOR} } @@ -374,7 +374,7 @@ up_coalesce_rx_frames_irq_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_IRQ="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-frames-irq '1024'" \ + -o match:"rx-frames-irq 1024" \ ${EXECUTOR} } @@ -382,7 +382,7 @@ up_coalesce_rx_frames_high_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_FRAMES_HIGH="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-frames-high '1024'" \ + -o match:"rx-frames-high 1024" \ ${EXECUTOR} } @@ -390,7 +390,7 @@ up_coalesce_rx_usecs_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-usecs '1024'" \ + -o match:"rx-usecs 1024" \ ${EXECUTOR} } @@ -398,7 +398,7 @@ up_coalesce_rx_usecs_low_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_LOW="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-usecs-low '1024'" \ + -o match:"rx-usecs-low 1024" \ ${EXECUTOR} } @@ -406,7 +406,7 @@ up_coalesce_rx_usecs_irq_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_IRQ="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-usecs-irq '1024'" \ + -o match:"rx-usecs-irq 1024" \ ${EXECUTOR} } @@ -414,7 +414,7 @@ up_coalesce_rx_usecs_high_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_RX_USECS_HIGH="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"rx-usecs-high '1024'" \ + -o match:"rx-usecs-high 1024" \ ${EXECUTOR} } @@ -422,7 +422,7 @@ up_coalesce_tx_frames_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-frames '1024'" \ + -o match:"tx-frames 1024" \ ${EXECUTOR} } @@ -430,7 +430,7 @@ up_coalesce_tx_frames_low_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_LOW="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-frames-low '1024'" \ + -o match:"tx-frames-low 1024" \ ${EXECUTOR} } @@ -438,7 +438,7 @@ up_coalesce_tx_frames_irq_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_IRQ="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-frames-irq '1024'" \ + -o match:"tx-frames-irq 1024" \ ${EXECUTOR} } @@ -446,7 +446,7 @@ up_coalesce_tx_frames_high_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_FRAMES_HIGH="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-frames-high '1024'" \ + -o match:"tx-frames-high 1024" \ ${EXECUTOR} } @@ -454,7 +454,7 @@ up_coalesce_tx_usecs_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-usecs '1024'" \ + -o match:"tx-usecs 1024" \ ${EXECUTOR} } @@ -462,7 +462,7 @@ up_coalesce_tx_usecs_low_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_LOW="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-usecs-low '1024'" \ + -o match:"tx-usecs-low 1024" \ ${EXECUTOR} } @@ -470,7 +470,7 @@ up_coalesce_tx_usecs_irq_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_IRQ="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-usecs-irq '1024'" \ + -o match:"tx-usecs-irq 1024" \ ${EXECUTOR} } @@ -478,6 +478,6 @@ up_coalesce_tx_usecs_high_body() { export IFACE="eth0" PHASE="up" IF_ETHTOOL_COALESCE_TX_USECS_HIGH="1024" MOCK="echo" atf_check -s exit:0 \ -o match:'ethtool --coalesce eth0' \ - -o match:"tx-usecs-high '1024'" \ + -o match:"tx-usecs-high 1024" \ ${EXECUTOR} }