RDMA/rxe: Update wqe_index for each wqe error completion
authorLi Zhijian <lizhijian@fujitsu.com>
Wed, 20 Jul 2022 08:56:05 +0000 (04:56 -0400)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 2 Aug 2022 16:41:36 +0000 (13:41 -0300)
Previously, if user space keeps sending abnormal wqe, queue.index will
keep increasing while qp->req.wqe_index doesn't. Once
qp->req.wqe_index==queue.index in next round, req_next_wqe() will treat
queue as empty. In such case, no new completion would be generated.

Update wqe_index for each wqe completion so that req_next_wqe() can get
next wqe properly.

Link: https://lore.kernel.org/r/1658307368-1851-2-git-send-email-lizhijian@fujitsu.com
Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_req.c

index 49e8f54db6f53e1fad5712292a036115f7ad5abb..5a85687b9c725c190b9f87e1a94e8a6c20c2ff06 100644 (file)
@@ -802,6 +802,8 @@ done:
        ret = 0;
        goto out;
 err:
+       /* update wqe_index for each wqe completion */
+       qp->req.wqe_index = queue_next_index(qp->sq.queue, qp->req.wqe_index);
        wqe->state = wqe_state_error;
        rxe_run_task(&qp->comp.task, 0);
 exit: