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 <pbhagavatula@caviumnetworks.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
This commit is contained in:
Pavan Nikhilesh 2018-01-10 16:40:11 +05:30 committed by Jerin Jacob
parent c7fcf3207a
commit d8b69cbad0
2 changed files with 11 additions and 2 deletions

View File

@ -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,

View File

@ -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;