diff mbox series

RDMA/rxe: Remove the member 'type' of struct rxe_mr

Message ID 20221021134513.17730-1-yangx.jy@fujitsu.com (mailing list archive)
State Superseded
Headers show
Series RDMA/rxe: Remove the member 'type' of struct rxe_mr | expand

Commit Message

Xiao Yang Oct. 21, 2022, 1:45 p.m. UTC
The member 'type' is included in both struct rxe_mr and struct ib_mr
so remove the duplicate one of struct rxe_mr.

Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
---
 drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
 drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
 2 files changed, 8 insertions(+), 9 deletions(-)

Comments

Bob Pearson Oct. 23, 2022, 5:18 p.m. UTC | #1
On 10/21/22 08:45, yangx.jy@fujitsu.com wrote:
> The member 'type' is included in both struct rxe_mr and struct ib_mr
> so remove the duplicate one of struct rxe_mr.
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
>  drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> index 502e9ada99b3..d4f10c2d1aa7 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> @@ -26,7 +26,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
>  {
>  
>  
> -	switch (mr->type) {
> +	switch (mr->ibmr.type) {
>  	case IB_MR_TYPE_DMA:
>  		return 0;
>  
> @@ -39,7 +39,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
>  
>  	default:
>  		pr_warn("%s: mr type (%d) not supported\n",
> -			__func__, mr->type);
> +			__func__, mr->ibmr.type);
>  		return -EFAULT;
>  	}
>  }
> @@ -109,7 +109,7 @@ void rxe_mr_init_dma(int access, struct rxe_mr *mr)
>  
>  	mr->access = access;
>  	mr->state = RXE_MR_STATE_VALID;
> -	mr->type = IB_MR_TYPE_DMA;
> +	mr->ibmr.type = IB_MR_TYPE_DMA;
>  }
>  
>  int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
> @@ -178,7 +178,7 @@ int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
>  	mr->access = access;
>  	mr->offset = ib_umem_offset(umem);
>  	mr->state = RXE_MR_STATE_VALID;
> -	mr->type = IB_MR_TYPE_USER;
> +	mr->ibmr.type = IB_MR_TYPE_USER;
>  
>  	return 0;
>  
> @@ -205,7 +205,7 @@ int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr)
>  
>  	mr->max_buf = max_pages;
>  	mr->state = RXE_MR_STATE_FREE;
> -	mr->type = IB_MR_TYPE_MEM_REG;
> +	mr->ibmr.type = IB_MR_TYPE_MEM_REG;
>  
>  	return 0;
>  
> @@ -304,7 +304,7 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
>  	if (length == 0)
>  		return 0;
>  
> -	if (mr->type == IB_MR_TYPE_DMA) {
> +	if (mr->ibmr.type == IB_MR_TYPE_DMA) {
>  		u8 *src, *dest;
>  
>  		src = (dir == RXE_TO_MR_OBJ) ? addr : ((void *)(uintptr_t)iova);
> @@ -547,8 +547,8 @@ int rxe_invalidate_mr(struct rxe_qp *qp, u32 key)
>  		goto err_drop_ref;
>  	}
>  
> -	if (unlikely(mr->type != IB_MR_TYPE_MEM_REG)) {
> -		pr_warn("%s: mr->type (%d) is wrong type\n", __func__, mr->type);
> +	if (unlikely(mr->ibmr.type != IB_MR_TYPE_MEM_REG)) {
> +		pr_warn("%s: mr type (%d) is wrong\n", __func__, mr->ibmr.type);
>  		ret = -EINVAL;
>  		goto err_drop_ref;
>  	}
> diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
> index 5f5cbfcb3569..22a299b0a9f0 100644
> --- a/drivers/infiniband/sw/rxe/rxe_verbs.h
> +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
> @@ -304,7 +304,6 @@ struct rxe_mr {
>  	u32			lkey;
>  	u32			rkey;
>  	enum rxe_mr_state	state;
> -	enum ib_mr_type		type;
>  	u32			offset;
>  	int			access;
>  

Looks good to me.

Reviewed-by: Bob Pearson <rpearsonhpe@gmail.com>
Leon Romanovsky Oct. 24, 2022, 11:51 a.m. UTC | #2
On Fri, Oct 21, 2022 at 01:45:17PM +0000, yangx.jy@fujitsu.com wrote:
> The member 'type' is included in both struct rxe_mr and struct ib_mr
> so remove the duplicate one of struct rxe_mr.
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
>  drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
>  2 files changed, 8 insertions(+), 9 deletions(-)

<...>

>  	default:
>  		pr_warn("%s: mr type (%d) not supported\n",
> -			__func__, mr->type);
> +			__func__, mr->ibmr.type);
>  		return -EFAULT;

<...>

> -	if (unlikely(mr->type != IB_MR_TYPE_MEM_REG)) {
> -		pr_warn("%s: mr->type (%d) is wrong type\n", __func__, mr->type);
> +	if (unlikely(mr->ibmr.type != IB_MR_TYPE_MEM_REG)) {
> +		pr_warn("%s: mr type (%d) is wrong\n", __func__, mr->ibmr.type);

Someone needs to convert pr_*() calls to ibdev_*() prints.

Thanks
Leon Romanovsky Oct. 24, 2022, 11:57 a.m. UTC | #3
On Fri, Oct 21, 2022 at 01:45:17PM +0000, yangx.jy@fujitsu.com wrote:
> The member 'type' is included in both struct rxe_mr and struct ib_mr
> so remove the duplicate one of struct rxe_mr.
> 
> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
>  drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
>  2 files changed, 8 insertions(+), 9 deletions(-)

Please fix you From field and resubmit.

71d236399160 (HEAD -> build) RDMA/rxe: Remove the member 'type' of struct rxe_mr
WARNING: From:/Signed-off-by: email name mismatch: 'From: "yangx.jy@fujitsu.com" <yangx.jy@fujitsu.com>' != 'Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>'


Thanks
Bob Pearson Oct. 24, 2022, 2:07 p.m. UTC | #4
On 10/24/22 06:51, Leon Romanovsky wrote:
> On Fri, Oct 21, 2022 at 01:45:17PM +0000, yangx.jy@fujitsu.com wrote:
>> The member 'type' is included in both struct rxe_mr and struct ib_mr
>> so remove the duplicate one of struct rxe_mr.
>>
>> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
>> ---
>>  drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
>>  drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
>>  2 files changed, 8 insertions(+), 9 deletions(-)
> 
> <...>
> 
>>  	default:
>>  		pr_warn("%s: mr type (%d) not supported\n",
>> -			__func__, mr->type);
>> +			__func__, mr->ibmr.type);
>>  		return -EFAULT;
> 
> <...>
> 
>> -	if (unlikely(mr->type != IB_MR_TYPE_MEM_REG)) {
>> -		pr_warn("%s: mr->type (%d) is wrong type\n", __func__, mr->type);
>> +	if (unlikely(mr->ibmr.type != IB_MR_TYPE_MEM_REG)) {
>> +		pr_warn("%s: mr type (%d) is wrong\n", __func__, mr->ibmr.type);
> 
> Someone needs to convert pr_*() calls to ibdev_*() prints.
> 
> Thanks

I have a patch laying around that does this. Hoping some of the backlog of rxe patches gets
accepted so I don't have to backport everything.

Bob
Leon Romanovsky Oct. 24, 2022, 5:08 p.m. UTC | #5
On Mon, Oct 24, 2022 at 09:07:11AM -0500, Bob Pearson wrote:
> On 10/24/22 06:51, Leon Romanovsky wrote:
> > On Fri, Oct 21, 2022 at 01:45:17PM +0000, yangx.jy@fujitsu.com wrote:
> >> The member 'type' is included in both struct rxe_mr and struct ib_mr
> >> so remove the duplicate one of struct rxe_mr.
> >>
> >> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
> >> ---
> >>  drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
> >>  drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
> >>  2 files changed, 8 insertions(+), 9 deletions(-)
> > 
> > <...>
> > 
> >>  	default:
> >>  		pr_warn("%s: mr type (%d) not supported\n",
> >> -			__func__, mr->type);
> >> +			__func__, mr->ibmr.type);
> >>  		return -EFAULT;
> > 
> > <...>
> > 
> >> -	if (unlikely(mr->type != IB_MR_TYPE_MEM_REG)) {
> >> -		pr_warn("%s: mr->type (%d) is wrong type\n", __func__, mr->type);
> >> +	if (unlikely(mr->ibmr.type != IB_MR_TYPE_MEM_REG)) {
> >> +		pr_warn("%s: mr type (%d) is wrong\n", __func__, mr->ibmr.type);
> > 
> > Someone needs to convert pr_*() calls to ibdev_*() prints.
> > 
> > Thanks
> 
> I have a patch laying around that does this. Hoping some of the backlog of rxe patches gets
> accepted so I don't have to backport everything.

The way to move forward with RXE patches is to collect Reviewed-by from
other active RXE contributors.

I'm not taking RXE patches without ROB, that don't apply cleanly and which
don't follow kernel coding style both in code and in commit messages.

Thanks

> 
> Bob
Xiao Yang Oct. 27, 2022, 6:34 a.m. UTC | #6
On 2022/10/24 19:57, Leon Romanovsky wrote:
> On Fri, Oct 21, 2022 at 01:45:17PM +0000, yangx.jy@fujitsu.com wrote:
>> The member 'type' is included in both struct rxe_mr and struct ib_mr
>> so remove the duplicate one of struct rxe_mr.
>>
>> Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>
>> ---
>>   drivers/infiniband/sw/rxe/rxe_mr.c    | 16 ++++++++--------
>>   drivers/infiniband/sw/rxe/rxe_verbs.h |  1 -
>>   2 files changed, 8 insertions(+), 9 deletions(-)
> 
> Please fix you From field and resubmit.
> 
> 71d236399160 (HEAD -> build) RDMA/rxe: Remove the member 'type' of struct rxe_mr
> WARNING: From:/Signed-off-by: email name mismatch: 'From: "yangx.jy@fujitsu.com" <yangx.jy@fujitsu.com>' != 'Signed-off-by: Xiao Yang <yangx.jy@fujitsu.com>'
> 
Hi Leon,

Thanks for your reminder. I will resend it shortly.

Best Regards,
Xiao Yang
> 
> Thanks
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
index 502e9ada99b3..d4f10c2d1aa7 100644
--- a/drivers/infiniband/sw/rxe/rxe_mr.c
+++ b/drivers/infiniband/sw/rxe/rxe_mr.c
@@ -26,7 +26,7 @@  int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
 {
 
 
-	switch (mr->type) {
+	switch (mr->ibmr.type) {
 	case IB_MR_TYPE_DMA:
 		return 0;
 
@@ -39,7 +39,7 @@  int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length)
 
 	default:
 		pr_warn("%s: mr type (%d) not supported\n",
-			__func__, mr->type);
+			__func__, mr->ibmr.type);
 		return -EFAULT;
 	}
 }
@@ -109,7 +109,7 @@  void rxe_mr_init_dma(int access, struct rxe_mr *mr)
 
 	mr->access = access;
 	mr->state = RXE_MR_STATE_VALID;
-	mr->type = IB_MR_TYPE_DMA;
+	mr->ibmr.type = IB_MR_TYPE_DMA;
 }
 
 int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
@@ -178,7 +178,7 @@  int rxe_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, u64 iova,
 	mr->access = access;
 	mr->offset = ib_umem_offset(umem);
 	mr->state = RXE_MR_STATE_VALID;
-	mr->type = IB_MR_TYPE_USER;
+	mr->ibmr.type = IB_MR_TYPE_USER;
 
 	return 0;
 
@@ -205,7 +205,7 @@  int rxe_mr_init_fast(int max_pages, struct rxe_mr *mr)
 
 	mr->max_buf = max_pages;
 	mr->state = RXE_MR_STATE_FREE;
-	mr->type = IB_MR_TYPE_MEM_REG;
+	mr->ibmr.type = IB_MR_TYPE_MEM_REG;
 
 	return 0;
 
@@ -304,7 +304,7 @@  int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, int length,
 	if (length == 0)
 		return 0;
 
-	if (mr->type == IB_MR_TYPE_DMA) {
+	if (mr->ibmr.type == IB_MR_TYPE_DMA) {
 		u8 *src, *dest;
 
 		src = (dir == RXE_TO_MR_OBJ) ? addr : ((void *)(uintptr_t)iova);
@@ -547,8 +547,8 @@  int rxe_invalidate_mr(struct rxe_qp *qp, u32 key)
 		goto err_drop_ref;
 	}
 
-	if (unlikely(mr->type != IB_MR_TYPE_MEM_REG)) {
-		pr_warn("%s: mr->type (%d) is wrong type\n", __func__, mr->type);
+	if (unlikely(mr->ibmr.type != IB_MR_TYPE_MEM_REG)) {
+		pr_warn("%s: mr type (%d) is wrong\n", __func__, mr->ibmr.type);
 		ret = -EINVAL;
 		goto err_drop_ref;
 	}
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/rxe/rxe_verbs.h
index 5f5cbfcb3569..22a299b0a9f0 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.h
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.h
@@ -304,7 +304,6 @@  struct rxe_mr {
 	u32			lkey;
 	u32			rkey;
 	enum rxe_mr_state	state;
-	enum ib_mr_type		type;
 	u32			offset;
 	int			access;