aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-07-21 19:23:46 -0700
committerFlorin Coras <fcoras@cisco.com>2019-07-26 16:18:50 -0700
commitb0ffbee67bd17f6880a02184d18cd94156f2389e (patch)
treeeab9dd3411306b963d891ad5ea40aaf49cf52139 /src/vppinfra
parent1f42101f2708452301c62ff2e07eaaad3bbcd31a (diff)
session: separate ctrl, new and old events
Type: feature Change-Id: I5e030b23943c012d8191ff657165055d33ec87a2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/llist.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/vppinfra/llist.h b/src/vppinfra/llist.h
index d521a725fc3..25fb95ff66e 100644
--- a/src/vppinfra/llist.h
+++ b/src/vppinfra/llist.h
@@ -52,6 +52,22 @@ typedef struct clib_llist_anchor
*/
#define clib_llist_entry_index(LP,E) ((E) - (LP))
/**
+ * Get prev list entry index
+ *
+ * @param E pool entry
+ * @name list anchor name
+ * @return previous index
+ */
+#define clib_llist_prev_index(E,name) _lprev(E,name)
+/**
+ * Get next list entry index
+ *
+ * @param E pool entry
+ * @name list anchor name
+ * @return next index
+ */
+#define clib_llist_next_index(E,name) _lnext(E,name)
+/**
* Get next pool entry
*
* @param LP linked list pool
@@ -248,6 +264,28 @@ do { \
} \
} while (0)
/**
+ * Walk list starting at head safe
+ *
+ * @param LP linked list pool
+ * @param name list anchor name
+ * @param HI head index
+ * @param EI entry index iterator
+ * @param body code to be executed
+ */
+#define clib_llist_foreach_safe(LP,name,H,E,body) \
+do { \
+ clib_llist_index_t _ll_var (HI) = clib_llist_entry_index (LP, H); \
+ clib_llist_index_t _ll_var (EI), _ll_var (NI); \
+ _ll_var (EI) = _lnext ((H),name); \
+ while (_ll_var (EI) != _ll_var (HI)) \
+ { \
+ (E) = pool_elt_at_index (LP, _ll_var (EI)); \
+ _ll_var (NI) = _lnext ((E),name); \
+ do { body; } while (0); \
+ _ll_var (EI) = _ll_var (NI); \
+ } \
+} while (0)
+/**
* Walk list starting at head in reverse order
*
* @param LP linked list pool