aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra/llist.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2021-05-17 18:16:44 -0700
committerFlorin Coras <florin.coras@gmail.com>2021-05-19 17:01:16 +0000
commitfa3bd303779957c5af3350b1a51ceb8158e05282 (patch)
tree069d099f6c29b25afd326eda446665fb1631aea7 /src/vppinfra/llist.h
parentb32af35fb9dc1d6139e6a246f53037497eb0c890 (diff)
vppinfra: add more llist macros
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ife79871c6530d2cd485928fee465baf2c8957e11
Diffstat (limited to 'src/vppinfra/llist.h')
-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 25fb95ff66e..42810904963 100644
--- a/src/vppinfra/llist.h
+++ b/src/vppinfra/llist.h
@@ -52,6 +52,44 @@ typedef struct clib_llist_anchor
*/
#define clib_llist_entry_index(LP,E) ((E) - (LP))
/**
+ * Alloc new element
+ *
+ * @param LP linked list pool
+ * @param E element to be returned
+ */
+#define clib_llist_get(LP, E) pool_get (LP, E)
+/**
+ * Free element
+ *
+ * @param LP linked list pool
+ * @param E element to be freed
+ */
+#define clib_llist_put(LP, E) pool_put (LP, E)
+/**
+ * Free list supporting container
+ *
+ * @param LP linked list pool
+ */
+#define clib_llist_free(LP) pool_free (LP)
+/**
+ * Get list elt at index
+ *
+ * @param LP linked list pool
+ * @param EI element index
+ * @return element
+ */
+#define clib_llist_elt(LP, EI) pool_elt_at_index (LP, EI)
+/**
+ * Get number of elements in supporting container
+ *
+ * This is NOT the elements linked in the list but the number of
+ * elements consumed out of the supporting pool
+ *
+ * @param LP linked list pool
+ * @return number of elements
+ */
+#define clib_llist_elts(LP) pool_elts (LP)
+/**
* Get prev list entry index
*
* @param E pool entry