Commit 3b3233fb authored by Raed Salem's avatar Raed Salem Committed by Leon Romanovsky

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: default avatarYishai Hadas <yishaih@mellanox.com>
Signed-off-by: default avatarRaed Salem <raeds@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b29e2a13
This diff is collapsed.
...@@ -175,6 +175,7 @@ struct mlx5_ib_flow_handler { ...@@ -175,6 +175,7 @@ struct mlx5_ib_flow_handler {
struct ib_flow ibflow; struct ib_flow ibflow;
struct mlx5_ib_flow_prio *prio; struct mlx5_ib_flow_prio *prio;
struct mlx5_flow_handle *rule; struct mlx5_flow_handle *rule;
struct ib_counters *ibcounters;
}; };
struct mlx5_ib_flow_db { struct mlx5_ib_flow_db {
...@@ -813,8 +814,22 @@ struct mlx5_memic { ...@@ -813,8 +814,22 @@ struct mlx5_memic {
DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES); DECLARE_BITMAP(memic_alloc_pages, MLX5_MAX_MEMIC_PAGES);
}; };
enum mlx5_ib_counters_type {
MLX5_IB_COUNTERS_FLOW,
};
struct mlx5_ib_mcounters { struct mlx5_ib_mcounters {
struct ib_counters ibcntrs; 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 * static inline struct mlx5_ib_mcounters *
......
...@@ -160,6 +160,7 @@ struct mlx5_flow_act { ...@@ -160,6 +160,7 @@ struct mlx5_flow_act {
u32 modify_id; u32 modify_id;
uintptr_t esp_id; uintptr_t esp_id;
struct mlx5_fs_vlan vlan; struct mlx5_fs_vlan vlan;
struct ib_counters *counters;
}; };
#define MLX5_DECLARE_FLOW_ACT(name) \ #define MLX5_DECLARE_FLOW_ACT(name) \
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/if_ether.h> /* For ETH_ALEN. */ #include <linux/if_ether.h> /* For ETH_ALEN. */
#include <rdma/ib_user_ioctl_verbs.h>
enum { enum {
MLX5_QP_FLAG_SIGNATURE = 1 << 0, MLX5_QP_FLAG_SIGNATURE = 1 << 0,
...@@ -441,4 +442,27 @@ enum { ...@@ -441,4 +442,27 @@ enum {
enum { enum {
MLX5_IB_CLOCK_INFO_V1 = 0, MLX5_IB_CLOCK_INFO_V1 = 0,
}; };
struct mlx5_ib_flow_counters_desc {
__u32 description;
__u32 index;
};
struct mlx5_ib_flow_counters_data {
RDMA_UAPI_PTR(struct mlx5_ib_flow_counters_desc *, counters_data);
__u32 ncounters;
__u32 reserved;
};
struct mlx5_ib_create_flow {
__u32 ncounters_data;
__u32 reserved;
/*
* Following are counters data based on ncounters_data, each
* entry in the data[] should match a corresponding counter object
* that was pointed by a counters spec upon the flow creation
*/
struct mlx5_ib_flow_counters_data data[];
};
#endif /* MLX5_ABI_USER_H */ #endif /* MLX5_ABI_USER_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment