diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2019-02-18 22:25:51 +0200 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2019-02-19 10:13:39 -0700 |
commit | 1b8b778864b338b2e295687733d785ae1a65a9ea (patch) | |
tree | 90fcfa7959803bfddd634aa7d721a68b3f61d7a6 /drivers/infiniband/core/restrack.c | |
parent | c3d02788b45ab4a2d8f243b98c04b549c8193af6 (diff) | |
download | linux-stable-1b8b778864b338b2e295687733d785ae1a65a9ea.tar.gz linux-stable-1b8b778864b338b2e295687733d785ae1a65a9ea.tar.bz2 linux-stable-1b8b778864b338b2e295687733d785ae1a65a9ea.zip |
RDMA/nldev: Connect QP number to .doit callback
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>
Diffstat (limited to 'drivers/infiniband/core/restrack.c')
-rw-r--r-- | drivers/infiniband/core/restrack.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c index a5ea3988b4c3..fa804093fafb 100644 --- a/drivers/infiniband/core/restrack.c +++ b/drivers/infiniband/core/restrack.c @@ -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; } |