From: Paolo Abeni <pabeni@redhat.com>
To: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Steffen Klassert <steffen.klassert@secunet.com>,
Willem de Bruijn <willemb@google.com>,
Miaohe Lin <linmiaohe@huawei.com>
Subject: [PATCH net 4/4] selftests: more UDP GRO tests
Date: Wed, 5 May 2021 17:35:04 +0200 [thread overview]
Message-ID: <31746302323edf8282b8c9e80293ca45f1dbbf03.1620223174.git.pabeni@redhat.com> (raw)
In-Reply-To: <cover.1620223174.git.pabeni@redhat.com>
Introduces explicit scenarios for the issues addressed
on the previous patches, and functionally checks the
expected aggregation and segmentation.
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
---
tools/testing/selftests/net/set_sysfs_attr.sh | 15 ++++++
tools/testing/selftests/net/udpgro_fwd.sh | 54 +++++++++++++++++++
2 files changed, 69 insertions(+)
create mode 100755 tools/testing/selftests/net/set_sysfs_attr.sh
diff --git a/tools/testing/selftests/net/set_sysfs_attr.sh b/tools/testing/selftests/net/set_sysfs_attr.sh
new file mode 100755
index 000000000000..fd042a162326
--- /dev/null
+++ b/tools/testing/selftests/net/set_sysfs_attr.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+
+if [ $# -lt 2 ]; then
+ echo -e "syntax:\n$0 <device> <attr> [<value>]"
+ exit 0
+fi
+
+mount -t sysfs /sys 2>/dev/null
+if [ $# -lt 3 ]; then
+ cat /sys/class/net/$1/$2
+ exit $?
+fi
+
+echo $3 > /sys/class/net/$1/$2
diff --git a/tools/testing/selftests/net/udpgro_fwd.sh b/tools/testing/selftests/net/udpgro_fwd.sh
index a8fa64136282..8569b3f81fd7 100755
--- a/tools/testing/selftests/net/udpgro_fwd.sh
+++ b/tools/testing/selftests/net/udpgro_fwd.sh
@@ -79,6 +79,16 @@ create_vxlan_pair() {
done
}
+move_address() {
+ local -r ns=$1
+ local -r src_dev=$2
+ local -r dst_dev=$3
+ local -r addr=$4
+
+ ip -n $ns addr del dev $src_dev $addr
+ ip -n $ns addr add dev $dst_dev $addr nodad 2>/dev/null
+}
+
is_ipv6() {
if [[ $1 =~ .*:.* ]]; then
return 0
@@ -86,6 +96,35 @@ is_ipv6() {
return 1
}
+create_bridge() {
+ local vxdev=vxlan$SRC
+ local src=$1
+ local i
+
+ is_ipv6 $src && vxdev=vxlan6$SRC
+
+ create_vxlan_pair
+ ip -n $NS_SRC link add name br_port type veth peer name br_port_peer
+ ip -n $NS_SRC link add name br0 type bridge
+ ip -n $NS_SRC link set dev br0 up
+ ip -n $NS_SRC link set dev br_port_peer up
+ ip -n $NS_SRC link set dev br_port up master br0
+ ip -n $NS_SRC link set dev $vxdev master br0
+ move_address $NS_SRC $vxdev br_port_peer $src/24
+
+ ip -n $NS_SRC link set br_port xdp object ../bpf/xdp_dummy.o section xdp_dummy 2>/dev/null
+ ip netns exec $NS_SRC ./set_sysfs_attr.sh br_port threaded 1
+
+ # slowing down the input path, we will help the napi thread to
+ # aggregate as much packets as possible via GRO
+ modprobe br_netfilter 2>/dev/null
+ ip netns exec $NS_SRC sysctl -qw net.bridge.bridge-nf-call-iptables=1
+ ip netns exec $NS_SRC sysctl -qw net.bridge.bridge-nf-call-ip6tables=1
+ for i in `seq 1 100`; do
+ ip netns exec $NS_SRC $IPT -A FORWARD
+ done
+}
+
run_test() {
local -r msg=$1
local -r dst=$2
@@ -228,6 +267,21 @@ for family in 4 6; do
run_test "GRO frag list over UDP tunnel" $OL_NET$DST 1 1
cleanup
+ create_bridge $OL_NET$SRC
+ ip netns exec $NS_SRC ethtool -K br_port rx-gro-list on
+ ip netns exec $NS_SRC ethtool -K br_port_peer tx-udp-segmentation off
+ ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on
+ run_test "GRO frag list over UDP tunnel segmentation" $OL_NET$DST 1 1
+ cleanup
+
+ create_bridge $OL_NET$SRC
+ ip netns exec $NS_SRC ethtool -K br_port rx-gro-list on
+ ip netns exec $NS_SRC ethtool -K br_port_peer tx-udp-segmentation off
+ ip netns exec $NS_DST ethtool -K veth$DST rx-gro-list on
+ ip netns exec $NS_SRC ethtool -K veth$SRC tx off
+ run_test "GRO frag list over UDP tunnel segmentation (tx csum off)" $OL_NET$DST 1 1
+ cleanup
+
# use NAT to circumvent GRO FWD check
create_vxlan_pair
ip -n $NS_DST addr add dev $VXDEV$DST $OL_NET$DST_NAT/$SUFFIX
--
2.26.2
prev parent reply other threads:[~2021-05-05 15:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 15:35 [PATCH net 0/4] udp: more FRAGLIST fixes Paolo Abeni
2021-05-05 15:35 ` [PATCH net 1/4] net: fix double-free on fraglist GSO skbs Paolo Abeni
2021-05-05 16:13 ` Willem de Bruijn
2021-05-05 17:28 ` Paolo Abeni
2021-05-05 17:30 ` Willem de Bruijn
2021-05-06 11:06 ` Paolo Abeni
2021-05-06 14:32 ` Willem de Bruijn
2021-05-06 15:55 ` Paolo Abeni
2021-05-06 21:17 ` Jakub Kicinski
2021-05-07 8:46 ` Paolo Abeni
2021-05-10 15:37 ` Paolo Abeni
2021-05-11 9:39 ` Steffen Klassert
2021-05-05 15:35 ` [PATCH net 2/4] udp: fix out-of-bound at segmentation time Paolo Abeni
2021-05-05 15:35 ` [PATCH net 3/4] udp: fix outer header csum for SKB_GSO_FRAGLIST over UDP tunnel Paolo Abeni
2021-05-05 15:35 ` Paolo Abeni [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=31746302323edf8282b8c9e80293ca45f1dbbf03.1620223174.git.pabeni@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linmiaohe@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).