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 0330e7369aa682ac2c2feb2bcb197e52dc1810fb (commit) via 7c72d611d8d568358d4a7849057e42708cbb10c3 (commit) from 9ccda90b1788836848ecc5977d9cd8a807ee20c9 (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 0330e7369aa682ac2c2feb2bcb197e52dc1810fb Author: Matias Elo matias.elo@nokia.com Date: Fri Jun 29 15:51:25 2018 +0300
example: use ODP_THREAD_COUNT_MAX as max worker count
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bogdan Pricope bogdan.pricope@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index cdcb35bb..3403647b 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -20,7 +20,7 @@ /** @def MAX_WORKERS * @brief Maximum number of worker threads */ -#define MAX_WORKERS 32 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** @def SHM_PKT_POOL_SIZE * @brief Size of the shared memory block diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 706c071a..0785e3ec 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -22,7 +22,8 @@
#include <odp/helper/odph_api.h>
-#define MAX_WORKERS 32 /* Max number of workers */ +/* Max number of workers */ +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1) #define POOL_NUM_PKT 2048 /* Number of packets in packet pool */ #define POOL_PKT_LEN 1856 /* Max packet length */ #define DEFAULT_PKT_INTERVAL 1000 /* Interval between each packet */ diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 6371437b..2624af5d 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -63,7 +63,8 @@ static int create_stream_db_entry(char *input ODP_UNUSED) } #endif
-#define MAX_WORKERS 32 /**< maximum number of worker threads */ +/* maximum number of worker threads */ +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** * Parsed command line application arguments diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 4e1d4b51..f827eeeb 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -63,7 +63,8 @@ static int create_stream_db_entry(char *input ODP_UNUSED) } #endif
-#define MAX_WORKERS 32 /**< maximum number of worker threads */ +/* maximum number of worker threads */ +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** * Parsed command line application arguments diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index 492740c6..63c8f126 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -45,7 +45,8 @@ #include <odp_ipsec_offload_fwd_db.h> #include <odp_ipsec_offload_cache.h>
-#define MAX_WORKERS 32 /**< maximum number of worker threads */ +/* maximum number of worker threads */ +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** * Parsed command line application arguments diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index c4b62341..34e2bfce 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -23,7 +23,7 @@ #define POOL_SEG_LEN 1856 #define MAX_PKT_BURST 32
-#define MAX_NB_WORKER 32 +#define MAX_NB_WORKER (ODP_THREAD_COUNT_MAX - 1) #define MAX_NB_PKTIO 32 #define MAX_NB_QUEUE 32 #define MAX_NB_QCONFS 1024 diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index 999eceb5..7755efcb 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -18,7 +18,7 @@ /** @def MAX_WORKERS * @brief Maximum number of worker threads */ -#define MAX_WORKERS 32 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** @def SHM_PKT_POOL_SIZE * @brief Size of the shared memory block diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index fd8df6eb..18771ea4 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -14,7 +14,7 @@ #include <odp/helper/odph_api.h>
/** Maximum number of worker threads */ -#define MAX_WORKERS 32 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** Size of the shared memory block */ #define SHM_PKT_POOL_SIZE 8192 diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 115c6a6d..9e431b47 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -19,8 +19,8 @@ /* GNU lib C */ #include <getopt.h>
- -#define MAX_WORKERS 32 /**< Max worker threads */ +/* Max worker threads */ +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1) #define NUM_TMOS 10000 /**< Number of timers */ #define WAIT_NUM 10 /**< Max tries to rx last tmo per worker */ #define MAX(a, b) (((a) > (b)) ? (a) : (b)) diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index fa6507cf..16336392 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -25,7 +25,7 @@ #include <odp/helper/odph_api.h>
/* Maximum number of worker threads */ -#define MAX_WORKERS 32 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/* Size of the shared memory block */ #define POOL_PKT_NUM (16 * 1024) diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index 4c1b4260..e884d38a 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -79,7 +79,7 @@ #define MAX_NUM_PKT (8 * 1024)
/** Maximum number of worker threads */ -#define MAX_WORKERS 64 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1)
/** Buffer size of the packet pool buffer in bytes*/ #define PKT_POOL_BUF_SIZE 1856 diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 41886997..7ddf8250 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -39,7 +39,7 @@ #define PKT_BUF_NUM (32 * 1024) #define MAX_NUM_IFACES 2 #define TEST_HDR_MAGIC 0x92749451 -#define MAX_WORKERS 128 +#define MAX_WORKERS (ODP_THREAD_COUNT_MAX - 1) #define BATCH_LEN_MAX 32
/* Packet rate at which to start when using binary search */
commit 7c72d611d8d568358d4a7849057e42708cbb10c3 Author: Matias Elo matias.elo@nokia.com Date: Thu Jun 28 15:59:34 2018 +0300
example: use min number of workers by default
Use minimum worker count by default in all example applications.
Signed-off-by: Matias Elo matias.elo@nokia.com Reviewed-by: Bogdan Pricope bogdan.pricope@linaro.org Reviewed-by: Bill Fischofer bill.fischofer@linaro.org Signed-off-by: Maxim Uvarov maxim.uvarov@linaro.org
diff --git a/example/classifier/odp_classifier.c b/example/classifier/odp_classifier.c index 3afe7645..cdcb35bb 100644 --- a/example/classifier/odp_classifier.c +++ b/example/classifier/odp_classifier.c @@ -70,7 +70,7 @@ typedef struct { int policy_count; /**< global policy count */ int appl_mode; /**< application mode */ odp_atomic_u64_t total_packets; /**< total received packets */ - int cpu_count; /**< Number of CPUs to use */ + unsigned int cpu_count; /**< Number of CPUs to use */ uint32_t time; /**< Number of seconds to run */ char *if_name; /**< pointer to interface names */ } appl_args_t; @@ -519,9 +519,8 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), args);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (args->cpu_count) + if (args->cpu_count && args->cpu_count < MAX_WORKERS) num_workers = args->cpu_count;
/* Get default worker cpumask */ @@ -807,6 +806,8 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ appl_args->cpu_count = 1; /* Use one worker by default */ + while (1) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index); @@ -919,8 +920,7 @@ static void usage(char *progname) "<mask bits> PMR mask bits to be applied on the PMR term value\n" "\n" "Optional OPTIONS\n" - " -c, --count <number> CPU count.\n" - " default: CPU core count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" "\n" " -m, --mode 0: Packet Drop mode. Received packets will be dropped\n" " !0: Packet ICMP mode. Received packets will be sent back\n" diff --git a/example/generator/odp_generator.c b/example/generator/odp_generator.c index 1a6bb911..706c071a 100644 --- a/example/generator/odp_generator.c +++ b/example/generator/odp_generator.c @@ -1169,9 +1169,7 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl);
- /* Default to max number of workers, unless user specified number of - * workers or cpumask */ - num_workers = MAX_WORKERS; + num_workers = 1; num_workers = odp_cpumask_default_worker(&cpumask, num_workers);
if (args->appl.num_workers) { @@ -1580,6 +1578,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) appl_args->dstport_end = 0; appl_args->csum = 0; appl_args->sched = 0; + appl_args->num_workers = -1;
while (1) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index); @@ -1596,9 +1595,11 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) num_workers = odp_cpumask_default_worker(&cpumask, 0); odp_cpumask_and(&cpumask_and, &cpumask_args, &cpumask); if (odp_cpumask_count(&cpumask_and) < - odp_cpumask_count(&cpumask_args)) { + odp_cpumask_count(&cpumask_args) || + odp_cpumask_count(&cpumask_args) > MAX_WORKERS) { EXAMPLE_ERR("Wrong cpu mask, max cpu's:%d\n", - num_workers); + num_workers < MAX_WORKERS ? + num_workers : MAX_WORKERS); exit(EXIT_FAILURE); } break; @@ -1748,6 +1749,12 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } }
+ if (appl_args->num_workers < 0) + appl_args->num_workers = 0; + else if (appl_args->num_workers == 0 || + appl_args->num_workers > MAX_WORKERS) + appl_args->num_workers = MAX_WORKERS; + if (appl_args->if_count == 0 || appl_args->mode == -1) { usage(argv[0]); exit(EXIT_FAILURE); @@ -1834,7 +1841,7 @@ static void usage(char *progname) " -i, --interval wait interval ms between sending each packet\n" " default is 1000ms. 0 for flood mode\n" " -w, --workers specify number of workers need to be assigned to application\n" - " default is to assign all\n" + " default is 1, 0 for all available\n" " -n, --count the number of packets to be send\n" " -c, --cpumask to set on cores\n" " -x, --udp_tx_burst size of UDP TX burst\n" diff --git a/example/ipsec/odp_ipsec.c b/example/ipsec/odp_ipsec.c index 1b21773e..6371437b 100644 --- a/example/ipsec/odp_ipsec.c +++ b/example/ipsec/odp_ipsec.c @@ -69,7 +69,7 @@ static int create_stream_db_entry(char *input ODP_UNUSED) * Parsed command line application arguments */ typedef struct { - int cpu_count; + unsigned int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ crypto_api_mode_e mode; /**< Crypto API preferred mode */ @@ -1247,9 +1247,8 @@ main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (args->appl.cpu_count) + if (args->appl.cpu_count && args->appl.cpu_count < MAX_WORKERS) num_workers = args->appl.cpu_count;
/* Get default worker cpumask */ @@ -1398,6 +1397,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args)
printf("\nParsing command line options\n");
+ appl_args->cpu_count = 1; /* use one worker by default */ appl_args->mode = 0; /* turn off async crypto API by default */
while (!rc) { @@ -1568,7 +1568,7 @@ static void usage(char *progname) " -a 192.168.111.2:192.168.222.2:md5:201:a731649644c5dee92cbd9c2e7e188ee6\n" "\n" "Optional OPTIONS\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -h, --help Display help and exit.\n" " environment variables: ODP_IPSEC_USE_POLL_QUEUES\n" " to enable use of poll queues instead of scheduled (default)\n" diff --git a/example/ipsec_api/odp_ipsec.c b/example/ipsec_api/odp_ipsec.c index 6142011b..4e1d4b51 100644 --- a/example/ipsec_api/odp_ipsec.c +++ b/example/ipsec_api/odp_ipsec.c @@ -69,7 +69,7 @@ static int create_stream_db_entry(char *input ODP_UNUSED) * Parsed command line application arguments */ typedef struct { - int cpu_count; + unsigned int cpu_count; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ odp_ipsec_op_mode_t mode; /**< IPsec operation mode */ @@ -945,9 +945,8 @@ main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (args->appl.cpu_count) + if (args->appl.cpu_count && args->appl.cpu_count < MAX_WORKERS) num_workers = args->appl.cpu_count;
/* Get default worker cpumask */ @@ -1095,6 +1094,8 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ appl_args->cpu_count = 1; /* use one worker by default */ + printf("\nParsing command line options\n");
while (!rc) { @@ -1268,7 +1269,7 @@ static void usage(char *progname) " -a 192.168.111.2:192.168.222.2:md5:201:a731649644c5dee92cbd9c2e7e188ee6\n" "\n" "Optional OPTIONS\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -h, --help Display help and exit.\n" " environment variables: ODP_IPSEC_USE_POLL_QUEUES\n" " to enable use of poll queues instead of scheduled (default)\n" diff --git a/example/ipsec_offload/odp_ipsec_offload.c b/example/ipsec_offload/odp_ipsec_offload.c index 890de682..492740c6 100644 --- a/example/ipsec_offload/odp_ipsec_offload.c +++ b/example/ipsec_offload/odp_ipsec_offload.c @@ -51,7 +51,7 @@ * Parsed command line application arguments */ typedef struct { - int cpu_count; + unsigned int cpu_count; int flows; int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ @@ -558,9 +558,8 @@ main(int argc, char *argv[]) if (odp_ipsec_config(&config)) EXAMPLE_ABORT("Error: IPSec not configured.\n");
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (args->appl.cpu_count && args->appl.cpu_count <= MAX_WORKERS) + if (args->appl.cpu_count && args->appl.cpu_count < MAX_WORKERS) num_workers = args->appl.cpu_count;
/* @@ -661,6 +660,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) {NULL, 0, NULL, 0} };
+ appl_args->cpu_count = 1; /* use one worker by default */ appl_args->flows = 1; appl_args->queue_type = ODP_SCHED_SYNC_ATOMIC;
@@ -842,7 +842,7 @@ static void usage(char *progname) "\n" "Optional OPTIONS\n" " -f, --flows <number> routes count.\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -q specify the queue type\n" " 0: ODP_SCHED_SYNC_PARALLEL\n" " 1: ODP_SCHED_SYNC_ATOMIC\n" diff --git a/example/l3fwd/odp_l3fwd.c b/example/l3fwd/odp_l3fwd.c index b12348cc..c4b62341 100644 --- a/example/l3fwd/odp_l3fwd.c +++ b/example/l3fwd/odp_l3fwd.c @@ -71,9 +71,9 @@ typedef struct { char *if_names[MAX_NB_PKTIO]; int if_count; char *route_str[MAX_NB_ROUTE]; - int worker_count; + unsigned int worker_count; struct l3fwd_qconf_s qconf_config[MAX_NB_QCONFS]; - int qconf_count; + unsigned int qconf_count; uint32_t duration; /* seconds to run */ uint8_t hash_mode; /* 1:hash, 0:lpm */ uint8_t dest_mac_changed[MAX_NB_PKTIO]; /* 1: dest mac from cmdline */ @@ -490,7 +490,7 @@ static void print_usage(char *progname) " -d, --duration Seconds to run and print stats\n" " optional, default as 0, run forever\n" " -t, --thread Number of threads to do forwarding\n" - " optional, default as availbe worker cpu count\n" + " 0=all available, default=1\n" " -q, --queue Configure rx queue(s) for port\n" " optional, format: [(port, queue, thread),...]\n" " for example: -q '(0, 0, 1),(1,0,2)'\n" @@ -507,7 +507,8 @@ static void parse_cmdline_args(int argc, char *argv[], app_args_t *args) int long_index; char *token, *local; size_t len, route_index = 0; - int i, mem_failure = 0; + int mem_failure = 0; + unsigned int i;
static struct option longopts[] = { {"interface", required_argument, NULL, 'i'}, /* return 'i' */ @@ -521,6 +522,8 @@ static void parse_cmdline_args(int argc, char *argv[], app_args_t *args) {NULL, 0, NULL, 0} };
+ args->worker_count = 1; /* use one worker by default */ + while (1) { opt = getopt_long(argc, argv, "+s:t:d:i:r:q:e:h", longopts, &long_index); @@ -679,8 +682,8 @@ static void print_info(char *progname, app_args_t *args) */ static void setup_worker_qconf(app_args_t *args) { - int nb_worker, if_count, pktio; - int i, j, rxq_idx; + int j, rxq_idx, pktio; + unsigned int i, nb_worker, if_count; struct thread_arg_s *arg; struct l3fwd_pktio_s *port; uint8_t queue_mask[MAX_NB_PKTIO][MAX_NB_QUEUE]; @@ -841,7 +844,8 @@ static void setup_worker_qconf(app_args_t *args)
static void print_qconf_table(app_args_t *args) { - int i, j, k, qid, if_idx; + unsigned int i; + int j, k, qid, if_idx; char buf[32]; struct thread_arg_s *thr_arg;
@@ -1038,9 +1042,8 @@ int main(int argc, char **argv) setup_fwd_db(); dump_fwd_db();
- /* Dicide available workers */ nb_worker = MAX_NB_WORKER; - if (args->worker_count) + if (args->worker_count && args->worker_count < MAX_NB_WORKER) nb_worker = args->worker_count; nb_worker = odp_cpumask_default_worker(&cpumask, nb_worker); args->worker_count = nb_worker; diff --git a/example/packet/odp_pktio.c b/example/packet/odp_pktio.c index fcce92b1..999eceb5 100644 --- a/example/packet/odp_pktio.c +++ b/example/packet/odp_pktio.c @@ -63,7 +63,7 @@ * Parsed command line application arguments */ typedef struct { - int cpu_count; /**< Number of CPUs to use */ + unsigned int cpu_count; /**< Number of CPUs to use */ int if_count; /**< Number of interfaces to be used */ char **if_names; /**< Array of pointers to interface names */ int mode; /**< Packet IO mode */ @@ -376,9 +376,8 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (args->appl.cpu_count) + if (args->appl.cpu_count && args->appl.cpu_count < MAX_WORKERS) num_workers = args->appl.cpu_count;
/* Get default worker cpumask */ @@ -572,6 +571,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ appl_args->cpu_count = 1; /* use one worker by default */ appl_args->mode = APPL_MODE_PKT_SCHED; appl_args->time = 0; /**< loop forever */
@@ -712,7 +712,7 @@ static void usage(char *progname) " -i, --interface Eth interfaces (comma-separated, no spaces)\n" "\n" "Optional OPTIONS\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -t, --time <seconds> Number of seconds to run.\n" " -m, --mode 0: Receive and send directly (no queues)\n" " 1: Receive and send via queues.\n" diff --git a/example/switch/odp_switch.c b/example/switch/odp_switch.c index 26fcbbcc..fd8df6eb 100644 --- a/example/switch/odp_switch.c +++ b/example/switch/odp_switch.c @@ -52,7 +52,7 @@ typedef union { * Parsed command line application arguments */ typedef struct { - int cpu_count; /**< Number of CPUs to be used */ + unsigned int cpu_count; /**< Number of CPUs to be used */ unsigned if_count; /**< Number of interfaces to be used */ int num_workers; /**< Number of worker threads */ char **if_names; /**< Array of pointers to interface names */ @@ -725,7 +725,7 @@ static void usage(char *progname) " Interface count min 2, max %i\n" "\n" "Optional OPTIONS:\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -t, --time <number> Time in seconds to run.\n" " -a, --accuracy <number> Statistics print interval in seconds\n" " (default is 10 second).\n" @@ -762,6 +762,7 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ appl_args->cpu_count = 1; /* use one worker by default */ appl_args->time = 0; /* loop forever if time to run is 0 */ appl_args->accuracy = 10; /* get and print pps stats second */
@@ -916,9 +917,8 @@ int main(int argc, char **argv) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &gbl_args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (gbl_args->appl.cpu_count) + if (gbl_args->appl.cpu_count && gbl_args->appl.cpu_count < MAX_WORKERS) num_workers = gbl_args->appl.cpu_count;
/* Get default worker cpumask */ diff --git a/example/timer/odp_timer_test.c b/example/timer/odp_timer_test.c index 45eea792..115c6a6d 100644 --- a/example/timer/odp_timer_test.c +++ b/example/timer/odp_timer_test.c @@ -27,7 +27,7 @@
/** Test arguments */ typedef struct { - int cpu_count; /**< CPU count*/ + unsigned int cpu_count; /**< CPU count*/ int resolution_us; /**< Timeout resolution in usec*/ int min_us; /**< Minimum timeout in usec*/ int max_us; /**< Maximum timeout in usec*/ @@ -237,7 +237,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count <number> CPU count\n"); + printf(" -c, --count <number> CPU count, 0=all available, default=1\n"); printf(" -r, --resolution <us> timeout resolution in usec\n"); printf(" -m, --min <us> minimum timeout in usec\n"); printf(" -x, --max <us> maximum timeout in usec\n"); @@ -280,7 +280,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) /* defaults */ odp_timer_capability(ODP_CLOCK_CPU, &timer_capa);
- args->cpu_count = 0; /* all CPU's */ + args->cpu_count = 1; args->resolution_us = MAX(10000, timer_capa.highest_res_ns / ODP_TIME_USEC_IN_NS); @@ -391,9 +391,8 @@ int main(int argc, char *argv[])
memset(thread_tbl, 0, sizeof(thread_tbl));
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (gbls->args.cpu_count) + if (gbls->args.cpu_count && gbls->args.cpu_count < MAX_WORKERS) num_workers = gbls->args.cpu_count;
/* Get default worker cpumask */ diff --git a/test/performance/odp_l2fwd.c b/test/performance/odp_l2fwd.c index ff14ab2f..fa6507cf 100644 --- a/test/performance/odp_l2fwd.c +++ b/test/performance/odp_l2fwd.c @@ -75,7 +75,7 @@ static inline int sched_mode(pktin_mode_t in_mode) */ typedef struct { int extra_check; /* Some extra checks have been enabled */ - int cpu_count; + unsigned int cpu_count; int if_count; /* Number of interfaces to be used */ int addr_count; /* Number of dst addresses to be used */ int num_workers; /* Number of worker threads */ @@ -1125,7 +1125,7 @@ static void usage(char *progname) " -o, --out_mode <arg> Packet output mode\n" " 0: Direct mode: PKTOUT_MODE_DIRECT (default)\n" " 1: Queue mode: PKTOUT_MODE_QUEUE\n" - " -c, --count <num> CPU count.\n" + " -c, --count <num> CPU count, 0=all available, default=1\n" " -t, --time <sec> Time in seconds to run.\n" " -a, --accuracy <sec> Time in seconds get print statistics\n" " (default is 1 second).\n" @@ -1188,6 +1188,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->cpu_count = 1; /* use one worker by default */ appl_args->dst_change = 1; /* change eth dst address by default */ appl_args->src_change = 1; /* change eth src address by default */ appl_args->num_groups = 0; /* use default group */ @@ -1492,9 +1493,8 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &gbl_args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (gbl_args->appl.cpu_count) + if (gbl_args->appl.cpu_count && gbl_args->appl.cpu_count < MAX_WORKERS) num_workers = gbl_args->appl.cpu_count;
/* Get default worker cpumask */ diff --git a/test/performance/odp_pktio_ordered.c b/test/performance/odp_pktio_ordered.c index ec6c4faa..4c1b4260 100644 --- a/test/performance/odp_pktio_ordered.c +++ b/test/performance/odp_pktio_ordered.c @@ -134,7 +134,7 @@ typedef enum pktin_mode_t { * Parsed command line application arguments */ typedef struct { - int cpu_count; /**< CPU count */ + unsigned int cpu_count; /**< CPU count */ int if_count; /**< Number of interfaces to be used */ int addr_count; /**< Number of dst addresses to be used */ int num_rx_q; /**< Number of input queues per interface */ @@ -826,7 +826,7 @@ static void usage(char *progname) " -r, --num_rx_q Number of RX queues per interface\n" " -f, --num_flows Number of packet flows\n" " -e, --extra_input <number> Number of extra input processing rounds\n" - " -c, --count <number> CPU count.\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -t, --time <number> Time in seconds to run.\n" " -a, --accuracy <number> Statistics print interval in seconds\n" " (default is 1 second).\n" @@ -872,6 +872,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 = DEF_STATS_INT; + appl_args->cpu_count = 1; /* use one worker by default */ appl_args->num_rx_q = DEF_NUM_RX_QUEUES; appl_args->num_flows = DEF_NUM_FLOWS; appl_args->extra_rounds = DEF_EXTRA_ROUNDS; @@ -997,12 +998,6 @@ static void parse_args(int argc, char *argv[], appl_args_t *appl_args) } }
- if (appl_args->cpu_count > MAX_WORKERS) { - printf("Too many workers requested %d, max: %d\n", - appl_args->cpu_count, MAX_WORKERS); - exit(EXIT_FAILURE); - } - if (appl_args->num_flows > MAX_FLOWS) { printf("Too many flows requested %d, max: %d\n", appl_args->num_flows, MAX_FLOWS); @@ -1136,9 +1131,8 @@ int main(int argc, char *argv[]) /* Print both system and application information */ print_info(NO_PATH(argv[0]), &gbl_args->appl);
- /* Default to system CPU count unless user specified */ num_workers = MAX_WORKERS; - if (gbl_args->appl.cpu_count) + if (gbl_args->appl.cpu_count && gbl_args->appl.cpu_count < MAX_WORKERS) num_workers = gbl_args->appl.cpu_count;
/* Get default worker cpumask */ diff --git a/test/performance/odp_pktio_perf.c b/test/performance/odp_pktio_perf.c index 2791856a..41886997 100644 --- a/test/performance/odp_pktio_perf.c +++ b/test/performance/odp_pktio_perf.c @@ -70,7 +70,7 @@
/** Parsed command line application arguments */ typedef struct { - int cpu_count; /* CPU count */ + unsigned int cpu_count; /* CPU count */ int num_tx_workers;/* Number of CPUs to use for transmit */ int duration; /* Number of seconds to run each iteration of the test for */ @@ -918,8 +918,7 @@ static int test_term(void) static void usage(void) { printf("\nUsage: odp_pktio_perf [options]\n\n"); - printf(" -c, --count <number> CPU count\n"); - printf(" default: all available\n"); + printf(" -c, --count <number> CPU count, 0=all available, default=2\n"); printf(" -t, --txcount <number> Number of CPUs to use for TX\n"); printf(" default: cpu_count+1/2\n"); printf(" -b, --txbatch <length> Number of packets per TX batch\n"); @@ -963,7 +962,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
- args->cpu_count = 0; /* all CPUs */ + args->cpu_count = 2; args->num_tx_workers = 0; /* defaults to cpu_count+1/2 */ args->tx_batch_len = BATCH_LEN_MAX; args->rx_batch_len = BATCH_LEN_MAX; diff --git a/test/performance/odp_sched_latency.c b/test/performance/odp_sched_latency.c index 7e98db18..64a21983 100644 --- a/test/performance/odp_sched_latency.c +++ b/test/performance/odp_sched_latency.c @@ -74,7 +74,7 @@ typedef struct {
/** Test arguments */ typedef struct { - int cpu_count; /**< CPU count */ + unsigned int cpu_count; /**< CPU count */ odp_schedule_sync_t sync_type; /**< Scheduler sync type */ struct { int queues; /**< Number of scheduling queues */ @@ -265,7 +265,7 @@ static void print_results(test_globals_t *globals) test_stat_t total; test_args_t *args; uint64_t avg; - int i, j; + unsigned int i, j;
args = &globals->args; stype = globals->args.sync_type; @@ -500,7 +500,7 @@ static void usage(void) "\n" "Usage: ./odp_sched_latency [options]\n" "Optional OPTIONS:\n" - " -c, --count <number> CPU count\n" + " -c, --count <number> CPU count, 0=all available, default=1\n" " -l, --lo-prio-queues <number> Number of low priority scheduled queues\n" " -t, --hi-prio-queues <number> Number of high priority scheduled queues\n" " -m, --lo-prio-events-per-queue <number> Number of events per low priority queue\n" @@ -552,6 +552,7 @@ static void parse_args(int argc, char *argv[], test_args_t *args) /* Let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ args->cpu_count = 1; args->sync_type = ODP_SCHED_SYNC_PARALLEL; args->sample_per_prio = SAMPLE_EVENT_PER_PRIO; args->prio[LO_PRIO].queues = LO_PRIO_QUEUES; diff --git a/test/performance/odp_scheduling.c b/test/performance/odp_scheduling.c index d2fbf894..3b75f635 100644 --- a/test/performance/odp_scheduling.c +++ b/test/performance/odp_scheduling.c @@ -51,7 +51,7 @@ typedef struct {
/** Test arguments */ typedef struct { - int cpu_count; /**< CPU count */ + unsigned int cpu_count; /**< CPU count */ int fairness; /**< Check fairness */ } test_args_t;
@@ -735,7 +735,7 @@ static void print_usage(void) { printf("\n\nUsage: ./odp_example [options]\n"); printf("Options:\n"); - printf(" -c, --count <number> CPU count, 0=all available, default=0\n"); + printf(" -c, --count <number> CPU count, 0=all available, default=1\n"); printf(" -h, --help this help\n"); printf(" -f, --fair collect fairness statistics\n"); printf("\n\n"); @@ -765,6 +765,8 @@ static void parse_args(int argc, char *argv[], test_args_t *args) /* let helper collect its own arguments (e.g. --odph_proc) */ argc = odph_parse_options(argc, argv);
+ args->cpu_count = 1; /* use one worker by default */ + while (1) { opt = getopt_long(argc, argv, shortopts, longopts, &long_index);
-----------------------------------------------------------------------
Summary of changes: example/classifier/odp_classifier.c | 12 ++++++------ example/generator/odp_generator.c | 22 +++++++++++++++------- example/ipsec/odp_ipsec.c | 11 ++++++----- example/ipsec_api/odp_ipsec.c | 12 +++++++----- example/ipsec_offload/odp_ipsec_offload.c | 11 ++++++----- example/l3fwd/odp_l3fwd.c | 23 +++++++++++++---------- example/packet/odp_pktio.c | 10 +++++----- example/switch/odp_switch.c | 10 +++++----- example/timer/odp_timer_test.c | 13 ++++++------- test/performance/odp_l2fwd.c | 10 +++++----- test/performance/odp_pktio_ordered.c | 16 +++++----------- test/performance/odp_pktio_perf.c | 9 ++++----- test/performance/odp_sched_latency.c | 7 ++++--- test/performance/odp_scheduling.c | 6 ++++-- 14 files changed, 91 insertions(+), 81 deletions(-)
hooks/post-receive