aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/sw/rxe/rxe_verbs.c
diff options
context:
space:
mode:
authorBob Pearson <rpearsonhpe@gmail.com>2022-04-20 20:40:40 -0500
committerJason Gunthorpe <jgg@nvidia.com>2022-05-09 09:03:45 -0300
commit4703b4f0d94a5f887297713a2f6c2916a1ef08fd (patch)
tree1f616e7e7d7ef783fec2638b878fdf9a83a351f1 /drivers/infiniband/sw/rxe/rxe_verbs.c
parentRDMA/rxe: Move mw cleanup code to rxe_mw_cleanup() (diff)
downloadlinux-dev-4703b4f0d94a5f887297713a2f6c2916a1ef08fd.tar.xz
linux-dev-4703b4f0d94a5f887297713a2f6c2916a1ef08fd.zip
RDMA/rxe: Enforce IBA C11-17
Add a counter to keep track of the number of WQs connected to a CQ and return an error if destroy_cq() is called while the counter is non zero. Link: https://lore.kernel.org/r/20220421014042.26985-8-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/sw/rxe/rxe_verbs.c')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_verbs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 198afb055b06..9d995854a174 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -795,6 +795,12 @@ static int rxe_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
{
struct rxe_cq *cq = to_rcq(ibcq);
+ /* See IBA C11-17: The CI shall return an error if this Verb is
+ * invoked while a Work Queue is still associated with the CQ.
+ */
+ if (atomic_read(&cq->num_wq))
+ return -EINVAL;
+
rxe_cq_disable(cq);
rxe_put(cq);