xref: /dpdk/app/test-eventdev/evt_options.c (revision 2df20a1d345a5fc0a1b6dc0317d11fc7b1fda7e7)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2017 Cavium, Inc
3  */
4 
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <inttypes.h>
9 #include <getopt.h>
10 
11 #include <rte_string_fns.h>
12 #include <rte_common.h>
13 #include <rte_eventdev.h>
14 #include <rte_lcore.h>
15 
16 #include "evt_options.h"
17 #include "evt_test.h"
18 #include "parser.h"
19 
20 void
21 evt_options_default(struct evt_options *opt)
22 {
23 	memset(opt, 0, sizeof(*opt));
24 	opt->verbose_level = 1; /* Enable minimal prints */
25 	opt->dev_id = 0;
26 	strncpy(opt->test_name, "order_queue", EVT_TEST_NAME_MAX_LEN);
27 	opt->nb_flows = 1024;
28 	opt->socket_id = SOCKET_ID_ANY;
29 	opt->pool_sz = 16 * 1024;
30 	opt->prod_enq_burst_sz = 0;
31 	opt->wkr_deq_dep = 16;
32 	opt->nb_pkts = (1ULL << 26); /* do ~64M packets */
33 	opt->nb_timers = 1E8;
34 	opt->nb_timer_adptrs = 1;
35 	opt->timer_tick_nsec = 1E3; /* 1000ns ~ 1us */
36 	opt->max_tmo_nsec = 1E5;  /* 100000ns ~100us */
37 	opt->expiry_nsec = 1E4;   /* 10000ns ~10us */
38 	opt->prod_type = EVT_PROD_TYPE_SYNT;
39 	opt->eth_queues = 1;
40 	opt->vector_size = 64;
41 	opt->vector_tmo_nsec = 100E3;
42 	opt->crypto_op_type = RTE_CRYPTO_OP_TYPE_SYMMETRIC;
43 	opt->crypto_cipher_alg = RTE_CRYPTO_CIPHER_NULL;
44 	opt->crypto_cipher_key_sz = 0;
45 }
46 
47 typedef int (*option_parser_t)(struct evt_options *opt,
48 		const char *arg);
49 
50 struct long_opt_parser {
51 	const char *lgopt_name;
52 	option_parser_t parser_fn;
53 };
54 
55 static int
56 evt_parse_nb_flows(struct evt_options *opt, const char *arg)
57 {
58 	int ret;
59 
60 	ret = parser_read_uint32(&(opt->nb_flows), arg);
61 
62 	return ret;
63 }
64 
65 static int
66 evt_parse_dev_id(struct evt_options *opt, const char *arg)
67 {
68 	int ret;
69 
70 	ret = parser_read_uint8(&(opt->dev_id), arg);
71 
72 	return ret;
73 }
74 
75 static int
76 evt_parse_verbose(struct evt_options *opt, const char *arg __rte_unused)
77 {
78 	opt->verbose_level = atoi(arg);
79 	return 0;
80 }
81 
82 static int
83 evt_parse_fwd_latency(struct evt_options *opt, const char *arg __rte_unused)
84 {
85 	opt->fwd_latency = 1;
86 	return 0;
87 }
88 
89 static int
90 evt_parse_queue_priority(struct evt_options *opt, const char *arg __rte_unused)
91 {
92 	opt->q_priority = 1;
93 	return 0;
94 }
95 
96 static int
97 evt_parse_deq_tmo_nsec(struct evt_options *opt, const char *arg)
98 {
99 	int ret;
100 
101 	ret = parser_read_uint32(&(opt->deq_tmo_nsec), arg);
102 
103 	return ret;
104 }
105 
106 static int
107 evt_parse_eth_prod_type(struct evt_options *opt, const char *arg __rte_unused)
108 {
109 	opt->prod_type = EVT_PROD_TYPE_ETH_RX_ADPTR;
110 	return 0;
111 }
112 
113 static int
114 evt_parse_tx_first(struct evt_options *opt, const char *arg __rte_unused)
115 {
116 	int ret;
117 
118 	ret = parser_read_uint32(&(opt->tx_first), arg);
119 
120 	return ret;
121 }
122 
123 static int
124 evt_parse_tx_pkt_sz(struct evt_options *opt, const char *arg __rte_unused)
125 {
126 	int ret;
127 
128 	ret = parser_read_uint16(&(opt->tx_pkt_sz), arg);
129 
130 	return ret;
131 }
132 
133 static int
134 evt_parse_timer_prod_type(struct evt_options *opt, const char *arg __rte_unused)
135 {
136 	opt->prod_type = EVT_PROD_TYPE_EVENT_TIMER_ADPTR;
137 	return 0;
138 }
139 
140 static int
141 evt_parse_timer_prod_type_burst(struct evt_options *opt,
142 		const char *arg __rte_unused)
143 {
144 	opt->prod_type = EVT_PROD_TYPE_EVENT_TIMER_ADPTR;
145 	opt->timdev_use_burst = 1;
146 	return 0;
147 }
148 
149 static int
150 evt_parse_crypto_prod_type(struct evt_options *opt,
151 			   const char *arg __rte_unused)
152 {
153 	opt->prod_type = EVT_PROD_TYPE_EVENT_CRYPTO_ADPTR;
154 	return 0;
155 }
156 
157 static int
158 evt_parse_crypto_adptr_mode(struct evt_options *opt, const char *arg)
159 {
160 	uint8_t mode;
161 	int ret;
162 
163 	ret = parser_read_uint8(&mode, arg);
164 	opt->crypto_adptr_mode = mode ? RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD :
165 					RTE_EVENT_CRYPTO_ADAPTER_OP_NEW;
166 	return ret;
167 }
168 
169 static int
170 evt_parse_crypto_op_type(struct evt_options *opt, const char *arg)
171 {
172 	uint8_t op_type;
173 	int ret;
174 
175 	ret = parser_read_uint8(&op_type, arg);
176 	opt->crypto_op_type = op_type ? RTE_CRYPTO_OP_TYPE_ASYMMETRIC :
177 					RTE_CRYPTO_OP_TYPE_SYMMETRIC;
178 	return ret;
179 }
180 
181 static bool
182 cipher_alg_is_bit_mode(enum rte_crypto_cipher_algorithm alg)
183 {
184 	return (alg == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 ||
185 		alg == RTE_CRYPTO_CIPHER_ZUC_EEA3 ||
186 		alg == RTE_CRYPTO_CIPHER_KASUMI_F8);
187 }
188 
189 static int
190 evt_parse_crypto_cipher_alg(struct evt_options *opt, const char *arg)
191 {
192 	enum rte_crypto_cipher_algorithm cipher_alg;
193 
194 	if (rte_cryptodev_get_cipher_algo_enum(&cipher_alg, arg) < 0) {
195 		RTE_LOG(ERR, USER1, "Invalid cipher algorithm specified\n");
196 		return -1;
197 	}
198 
199 	opt->crypto_cipher_alg = cipher_alg;
200 	opt->crypto_cipher_bit_mode = cipher_alg_is_bit_mode(cipher_alg);
201 
202 	return 0;
203 }
204 
205 static int
206 evt_parse_crypto_cipher_key(struct evt_options *opt, const char *arg)
207 {
208 	opt->crypto_cipher_key_sz = EVT_CRYPTO_MAX_KEY_SIZE;
209 	if (parse_hex_string(arg, opt->crypto_cipher_key,
210 			     (uint32_t *)&opt->crypto_cipher_key_sz)) {
211 		RTE_LOG(ERR, USER1, "Invalid cipher key specified\n");
212 		return -1;
213 	}
214 
215 	return 0;
216 }
217 
218 static int
219 evt_parse_crypto_cipher_iv_sz(struct evt_options *opt, const char *arg)
220 {
221 	uint16_t iv_sz;
222 	int ret;
223 
224 	ret = parser_read_uint16(&(iv_sz), arg);
225 	if (iv_sz > EVT_CRYPTO_MAX_IV_SIZE) {
226 		RTE_LOG(ERR, USER1,
227 			"Unsupported cipher IV length [%d] specified\n",
228 			iv_sz);
229 		return -1;
230 	}
231 
232 	opt->crypto_cipher_iv_sz = iv_sz;
233 	return ret;
234 }
235 
236 static int
237 evt_parse_test_name(struct evt_options *opt, const char *arg)
238 {
239 	strlcpy(opt->test_name, arg, EVT_TEST_NAME_MAX_LEN);
240 	return 0;
241 }
242 
243 static int
244 evt_parse_socket_id(struct evt_options *opt, const char *arg)
245 {
246 	opt->socket_id = atoi(arg);
247 	return 0;
248 }
249 
250 static int
251 evt_parse_wkr_deq_dep(struct evt_options *opt, const char *arg)
252 {
253 	int ret;
254 
255 	ret = parser_read_uint16(&(opt->wkr_deq_dep), arg);
256 	return ret;
257 }
258 
259 static int
260 evt_parse_nb_pkts(struct evt_options *opt, const char *arg)
261 {
262 	int ret;
263 
264 	ret = parser_read_uint64(&(opt->nb_pkts), arg);
265 
266 	return ret;
267 }
268 
269 static int
270 evt_parse_nb_timers(struct evt_options *opt, const char *arg)
271 {
272 	int ret;
273 
274 	ret = parser_read_uint64(&(opt->nb_timers), arg);
275 
276 	return ret;
277 }
278 
279 static int
280 evt_parse_timer_tick_nsec(struct evt_options *opt, const char *arg)
281 {
282 	int ret;
283 
284 	ret = parser_read_uint64(&(opt->timer_tick_nsec), arg);
285 
286 	return ret;
287 }
288 
289 static int
290 evt_parse_max_tmo_nsec(struct evt_options *opt, const char *arg)
291 {
292 	int ret;
293 
294 	ret = parser_read_uint64(&(opt->max_tmo_nsec), arg);
295 
296 	return ret;
297 }
298 
299 static int
300 evt_parse_expiry_nsec(struct evt_options *opt, const char *arg)
301 {
302 	int ret;
303 
304 	ret = parser_read_uint64(&(opt->expiry_nsec), arg);
305 
306 	return ret;
307 }
308 
309 static int
310 evt_parse_nb_timer_adptrs(struct evt_options *opt, const char *arg)
311 {
312 	int ret;
313 
314 	ret = parser_read_uint8(&(opt->nb_timer_adptrs), arg);
315 	if (opt->nb_timer_adptrs <= 0) {
316 		evt_err("Number of timer adapters cannot be <= 0");
317 		return -EINVAL;
318 	}
319 
320 	return ret;
321 }
322 
323 static int
324 evt_parse_pool_sz(struct evt_options *opt, const char *arg)
325 {
326 	opt->pool_sz = atoi(arg);
327 
328 	return 0;
329 }
330 
331 static int
332 evt_parse_plcores(struct evt_options *opt, const char *corelist)
333 {
334 	int ret;
335 
336 	ret = parse_lcores_list(opt->plcores, RTE_MAX_LCORE, corelist);
337 	if (ret == -E2BIG)
338 		evt_err("duplicate lcores in plcores");
339 
340 	return ret;
341 }
342 
343 static int
344 evt_parse_work_lcores(struct evt_options *opt, const char *corelist)
345 {
346 	int ret;
347 
348 	ret = parse_lcores_list(opt->wlcores, RTE_MAX_LCORE, corelist);
349 	if (ret == -E2BIG)
350 		evt_err("duplicate lcores in wlcores");
351 
352 	return ret;
353 }
354 
355 static int
356 evt_parse_mbuf_sz(struct evt_options *opt, const char *arg)
357 {
358 	int ret;
359 
360 	ret = parser_read_uint16(&(opt->mbuf_sz), arg);
361 
362 	return ret;
363 }
364 
365 static int
366 evt_parse_max_pkt_sz(struct evt_options *opt, const char *arg)
367 {
368 	int ret;
369 
370 	ret = parser_read_uint32(&(opt->max_pkt_sz), arg);
371 
372 	return ret;
373 }
374 
375 static int
376 evt_parse_ena_vector(struct evt_options *opt, const char *arg __rte_unused)
377 {
378 	opt->ena_vector = 1;
379 	return 0;
380 }
381 
382 static int
383 evt_parse_vector_size(struct evt_options *opt, const char *arg)
384 {
385 	int ret;
386 
387 	ret = parser_read_uint16(&(opt->vector_size), arg);
388 
389 	return ret;
390 }
391 
392 static int
393 evt_parse_vector_tmo_ns(struct evt_options *opt, const char *arg)
394 {
395 	int ret;
396 
397 	ret = parser_read_uint64(&(opt->vector_tmo_nsec), arg);
398 
399 	return ret;
400 }
401 
402 static int
403 evt_parse_eth_queues(struct evt_options *opt, const char *arg)
404 {
405 	int ret;
406 
407 	ret = parser_read_uint16(&(opt->eth_queues), arg);
408 
409 	return ret;
410 }
411 
412 static int
413 evt_parse_per_port_pool(struct evt_options *opt, const char *arg __rte_unused)
414 {
415 	opt->per_port_pool = 1;
416 	return 0;
417 }
418 
419 static int
420 evt_parse_prod_enq_burst_sz(struct evt_options *opt, const char *arg)
421 {
422 	int ret;
423 
424 	ret = parser_read_uint32(&(opt->prod_enq_burst_sz), arg);
425 
426 	return ret;
427 }
428 
429 static void
430 usage(char *program)
431 {
432 	printf("usage : %s [EAL options] -- [application options]\n", program);
433 	printf("application options:\n");
434 	printf("\t--verbose          : verbose level\n"
435 		"\t--dev              : device id of the event device\n"
436 		"\t--test             : name of the test application to run\n"
437 		"\t--socket_id        : socket_id of application resources\n"
438 		"\t--pool_sz          : pool size of the mempool\n"
439 		"\t--plcores          : list of lcore ids for producers\n"
440 		"\t--wlcores          : list of lcore ids for workers\n"
441 		"\t--stlist           : list of scheduled types of the stages\n"
442 		"\t--nb_flows         : number of flows to produce\n"
443 		"\t--nb_pkts          : number of packets to produce\n"
444 		"\t--worker_deq_depth : dequeue depth of the worker\n"
445 		"\t--fwd_latency      : perform fwd_latency measurement\n"
446 		"\t--queue_priority   : enable queue priority\n"
447 		"\t--deq_tmo_nsec     : global dequeue timeout\n"
448 		"\t--prod_type_ethdev : use ethernet device as producer.\n"
449 		"\t--prod_type_cryptodev : use crypto device as producer.\n"
450 		"\t--prod_type_timerdev : use event timer device as producer.\n"
451 		"\t                     expiry_nsec would be the timeout\n"
452 		"\t                     in ns.\n"
453 		"\t--prod_type_timerdev_burst : use timer device as producer\n"
454 		"\t                             burst mode.\n"
455 		"\t--nb_timers        : number of timers to arm.\n"
456 		"\t--nb_timer_adptrs  : number of timer adapters to use.\n"
457 		"\t--timer_tick_nsec  : timer tick interval in ns.\n"
458 		"\t--max_tmo_nsec     : max timeout interval in ns.\n"
459 		"\t--expiry_nsec      : event timer expiry ns.\n"
460 		"\t--crypto_adptr_mode : 0 for OP_NEW mode (default) and\n"
461 		"\t                      1 for OP_FORWARD mode.\n"
462 		"\t--crypto_op_type   : 0 for SYM ops (default) and\n"
463 		"\t                     1 for ASYM ops.\n"
464 		"\t--crypto_cipher_alg : cipher algorithm to be used\n"
465 		"\t                      default algorithm is NULL.\n"
466 		"\t--crypto_cipher_key : key for the cipher algorithm selected\n"
467 		"\t--crypto_cipher_iv_sz : IV size for the cipher algorithm\n"
468 		"\t                        selected\n"
469 		"\t--mbuf_sz          : packet mbuf size.\n"
470 		"\t--max_pkt_sz       : max packet size.\n"
471 		"\t--prod_enq_burst_sz : producer enqueue burst size.\n"
472 		"\t--nb_eth_queues    : number of ethernet Rx queues.\n"
473 		"\t--enable_vector    : enable event vectorization.\n"
474 		"\t--vector_size      : Max vector size.\n"
475 		"\t--vector_tmo_ns    : Max vector timeout in nanoseconds\n"
476 		"\t--per_port_pool    : Configure unique pool per ethdev port\n"
477 		"\t--tx_first         : Transmit given number of packets\n"
478 		"                       across all the ethernet devices before\n"
479 		"                       event workers start.\n"
480 		"\t--tx_pkt_sz        : Packet size to use with Tx first."
481 		);
482 	printf("available tests:\n");
483 	evt_test_dump_names();
484 }
485 
486 static int
487 evt_parse_sched_type_list(struct evt_options *opt, const char *arg)
488 {
489 	char c;
490 	int i = 0, j = -1;
491 
492 	for (i = 0; i < EVT_MAX_STAGES; i++)
493 		opt->sched_type_list[i] = (uint8_t)-1;
494 
495 	i = 0;
496 
497 	do {
498 		c = arg[++j];
499 
500 		switch (c) {
501 		case 'o':
502 		case 'O':
503 			opt->sched_type_list[i++] = RTE_SCHED_TYPE_ORDERED;
504 			break;
505 		case 'a':
506 		case 'A':
507 			opt->sched_type_list[i++] = RTE_SCHED_TYPE_ATOMIC;
508 			break;
509 		case 'p':
510 		case 'P':
511 			opt->sched_type_list[i++] = RTE_SCHED_TYPE_PARALLEL;
512 			break;
513 		case ',':
514 			break;
515 		default:
516 			if (c != '\0') {
517 				evt_err("invalid sched_type %c", c);
518 				return -EINVAL;
519 			}
520 		}
521 	} while (c != '\0');
522 
523 	opt->nb_stages = i;
524 	return 0;
525 }
526 
527 static struct option lgopts[] = {
528 	{ EVT_NB_FLOWS,            1, 0, 0 },
529 	{ EVT_DEVICE,              1, 0, 0 },
530 	{ EVT_VERBOSE,             1, 0, 0 },
531 	{ EVT_TEST,                1, 0, 0 },
532 	{ EVT_PROD_LCORES,         1, 0, 0 },
533 	{ EVT_WORK_LCORES,         1, 0, 0 },
534 	{ EVT_SOCKET_ID,           1, 0, 0 },
535 	{ EVT_POOL_SZ,             1, 0, 0 },
536 	{ EVT_NB_PKTS,             1, 0, 0 },
537 	{ EVT_WKR_DEQ_DEP,         1, 0, 0 },
538 	{ EVT_SCHED_TYPE_LIST,     1, 0, 0 },
539 	{ EVT_FWD_LATENCY,         0, 0, 0 },
540 	{ EVT_QUEUE_PRIORITY,      0, 0, 0 },
541 	{ EVT_DEQ_TMO_NSEC,        1, 0, 0 },
542 	{ EVT_PROD_ETHDEV,         0, 0, 0 },
543 	{ EVT_PROD_CRYPTODEV,      0, 0, 0 },
544 	{ EVT_PROD_TIMERDEV,       0, 0, 0 },
545 	{ EVT_PROD_TIMERDEV_BURST, 0, 0, 0 },
546 	{ EVT_CRYPTO_ADPTR_MODE,   1, 0, 0 },
547 	{ EVT_CRYPTO_OP_TYPE,	   1, 0, 0 },
548 	{ EVT_CRYPTO_CIPHER_ALG,   1, 0, 0 },
549 	{ EVT_CRYPTO_CIPHER_KEY,   1, 0, 0 },
550 	{ EVT_CRYPTO_CIPHER_IV_SZ, 1, 0, 0 },
551 	{ EVT_NB_TIMERS,           1, 0, 0 },
552 	{ EVT_NB_TIMER_ADPTRS,     1, 0, 0 },
553 	{ EVT_TIMER_TICK_NSEC,     1, 0, 0 },
554 	{ EVT_MAX_TMO_NSEC,        1, 0, 0 },
555 	{ EVT_EXPIRY_NSEC,         1, 0, 0 },
556 	{ EVT_MBUF_SZ,             1, 0, 0 },
557 	{ EVT_MAX_PKT_SZ,          1, 0, 0 },
558 	{ EVT_PROD_ENQ_BURST_SZ,   1, 0, 0 },
559 	{ EVT_NB_ETH_QUEUES,       1, 0, 0 },
560 	{ EVT_ENA_VECTOR,          0, 0, 0 },
561 	{ EVT_VECTOR_SZ,           1, 0, 0 },
562 	{ EVT_VECTOR_TMO,          1, 0, 0 },
563 	{ EVT_PER_PORT_POOL,       0, 0, 0 },
564 	{ EVT_HELP,                0, 0, 0 },
565 	{ EVT_TX_FIRST,            1, 0, 0 },
566 	{ EVT_TX_PKT_SZ,           1, 0, 0 },
567 	{ NULL,                    0, 0, 0 }
568 };
569 
570 static int
571 evt_opts_parse_long(int opt_idx, struct evt_options *opt)
572 {
573 	unsigned int i;
574 
575 	struct long_opt_parser parsermap[] = {
576 		{ EVT_NB_FLOWS, evt_parse_nb_flows},
577 		{ EVT_DEVICE, evt_parse_dev_id},
578 		{ EVT_VERBOSE, evt_parse_verbose},
579 		{ EVT_TEST, evt_parse_test_name},
580 		{ EVT_PROD_LCORES, evt_parse_plcores},
581 		{ EVT_WORK_LCORES, evt_parse_work_lcores},
582 		{ EVT_SOCKET_ID, evt_parse_socket_id},
583 		{ EVT_POOL_SZ, evt_parse_pool_sz},
584 		{ EVT_NB_PKTS, evt_parse_nb_pkts},
585 		{ EVT_WKR_DEQ_DEP, evt_parse_wkr_deq_dep},
586 		{ EVT_SCHED_TYPE_LIST, evt_parse_sched_type_list},
587 		{ EVT_FWD_LATENCY, evt_parse_fwd_latency},
588 		{ EVT_QUEUE_PRIORITY, evt_parse_queue_priority},
589 		{ EVT_DEQ_TMO_NSEC, evt_parse_deq_tmo_nsec},
590 		{ EVT_PROD_ETHDEV, evt_parse_eth_prod_type},
591 		{ EVT_PROD_CRYPTODEV, evt_parse_crypto_prod_type},
592 		{ EVT_PROD_TIMERDEV, evt_parse_timer_prod_type},
593 		{ EVT_PROD_TIMERDEV_BURST, evt_parse_timer_prod_type_burst},
594 		{ EVT_CRYPTO_ADPTR_MODE, evt_parse_crypto_adptr_mode},
595 		{ EVT_CRYPTO_OP_TYPE, evt_parse_crypto_op_type},
596 		{ EVT_CRYPTO_CIPHER_ALG, evt_parse_crypto_cipher_alg},
597 		{ EVT_CRYPTO_CIPHER_KEY, evt_parse_crypto_cipher_key},
598 		{ EVT_CRYPTO_CIPHER_IV_SZ, evt_parse_crypto_cipher_iv_sz},
599 		{ EVT_NB_TIMERS, evt_parse_nb_timers},
600 		{ EVT_NB_TIMER_ADPTRS, evt_parse_nb_timer_adptrs},
601 		{ EVT_TIMER_TICK_NSEC, evt_parse_timer_tick_nsec},
602 		{ EVT_MAX_TMO_NSEC, evt_parse_max_tmo_nsec},
603 		{ EVT_EXPIRY_NSEC, evt_parse_expiry_nsec},
604 		{ EVT_MBUF_SZ, evt_parse_mbuf_sz},
605 		{ EVT_MAX_PKT_SZ, evt_parse_max_pkt_sz},
606 		{ EVT_PROD_ENQ_BURST_SZ, evt_parse_prod_enq_burst_sz},
607 		{ EVT_NB_ETH_QUEUES, evt_parse_eth_queues},
608 		{ EVT_ENA_VECTOR, evt_parse_ena_vector},
609 		{ EVT_VECTOR_SZ, evt_parse_vector_size},
610 		{ EVT_VECTOR_TMO, evt_parse_vector_tmo_ns},
611 		{ EVT_PER_PORT_POOL, evt_parse_per_port_pool},
612 		{ EVT_TX_FIRST, evt_parse_tx_first},
613 		{ EVT_TX_PKT_SZ, evt_parse_tx_pkt_sz},
614 	};
615 
616 	for (i = 0; i < RTE_DIM(parsermap); i++) {
617 		if (strncmp(lgopts[opt_idx].name, parsermap[i].lgopt_name,
618 				strlen(lgopts[opt_idx].name)) == 0)
619 			return parsermap[i].parser_fn(opt, optarg);
620 	}
621 
622 	return -EINVAL;
623 }
624 
625 int
626 evt_options_parse(struct evt_options *opt, int argc, char **argv)
627 {
628 	int opts, retval, opt_idx;
629 
630 	while ((opts = getopt_long(argc, argv, "", lgopts, &opt_idx)) != EOF) {
631 		switch (opts) {
632 		case 0: /* long options */
633 			if (!strcmp(lgopts[opt_idx].name, "help")) {
634 				usage(argv[0]);
635 				exit(EXIT_SUCCESS);
636 			}
637 
638 			retval = evt_opts_parse_long(opt_idx, opt);
639 			if (retval != 0)
640 				return retval;
641 			break;
642 		default:
643 			return -EINVAL;
644 		}
645 	}
646 	return 0;
647 }
648 
649 void
650 evt_options_dump(struct evt_options *opt)
651 {
652 	int lcore_id;
653 	struct rte_event_dev_info dev_info;
654 
655 	rte_event_dev_info_get(opt->dev_id, &dev_info);
656 	evt_dump("driver", "%s", dev_info.driver_name);
657 	evt_dump("test", "%s", opt->test_name);
658 	evt_dump("dev", "%d", opt->dev_id);
659 	evt_dump("verbose_level", "%d", opt->verbose_level);
660 	evt_dump("socket_id", "%d", opt->socket_id);
661 	evt_dump("pool_sz", "%d", opt->pool_sz);
662 	evt_dump("main lcore", "%d", rte_get_main_lcore());
663 	evt_dump("nb_pkts", "%"PRIu64, opt->nb_pkts);
664 	evt_dump("nb_timers", "%"PRIu64, opt->nb_timers);
665 	evt_dump_begin("available lcores");
666 	RTE_LCORE_FOREACH(lcore_id)
667 		printf("%d ", lcore_id);
668 	evt_dump_end;
669 	evt_dump_nb_flows(opt);
670 	evt_dump_worker_dequeue_depth(opt);
671 }
672