* [dpdk-dev] [PATCH v1 0/2] Global Priorities
@ 2018-04-24 11:28 Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 1/2] eal: list acceptable init priorities Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 2/2] eal: add last init priority Gaetan Rivet
0 siblings, 2 replies; 5+ messages in thread
From: Gaetan Rivet @ 2018-04-24 11:28 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
These patches are extracted from the device querying series [1]
for earlier integration.
[1]: https://dpdk.org/ml/archives/dev/2018-March/092891.html
Gaetan Rivet (2):
eal: list acceptable init priorities
eal: add last init priority
lib/librte_eal/common/eal_common_log.c | 2 +-
lib/librte_eal/common/include/rte_bus.h | 2 +-
lib/librte_eal/common/include/rte_common.h | 29 ++++++++++++++++++-----------
3 files changed, 20 insertions(+), 13 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v1 1/2] eal: list acceptable init priorities
2018-04-24 11:28 [dpdk-dev] [PATCH v1 0/2] Global Priorities Gaetan Rivet
@ 2018-04-24 11:28 ` Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 2/2] eal: add last init priority Gaetan Rivet
1 sibling, 0 replies; 5+ messages in thread
From: Gaetan Rivet @ 2018-04-24 11:28 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
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>
---
lib/librte_eal/common/eal_common_log.c | 2 +-
lib/librte_eal/common/include/rte_bus.h | 2 +-
lib/librte_eal/common/include/rte_common.h | 8 +++++++-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_log.c b/lib/librte_eal/common/eal_common_log.c
index a27192620..36b9d6e08 100644
--- a/lib/librte_eal/common/eal_common_log.c
+++ b/lib/librte_eal/common/eal_common_log.c
@@ -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)
{
diff --git a/lib/librte_eal/common/include/rte_bus.h b/lib/librte_eal/common/include/rte_bus.h
index 6fb08341a..eb9eded4e 100644
--- a/lib/librte_eal/common/include/rte_bus.h
+++ b/lib/librte_eal/common/include/rte_bus.h
@@ -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);\
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 6c5bc5a76..8f04518f7 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -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
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v1 2/2] eal: add last init priority
2018-04-24 11:28 [dpdk-dev] [PATCH v1 0/2] Global Priorities Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 1/2] eal: list acceptable init priorities Gaetan Rivet
@ 2018-04-24 11:28 ` Gaetan Rivet
2018-04-24 11:41 ` Shreyansh Jain
1 sibling, 1 reply; 5+ messages in thread
From: Gaetan Rivet @ 2018-04-24 11:28 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
Add the priority RTE_PRIORITY_LAST, used for initialization routines
meant to be run after all other constructors.
This priority becomes the default priority for all DPDK constructors.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
lib/librte_eal/common/include/rte_common.h | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/lib/librte_eal/common/include/rte_common.h b/lib/librte_eal/common/include/rte_common.h
index 8f04518f7..69e5ed1e3 100644
--- a/lib/librte_eal/common/include/rte_common.h
+++ b/lib/librte_eal/common/include/rte_common.h
@@ -83,22 +83,12 @@ typedef uint16_t unaligned_uint16_t;
#define RTE_PRIORITY_LOG 101
#define RTE_PRIORITY_BUS 110
+#define RTE_PRIORITY_LAST 65535
#define RTE_PRIO(prio) \
RTE_PRIORITY_ ## prio
/**
- * Run function before main() with low priority.
- *
- * The constructor will be run after prioritized constructors.
- *
- * @param func
- * Constructor function.
- */
-#define RTE_INIT(func) \
-static void __attribute__((constructor, used)) func(void)
-
-/**
* Run function before main() with high priority.
*
* @param func
@@ -111,6 +101,17 @@ static void __attribute__((constructor, used)) func(void)
static void __attribute__((constructor(RTE_PRIO(prio)), used)) func(void)
/**
+ * Run function before main() with low priority.
+ *
+ * The constructor will be run after prioritized constructors.
+ *
+ * @param func
+ * Constructor function.
+ */
+#define RTE_INIT(func) \
+ RTE_INIT_PRIO(func, LAST)
+
+/**
* Force a function to be inlined
*/
#define __rte_always_inline inline __attribute__((always_inline))
--
2.11.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v1 2/2] eal: add last init priority
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 2/2] eal: add last init priority Gaetan Rivet
@ 2018-04-24 11:41 ` Shreyansh Jain
2018-04-25 2:10 ` Thomas Monjalon
0 siblings, 1 reply; 5+ messages in thread
From: Shreyansh Jain @ 2018-04-24 11:41 UTC (permalink / raw)
To: Gaetan Rivet, dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Gaetan Rivet
> Sent: Tuesday, April 24, 2018 4:59 PM
> To: dev@dpdk.org
> Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
> Subject: [dpdk-dev] [PATCH v1 2/2] eal: add last init priority
>
> Add the priority RTE_PRIORITY_LAST, used for initialization routines
> meant to be run after all other constructors.
>
> This priority becomes the default priority for all DPDK constructors.
>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
Acked-by: Shreyansh Jain <Shreyansh.jain@nxp.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v1 2/2] eal: add last init priority
2018-04-24 11:41 ` Shreyansh Jain
@ 2018-04-25 2:10 ` Thomas Monjalon
0 siblings, 0 replies; 5+ messages in thread
From: Thomas Monjalon @ 2018-04-25 2:10 UTC (permalink / raw)
To: Gaetan Rivet; +Cc: dev, Shreyansh Jain
> > Add the priority RTE_PRIORITY_LAST, used for initialization routines
> > meant to be run after all other constructors.
> >
> > This priority becomes the default priority for all DPDK constructors.
> >
> > Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> > ---
>
> Acked-by: Shreyansh Jain <Shreyansh.jain@nxp.com>
Applied, thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-25 2:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-24 11:28 [dpdk-dev] [PATCH v1 0/2] Global Priorities Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 1/2] eal: list acceptable init priorities Gaetan Rivet
2018-04-24 11:28 ` [dpdk-dev] [PATCH v1 2/2] eal: add last init priority Gaetan Rivet
2018-04-24 11:41 ` Shreyansh Jain
2018-04-25 2:10 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).