summaryrefslogtreecommitdiff
path: root/drivers/infiniband/core/restrack.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/restrack.c')
-rw-r--r--drivers/infiniband/core/restrack.c25
1 files changed, 2 insertions, 23 deletions
diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c
index fa804093fafb..3b5ff2f7b5f8 100644
--- a/drivers/infiniband/core/restrack.c
+++ b/drivers/infiniband/core/restrack.c
@@ -13,28 +13,6 @@
#include "cma_priv.h"
#include "restrack.h"
-static int rt_xa_alloc_cyclic(struct xarray *xa, u32 *id, void *entry,
- u32 *next)
-{
- int err;
-
- *id = *next;
- if (*next == U32_MAX)
- *id = 0;
-
- xa_lock(xa);
- err = __xa_alloc(xa, id, U32_MAX, entry, GFP_KERNEL);
- if (err && *next != U32_MAX) {
- *id = 0;
- err = __xa_alloc(xa, id, *next, entry, GFP_KERNEL);
- }
-
- if (!err)
- *next = *id + 1;
- xa_unlock(xa);
- return err;
-}
-
/**
* rdma_restrack_init() - initialize and allocate resource tracking
* @dev: IB device
@@ -226,7 +204,8 @@ static void rdma_restrack_add(struct rdma_restrack_entry *res)
kref_init(&res->kref);
init_completion(&res->comp);
if (res->type != RDMA_RESTRACK_QP)
- ret = rt_xa_alloc_cyclic(&rt->xa, &res->id, res, &rt->next_id);
+ ret = xa_alloc_cyclic(&rt->xa, &res->id, res, xa_limit_32b,
+ &rt->next_id, GFP_KERNEL);
else {
/* Special case to ensure that LQPN points to right QP */
struct ib_qp *qp = container_of(res, struct ib_qp, res);