diff mbox series

[v2,for-next,1/4] RDMA/hns: Export hardware capability flags to userspace

Message ID 1597929469-22674-2-git-send-email-liweihang@huawei.com (mailing list archive)
State Superseded
Delegated to: Jason Gunthorpe
Headers show
Series RDMA/hns: Extend some capabilities for HIP09 | expand

Commit Message

Weihang Li Aug. 20, 2020, 1:17 p.m. UTC
From: Xi Wang <wangxi11@huawei.com>

The libhns in userspace for HIP09 will use the hardware's capability to
enable some features. So export the hardware capablility flags to userspace
by reusing the reserved fields in structure
"hns_roce_ib_alloc_ucontext_resp".

Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Weihang Li <liweihang@huawei.com>
---
 drivers/infiniband/hw/hns/hns_roce_main.c | 1 +
 include/uapi/rdma/hns-abi.h               | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Jason Gunthorpe Aug. 27, 2020, 12:40 p.m. UTC | #1
On Thu, Aug 20, 2020 at 09:17:46PM +0800, Weihang Li wrote:
> From: Xi Wang <wangxi11@huawei.com>
> 
> The libhns in userspace for HIP09 will use the hardware's capability to
> enable some features. So export the hardware capablility flags to userspace
> by reusing the reserved fields in structure
> "hns_roce_ib_alloc_ucontext_resp".
> 
> Signed-off-by: Xi Wang <wangxi11@huawei.com>
> Signed-off-by: Weihang Li <liweihang@huawei.com>
>  drivers/infiniband/hw/hns/hns_roce_main.c | 1 +
>  include/uapi/rdma/hns-abi.h               | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index 5907cfd..98945df 100644
> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> @@ -313,6 +313,7 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx,
>  		return -EAGAIN;
>  
>  	resp.qp_tab_size = hr_dev->caps.num_qps;
> +	resp.cap_flags = (u32)hr_dev->caps.flags;

This makes all the HNS_ROCE_CAP_FLAG_* values uapi, they need to be
moved to the uapi header too.

Or rethink this to only expose what you want to be uapi.

Jason
Weihang Li Aug. 31, 2020, 7:46 a.m. UTC | #2
On 2020/8/27 20:40, Jason Gunthorpe wrote:
> On Thu, Aug 20, 2020 at 09:17:46PM +0800, Weihang Li wrote:
>> From: Xi Wang <wangxi11@huawei.com>
>>
>> The libhns in userspace for HIP09 will use the hardware's capability to
>> enable some features. So export the hardware capablility flags to userspace
>> by reusing the reserved fields in structure
>> "hns_roce_ib_alloc_ucontext_resp".
>>
>> Signed-off-by: Xi Wang <wangxi11@huawei.com>
>> Signed-off-by: Weihang Li <liweihang@huawei.com>
>>  drivers/infiniband/hw/hns/hns_roce_main.c | 1 +
>>  include/uapi/rdma/hns-abi.h               | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
>> index 5907cfd..98945df 100644
>> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
>> @@ -313,6 +313,7 @@ static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx,
>>  		return -EAGAIN;
>>  
>>  	resp.qp_tab_size = hr_dev->caps.num_qps;
>> +	resp.cap_flags = (u32)hr_dev->caps.flags;
> 
> This makes all the HNS_ROCE_CAP_FLAG_* values uapi, they need to be
> moved to the uapi header too.
> 
> Or rethink this to only expose what you want to be uapi.
> 
> Jason
> 

Hi Jason,

Thanks for your comments, we will only expose the needed flag to be
uapi.

Considering that this cap_flags field is not necessary for this series,
I will drop #1 and send a new version. And the modification about
cap_flags will be sent later.

Weihang
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 5907cfd..98945df 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -313,6 +313,7 @@  static int hns_roce_alloc_ucontext(struct ib_ucontext *uctx,
 		return -EAGAIN;
 
 	resp.qp_tab_size = hr_dev->caps.num_qps;
+	resp.cap_flags = (u32)hr_dev->caps.flags;
 
 	ret = hns_roce_uar_alloc(hr_dev, &context->uar);
 	if (ret)
diff --git a/include/uapi/rdma/hns-abi.h b/include/uapi/rdma/hns-abi.h
index eb76b38..5c38758 100644
--- a/include/uapi/rdma/hns-abi.h
+++ b/include/uapi/rdma/hns-abi.h
@@ -73,7 +73,7 @@  struct hns_roce_ib_create_qp_resp {
 
 struct hns_roce_ib_alloc_ucontext_resp {
 	__u32	qp_tab_size;
-	__u32	reserved;
+	__u32	cap_flags;
 };
 
 struct hns_roce_ib_alloc_pd_resp {