#include "mlx5_ib.h"
#include <linux/mlx5/eswitch.h>
#include <linux/mlx5/vport.h>
#include "counters.h"
#include "ib_rep.h"
#include "qp.h"
struct mlx5_ib_counter { … };
#define INIT_Q_COUNTER(_name) …
#define INIT_VPORT_Q_COUNTER(_name) …
static const struct mlx5_ib_counter basic_q_cnts[] = …;
static const struct mlx5_ib_counter out_of_seq_q_cnts[] = …;
static const struct mlx5_ib_counter retrans_q_cnts[] = …;
static const struct mlx5_ib_counter vport_basic_q_cnts[] = …;
static const struct mlx5_ib_counter vport_out_of_seq_q_cnts[] = …;
static const struct mlx5_ib_counter vport_retrans_q_cnts[] = …;
#define INIT_CONG_COUNTER(_name) …
static const struct mlx5_ib_counter cong_cnts[] = …;
static const struct mlx5_ib_counter extended_err_cnts[] = …;
static const struct mlx5_ib_counter roce_accl_cnts[] = …;
static const struct mlx5_ib_counter vport_extended_err_cnts[] = …;
static const struct mlx5_ib_counter vport_roce_accl_cnts[] = …;
#define INIT_EXT_PPCNT_COUNTER(_name) …
static const struct mlx5_ib_counter ext_ppcnt_cnts[] = …;
#define INIT_OP_COUNTER(_name, _type) …
static const struct mlx5_ib_counter basic_op_cnts[] = …;
static const struct mlx5_ib_counter rdmarx_cnp_op_cnts[] = …;
static const struct mlx5_ib_counter rdmatx_cnp_op_cnts[] = …;
static int mlx5_ib_read_counters(struct ib_counters *counters,
struct ib_counters_read_attr *read_attr,
struct uverbs_attr_bundle *attrs)
{ … }
static int mlx5_ib_destroy_counters(struct ib_counters *counters)
{ … }
static int mlx5_ib_create_counters(struct ib_counters *counters,
struct uverbs_attr_bundle *attrs)
{ … }
static bool vport_qcounters_supported(struct mlx5_ib_dev *dev)
{ … }
static const struct mlx5_ib_counters *get_counters(struct mlx5_ib_dev *dev,
u32 port_num)
{ … }
u16 mlx5_ib_get_counters_id(struct mlx5_ib_dev *dev, u32 port_num)
{ … }
static struct rdma_hw_stats *do_alloc_stats(const struct mlx5_ib_counters *cnts)
{ … }
static struct rdma_hw_stats *
mlx5_ib_alloc_hw_device_stats(struct ib_device *ibdev)
{ … }
static struct rdma_hw_stats *
mlx5_ib_alloc_hw_port_stats(struct ib_device *ibdev, u32 port_num)
{ … }
static int mlx5_ib_query_q_counters(struct mlx5_core_dev *mdev,
const struct mlx5_ib_counters *cnts,
struct rdma_hw_stats *stats,
u16 set_id)
{ … }
static int mlx5_ib_query_ext_ppcnt_counters(struct mlx5_ib_dev *dev,
const struct mlx5_ib_counters *cnts,
struct rdma_hw_stats *stats)
{ … }
static int mlx5_ib_query_q_counters_vport(struct mlx5_ib_dev *dev,
u32 port_num,
const struct mlx5_ib_counters *cnts,
struct rdma_hw_stats *stats)
{ … }
static int do_get_hw_stats(struct ib_device *ibdev,
struct rdma_hw_stats *stats,
u32 port_num, int index)
{ … }
static int do_get_op_stat(struct ib_device *ibdev,
struct rdma_hw_stats *stats,
u32 port_num, int index)
{ … }
static int do_get_op_stats(struct ib_device *ibdev,
struct rdma_hw_stats *stats,
u32 port_num)
{ … }
static int mlx5_ib_get_hw_stats(struct ib_device *ibdev,
struct rdma_hw_stats *stats,
u32 port_num, int index)
{ … }
static struct rdma_hw_stats *
mlx5_ib_counter_alloc_stats(struct rdma_counter *counter)
{ … }
static int mlx5_ib_counter_update_stats(struct rdma_counter *counter)
{ … }
static int mlx5_ib_counter_dealloc(struct rdma_counter *counter)
{ … }
static int mlx5_ib_counter_bind_qp(struct rdma_counter *counter,
struct ib_qp *qp)
{ … }
static int mlx5_ib_counter_unbind_qp(struct ib_qp *qp)
{ … }
static void mlx5_ib_fill_counters(struct mlx5_ib_dev *dev,
struct rdma_stat_desc *descs, size_t *offsets,
u32 port_num)
{ … }
static int __mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev,
struct mlx5_ib_counters *cnts, u32 port_num)
{ … }
static void mlx5_ib_dealloc_counters(struct mlx5_ib_dev *dev)
{ … }
static int mlx5_ib_alloc_counters(struct mlx5_ib_dev *dev)
{ … }
static int read_flow_counters(struct ib_device *ibdev,
struct mlx5_read_counters_attr *read_attr)
{ … }
#define FLOW_COUNTERS_NUM …
static int counters_set_description(
struct ib_counters *counters, enum mlx5_ib_counters_type counters_type,
struct mlx5_ib_flow_counters_desc *desc_data, u32 ncounters)
{ … }
#define MAX_COUNTERS_NUM …
int mlx5_ib_flow_counters_set_data(struct ib_counters *ibcounters,
struct mlx5_ib_create_flow *ucmd)
{ … }
void mlx5_ib_counters_clear_description(struct ib_counters *counters)
{ … }
static int mlx5_ib_modify_stat(struct ib_device *device, u32 port,
unsigned int index, bool enable)
{ … }
static const struct ib_device_ops hw_stats_ops = …;
static const struct ib_device_ops hw_switchdev_vport_op = …;
static const struct ib_device_ops hw_switchdev_stats_ops = …;
static const struct ib_device_ops counters_ops = …;
int mlx5_ib_counters_init(struct mlx5_ib_dev *dev)
{ … }
void mlx5_ib_counters_cleanup(struct mlx5_ib_dev *dev)
{ … }