All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 09/10] selftests: net: add a test for static UDP tunnel ports
Date: Fri, 25 Sep 2020 17:56:48 -0700	[thread overview]
Message-ID: <20200926005649.3285089-10-kuba@kernel.org> (raw)
In-Reply-To: <20200926005649.3285089-1-kuba@kernel.org>

Check UDP_TUNNEL_NIC_INFO_STATIC_IANA_VXLAN works as expected.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 .../drivers/net/netdevsim/udp_tunnel_nic.sh   | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh b/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
index 9225133784af..1b08e042cf94 100755
--- a/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
+++ b/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh
@@ -7,6 +7,7 @@ NSIM_DEV_SYS=/sys/bus/netdevsim/devices/netdevsim$NSIM_ID
 NSIM_DEV_DFS=/sys/kernel/debug/netdevsim/netdevsim$NSIM_ID
 NSIM_NETDEV=
 HAS_ETHTOOL=
+STATIC_ENTRIES=
 EXIT_STATUS=0
 num_cases=0
 num_errors=0
@@ -193,6 +194,21 @@ function check_tables {
 	sleep 0.02
 	((retries--))
     done
+
+    if [ -n "$HAS_ETHTOOL" -a -n "${STATIC_ENTRIES[0]}" ]; then
+	fail=0
+	for i in "${!STATIC_ENTRIES[@]}"; do
+	    pp_expected=`pre_ethtool ${STATIC_ENTRIES[i]}`
+	    cnt=$(ethtool --show-tunnels $NSIM_NETDEV | grep -c "$pp_expected")
+	    if [ $cnt -ne 1 ]; then
+		err_cnt "ethtool static entry: $pfx - $msg"
+		echo "       check_table: ethtool does not contain '$pp_expected'"
+		ethtool --show-tunnels $NSIM_NETDEV
+		fail=1
+	    fi
+	done
+	[ $fail == 0 ] && pass_cnt
+    fi
 }
 
 function print_table {
@@ -884,6 +900,48 @@ echo 2 > $NSIM_DEV_SYS/del_port
 
 cleanup_nsim
 
+# Static IANA port
+pfx="static IANA vxlan"
+
+echo $NSIM_ID > /sys/bus/netdevsim/new_device
+echo 0 > $NSIM_DEV_SYS/del_port
+
+echo 1 > $NSIM_DEV_DFS/udp_ports_static_iana_vxlan
+STATIC_ENTRIES=( `mke 4789 1` )
+
+port=1
+old_netdevs=$(ls /sys/class/net)
+echo $port > $NSIM_DEV_SYS/new_port
+NSIM_NETDEV=`get_netdev_name old_netdevs`
+
+msg="check empty"
+exp0=( 0 0 0 0 )
+exp1=( 0 0 0 0 )
+check_tables
+
+msg="add on static port"
+new_vxlan vxlan0 4789 $NSIM_NETDEV
+new_vxlan vxlan1 4789 $NSIM_NETDEV
+
+msg="add on different port"
+exp0=( `mke 4790 1` 0 0 0 )
+new_vxlan vxlan2 4790 $NSIM_NETDEV
+
+cleanup_tuns
+
+msg="tunnels destroyed"
+exp0=( 0 0 0 0 )
+exp1=( 0 0 0 0 )
+check_tables
+
+msg="different type"
+new_geneve gnv0	4789
+
+cleanup_tuns
+cleanup_nsim
+
+# END
+
 modprobe -r netdevsim
 
 if [ $num_errors -eq 0 ]; then
-- 
2.26.2


  parent reply	other threads:[~2020-09-26  0:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-26  0:56 [PATCH net-next v2 00/10] udp_tunnel: convert Intel drivers with shared tables Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 01/10] udp_tunnel: add the ability to share port tables Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 02/10] netdevsim: add warnings on unexpected UDP tunnel port errors Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 03/10] netdevsim: shared UDP tunnel port table support Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 04/10] selftests: net: add a test for shared UDP tunnel info tables Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 05/10] i40e: convert to new udp_tunnel infrastructure Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 06/10] ice: remove unused args from ice_get_open_tunnel_port() Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 07/10] ice: convert to new udp_tunnel infrastructure Jakub Kicinski
2020-09-26  0:56 ` [PATCH net-next v2 08/10] netdevsim: support the static IANA VXLAN port flag Jakub Kicinski
2020-09-26  0:56 ` Jakub Kicinski [this message]
2020-09-26  0:56 ` [PATCH net-next v2 10/10] docs: vxlan: add info about device features Jakub Kicinski
2020-09-28 16:23 ` [PATCH net-next v2 00/10] udp_tunnel: convert Intel drivers with shared tables Nguyen, Anthony L
2020-09-28 19:49   ` David Miller
2020-09-28 19:50 ` David Miller

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=20200926005649.3285089-10-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.