eal: set affinity for control threads
[dpdk.git] / lib / librte_eal / common / include / rte_tailq.h
index 4a686e6..3aae098 100644 (file)
@@ -107,7 +107,7 @@ struct rte_tailq_elem {
        RTE_TAILQ_CAST(rte_eal_tailq_lookup(name), struct_name)
 
 /**
- * Dump tail queues to the console.
+ * Dump tail queues to a file.
  *
  * @param f
  *   A pointer to a file for output
@@ -148,13 +148,21 @@ struct rte_tailq_head *rte_eal_tailq_lookup(const char *name);
 int rte_eal_tailq_register(struct rte_tailq_elem *t);
 
 #define EAL_REGISTER_TAILQ(t) \
-void tailqinitfn_ ##t(void); \
-void __attribute__((constructor, used)) tailqinitfn_ ##t(void) \
+RTE_INIT(tailqinitfn_ ##t); \
+static void tailqinitfn_ ##t(void) \
 { \
        if (rte_eal_tailq_register(&t) < 0) \
                rte_panic("Cannot initialize tailq: %s\n", t.name); \
 }
 
+/* This macro permits both remove and free var within the loop safely.*/
+#ifndef TAILQ_FOREACH_SAFE
+#define TAILQ_FOREACH_SAFE(var, head, field, tvar)             \
+       for ((var) = TAILQ_FIRST((head));                       \
+           (var) && ((tvar) = TAILQ_NEXT((var), field), 1);    \
+           (var) = (tvar))
+#endif
+
 #ifdef __cplusplus
 }
 #endif