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 the EAL command line option being registered.
36 TAILQ_ENTRY(rte_option) next; /**< Next entry in the list. */
37 char *opt_str; /**< The option name. */
38 const char *usage; /**< Option summary string. */
39 rte_option_cb cb; /**< Function called when option is used. */
40 int enabled; /**< Set when the option is used. */
45 * @b EXPERIMENTAL: this API may change without prior notice
47 * Register an option to the EAL command line.
48 * When recognized, the associated function will be executed at the end of EAL
51 * The associated structure must be available the whole time this option is
52 * registered (i.e. not stack memory).
55 * Structure describing the option to parse.
57 void __rte_experimental
58 rte_option_register(struct rte_option *opt);