diff options
author | Matias Elo <matias.elo@nokia.com> | 2020-10-19 10:42:45 +0300 |
---|---|---|
committer | Matias Elo <matias.elo@nokia.com> | 2020-10-30 13:04:25 +0200 |
commit | fcd1b711c06b1d9df9e1cffcaef16a43ab059da6 (patch) | |
tree | a9a4afa276b8d43fe9f72c6e369971d9dc61f6bb /platform/linux-dpdk/test | |
parent | a764f9a1e47d93ca1296e0c444f5747aaba114f7 (diff) |
Port 9a4244c78 "example: script: enhance application run script"
Add DPDK specific pktio_env files for running example application tests.
Signed-off-by: Matias Elo <matias.elo@nokia.com>
Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'platform/linux-dpdk/test')
14 files changed, 346 insertions, 1 deletions
diff --git a/platform/linux-dpdk/test/Makefile.am b/platform/linux-dpdk/test/Makefile.am index a872400e4..f51859773 100644 --- a/platform/linux-dpdk/test/Makefile.am +++ b/platform/linux-dpdk/test/Makefile.am @@ -10,7 +10,8 @@ SUBDIRS += validation/api/pktio else #performance tests refer to pktio_env if test_perf -SUBDIRS += validation/api/pktio +SUBDIRS += validation/api/pktio \ + example endif endif diff --git a/platform/linux-dpdk/test/example/Makefile.am b/platform/linux-dpdk/test/example/Makefile.am new file mode 100644 index 000000000..2e6a7ce6c --- /dev/null +++ b/platform/linux-dpdk/test/example/Makefile.am @@ -0,0 +1,7 @@ +SUBDIRS = \ + l2fwd_simple \ + l3fwd \ + packet \ + ping \ + simple_pipeline \ + switch diff --git a/platform/linux-dpdk/test/example/l2fwd_simple/Makefile.am b/platform/linux-dpdk/test/example/l2fwd_simple/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/l2fwd_simple/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/l2fwd_simple/pktio_env b/platform/linux-dpdk/test/example/l2fwd_simple/pktio_env new file mode 100644 index 000000000..c2cccffbc --- /dev/null +++ b/platform/linux-dpdk/test/example/l2fwd_simple/pktio_env @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create two pcap interfaces which +# use udp64.pcap file to inject traffic. An output pcap file is generated by +# the second interface. +# +# Network set-up +# IF0 <---> IF1 + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +IF0=0 +IF1=1 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \ +--vdev net_pcap1,rx_pcap=${PCAP_IN},tx_pcap=pcapout.pcap" + +echo "Using PCAP_IN = ${PCAP_IN}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + if [ `stat -c %s pcapout.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then + echo "File sizes disagree" + exit 1 + fi + + rm -f pcapout.pcap +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1." + return 0 +} diff --git a/platform/linux-dpdk/test/example/l3fwd/Makefile.am b/platform/linux-dpdk/test/example/l3fwd/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/l3fwd/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/l3fwd/pktio_env b/platform/linux-dpdk/test/example/l3fwd/pktio_env new file mode 100644 index 000000000..c9e35f09a --- /dev/null +++ b/platform/linux-dpdk/test/example/l3fwd/pktio_env @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create two pcap interfaces of which +# the first one uses udp64.pcap to inject traffic. An output pcap file is +# generated by the second interface. +# +# Network set-up +# IF0 <---> IF1 + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +PCAP_OUT="pcapout.pcap" +PCAP_EMPTY=`find . ${TEST_DIR} $(dirname $0) -name empty.pcap -print -quit` +PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}` +IF0=0 +IF1=1 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \ +--vdev net_pcap1,rx_pcap=${PCAP_EMPTY},tx_pcap=${PCAP_OUT}" + +echo "Using PCAP_IN = ${PCAP_IN}, PCAP_OUT = ${PCAP_OUT}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` + if [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then + echo "in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + exit 1 + fi + + echo "Pass: in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + rm -f pcapout.pcap +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1." + return 0 +} diff --git a/platform/linux-dpdk/test/example/packet/Makefile.am b/platform/linux-dpdk/test/example/packet/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/packet/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/packet/pktio_env b/platform/linux-dpdk/test/example/packet/pktio_env new file mode 100644 index 000000000..0f6a1c233 --- /dev/null +++ b/platform/linux-dpdk/test/example/packet/pktio_env @@ -0,0 +1,55 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create two pcap interfaces which +# use udp64.pcap file to inject traffic. An output pcap file is generated by +# the second interface. +# +# Network set-up +# IF0 <---> IF1 + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +PCAP_OUT="pcapout.pcap" +PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}` +IF0=0 +IF1=1 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \ +--vdev net_pcap1,rx_pcap=${PCAP_IN},tx_pcap=${PCAP_OUT}" + +echo "Using PCAP in=${PCAP_IN}:out=${PCAP_OUT} size %${PCAP_IN_SIZE}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` + if [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then + echo "Error: in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + exit 1 + fi + + rm -f pcapout.pcap +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1." + return 0 +} diff --git a/platform/linux-dpdk/test/example/ping/Makefile.am b/platform/linux-dpdk/test/example/ping/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/ping/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/ping/pktio_env b/platform/linux-dpdk/test/example/ping/pktio_env new file mode 100644 index 000000000..a8dba6e9a --- /dev/null +++ b/platform/linux-dpdk/test/example/ping/pktio_env @@ -0,0 +1,54 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create one pcap interface which uses +# udp64.pcap file for incoming test traffic. An separate output pcap file is +# generated for transmitted packets. +# +# Network set-up +# IF0 + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name icmp_echo_req.pcap -print -quit` +PCAP_OUT="pcapout.pcap" +PCAP_IN_SIZE=`stat -c %s ${PCAP_IN}` +IF0=0 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=${PCAP_OUT}" + +echo "Using PCAP in=${PCAP_IN}:out=${PCAP_OUT} size %${PCAP_IN_SIZE}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + PCAP_OUT_SIZE=`stat -c %s ${PCAP_OUT}` + if [ ${PCAP_IN_SIZE} -ne ${PCAP_OUT_SIZE} ]; then + echo "Error: in:${PCAP_IN_SIZE} out:${PCAP_OUT_SIZE}" + exit 1 + fi + + echo "pcap in size:${PCAP_IN_SIZE} pcap out size:${PCAP_OUT_SIZE}" + rm -f pcapout.pcap +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1." + return 0 +} diff --git a/platform/linux-dpdk/test/example/simple_pipeline/Makefile.am b/platform/linux-dpdk/test/example/simple_pipeline/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/simple_pipeline/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/simple_pipeline/pktio_env b/platform/linux-dpdk/test/example/simple_pipeline/pktio_env new file mode 100644 index 000000000..c2cccffbc --- /dev/null +++ b/platform/linux-dpdk/test/example/simple_pipeline/pktio_env @@ -0,0 +1,52 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create two pcap interfaces which +# use udp64.pcap file to inject traffic. An output pcap file is generated by +# the second interface. +# +# Network set-up +# IF0 <---> IF1 + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +IF0=0 +IF1=1 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \ +--vdev net_pcap1,rx_pcap=${PCAP_IN},tx_pcap=pcapout.pcap" + +echo "Using PCAP_IN = ${PCAP_IN}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + if [ `stat -c %s pcapout.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then + echo "File sizes disagree" + exit 1 + fi + + rm -f pcapout.pcap +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1." + return 0 +} diff --git a/platform/linux-dpdk/test/example/switch/Makefile.am b/platform/linux-dpdk/test/example/switch/Makefile.am new file mode 100644 index 000000000..2ffced539 --- /dev/null +++ b/platform/linux-dpdk/test/example/switch/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = pktio_env diff --git a/platform/linux-dpdk/test/example/switch/pktio_env b/platform/linux-dpdk/test/example/switch/pktio_env new file mode 100644 index 000000000..413588c1f --- /dev/null +++ b/platform/linux-dpdk/test/example/switch/pktio_env @@ -0,0 +1,61 @@ +#!/bin/sh +# +# Copyright (c) 2020, Marvell +# Copyright (c) 2020, Nokia +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# +# Script to setup interfaces used for running application on linux-dpdk. +# +# For linux-dpdk the default behavior is to create four pcap interfaces of which +# the first one uses udp64.pcap file to inject traffic. The other three +# interfaces generate individual output pcap files. +# +# Network set-up +# IF0 |---> IF1 +# |---> IF2 +# |---> IF3 + +NUM_RX_PORT=3 +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +PCAP_EMPTY=`find . ${TEST_DIR} $(dirname $0) -name empty.pcap -print -quit` +IF0=0 +IF1=1 +IF2=2 +IF3=3 + +export ODP_PLATFORM_PARAMS="--no-pci \ +--vdev net_pcap0,rx_pcap=${PCAP_IN},tx_pcap=/dev/null \ +--vdev net_pcap1,rx_pcap=${PCAP_EMPTY},tx_pcap=pcapout1.pcap \ +--vdev net_pcap2,rx_pcap=${PCAP_EMPTY},tx_pcap=pcapout2.pcap \ +--vdev net_pcap3,rx_pcap=${PCAP_EMPTY},tx_pcap=pcapout3.pcap" + +echo "Switch test using PCAP_IN = ${PCAP_IN}" + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "Error: Platform specific env file has to be sourced." +fi + +validate_result() +{ + for i in `seq 1 $NUM_RX_PORT`; + do + if [ `stat -c %s pcapout${i}.pcap` -ne `stat -c %s ${PCAP_IN}` ]; then + echo "Error: Output file $i size not matching" + fi + rm -f pcapout${i}.pcap + done +} + +setup_interfaces() +{ + echo "pktio: setting up test interfaces $IF0, $IF1, $IF2, $IF3." + return 0 +} + +cleanup_interfaces() +{ + echo "pktio: cleaning up test interfaces $IF0, $IF1, $IF2, $IF3." + return 0 +} |