1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation.
5 #ifndef __INCLUDE_RTE_OPTION_H__
6 #define __INCLUDE_RTE_OPTION_H__
11 * This API offers the ability to register options to the EAL command line and
12 * map those options to functions that will be executed at the end of EAL
13 * initialization. These options will be available as part of the EAL command
14 * line of applications and are dynamically managed.
16 * This is used primarily by DPDK libraries offering command line options.
17 * Currently, this API is limited to registering options without argument.
19 * The register API can be used to resolve circular dependency issues
20 * between EAL and the library. The library uses EAL, but is also initialized
21 * by EAL. Hence, EAL depends on the init function of the library. The API
22 * introduced in rte_option allows us to register the library init with EAL
23 * (passing a function pointer) and avoid the circular dependency.
30 typedef int (*rte_option_cb)(void);
33 * Structure describing an EAL command line option dynamically registered.
35 * Common EAL options are mostly statically defined.
36 * Some libraries need additional options to be dynamically added.
37 * This structure describes such options.
40 TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */
41 const char *name; /**< The option name. */
42 const char *usage; /**< Option summary string. */
43 rte_option_cb cb; /**< Function called when option is used. */
44 int enabled; /**< Set when the option is used. */
49 * @b EXPERIMENTAL: this API may change without prior notice
51 * Register an option to the EAL command line.
52 * When recognized, the associated function will be executed at the end of EAL
55 * The associated structure must be available the whole time this option is
56 * registered (i.e. not stack memory).
59 * Structure describing the option to parse.
62 * 0 on success, <0 otherwise.
66 rte_option_register(struct rte_option *opt);