eal: list acceptable init priorities

Build a central list to quickly see each used priorities for
constructors, allowing to verify that they are both above 100 and in the
proper order.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
This commit is contained in:
Gaetan Rivet 2018-04-24 13:28:52 +02:00 committed by Thomas Monjalon
parent b65ecf1993
commit f779053ab3
3 changed files with 9 additions and 3 deletions

View File

@ -260,7 +260,7 @@ static const struct logtype logtype_strings[] = {
};
/* Logging should be first initializer (before drivers and bus) */
RTE_INIT_PRIO(rte_log_init, 101);
RTE_INIT_PRIO(rte_log_init, LOG);
static void
rte_log_init(void)
{

View File

@ -325,7 +325,7 @@ enum rte_iova_mode rte_bus_get_iommu_class(void);
* The constructor has higher priority than PMD constructors.
*/
#define RTE_REGISTER_BUS(nm, bus) \
RTE_INIT_PRIO(businitfn_ ##nm, 110); \
RTE_INIT_PRIO(businitfn_ ##nm, BUS); \
static void businitfn_ ##nm(void) \
{\
(bus).name = RTE_STR(nm);\

View File

@ -81,6 +81,12 @@ typedef uint16_t unaligned_uint16_t;
*/
#define RTE_SET_USED(x) (void)(x)
#define RTE_PRIORITY_LOG 101
#define RTE_PRIORITY_BUS 110
#define RTE_PRIO(prio) \
RTE_PRIORITY_ ## prio
/**
* Run function before main() with low priority.
*
@ -102,7 +108,7 @@ static void __attribute__((constructor, used)) func(void)
* Lowest number is the first to run.
*/
#define RTE_INIT_PRIO(func, prio) \
static void __attribute__((constructor(prio), used)) func(void)
static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void)
/**
* Force a function to be inlined