This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "".
The branch, master has been updated via 654507c6eeed83dd84210f7e481ded34f5d4cdca (commit) via 84f8013995d4b96ac9471cc92285c76b50464415 (commit) from 92ebb26bae583ff864bc4bef6a2776329527a069 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit 654507c6eeed83dd84210f7e481ded34f5d4cdca Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Mar 27 14:25:12 2018 +0300
test: sched_pktio: run in validation test suite
Add script to run the test as part of validation test suite. The script is based on odp_l2fwd_run.sh. Use only single worker as that requires only one rx/tx queue from pktio. Test passes if at least 1000 packets are received in 5 seconds.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/performance/Makefile.am b/test/performance/Makefile.am index c8f0bdec..811cc1c0 100644 --- a/test/performance/Makefile.am +++ b/test/performance/Makefile.am @@ -15,6 +15,7 @@ COMPILE_ONLY = odp_l2fwd \
TESTSCRIPTS = odp_l2fwd_run.sh \ odp_sched_latency_run.sh \ + odp_sched_pktio_run.sh \ odp_scheduling_run.sh
if HAVE_PCAP diff --git a/test/performance/odp_sched_pktio_run.sh b/test/performance/odp_sched_pktio_run.sh new file mode 100755 index 00000000..db14fb59 --- /dev/null +++ b/test/performance/odp_sched_pktio_run.sh @@ -0,0 +1,101 @@ +#!/bin/sh +# +# Copyright (c) 2018, Linaro Limited +# All rights reserved. +# +# SPDX-License-Identifier: BSD-3-Clause +# + +# directory where test binaries have been built +TEST_DIR="${TEST_DIR:-$PWD}" +# directory where test sources are, including scripts +TEST_SRC_DIR=$(dirname $0) + +PATH=$TEST_DIR:$TEST_DIR/../../example/generator:$PATH + +# exit codes expected by automake for skipped tests +TEST_SKIPPED=77 + +VALIDATION_TESTDIR=platform/$ODP_PLATFORM/test/validation +PLATFORM_VALIDATION=${TEST_SRC_DIR}/../../$VALIDATION_TESTDIR + +FLOOD_MODE=0 + +# Use installed pktio env or for make check take it from platform directory +if [ -f "./pktio_env" ]; then + . ./pktio_env +elif [ "$ODP_PLATFORM" = "" ]; then + echo "$0: error: ODP_PLATFORM must be defined" + # not skipped as this should never happen via "make check" + exit 1 +elif [ -f ${PLATFORM_VALIDATION}/api/pktio/pktio_env ]; then + . ${PLATFORM_VALIDATION}/api/pktio/pktio_env +else + echo "BUG: unable to find pktio_env!" + echo "pktio_env has to be in current directory or " + echo "in platform/$ODP_PLATFORM/test." + echo "ODP_PLATFORM="$ODP_PLATFORM"" + exit 1 +fi + +run_sched_pktio() +{ + setup_pktio_env clean # install trap to call cleanup_pktio_env + + if [ $? -ne 0 ]; then + echo "setup_pktio_env error $?" + exit $TEST_SKIPPED + fi + + type odp_generator > /dev/null + if [ $? -ne 0 ]; then + echo "odp_generator not installed. Aborting." + cleanup_pktio_env + exit 1 + fi + + # 1 worker + odp_sched_pktio${EXEEXT} -i $IF1,$IF2 -c 1 -s & + + TEST_PID=$! + + sleep 1 + + # Run generator with one worker + (odp_generator${EXEEXT} --interval $FLOOD_MODE -I $IF0 \ + --srcip 192.168.0.1 --dstip 192.168.0.2 \ + -m u -w 1 2>&1 > /dev/null) \ + 2>&1 > /dev/null & + + GEN_PID=$! + + # Run test for 5 sec + sleep 5 + + kill ${GEN_PID} + wait ${GEN_PID} + + # Kill with SIGINT to output statistics + kill -2 ${TEST_PID} + wait ${TEST_PID} + + ret=$? + + if [ $ret -eq 3 ]; then + echo "PASS: received and transmitted over 5000 packets" + ret=0 + else + echo "FAIL: less than thousand rx or tx packets $ret" + ret=1 + fi + + cleanup_pktio_env + + exit $ret +} + +case "$1" in + setup) setup_pktio_env ;; + cleanup) cleanup_pktio_env ;; + *) run_sched_pktio ;; +esac
commit 84f8013995d4b96ac9471cc92285c76b50464415 Author: Petri Savolainen petri.savolainen@linaro.org Date: Tue Mar 27 12:55:57 2018 +0300
test: sched_pktio: add option to collect statistics
Options -s enables statistics collection and changes return value to kilo-packets. Return value can be used in scripts to validate correct test execution.
Signed-off-by: Petri Savolainen petri.savolainen@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/test/performance/odp_sched_pktio.c b/test/performance/odp_sched_pktio.c index cf6e17f4..16d14b19 100644 --- a/test/performance/odp_sched_pktio.c +++ b/test/performance/odp_sched_pktio.c @@ -8,6 +8,8 @@ #include <string.h> #include <signal.h> #include <stdlib.h> +#include <stdint.h> +#include <inttypes.h>
#include <odp_api.h> #include <odp/helper/odph_api.h> @@ -22,12 +24,18 @@ #define BURST_SIZE 32 #define CHECK_PERIOD 10000 #define MAX_PKTIO_INDEXES 256 +#define TEST_PASSED_LIMIT 5000
typedef struct { int worker_id; void *test_global_ptr; } worker_arg_t;
+typedef struct ODP_ALIGNED_CACHE { + uint64_t rx_pkt; + uint64_t tx_pkt; +} worker_stat_t; + typedef struct { volatile int stop_workers; odp_barrier_t worker_start; @@ -35,6 +43,7 @@ typedef struct { struct { int num_worker; int num_pktio; + uint8_t collect_stat; } opt;
int max_workers; @@ -66,6 +75,10 @@ typedef struct { /* Maps pktio input index to pktio[] index for output */ uint8_t pktio_map[MAX_PKTIO_INDEXES];
+ worker_stat_t worker_stat[MAX_WORKERS]; + uint64_t rx_pkt_sum; + uint64_t tx_pkt_sum; + } test_global_t;
static test_global_t *test_global; @@ -143,6 +156,11 @@ static int worker_thread(void *arg)
if (odp_unlikely(drop)) odp_packet_free_multi(&pkt[sent], drop); + + if (odp_unlikely(test_global->opt.collect_stat)) { + test_global->worker_stat[worker_id].rx_pkt += num; + test_global->worker_stat[worker_id].tx_pkt += sent; + } }
printf("Worker %i stopped\n", worker_id); @@ -172,7 +190,8 @@ static void print_usage(const char *progname) "\n" "OPTIONS:\n" " -i, --interface <name> Packet IO interfaces (comma-separated, no spaces)\n" - " -c, --count Worker thread count. Default: 1\n" + " -c, --count <number> Worker thread count. Default: 1\n" + " -s, --stat Collect statistics.\n" " -h, --help Display help and exit.\n\n", NO_PATH(progname)); } @@ -185,10 +204,11 @@ static int parse_options(int argc, char *argv[], test_global_t *test_global) const struct option longopts[] = { {"interface", required_argument, NULL, 'i'}, {"count", required_argument, NULL, 'c'}, + {"stat", no_argument, NULL, 's'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0} }; - const char *shortopts = "+i:c:h"; + const char *shortopts = "+i:c:sh"; int ret = 0;
test_global->opt.num_worker = 1; @@ -237,6 +257,9 @@ static int parse_options(int argc, char *argv[], test_global_t *test_global) case 'c': test_global->opt.num_worker = atoi(optarg); break; + case 's': + test_global->opt.collect_stat = 1; + break; case 'h': print_usage(argv[0]); ret = -1; @@ -342,9 +365,47 @@ static void print_config(test_global_t *test_global) " num output queues: %i\n", test_global->num_input_queues, test_global->num_output_queues);
+ printf(" collect statistics: %u\n", test_global->opt.collect_stat); + printf("\n"); }
+static void print_stat(test_global_t *test_global, uint64_t nsec) +{ + int i; + uint64_t rx, tx, drop; + uint64_t rx_sum = 0; + uint64_t tx_sum = 0; + double sec = 0.0; + + printf("\nTest statistics\n"); + printf(" worker rx_pkt tx_pkt dropped\n"); + + for (i = 0; i < test_global->opt.num_worker; i++) { + rx = test_global->worker_stat[i].rx_pkt; + tx = test_global->worker_stat[i].tx_pkt; + rx_sum += rx; + tx_sum += tx; + + printf(" %6i %16" PRIu64 " %16" PRIu64 " %16" PRIu64 "\n", + i, rx, tx, rx - tx); + } + + test_global->rx_pkt_sum = rx_sum; + test_global->tx_pkt_sum = tx_sum; + drop = rx_sum - tx_sum; + + printf(" --------------------------------------------------\n"); + printf(" total %16" PRIu64 " %16" PRIu64 " %16" PRIu64 "\n\n", + rx_sum, tx_sum, drop); + + sec = nsec / 1000000000.0; + printf(" Total test time: %.2f sec\n", sec); + printf(" Rx packet rate: %.2f pps\n", rx_sum / sec); + printf(" Tx packet rate: %.2f pps\n", tx_sum / sec); + printf(" Drop rate: %.2f pps\n\n", drop / sec); +} + static int open_pktios(test_global_t *test_global) { odp_pool_param_t pool_param; @@ -628,7 +689,9 @@ int main(int argc, char *argv[]) odp_instance_t instance; odp_init_t init; odp_shm_t shm; + odp_time_t t1, t2; odph_odpthread_t thread[MAX_WORKERS]; + int ret = 0;
signal(SIGINT, sig_handler);
@@ -696,13 +759,28 @@ int main(int argc, char *argv[]) odp_mb_full(); }
+ t1 = odp_time_local(); + wait_workers(thread, test_global);
+ t2 = odp_time_local(); + quit: stop_pktios(test_global); empty_queues(); close_pktios(test_global);
+ if (test_global->opt.collect_stat) { + print_stat(test_global, odp_time_diff_ns(t2, t1)); + + /* Encode return value for validation test usage. */ + if (test_global->rx_pkt_sum > TEST_PASSED_LIMIT) + ret += 1; + + if (test_global->tx_pkt_sum > TEST_PASSED_LIMIT) + ret += 2; + } + if (odp_shm_free(shm)) { printf("Error: shm free failed.\n"); return -1; @@ -718,5 +796,5 @@ quit: return -1; }
- return 0; + return ret; }
-----------------------------------------------------------------------
Summary of changes: test/performance/Makefile.am | 1 + test/performance/odp_sched_pktio.c | 84 +++++++++++++++++++++- .../{odp_l2fwd_run.sh => odp_sched_pktio_run.sh} | 69 +++++++----------- 3 files changed, 108 insertions(+), 46 deletions(-) copy test/performance/{odp_l2fwd_run.sh => odp_sched_pktio_run.sh} (50%)
hooks/post-receive