From: Pavan Nikhilesh Date: Wed, 10 Jan 2018 11:10:11 +0000 (+0530) Subject: examples/eventdev: add mempool size configuration X-Git-Tag: spdx-start~170 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=d8b69cbad00096b8f0e4c6af0189105957aedcf0;p=dpdk.git examples/eventdev: add mempool size configuration Add option to configure the mempool size at run time instead of hardcoding it to 16384 * num_ports. Signed-off-by: Pavan Nikhilesh Acked-by: Harry van Haaren --- diff --git a/examples/eventdev_pipeline_sw_pmd/main.c b/examples/eventdev_pipeline_sw_pmd/main.c index 81ba3406cf..2422c18490 100644 --- a/examples/eventdev_pipeline_sw_pmd/main.c +++ b/examples/eventdev_pipeline_sw_pmd/main.c @@ -116,6 +116,7 @@ static struct option long_options[] = { {"sched-mask", required_argument, 0, 'e'}, {"cq-depth", required_argument, 0, 'c'}, {"work-cycles", required_argument, 0, 'W'}, + {"mempool-size", required_argument, 0, 'm'}, {"queue-priority", no_argument, 0, 'P'}, {"parallel", no_argument, 0, 'p'}, {"ordered", no_argument, 0, 'o'}, @@ -145,6 +146,7 @@ usage(void) " -p, --parallel Use parallel scheduling\n" " -q, --quiet Minimize printed output\n" " -a, --use-atq Use all type queues\n" + " -m, --mempool-size=N Dictate the mempool size\n" " -D, --dump Print detailed statistics before exit" "\n"; fprintf(stderr, "%s", usage_str); @@ -165,7 +167,7 @@ parse_app_args(int argc, char **argv) int i; for (;;) { - c = getopt_long(argc, argv, "r:t:e:c:w:n:f:s:paoPqDW:", + c = getopt_long(argc, argv, "r:t:e:c:w:n:f:s:m:paoPqDW:", long_options, &option_index); if (c == -1) break; @@ -225,6 +227,9 @@ parse_app_args(int argc, char **argv) popcnt = __builtin_popcountll(sched_lcore_mask); fdata->sched_single = (popcnt == 1); break; + case 'm': + cdata.num_mbuf = (uint64_t)atol(optarg); + break; default: usage(); } @@ -339,8 +344,11 @@ init_ports(unsigned int num_ports) uint8_t portid; unsigned int i; + if (!cdata.num_mbuf) + cdata.num_mbuf = 16384 * num_ports; + struct rte_mempool *mp = rte_pktmbuf_pool_create("packet_pool", - /* mbufs */ 16384 * num_ports, + /* mbufs */ cdata.num_mbuf, /* cache_size */ 512, /* priv_size*/ 0, /* data_room_size */ RTE_MBUF_DEFAULT_BUF_SIZE, diff --git a/examples/eventdev_pipeline_sw_pmd/pipeline_common.h b/examples/eventdev_pipeline_sw_pmd/pipeline_common.h index 66553038ca..9703396f8d 100644 --- a/examples/eventdev_pipeline_sw_pmd/pipeline_common.h +++ b/examples/eventdev_pipeline_sw_pmd/pipeline_common.h @@ -70,6 +70,7 @@ struct config_data { unsigned int active_cores; unsigned int num_workers; int64_t num_packets; + uint64_t num_mbuf; unsigned int num_fids; int queue_type; int worker_cycles;