[dpdk-dev,v1,2/2] eal: add last init priority

Message ID b5af4fc8a3502b080925472d8028e006cdeb43f7.1524569193.git.gaetan.rivet@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Gaëtan Rivet April 24, 2018, 11:28 a.m. UTC
  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(-)
  

Comments

Shreyansh Jain April 24, 2018, 11:41 a.m. UTC | #1
> -----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>
  
Thomas Monjalon April 25, 2018, 2:10 a.m. UTC | #2
> > 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
  

Patch

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))