[PATCH rdma-core 10/11] mlx5: Add support for counters read

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

 



From: Raed Salem <raeds@xxxxxxxxxxxx>

Reads the hardware counters values and writes them to
the output index location in the user supplied array.

All counters values are represented as uint64_t types.

The read counter values in the array are defined according to the
configuration defined by user in the ibv_attach_counters_point_xxx
functions.

Signed-off-by: Raed Salem <raeds@xxxxxxxxxxxx>
Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx>
---
 providers/mlx5/mlx5.c  |  1 +
 providers/mlx5/mlx5.h  |  4 ++++
 providers/mlx5/verbs.c | 15 +++++++++++++++
 3 files changed, 20 insertions(+)

diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index 24a69f3..814f7a6 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -144,6 +144,7 @@ static const struct verbs_context_ops mlx5_ctx_common_ops = {
 	.post_srq_ops = mlx5_post_srq_ops,
 	.query_device_ex = mlx5_query_device_ex,
 	.query_rt_values = mlx5_query_rt_values,
+	.read_counters = mlx5_read_counters,
 	.reg_dm_mr = mlx5_reg_dm_mr,
 };
 
diff --git a/providers/mlx5/mlx5.h b/providers/mlx5/mlx5.h
index c975dff..4890e65 100644
--- a/providers/mlx5/mlx5.h
+++ b/providers/mlx5/mlx5.h
@@ -858,6 +858,10 @@ int mlx5_destroy_counters(struct ibv_counters *counters);
 int mlx5_attach_counters_point_flow(struct ibv_counters *counters,
 				    struct ibv_counter_attach_attr *attr,
 				    struct ibv_flow *flow);
+int mlx5_read_counters(struct ibv_counters *counters,
+		       uint64_t *counters_value,
+		       uint32_t ncounters,
+		       uint32_t flags);
 
 static inline void *mlx5_find_uidx(struct mlx5_context *ctx, uint32_t uidx)
 {
diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c
index 780f093..63701b8 100644
--- a/providers/mlx5/verbs.c
+++ b/providers/mlx5/verbs.c
@@ -3323,3 +3323,18 @@ int mlx5_attach_counters_point_flow(struct ibv_counters *counters,
 
 	return 0;
 }
+
+int mlx5_read_counters(struct ibv_counters *counters,
+		       uint64_t *counters_value,
+		       uint32_t ncounters,
+		       uint32_t flags)
+{
+	struct mlx5_counters *mcntrs = to_mcounters(counters);
+
+	return ibv_cmd_read_counters(&mcntrs->vcounters,
+				     counters_value,
+				     ncounters,
+				     flags,
+				     NULL);
+
+}
-- 
1.8.3.1

--
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