Re: [PATCH v4 for-next 01/12] RDMA/hns: Introduce DCA for RC QP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 2021/8/20 7:54, Jason Gunthorpe wrote:
> On Thu, Jul 29, 2021 at 10:19:12AM +0800, Wenpeng Liang wrote:
> 
>> +static int UVERBS_HANDLER(HNS_IB_METHOD_DCA_MEM_REG)(
>> +	struct uverbs_attr_bundle *attrs)
>> +{
>> +	struct hns_roce_ucontext *uctx = uverbs_attr_to_hr_uctx(attrs);
>> +	struct hns_roce_dev *hr_dev = to_hr_dev(uctx->ibucontext.device);
>> +	struct ib_uobject *uobj =
>> +		uverbs_attr_get_uobject(attrs, HNS_IB_ATTR_DCA_MEM_REG_HANDLE);
>> +	struct dca_mem_attr init_attr = {};
>> +	struct dca_mem *mem;
>> +	int ret;
>> +
>> +	if (uverbs_copy_from(&init_attr.addr, attrs,
>> +			     HNS_IB_ATTR_DCA_MEM_REG_ADDR) ||
>> +	    uverbs_copy_from(&init_attr.size, attrs,
>> +			     HNS_IB_ATTR_DCA_MEM_REG_LEN) ||
>> +	    uverbs_copy_from(&init_attr.key, attrs,
>> +			     HNS_IB_ATTR_DCA_MEM_REG_KEY))
>> +		return -EFAULT;
> 
> This should return the code from uverbs_copy_from() not
> -EFAULT.
> 

I will fix it, including the other uverbs_copy_from of this patchset.

>> +DECLARE_UVERBS_NAMED_METHOD(
>> +	HNS_IB_METHOD_DCA_MEM_REG,
>> +	UVERBS_ATTR_IDR(HNS_IB_ATTR_DCA_MEM_REG_HANDLE, HNS_IB_OBJECT_DCA_MEM,
>> +			UVERBS_ACCESS_NEW, UA_MANDATORY),
>> +	UVERBS_ATTR_PTR_IN(HNS_IB_ATTR_DCA_MEM_REG_LEN, UVERBS_ATTR_TYPE(u32),
>> +			   UA_MANDATORY),
>> +	UVERBS_ATTR_PTR_IN(HNS_IB_ATTR_DCA_MEM_REG_ADDR, UVERBS_ATTR_TYPE(u64),
>> +			   UA_MANDATORY),
>> +	UVERBS_ATTR_PTR_IN(HNS_IB_ATTR_DCA_MEM_REG_KEY, UVERBS_ATTR_TYPE(u64),
>> +			   UA_MANDATORY));
> 
> I think these ptr_in's are supposed to be const_in these days? The
> code you were referencing for this pre-dates const_in and hasn't been
> converted.
> 
> The distinction is that const_in is only for small < 64 bit types.
> 
> Please check all the cases for both of these things
> 

thanks,

>> +extern const struct uapi_definition hns_roce_dca_uapi_defs[];
>> +static const struct uapi_definition hns_roce_uapi_defs[] = {
>> +	UAPI_DEF_CHAIN(hns_roce_dca_uapi_defs),
>> +	{}
>> +};
> 
> The 2nd array isn't necessary, is it?
> 
> Jason
> .
> 

I will delete it.

Thanks,
Wenpeng.





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux