On 7/1/22 2:10 PM, lizhijian@xxxxxxxxxxx wrote:
As per IBTA specification, all subsequent WQEs while QP is in error
state should be completed with a flush error.
Here we check QP_STATE_ERROR after req_next_wqe() so that rxe_completer()
has chance to be called where it will set CQ state to FLUSH ERROR and the
completion can associate with its WQE.
Signed-off-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
---
V4: check QP ERROR before QP RESET # Bob
V3: unlikely() optimization # Cheng Xu <chengyou@xxxxxxxxxxxxxxxxx>
update commit log # Haakon Bugge <haakon.bugge@xxxxxxxxxx>
---
drivers/infiniband/sw/rxe/rxe_req.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 4ffc4ebd6e28..7fdc8e6bf738 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -610,9 +610,22 @@ int rxe_requester(void *arg)
return -EAGAIN;
next_wqe:
- if (unlikely(!qp->valid || qp->req.state == QP_STATE_ERROR))
+ if (unlikely(!qp->valid))
goto exit;
+ if (unlikely(qp->req.state == QP_STATE_ERROR)) {
+ wqe = req_next_wqe(qp);
+ if (wqe)
+ /*
+ * Generate an error completion so that user space
+ * is able to poll this completion.
+ */
+ goto err;
+ else {
+ goto exit;
+ }
~~~
If I read it right, a single statement should not use parentheses.
Thanks,
Cheng Xu
+ }
+
if (unlikely(qp->req.state == QP_STATE_RESET)) {
qp->req.wqe_index = queue_get_consumer(q,
QUEUE_TYPE_FROM_CLIENT);