Skip to content

Commit

Permalink
RDMA/nldev: Connect QP number to .doit callback
Browse files Browse the repository at this point in the history
This patch adds ability to query specific QP based on its LQPN (local
QPN), which is assigned by HW and needs special treatment while inserting
into restrack DB.

Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
  • Loading branch information
Leon Romanovsky authored and Jason Gunthorpe committed Feb 19, 2019
1 parent c3d0278 commit 1b8b778
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions drivers/infiniband/core/nldev.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ static const struct nldev_fill_res_entry fill_entries[RDMA_RESTRACK_MAX] = {
.nldev_cmd = RDMA_NLDEV_CMD_RES_QP_GET,
.nldev_attr = RDMA_NLDEV_ATTR_RES_QP,
.entry = RDMA_NLDEV_ATTR_RES_QP_ENTRY,
.id = RDMA_NLDEV_ATTR_RES_LQPN,
},
[RDMA_RESTRACK_CM_ID] = {
.fill_res_func = fill_res_cm_id_entry,
Expand Down
11 changes: 10 additions & 1 deletion drivers/infiniband/core/restrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,16 @@ static void rdma_restrack_add(struct rdma_restrack_entry *res)

kref_init(&res->kref);
init_completion(&res->comp);
ret = rt_xa_alloc_cyclic(&rt->xa, &res->id, res, &rt->next_id);
if (res->type != RDMA_RESTRACK_QP)
ret = rt_xa_alloc_cyclic(&rt->xa, &res->id, res, &rt->next_id);
else {
/* Special case to ensure that LQPN points to right QP */
struct ib_qp *qp = container_of(res, struct ib_qp, res);

ret = xa_insert(&rt->xa, qp->qp_num, res, GFP_KERNEL);
res->id = ret ? 0 : qp->qp_num;
}

if (!ret)
res->valid = true;
}
Expand Down

0 comments on commit 1b8b778

Please sign in to comment.