Re: [PATCH rdma-next 05/12] IB/uverbs: Add read counters support

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

 



On Tue, May 15, 2018 at 05:09:43PM +0300, Leon Romanovsky wrote:
> From: Raed Salem <raeds@xxxxxxxxxxxx>
> 
> This patch exposes the read counters verb to user space
> applications.
> By that verb the user can read the hardware counters which
> are associated with the counters object.
> 
> The application needs to provide a sufficient memory to
> hold the statistics.
> 
> Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
> Signed-off-by: Raed Salem <raeds@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>  .../infiniband/core/uverbs_std_types_counters.c    | 59 +++++++++++++++++++++-
>  include/uapi/rdma/ib_user_ioctl_cmds.h             |  7 +++
>  2 files changed, 65 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/core/uverbs_std_types_counters.c b/drivers/infiniband/core/uverbs_std_types_counters.c
> index 1c39cbe4c772..ec59aede7bd2 100644
> +++ b/drivers/infiniband/core/uverbs_std_types_counters.c
> @@ -78,6 +78,50 @@ static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_CREATE)(struct ib_device *ib_de
>  	return ret;
>  }
>  
> +static int UVERBS_HANDLER(UVERBS_METHOD_COUNTERS_READ)(struct ib_device *ib_dev,
> +						       struct ib_uverbs_file *file,
> +						       struct uverbs_attr_bundle *attrs)
> +{
> +	struct ib_counters_read_attr read_attr = {};
> +	const struct uverbs_attr *uattr =
> +		uverbs_attr_get(attrs, UVERBS_ATTR_READ_COUNTERS_HANDLE);
> +	struct ib_uobject *uobj = uattr->obj_attr.uobject;
> +	struct ib_counters *counters = (struct ib_counters *)(uobj->object);

Yikes, the above should simply be:

struct ib_counters *counters = uverbs_attr_get_obj(attrs, UVERBS_ATTR_READ_COUNTERS_HANDLE);

> +	&UVERBS_ATTR_PTR_OUT(UVERBS_ATTR_READ_COUNTERS_BUFF,
> +			     UVERBS_ATTR_SIZE(0, USHRT_MAX),
> +			     UA_FLAGS(UVERBS_ATTR_SPEC_F_MANDATORY)),

This is a good place to use:

https://patchwork.kernel.org/project/linux-rdma/list/

Maybe move that trivial patch to this series.

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