diff mbox series

[V2,3/3] RDMA/siw: Call llist_reverse_order in siw_run_sq

Message ID 20230821084743.6489-4-guoqing.jiang@linux.dev (mailing list archive)
State Superseded
Headers show
Series Misc changes for siw | expand

Commit Message

Guoqing Jiang Aug. 21, 2023, 8:47 a.m. UTC
We can call the function to get fifo list.

Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
---
 drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

Comments

Bernard Metzler Aug. 21, 2023, noon UTC | #1
> -----Original Message-----
> From: Guoqing Jiang <guoqing.jiang@linux.dev>
> Sent: Monday, 21 August 2023 10:48
> To: Bernard Metzler <BMT@zurich.ibm.com>; jgg@ziepe.ca; leon@kernel.org
> Cc: linux-rdma@vger.kernel.org
> Subject: [EXTERNAL] [PATCH V2 3/3] RDMA/siw: Call llist_reverse_order in
> siw_run_sq
> 
> We can call the function to get fifo list.
> 
> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
> ---
>  drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c
> b/drivers/infiniband/sw/siw/siw_qp_tx.c
> index 4b292e0504f1..eb3d438828e2 100644
> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
> @@ -1229,17 +1229,7 @@ int siw_run_sq(void *data)
>  			break;
> 
>  		active = llist_del_all(&tx_task->active);
> -		/*
> -		 * llist_del_all returns a list with newest entry first.
> -		 * Re-order list for fairness among QP's.
> -		 */
> -		while (active) {
> -			struct llist_node *tmp = active;
> -
> -			active = llist_next(active);
> -			tmp->next = fifo_list;
> -			fifo_list = tmp;
> -		}
> +		fifo_list = llist_reverse_order(active);
>  		while (fifo_list) {
>  			qp = container_of(fifo_list, struct siw_qp, tx_list);
>  			fifo_list = llist_next(fifo_list);
> --
> 2.35.3

Oh yes, that function already exists. Many thanks!
I'd keep the comment, since it might be not obvious why we
reverse the list.

Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
Guoqing Jiang Aug. 21, 2023, 1:23 p.m. UTC | #2
On 8/21/23 20:00, Bernard Metzler wrote:
>
>> -----Original Message-----
>> From: Guoqing Jiang <guoqing.jiang@linux.dev>
>> Sent: Monday, 21 August 2023 10:48
>> To: Bernard Metzler <BMT@zurich.ibm.com>; jgg@ziepe.ca; leon@kernel.org
>> Cc: linux-rdma@vger.kernel.org
>> Subject: [EXTERNAL] [PATCH V2 3/3] RDMA/siw: Call llist_reverse_order in
>> siw_run_sq
>>
>> We can call the function to get fifo list.
>>
>> Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev>
>> ---
>>   drivers/infiniband/sw/siw/siw_qp_tx.c | 12 +-----------
>>   1 file changed, 1 insertion(+), 11 deletions(-)
>>
>> diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c
>> b/drivers/infiniband/sw/siw/siw_qp_tx.c
>> index 4b292e0504f1..eb3d438828e2 100644
>> --- a/drivers/infiniband/sw/siw/siw_qp_tx.c
>> +++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
>> @@ -1229,17 +1229,7 @@ int siw_run_sq(void *data)
>>   			break;
>>
>>   		active = llist_del_all(&tx_task->active);
>> -		/*
>> -		 * llist_del_all returns a list with newest entry first.
>> -		 * Re-order list for fairness among QP's.
>> -		 */
>> -		while (active) {
>> -			struct llist_node *tmp = active;
>> -
>> -			active = llist_next(active);
>> -			tmp->next = fifo_list;
>> -			fifo_list = tmp;
>> -		}
>> +		fifo_list = llist_reverse_order(active);
>>   		while (fifo_list) {
>>   			qp = container_of(fifo_list, struct siw_qp, tx_list);
>>   			fifo_list = llist_next(fifo_list);
>> --
>> 2.35.3
> Oh yes, that function already exists. Many thanks!
> I'd keep the comment, since it might be not obvious why we
> reverse the list.

Ok, will add them back.

> Acked-by: Bernard Metzler <bmt@zurich.ibm.com>

Appreciate for your review!

Thanks,
Guoqing
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index 4b292e0504f1..eb3d438828e2 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -1229,17 +1229,7 @@  int siw_run_sq(void *data)
 			break;
 
 		active = llist_del_all(&tx_task->active);
-		/*
-		 * llist_del_all returns a list with newest entry first.
-		 * Re-order list for fairness among QP's.
-		 */
-		while (active) {
-			struct llist_node *tmp = active;
-
-			active = llist_next(active);
-			tmp->next = fifo_list;
-			fifo_list = tmp;
-		}
+		fifo_list = llist_reverse_order(active);
 		while (fifo_list) {
 			qp = container_of(fifo_list, struct siw_qp, tx_list);
 			fifo_list = llist_next(fifo_list);