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

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

 



On Tue, May 15, 2018 at 05:09:49PM +0300, Leon Romanovsky wrote:
> From: Raed Salem <raeds@xxxxxxxxxxxx>
> 
> Implements the flow counters read wrapper.
> 
> 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    | 22 ++++++++++++++++++++++
>  drivers/infiniband/hw/mlx5/mlx5_ib.h |  5 +++++
>  2 files changed, 27 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 61fefee40922..59ee1e96cf2e 100644
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -3180,6 +3180,28 @@ static void set_underlay_qp(struct mlx5_ib_dev *dev,
>  	}
>  }
>  
> +static int read_flow_counters(struct ib_device *ibdev,
> +			      struct mlx5_read_counters_attr *read_attr)
> +{
> +	struct mlx5_fc *fc = (struct mlx5_fc *)(read_attr->hw_cntrs_hndl);
> +	struct mlx5_ib_dev *dev = to_mdev(ibdev);
> +
> +	return mlx5_fc_query(dev->mdev, fc->id, &read_attr->out[0],
> +			     &read_attr->out[1]);
> +}
> +
> +struct mlx5_ib_flow_counter {
> +	size_t offset;
> +};
> +
> +#define INIT_COUNTER(_struct, _name)\
> +	{ .offset = MLX5_BYTE_OFF(_struct, _name)}
> +
> +static const struct mlx5_ib_flow_counter basic_flow_cnts[] = {
> +	INIT_COUNTER(traffic_counter, packets),
> +	INIT_COUNTER(traffic_counter, octets),
> +};

Why does this static array exist? The only use is in ARRAY_SIZE.

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