Re: [PATCH rdma-next 03/12] IB/uverbs: Add create/destroy counters support

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

 



On Tue, May 15, 2018 at 05:09:41PM +0300, Leon Romanovsky wrote:

> +static int uverbs_free_counters(struct ib_uobject *uobject,
> +				enum rdma_remove_reason why)
> +{
> +	struct ib_counters *counters =
> +			(struct ib_counters *)(uobject->object);

No casts from void *.

> +static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(struct ib_device *ib_dev,
> +							 struct ib_uverbs_file *file,
> +							 struct uverbs_attr_bundle *attrs)
> +{
> +	const struct uverbs_attr *uattr;
> +	struct ib_counters *counters;
> +	struct ib_uobject *uobj;
> +	int ret;
> +
> +	if (!ib_dev->create_counters)
> +		return -EOPNOTSUPP;

The methods shouldn't even exist in the parse tree if the function
pointer is not present - we have systematically made this mistake in
the new uapi, and it needs more infrastructure to fix, so we can leave
it here for now.. But noting it to help not forget..

> +	uattr = uverbs_attr_get(attrs, UVERBS_ATTR_CREATE_COUNTERS_HANDLE);
> +	uobj = uattr->obj_attr.uobject;

Would prefer to see this patch as part of this series:

https://patchwork.kernel.org/patch/10401247/

And the above to use it, as we are going to forget to do this conversion.

> +DECLARE_UVERBS_NAMED_OBJECT(UVERBS_OBJECT_COUNTERS,
> +			    &UVERBS_TYPE_ALLOC_IDR(uverbs_free_counters),
> +			    &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_CREATE),
> +			    &UVERBS_METHOD(UVERBS_METHOD_COUNTERS_DESTROY));

And this doesn't compile out of sequence with the devx patches, is '0'
the right ordering level for counters?

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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