Lines Matching refs:cnts
160 return is_mdev_switchdev_mode(dev->mdev) ? &dev->port[0].cnts : in get_counters()
161 &dev->port[port_num].cnts; in get_counters()
175 const struct mlx5_ib_counters *cnts = get_counters(dev, port_num); in mlx5_ib_get_counters_id() local
177 return cnts->set_id; in mlx5_ib_get_counters_id()
180 static struct rdma_hw_stats *do_alloc_stats(const struct mlx5_ib_counters *cnts) in do_alloc_stats() argument
186 num_hw_counters = cnts->num_q_counters + cnts->num_cong_counters + in do_alloc_stats()
187 cnts->num_ext_ppcnt_counters; in do_alloc_stats()
188 stats = rdma_alloc_hw_stats_struct(cnts->descs, in do_alloc_stats()
190 cnts->num_op_counters, in do_alloc_stats()
195 for (i = 0; i < cnts->num_op_counters; i++) in do_alloc_stats()
205 const struct mlx5_ib_counters *cnts = &dev->port[0].cnts; in mlx5_ib_alloc_hw_device_stats() local
207 return do_alloc_stats(cnts); in mlx5_ib_alloc_hw_device_stats()
214 const struct mlx5_ib_counters *cnts = &dev->port[port_num - 1].cnts; in mlx5_ib_alloc_hw_port_stats() local
216 return do_alloc_stats(cnts); in mlx5_ib_alloc_hw_port_stats()
220 const struct mlx5_ib_counters *cnts, in mlx5_ib_query_q_counters() argument
235 for (i = 0; i < cnts->num_q_counters; i++) { in mlx5_ib_query_q_counters()
236 val = *(__be32 *)((void *)out + cnts->offsets[i]); in mlx5_ib_query_q_counters()
244 const struct mlx5_ib_counters *cnts, in mlx5_ib_query_ext_ppcnt_counters() argument
247 int offset = cnts->num_q_counters + cnts->num_cong_counters; in mlx5_ib_query_ext_ppcnt_counters()
264 for (i = 0; i < cnts->num_ext_ppcnt_counters; i++) in mlx5_ib_query_ext_ppcnt_counters()
267 cnts->offsets[i + offset])); in mlx5_ib_query_ext_ppcnt_counters()
278 const struct mlx5_ib_counters *cnts = get_counters(dev, port_num - 1); in do_get_hw_stats() local
285 num_counters = cnts->num_q_counters + in do_get_hw_stats()
286 cnts->num_cong_counters + in do_get_hw_stats()
287 cnts->num_ext_ppcnt_counters; in do_get_hw_stats()
290 ret = mlx5_ib_query_q_counters(dev->mdev, cnts, stats, cnts->set_id); in do_get_hw_stats()
295 ret = mlx5_ib_query_ext_ppcnt_counters(dev, cnts, stats); in do_get_hw_stats()
313 cnts->num_q_counters, in do_get_hw_stats()
314 cnts->num_cong_counters, in do_get_hw_stats()
315 cnts->offsets + in do_get_hw_stats()
316 cnts->num_q_counters); in do_get_hw_stats()
332 const struct mlx5_ib_counters *cnts; in do_get_op_stat() local
338 cnts = get_counters(dev, port_num - 1); in do_get_op_stat()
339 opfcs = cnts->opfcs; in do_get_op_stat()
340 type = *(u32 *)cnts->descs[index].priv; in do_get_op_stat()
362 const struct mlx5_ib_counters *cnts; in do_get_op_stats() local
365 cnts = get_counters(dev, port_num - 1); in do_get_op_stats()
366 num_hw_counters = cnts->num_q_counters + cnts->num_cong_counters + in do_get_op_stats()
367 cnts->num_ext_ppcnt_counters; in do_get_op_stats()
369 index < (num_hw_counters + cnts->num_op_counters); index++) { in do_get_op_stats()
375 return cnts->num_op_counters; in do_get_op_stats()
384 const struct mlx5_ib_counters *cnts; in mlx5_ib_get_hw_stats() local
386 cnts = get_counters(dev, port_num - 1); in mlx5_ib_get_hw_stats()
387 num_hw_counters = cnts->num_q_counters + cnts->num_cong_counters + in mlx5_ib_get_hw_stats()
388 cnts->num_ext_ppcnt_counters; in mlx5_ib_get_hw_stats()
389 num_counters = num_hw_counters + cnts->num_op_counters; in mlx5_ib_get_hw_stats()
413 const struct mlx5_ib_counters *cnts = in mlx5_ib_counter_alloc_stats() local
416 return do_alloc_stats(cnts); in mlx5_ib_counter_alloc_stats()
422 const struct mlx5_ib_counters *cnts = in mlx5_ib_counter_update_stats() local
425 return mlx5_ib_query_q_counters(dev->mdev, cnts, in mlx5_ib_counter_update_stats()
561 struct mlx5_ib_counters *cnts) in __mlx5_ib_alloc_counters() argument
579 cnts->num_q_counters = num_counters; in __mlx5_ib_alloc_counters()
582 cnts->num_cong_counters = ARRAY_SIZE(cong_cnts); in __mlx5_ib_alloc_counters()
586 cnts->num_ext_ppcnt_counters = ARRAY_SIZE(ext_ppcnt_cnts); in __mlx5_ib_alloc_counters()
600 cnts->num_op_counters = num_op_counters; in __mlx5_ib_alloc_counters()
602 cnts->descs = kcalloc(num_counters, in __mlx5_ib_alloc_counters()
604 if (!cnts->descs) in __mlx5_ib_alloc_counters()
607 cnts->offsets = kcalloc(num_counters, in __mlx5_ib_alloc_counters()
608 sizeof(*cnts->offsets), GFP_KERNEL); in __mlx5_ib_alloc_counters()
609 if (!cnts->offsets) in __mlx5_ib_alloc_counters()
615 kfree(cnts->descs); in __mlx5_ib_alloc_counters()
616 cnts->descs = NULL; in __mlx5_ib_alloc_counters()
632 if (dev->port[i].cnts.set_id) { in mlx5_ib_dealloc_counters()
634 dev->port[i].cnts.set_id); in mlx5_ib_dealloc_counters()
637 kfree(dev->port[i].cnts.descs); in mlx5_ib_dealloc_counters()
638 kfree(dev->port[i].cnts.offsets); in mlx5_ib_dealloc_counters()
641 if (!dev->port[i].cnts.opfcs[j].fc) in mlx5_ib_dealloc_counters()
646 &dev->port[i].cnts.opfcs[j], j); in mlx5_ib_dealloc_counters()
648 dev->port[i].cnts.opfcs[j].fc); in mlx5_ib_dealloc_counters()
649 dev->port[i].cnts.opfcs[j].fc = NULL; in mlx5_ib_dealloc_counters()
668 err = __mlx5_ib_alloc_counters(dev, &dev->port[i].cnts); in mlx5_ib_alloc_counters()
672 mlx5_ib_fill_counters(dev, dev->port[i].cnts.descs, in mlx5_ib_alloc_counters()
673 dev->port[i].cnts.offsets); in mlx5_ib_alloc_counters()
686 dev->port[i].cnts.set_id = in mlx5_ib_alloc_counters()
834 struct mlx5_ib_counters *cnts; in mlx5_ib_modify_stat() local
839 cnts = &dev->port[port - 1].cnts; in mlx5_ib_modify_stat()
840 num_hw_counters = cnts->num_q_counters + cnts->num_cong_counters + in mlx5_ib_modify_stat()
841 cnts->num_ext_ppcnt_counters; in mlx5_ib_modify_stat()
843 index >= (num_hw_counters + cnts->num_op_counters)) in mlx5_ib_modify_stat()
846 if (!(cnts->descs[index].flags & IB_STAT_FLAG_OPTIONAL)) in mlx5_ib_modify_stat()
849 type = *(u32 *)cnts->descs[index].priv; in mlx5_ib_modify_stat()
853 opfc = &cnts->opfcs[type]; in mlx5_ib_modify_stat()