If you want to test traffic going only in one direction, you might be better off with one thread for a pair of interfaces.
Signed-off-by: Zoltan Kiss <[email protected]> --- test/performance/odp_l2fwd.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index 5d4b833..0cb6e55 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -71,6 +71,7 @@ typedef struct { int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ + int unidir; /**< Unidirectional test */ int mode; /**< Packet IO mode */ int time; /**< Time in seconds to run. */ int accuracy; /**< Number of seconds to get and print statistics */ @@ -397,9 +398,11 @@ int main(int argc, char *argv[]) printf("first CPU: %i\n", odp_cpumask_first(&cpumask)); printf("cpu mask: %s\n", cpumaskstr); - if (num_workers < gbl_args->appl.if_count) { - LOG_ERR("Error: CPU count %d less than interface count\n", - num_workers); + if (num_workers < gbl_args->appl.if_count || + (gbl_args->appl.unidir && + num_workers * 2 < gbl_args->appl.if_count)) { + LOG_ERR("Error: CPU count %d not enough for %d interface\n", + num_workers, gbl_args->appl.if_count); exit(EXIT_FAILURE); } if (gbl_args->appl.if_count % 2 != 0) { @@ -446,7 +449,13 @@ int main(int argc, char *argv[]) else /* APPL_MODE_PKT_QUEUE */ thr_run_func = pktio_queue_thread; - gbl_args->thread[i].src_idx = i % gbl_args->appl.if_count; + if (gbl_args->appl.unidir) + /* The first of every pair will be the ingress if */ + gbl_args->thread[i].src_idx = + (i * 2) % gbl_args->appl.if_count; + else + gbl_args->thread[i].src_idx = + i % gbl_args->appl.if_count; gbl_args->thread[i].stats = &stats[i]; odp_cpumask_zero(&thd_mask); @@ -522,6 +531,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {"time", required_argument, NULL, 't'}, {"accuracy", required_argument, NULL, 'a'}, {"interface", required_argument, NULL, 'i'}, /* return 'i' */ + {"unidir", optional_argument, NULL, 'u'}, {"mode", required_argument, NULL, 'm'}, /* return 'm' */ {"help", no_argument, NULL, 'h'}, /* return 'h' */ {NULL, 0, NULL, 0} @@ -530,6 +540,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 1; /* get and print pps stats second */ appl_args->mode = -1; /* Invalid, must be changed by parsing */ + appl_args->unidir = 0; /* Do bidirectional tests by default */ while (1) { opt = getopt_long(argc, argv, "+c:+t:+a:i:m:h", @@ -589,6 +600,10 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } break; + case 'u': + appl_args->unidir = 1; + break; + case 'm': i = atoi(optarg); if (i == 0) @@ -667,6 +682,8 @@ static void usage(char *progname) "\n" "Mandatory OPTIONS:\n" " -i, --interface Eth interfaces (comma-separated, no spaces)\n" + " -u, --unidir Unidirectional test, first in the pair of\n" + " interfaces above is the source\n" " -m, --mode 0: Burst send&receive packets (no queues)\n" " 1: Send&receive packets through ODP queues.\n" "\n" -- 1.9.1 _______________________________________________ lng-odp mailing list [email protected] https://lists.linaro.org/mailman/listinfo/lng-odp
