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

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

 



On Tue, May 15, 2018 at 05:09:50PM +0300, Leon Romanovsky wrote:
> From: Raed Salem <raeds@xxxxxxxxxxxx>
> 
> This patch implements the uverbs counters read API, it will use the
> specific read counters function to the given type to accomplish its
> task.
> 
> Reviewed-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
> Signed-off-by: Raed Salem <raeds@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>  drivers/infiniband/hw/mlx5/main.c | 44 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 59ee1e96cf2e..72a521d5638f 100644
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -5361,6 +5361,49 @@ static void depopulate_specs_root(struct mlx5_ib_dev *dev)
>  	uverbs_free_spec_tree(dev->ib_dev.specs_root);
>  }
>  
> +static int mlx5_ib_read_counters(struct ib_counters *counters,
> +				 struct ib_counters_read_attr *read_attr,
> +				 struct uverbs_attr_bundle *attrs)
> +{
> +	struct mlx5_ib_mcounters *mcounters = to_mcounters(counters);
> +	struct mlx5_read_counters_attr mread_attr = {};
> +	u32 *desc, *index;
> +	int ret, i;
> +
> +	mutex_lock(&mcounters->mcntrs_mutex);
> +	if (mcounters->cntrs_max_index > read_attr->ncounters) {
> +		ret = -EINVAL;
> +		goto err_bound;
> +	}
> +
> +	mread_attr.out = kcalloc(mcounters->counters_num, sizeof(u64),
> +				 GFP_KERNEL);
> +	if (!mread_attr.out) {
> +		ret = -ENOMEM;
> +		goto err_bound;
> +	}
> +
> +	mread_attr.hw_cntrs_hndl = mcounters->hw_cntrs_hndl;
> +	mread_attr.flags = read_attr->flags;
> +	ret = mcounters->read_counters(counters->device, &mread_attr);

This doesn't compile, there is no 'read_counters' in 'struct
mlx5_ib_mcounters'

struct mlx5_ib_mcounters {
	struct ib_counters ibcntrs;
	enum mlx5_ib_counters_type type;
	void *hw_cntrs_hndl;
	/* max index set as part of create_flow */
	u32 cntrs_max_index;
	/* number of counters data entries (<description,index> pair) */
	u32 ncounters;
	/* counters data array for descriptions and indexes */
	u32 *counters_data;
	/* protects access to mcounters internal data */
	struct mutex mcntrs_mutex;
};

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