diff --git a/platform/linux-generic/m4/configure.m4 b/platform/linux-generic/m4/configure.m4 index 00ee3683b53..556f01c19a6 100644 --- a/platform/linux-generic/m4/configure.m4 +++ b/platform/linux-generic/m4/configure.m4 @@ -71,5 +71,7 @@ AC_CONFIG_FILES([platform/linux-generic/Makefile platform/linux-generic/test/example/switch/Makefile platform/linux-generic/test/validation/api/shmem/Makefile platform/linux-generic/test/validation/api/pktio/Makefile + platform/linux-generic/test/performance/Makefile + platform/linux-generic/test/performance/dmafwd/Makefile platform/linux-generic/test/pktio_ipc/Makefile]) ]) diff --git a/platform/linux-generic/test/Makefile.am b/platform/linux-generic/test/Makefile.am index 99d7199adc9..30ef260783b 100644 --- a/platform/linux-generic/test/Makefile.am +++ b/platform/linux-generic/test/Makefile.am @@ -15,10 +15,11 @@ TESTS += validation/api/pktio/pktio_run.sh \ validation/api/pktio/pktio_run_tap.sh \ validation/api/shmem/shmem_linux$(EXEEXT) -SUBDIRS += validation/api/pktio\ - validation/api/shmem\ - pktio_ipc \ - example +SUBDIRS += validation/api/pktio \ + validation/api/shmem \ + pktio_ipc \ + example \ + performance if ODP_PKTIO_PCAP TESTS += validation/api/pktio/pktio_run_pcap.sh @@ -31,7 +32,8 @@ SUBDIRS += pktio_ipc else #performance tests refer to pktio_env if test_perf -SUBDIRS += validation/api/pktio +SUBDIRS += validation/api/pktio \ + performance endif endif diff --git a/platform/linux-generic/test/performance/Makefile.am b/platform/linux-generic/test/performance/Makefile.am new file mode 100644 index 00000000000..4070f09f2e6 --- /dev/null +++ b/platform/linux-generic/test/performance/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = dmafwd diff --git a/platform/linux-generic/test/performance/dmafwd/Makefile.am b/platform/linux-generic/test/performance/dmafwd/Makefile.am new file mode 100644 index 00000000000..91d42cc7456 --- /dev/null +++ b/platform/linux-generic/test/performance/dmafwd/Makefile.am @@ -0,0 +1,18 @@ +EXTRA_DIST = pktio_env + +all-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + if [ -e $(srcdir)/$$f ]; then \ + mkdir -p $(builddir)/$$(dirname $$f); \ + cp -f $(srcdir)/$$f $(builddir)/$$f; \ + fi \ + done \ + fi + +clean-local: + if [ "x$(srcdir)" != "x$(builddir)" ]; then \ + for f in $(EXTRA_DIST); do \ + rm -f $(builddir)/$$f; \ + done \ + fi diff --git a/platform/linux-generic/test/performance/dmafwd/pktio_env b/platform/linux-generic/test/performance/dmafwd/pktio_env new file mode 100644 index 00000000000..9fef478f2ad --- /dev/null +++ b/platform/linux-generic/test/performance/dmafwd/pktio_env @@ -0,0 +1,46 @@ +#!/bin/sh +# +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2023 Nokia + +PCAP_IN=`find . ${TEST_DIR} $(dirname $0) -name udp64.pcap -print -quit` +PCAP_OUT=dmafwd_out.pcap + +IF0=pcap:in=${PCAP_IN}:out=${PCAP_OUT} + +if [ "$0" = "$BASH_SOURCE" ]; then + echo "ERROR: Platform specific env file has to be sourced." +fi + +validate_result() +{ + local VALIN=valin + local VALOUT=valout + + tcpdump -r ${PCAP_IN} -t -x > ${VALIN} + tcpdump -r ${PCAP_OUT} -t -x > ${VALOUT} + diff ${VALIN} ${VALOUT} + + local RET=$? + + rm -f ${PCAP_OUT} + rm -f ${VALIN} + rm -f ${VALOUT} + + if [ $RET -ne 0 ]; then + echo "ERROR: input and output captures do not match, exiting" + exit 1 + fi + + return 0 +} + +setup_interfaces() +{ + return 0 +} + +cleanup_interfaces() +{ + return 0 +} diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index b995a9d6a72..68532ac6ab3 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -47,7 +47,8 @@ TESTSCRIPTS = odp_cpu_bench_run.sh \ odp_timer_perf_run.sh if ODP_PKTIO_PCAP -TESTSCRIPTS += odp_pktio_ordered_run.sh +TESTSCRIPTS += odp_dmafwd_run.sh \ + odp_pktio_ordered_run.sh endif TEST_EXTENSIONS = .sh diff --git a/test/performance/odp_dmafwd_run.sh b/test/performance/odp_dmafwd_run.sh new file mode 100755 index 00000000000..85a2c20f1c9 --- /dev/null +++ b/test/performance/odp_dmafwd_run.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# +# SPDX-License-Identifier: BSD-3-Clause +# Copyright (c) 2023 Nokia + +TEST_DIR="${TEST_DIR:-$PWD}" +TEST_SRC_DIR=$(dirname $0) +PERF_TEST_DIR=platform/${ODP_PLATFORM}/test/performance +PERF_TEST_DIR=${TEST_SRC_DIR}/../../${PERF_TEST_DIR} + +BIN_NAME=odp_dmafwd +BATCH=10 +TIME=2 +TESTS_RUN=0 + +check_env() +{ + if [ -f "./pktio_env" ]; then + . ./pktio_env + elif [ "${ODP_PLATFORM}" = "" ]; then + echo "$0: ERROR: ODP_PLATFORM must be defined" + exit 1 + elif [ -f ${PERF_TEST_DIR}/dmafwd/pktio_env ]; then + . ${PERF_TEST_DIR}/dmafwd/pktio_env + else + echo "ERROR: unable to find pktio_env" + echo "pktio_env has to be in current directory or in platform/\$ODP_PLATFORM/test/" + echo "ODP_PLATFORM=\"${ODP_PLATFORM}\"" + exit 1 + fi +} + +check_result() +{ + if [ $1 -eq 0 ]; then + TESTS_RUN=`expr $TESTS_RUN + 1` + elif [ $1 -eq 1 ]; then + echo "Test FAILED, exiting" + exit 1 + else + echo "Test SKIPPED" + return 0 + fi + + validate_result +} + +check_exit() +{ + if [ $TESTS_RUN -eq 0 ]; then + exit 77 + fi + + exit 0 +} + +check_env +setup_interfaces +echo "${BIN_NAME}: SW copy" +echo "===================" +./${BIN_NAME}${EXEEXT} -i ${IF0} -b ${BATCH} -T ${TIME} -t 0 +check_result $? +echo "${BIN_NAME}: DMA copy" +echo "====================" +./${BIN_NAME}${EXEEXT} -i ${IF0} -b ${BATCH} -T ${TIME} -t 1 +check_result $? +cleanup_interfaces +check_exit