diff mbox series

[v4,2/3] RDMA/rxe: Generate error completion for error requester QP state

Message ID 20220701061731.1582399-3-lizhijian@fujitsu.com (mailing list archive)
State Superseded
Headers show
Series RDMA/rxe: Fix no completion event issue | expand

Commit Message

Zhijian Li (Fujitsu) July 1, 2022, 6:10 a.m. UTC
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@fujitsu.com>
---
V4: check QP ERROR before QP RESET # Bob
V3: unlikely() optimization # Cheng Xu <chengyou@linux.alibaba.com>
    update commit log # Haakon Bugge <haakon.bugge@oracle.com>
---
 drivers/infiniband/sw/rxe/rxe_req.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

Comments

Cheng Xu July 1, 2022, 7:58 a.m. UTC | #1
On 7/1/22 2:10 PM, lizhijian@fujitsu.com 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@fujitsu.com>
> ---
> V4: check QP ERROR before QP RESET # Bob
> V3: unlikely() optimization # Cheng Xu <chengyou@linux.alibaba.com>
>      update commit log # Haakon Bugge <haakon.bugge@oracle.com>
> ---
>   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);
Zhijian Li (Fujitsu) July 4, 2022, 6:01 a.m. UTC | #2
On 01/07/2022 15:58, Cheng Xu wrote:
>
>
> On 7/1/22 2:10 PM, lizhijian@fujitsu.com 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@fujitsu.com>
>> ---
>> V4: check QP ERROR before QP RESET # Bob
>> V3: unlikely() optimization # Cheng Xu <chengyou@linux.alibaba.com>
>>      update commit log # Haakon Bugge <haakon.bugge@oracle.com>
>> ---
>>   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.

Good catch, Fixed it in V5
Thanks



>
> Thanks,
> Cheng Xu
>
>> +    }
>> +
>>       if (unlikely(qp->req.state == QP_STATE_RESET)) {
>>           qp->req.wqe_index = queue_get_consumer(q,
>>                           QUEUE_TYPE_FROM_CLIENT);
diff mbox series

Patch

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 (unlikely(qp->req.state == QP_STATE_RESET)) {
 		qp->req.wqe_index = queue_get_consumer(q,
 						QUEUE_TYPE_FROM_CLIENT);