summaryrefslogtreecommitdiff
path: root/drivers/infiniband/sw/rxe/rxe_pool.h
diff options
context:
space:
mode:
authorBob Pearson <rpearsonhpe@gmail.com>2020-12-17 02:15:45 +0300
committerJason Gunthorpe <jgg@nvidia.com>2021-01-12 23:35:38 +0300
commitc06ee3a0147e016b6127eb25432739a4f4b151f5 (patch)
treefc99124621d8e092ba217a5e372349b05db5f955 /drivers/infiniband/sw/rxe/rxe_pool.h
parent1d11c1b7f9ff28196d66d995f11fcf3101301fe9 (diff)
downloadlinux-c06ee3a0147e016b6127eb25432739a4f4b151f5.tar.xz
RDMA/rxe: Let pools support both keys and indices
Allow both indices and keys to exist for objects in pools. Previously you were limited to one or the other. This is required for later implementing rxe memory windows. Link: https://lore.kernel.org/r/20201216231550.27224-3-rpearson@hpe.com Signed-off-by: Bob Pearson <rpearson@hpe.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_pool.h')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_pool.h32
1 files changed, 21 insertions, 11 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_pool.h b/drivers/infiniband/sw/rxe/rxe_pool.h
index 432745ffc8d4..3d722aae5f15 100644
--- a/drivers/infiniband/sw/rxe/rxe_pool.h
+++ b/drivers/infiniband/sw/rxe/rxe_pool.h
@@ -56,8 +56,11 @@ struct rxe_pool_entry {
struct kref ref_cnt;
struct list_head list;
- /* only used if indexed or keyed */
- struct rb_node node;
+ /* only used if keyed */
+ struct rb_node key_node;
+
+ /* only used if indexed */
+ struct rb_node index_node;
u32 index;
};
@@ -74,15 +77,22 @@ struct rxe_pool {
unsigned int max_elem;
atomic_t num_elem;
- /* only used if indexed or keyed */
- struct rb_root tree;
- unsigned long *table;
- size_t table_size;
- u32 max_index;
- u32 min_index;
- u32 last;
- size_t key_offset;
- size_t key_size;
+ /* only used if indexed */
+ struct {
+ struct rb_root tree;
+ unsigned long *table;
+ size_t table_size;
+ u32 last;
+ u32 max_index;
+ u32 min_index;
+ } index;
+
+ /* only used if keyed */
+ struct {
+ struct rb_root tree;
+ size_t key_offset;
+ size_t key_size;
+ } key;
};
/* initialize a pool of objects with given limit on