diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-02-18 22:25:48 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-02-19 10:13:38 -0700 |
commit | 7c77c6a9bf9d71711dd3f89858bb0f5157a11919 (patch) | |
tree | 8c7f62c751d056b92cad308589fbb04089a65853 /drivers/infiniband/core/restrack.h | |
parent | RDMA/restrack: Hide restrack DB from IB/core (diff) | |
download | linux-dev-7c77c6a9bf9d71711dd3f89858bb0f5157a11919.tar.xz linux-dev-7c77c6a9bf9d71711dd3f89858bb0f5157a11919.zip |
RDMA/restrack: Prepare restrack_root to addition of extra fields per-type
As a preparation to extension of rdma_restrack_root to provide software
IDs, which will be per-type too. We convert the rdma_restrack_root from
struct with arrays to array of structs.
Such conversion allows us to drop rwsem lock in favour of internal XArray
lock.
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to '')
-rw-r--r-- | drivers/infiniband/core/restrack.h | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/infiniband/core/restrack.h b/drivers/infiniband/core/restrack.h index cf89ef0b8ed5..09a1fbdf578e 100644 --- a/drivers/infiniband/core/restrack.h +++ b/drivers/infiniband/core/restrack.h @@ -7,33 +7,22 @@ #define _RDMA_CORE_RESTRACK_H_ #include <linux/mutex.h> -#include <linux/rwsem.h> /** * struct rdma_restrack_root - main resource tracking management * entity, per-device */ struct rdma_restrack_root { - /* - * @rwsem: Read/write lock to protect erase of entry. - * Lists and insertions are protected by XArray internal lock. - */ - struct rw_semaphore rwsem; /** - * @xa: Array of XArray structures to hold restrack entries. - * We want to use array of XArrays because insertion is type - * dependent. For types with xisiting unique ID (like QPN), - * we will insert to that unique index. For other types, - * we insert based on pointers and auto-allocate unique index. + * @xa: Array of XArray structure to hold restrack entries. */ - struct xarray xa[RDMA_RESTRACK_MAX]; + struct xarray xa; /** * @next_id: Next ID to support cyclic allocation */ - u32 next_id[RDMA_RESTRACK_MAX]; + u32 next_id; }; - int rdma_restrack_init(struct ib_device *dev); void rdma_restrack_clean(struct ib_device *dev); #endif /* _RDMA_CORE_RESTRACK_H_ */ |