IB/mlx5: Add flow counters binding support

Associates a counters with a flow when IB_FLOW_SPEC_ACTION_COUNT is part
of the flow specifications.

The counters user space placements of location and description (index,
description) pairs are passed as private data of the counters flow
specification.

Reviewed-by: Yishai Hadas <yishaih@mellanox.com>
Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:
Raed Salem
2018-05-31 16:43:39 +03:00
committed by Leon Romanovsky
parent b29e2a1309
commit 3b3233fbf0
4 changed files with 249 additions and 13 deletions

View File

@@ -175,6 +175,7 @@ struct mlx5_ib_flow_handler {
struct ib_flow ibflow;
struct mlx5_ib_flow_prio *prio;
struct mlx5_flow_handle *rule;
struct ib_counters *ibcounters;
};
struct mlx5_ib_flow_db {
@@ -813,8 +814,22 @@ struct mlx5_memic {
DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES);
};
enum mlx5_ib_counters_type {
MLX5_IB_COUNTERS_FLOW,
};
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 */
struct mlx5_ib_flow_counters_desc *counters_data;
/* protects access to mcounters internal data */
struct mutex mcntrs_mutex;
};
static inline struct mlx5_ib_mcounters *