RDMA/rxe: Send last wqe reached event on qp cleanup
authorBob Pearson <rpearsonhpe@gmail.com>
Fri, 2 Jun 2023 16:42:29 +0000 (11:42 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 9 Jun 2023 17:06:23 +0000 (14:06 -0300)
The IBA requires:
o11-5.2.5: If the HCA supports SRQ, for RC and UD service,
the CI shall generate a Last WQE Reached Affiliated Asynchronous
Event on a QP that is in the Error State and is associated with
an SRQ when either:
• a CQE is generated for the last WQE, or
• the QP gets in the Error State and there are no more
  WQEs on the RQ.

This patch implements this behavior in flush_recv_queue() which is called
as a result of rxe_qp_error() being called whenever the qp is put into the
error state. The rxe responder executes SRQ WQEs directly from the SRQ so
there are never more WQES on the RQ.

Link: https://lore.kernel.org/r/20230602164229.9277-1-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_resp.c

index 0729920..8a3c9c2 100644 (file)
@@ -1455,8 +1455,17 @@ static void flush_recv_queue(struct rxe_qp *qp, bool notify)
        struct rxe_recv_wqe *wqe;
        int err;
 
-       if (qp->srq)
+       if (qp->srq) {
+               if (notify && qp->ibqp.event_handler) {
+                       struct ib_event ev;
+
+                       ev.device = qp->ibqp.device;
+                       ev.element.qp = &qp->ibqp;
+                       ev.event = IB_EVENT_QP_LAST_WQE_REACHED;
+                       qp->ibqp.event_handler(&ev, qp->ibqp.qp_context);
+               }
                return;
+       }
 
        while ((wqe = queue_head(q, q->type))) {
                if (notify) {