diff options
author | Florin Coras <fcoras@cisco.com> | 2019-04-19 15:56:00 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2019-04-24 11:31:55 +0000 |
commit | 4375fa312e91ffeef0d34ab0594bda4a8c9189ea (patch) | |
tree | abd9fce225e8bd351f53d36d446fe61ec107dbc2 /src/vppinfra/rbtree.h | |
parent | d35d4232953aa32a27a5a1024377191360441416 (diff) |
svm: fifo ooo reads/writes with multiple chunks
Change-Id: If23a04623a7138c9f6c98ee9ecfa587396618a60
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vppinfra/rbtree.h')
-rw-r--r-- | src/vppinfra/rbtree.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/vppinfra/rbtree.h b/src/vppinfra/rbtree.h index 73180d1d54c..79437cdd719 100644 --- a/src/vppinfra/rbtree.h +++ b/src/vppinfra/rbtree.h @@ -36,7 +36,7 @@ typedef struct rb_node_ rb_node_index_t left; /**< left child index */ rb_node_index_t right; /**< right child index */ u32 key; /**< node key */ - u32 opaque; /**< value stored by node */ + uword opaque; /**< value stored by node */ } rb_node_t; typedef struct rb_tree_ @@ -47,7 +47,7 @@ typedef struct rb_tree_ void rb_tree_init (rb_tree_t * rt); rb_node_index_t rb_tree_add (rb_tree_t * rt, u32 key); -rb_node_index_t rb_tree_add2 (rb_tree_t * rt, u32 key, u32 opaque); +rb_node_index_t rb_tree_add2 (rb_tree_t * rt, u32 key, uword opaque); void rb_tree_del (rb_tree_t * rt, u32 key); void rb_tree_free_nodes (rb_tree_t * rt); u32 rb_tree_n_nodes (rb_tree_t * rt); @@ -75,6 +75,24 @@ rb_node (rb_tree_t * rt, rb_node_index_t ri) return pool_elt_at_index (rt->nodes, ri); } +static inline rb_node_t * +rb_node_right (rb_tree_t * rt, rb_node_t * n) +{ + return pool_elt_at_index (rt->nodes, n->right); +} + +static inline rb_node_t * +rb_node_left (rb_tree_t * rt, rb_node_t * n) +{ + return pool_elt_at_index (rt->nodes, n->left); +} + +static inline rb_node_t * +rb_node_parent (rb_tree_t * rt, rb_node_t * n) +{ + return pool_elt_at_index (rt->nodes, n->parent); +} + #endif /* SRC_VPPINFRA_RBTREE_H_ */ /* |