linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix
@ 2025-03-27 11:47 Junxian Huang
  2025-03-27 11:47 ` [PATCH for-next 1/2] RDMA/hns: Remove unused parameters Junxian Huang
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Junxian Huang @ 2025-03-27 11:47 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm, huangjunxian6, tangchengchang

These are two simple patches, one for cleanup, the other for a HW
limit fix.

Chengchang Tang (2):
  RDMA/hns: Remove unused parameters
  RDMA/hns: Fix wrong maximum DMA segment size

 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 5 ++---
 drivers/infiniband/hw/hns/hns_roce_main.c  | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)

--
2.33.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH for-next 1/2] RDMA/hns: Remove unused parameters
  2025-03-27 11:47 [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Junxian Huang
@ 2025-03-27 11:47 ` Junxian Huang
  2025-03-27 11:47 ` [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size Junxian Huang
  2025-04-07 18:36 ` [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Jason Gunthorpe
  2 siblings, 0 replies; 9+ messages in thread
From: Junxian Huang @ 2025-03-27 11:47 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm, huangjunxian6, tangchengchang

From: Chengchang Tang <tangchengchang@huawei.com>

Remove unused parameters.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
index dded339802b3..b024cdac8ff6 100644
--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
+++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c
@@ -4270,8 +4270,7 @@ static inline int get_pdn(struct ib_pd *ib_pd)
 }
 
 static void modify_qp_reset_to_init(struct ib_qp *ibqp,
-				    struct hns_roce_v2_qp_context *context,
-				    struct hns_roce_v2_qp_context *qpc_mask)
+				    struct hns_roce_v2_qp_context *context)
 {
 	struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device);
 	struct hns_roce_qp *hr_qp = to_hr_qp(ibqp);
@@ -5090,7 +5089,7 @@ static int hns_roce_v2_set_abs_fields(struct ib_qp *ibqp,
 
 	if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
 		memset(qpc_mask, 0, hr_dev->caps.qpc_sz);
-		modify_qp_reset_to_init(ibqp, context, qpc_mask);
+		modify_qp_reset_to_init(ibqp, context);
 	} else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_INIT) {
 		modify_qp_init_to_init(ibqp, context, qpc_mask);
 	} else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-03-27 11:47 [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Junxian Huang
  2025-03-27 11:47 ` [PATCH for-next 1/2] RDMA/hns: Remove unused parameters Junxian Huang
@ 2025-03-27 11:47 ` Junxian Huang
  2025-04-01 16:39   ` Jason Gunthorpe
  2025-04-07 18:36 ` [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Jason Gunthorpe
  2 siblings, 1 reply; 9+ messages in thread
From: Junxian Huang @ 2025-03-27 11:47 UTC (permalink / raw)
  To: jgg, leon; +Cc: linux-rdma, linuxarm, huangjunxian6, tangchengchang

From: Chengchang Tang <tangchengchang@huawei.com>

Set maximum DMA segment size to 2G instead of UINT_MAX due to HW limit.

Fixes: e0477b34d9d1 ("RDMA: Explicitly pass in the dma_device to ib_register_device")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index ae24c81c9812..18a78f577c1b 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
 		if (ret)
 			return ret;
 	}
-	dma_set_max_seg_size(dev, UINT_MAX);
+	dma_set_max_seg_size(dev, SZ_2G);
 	ret = ib_register_device(ib_dev, "hns_%d", dev);
 	if (ret) {
 		dev_err(dev, "ib_register_device failed!\n");
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-03-27 11:47 ` [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size Junxian Huang
@ 2025-04-01 16:39   ` Jason Gunthorpe
  2025-04-02  4:05     ` Junxian Huang
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Gunthorpe @ 2025-04-01 16:39 UTC (permalink / raw)
  To: Junxian Huang; +Cc: leon, linux-rdma, linuxarm, tangchengchang

On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote:
> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
>  		if (ret)
>  			return ret;
>  	}
> -	dma_set_max_seg_size(dev, UINT_MAX);
> +	dma_set_max_seg_size(dev, SZ_2G);

Are you sure? What do you think this does in the RDMA stack?

Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-04-01 16:39   ` Jason Gunthorpe
@ 2025-04-02  4:05     ` Junxian Huang
  2025-04-04 13:27       ` Jason Gunthorpe
  0 siblings, 1 reply; 9+ messages in thread
From: Junxian Huang @ 2025-04-02  4:05 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: leon, linux-rdma, linuxarm, tangchengchang



On 2025/4/2 0:39, Jason Gunthorpe wrote:
> On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote:
>> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
>>  		if (ret)
>>  			return ret;
>>  	}
>> -	dma_set_max_seg_size(dev, UINT_MAX);
>> +	dma_set_max_seg_size(dev, SZ_2G);
> 
> Are you sure? What do you think this does in the RDMA stack?
> 

This is the maximum DMA segment size when mapping ULP's scatter/gather
list to DMA address, right?

In some cases, it is possible to map a DMA segment exceeding 2G. This
exceeds the limit of our HW.

Junxian

> Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-04-02  4:05     ` Junxian Huang
@ 2025-04-04 13:27       ` Jason Gunthorpe
  2025-04-07 13:51         ` Junxian Huang
  0 siblings, 1 reply; 9+ messages in thread
From: Jason Gunthorpe @ 2025-04-04 13:27 UTC (permalink / raw)
  To: Junxian Huang; +Cc: leon, linux-rdma, linuxarm, tangchengchang

On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote:
> 
> 
> On 2025/4/2 0:39, Jason Gunthorpe wrote:
> > On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote:
> >> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
> >>  		if (ret)
> >>  			return ret;
> >>  	}
> >> -	dma_set_max_seg_size(dev, UINT_MAX);
> >> +	dma_set_max_seg_size(dev, SZ_2G);
> > 
> > Are you sure? What do you think this does in the RDMA stack?
> > 
> 
> This is the maximum DMA segment size when mapping ULP's scatter/gather
> list to DMA address, right?

Yes, but only for ib_sge

But I think there are other possible problems if your HW cannot
implement the full ib_sge :\

Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-04-04 13:27       ` Jason Gunthorpe
@ 2025-04-07 13:51         ` Junxian Huang
  2025-04-07 13:54           ` Jason Gunthorpe
  0 siblings, 1 reply; 9+ messages in thread
From: Junxian Huang @ 2025-04-07 13:51 UTC (permalink / raw)
  To: Jason Gunthorpe; +Cc: leon, linux-rdma, linuxarm, tangchengchang



On 2025/4/4 21:27, Jason Gunthorpe wrote:
> On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote:
>>
>>
>> On 2025/4/2 0:39, Jason Gunthorpe wrote:
>>> On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote:
>>>> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
>>>>  		if (ret)
>>>>  			return ret;
>>>>  	}
>>>> -	dma_set_max_seg_size(dev, UINT_MAX);
>>>> +	dma_set_max_seg_size(dev, SZ_2G);
>>>
>>> Are you sure? What do you think this does in the RDMA stack?
>>>
>>
>> This is the maximum DMA segment size when mapping ULP's scatter/gather
>> list to DMA address, right?
> 
> Yes, but only for ib_sge
> 
> But I think there are other possible problems if your HW cannot
> implement the full ib_sge :\

Why? According to IB spec, the maximum RDMA messgae size is 2GB,
so IMHO supporting ib_sge with DMA size larger than 2GB doesn't
seem to have much practical meaning.

Junxian

> 
> Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size
  2025-04-07 13:51         ` Junxian Huang
@ 2025-04-07 13:54           ` Jason Gunthorpe
  0 siblings, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2025-04-07 13:54 UTC (permalink / raw)
  To: Junxian Huang; +Cc: leon, linux-rdma, linuxarm, tangchengchang

On Mon, Apr 07, 2025 at 09:51:37PM +0800, Junxian Huang wrote:
> 
> 
> On 2025/4/4 21:27, Jason Gunthorpe wrote:
> > On Wed, Apr 02, 2025 at 12:05:36PM +0800, Junxian Huang wrote:
> >>
> >>
> >> On 2025/4/2 0:39, Jason Gunthorpe wrote:
> >>> On Thu, Mar 27, 2025 at 07:47:24PM +0800, Junxian Huang wrote:
> >>>> @@ -763,7 +763,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev)
> >>>>  		if (ret)
> >>>>  			return ret;
> >>>>  	}
> >>>> -	dma_set_max_seg_size(dev, UINT_MAX);
> >>>> +	dma_set_max_seg_size(dev, SZ_2G);
> >>>
> >>> Are you sure? What do you think this does in the RDMA stack?
> >>>
> >>
> >> This is the maximum DMA segment size when mapping ULP's scatter/gather
> >> list to DMA address, right?
> > 
> > Yes, but only for ib_sge
> > 
> > But I think there are other possible problems if your HW cannot
> > implement the full ib_sge :\
> 
> Why? According to IB spec, the maximum RDMA messgae size is 2GB,
> so IMHO supporting ib_sge with DMA size larger than 2GB doesn't
> seem to have much practical meaning.

I'm not sure we comprehensively check that everywhere..

Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix
  2025-03-27 11:47 [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Junxian Huang
  2025-03-27 11:47 ` [PATCH for-next 1/2] RDMA/hns: Remove unused parameters Junxian Huang
  2025-03-27 11:47 ` [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size Junxian Huang
@ 2025-04-07 18:36 ` Jason Gunthorpe
  2 siblings, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2025-04-07 18:36 UTC (permalink / raw)
  To: Junxian Huang; +Cc: leon, linux-rdma, linuxarm, tangchengchang

On Thu, Mar 27, 2025 at 07:47:22PM +0800, Junxian Huang wrote:
> These are two simple patches, one for cleanup, the other for a HW
> limit fix.
> 
> Chengchang Tang (2):
>   RDMA/hns: Remove unused parameters
>   RDMA/hns: Fix wrong maximum DMA segment size

Applied both, the first to -next and the second to -rc

Thanks,
Jason

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-04-07 18:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-27 11:47 [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Junxian Huang
2025-03-27 11:47 ` [PATCH for-next 1/2] RDMA/hns: Remove unused parameters Junxian Huang
2025-03-27 11:47 ` [PATCH for-next 2/2] RDMA/hns: Fix wrong maximum DMA segment size Junxian Huang
2025-04-01 16:39   ` Jason Gunthorpe
2025-04-02  4:05     ` Junxian Huang
2025-04-04 13:27       ` Jason Gunthorpe
2025-04-07 13:51         ` Junxian Huang
2025-04-07 13:54           ` Jason Gunthorpe
2025-04-07 18:36 ` [PATCH for-next 0/2] RDMA/hns: Cleanup and Bugfix Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).