forked from DPDK/dpdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
init: defer component init in EAL init
Signed-off-by: David Marchand <[email protected]>
- Loading branch information
1 parent
58aec28
commit decd11c
Showing
5 changed files
with
90 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright (c) 2024 Red Hat, Inc. | ||
|
||
includes += global_inc | ||
sources = files('rte_init.c') | ||
headers = files('rte_init.h') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* SPDX-License-Identifier: BSD-3-Clause | ||
* Copyright (c) 2024 Red Hat, Inc. | ||
*/ | ||
|
||
#include <stdbool.h> | ||
#include <stdlib.h> | ||
|
||
#include <rte_os.h> | ||
|
||
#include <rte_common.h> | ||
#include <rte_init.h> | ||
|
||
static bool init_called; | ||
|
||
static RTE_TAILQ_HEAD(, rte_init) init_list = TAILQ_HEAD_INITIALIZER(init_list); | ||
|
||
void | ||
rte_init_register(struct rte_init *i) | ||
{ | ||
struct rte_init *p; | ||
|
||
/* | ||
* This code has been invoked after rte_eal_init() (common case is with drivers loaded | ||
* as shared libraries). | ||
*/ | ||
if (init_called) { | ||
i->callback(); | ||
return; | ||
} | ||
|
||
TAILQ_FOREACH(p, &init_list, next) { | ||
if (i->priority >= p->priority) | ||
continue; | ||
TAILQ_INSERT_BEFORE(p, i, next); | ||
return; | ||
} | ||
|
||
TAILQ_INSERT_TAIL(&init_list, i, next); | ||
} | ||
|
||
void | ||
eal_init_early(void) | ||
{ | ||
struct rte_init *i; | ||
|
||
init_called = true; | ||
|
||
TAILQ_FOREACH(i, &init_list, next) | ||
i->callback(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
DPDK_25 { | ||
global: | ||
|
||
rte_init_register; | ||
|
||
local: *; | ||
}; | ||
|
||
INTERNAL { | ||
global: | ||
|
||
eal_init_early; | ||
}; |