@@ -3834,6 +3834,37 @@ static struct rdma_hw_stats *mlx5_ib_alloc_hw_stats(struct ib_device *ibdev,
3834
3834
RDMA_HW_STATS_DEFAULT_LIFESPAN );
3835
3835
}
3836
3836
3837
+ static int mlx5_ib_clear_hw_stats (struct ib_device * ibdev , u8 port_num )
3838
+ {
3839
+ struct mlx5_ib_dev * dev = to_mdev (ibdev );
3840
+ struct mlx5_ib_port * port = & dev -> port [port_num - 1 ];
3841
+ int outlen = MLX5_ST_SZ_BYTES (query_q_counter_out );
3842
+ void * out ;
3843
+ int ret ;
3844
+
3845
+ out = kvzalloc (outlen , GFP_KERNEL );
3846
+ if (!out )
3847
+ return - ENOMEM ;
3848
+
3849
+ ret = mlx5_core_query_q_counter (dev -> mdev ,
3850
+ port -> cnts .set_id , 1 ,
3851
+ out , outlen );
3852
+ kvfree (out );
3853
+
3854
+ if (ret )
3855
+ return ret ;
3856
+
3857
+ outlen = MLX5_ST_SZ_BYTES (query_cong_statistics_out );
3858
+ out = kvzalloc (outlen , GFP_KERNEL );
3859
+ if (!out )
3860
+ return - ENOMEM ;
3861
+
3862
+ ret = mlx5_cmd_query_cong_counter (dev -> mdev , true, out , outlen );
3863
+
3864
+ kvfree (out );
3865
+ return ret ;
3866
+ }
3867
+
3837
3868
static int mlx5_ib_query_q_counters (struct mlx5_core_dev * mdev ,
3838
3869
struct mlx5_ib_port * port ,
3839
3870
struct rdma_hw_stats * stats )
@@ -4571,6 +4602,7 @@ static void *mlx5_ib_add(struct mlx5_core_dev *mdev)
4571
4602
if (MLX5_CAP_GEN (dev -> mdev , max_qp_cnt )) {
4572
4603
dev -> ib_dev .get_hw_stats = mlx5_ib_get_hw_stats ;
4573
4604
dev -> ib_dev .alloc_hw_stats = mlx5_ib_alloc_hw_stats ;
4605
+ dev -> ib_dev .clear_hw_stats = mlx5_ib_clear_hw_stats ;
4574
4606
}
4575
4607
4576
4608
if (MLX5_CAP_GEN (mdev , xrc )) {
0 commit comments