1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2019 Mellanox Technologies. */
4 #ifndef __LIB_HV_VHCA_H__
5 #define __LIB_HV_VHCA_H__
10 struct mlx5_hv_vhca_agent;
12 struct mlx5_hv_vhca_control_block;
14 enum mlx5_hv_vhca_agent_type {
15 MLX5_HV_VHCA_AGENT_CONTROL = 0,
16 MLX5_HV_VHCA_AGENT_STATS = 1,
17 MLX5_HV_VHCA_AGENT_MAX = 32,
20 #if IS_ENABLED(CONFIG_PCI_HYPERV_INTERFACE)
22 struct mlx5_hv_vhca_control_block {
32 struct mlx5_hv_vhca *mlx5_hv_vhca_create(struct mlx5_core_dev *dev);
33 void mlx5_hv_vhca_destroy(struct mlx5_hv_vhca *hv_vhca);
34 int mlx5_hv_vhca_init(struct mlx5_hv_vhca *hv_vhca);
35 void mlx5_hv_vhca_cleanup(struct mlx5_hv_vhca *hv_vhca);
36 void mlx5_hv_vhca_invalidate(void *context, u64 block_mask);
38 struct mlx5_hv_vhca_agent *
39 mlx5_hv_vhca_agent_create(struct mlx5_hv_vhca *hv_vhca,
40 enum mlx5_hv_vhca_agent_type type,
41 void (*control)(struct mlx5_hv_vhca_agent*,
42 struct mlx5_hv_vhca_control_block *block),
43 void (*invalidate)(struct mlx5_hv_vhca_agent*,
45 void (*cleanup)(struct mlx5_hv_vhca_agent *agent),
48 void mlx5_hv_vhca_agent_destroy(struct mlx5_hv_vhca_agent *agent);
49 int mlx5_hv_vhca_agent_write(struct mlx5_hv_vhca_agent *agent,
51 void *mlx5_hv_vhca_agent_priv(struct mlx5_hv_vhca_agent *agent);
55 static inline struct mlx5_hv_vhca *
56 mlx5_hv_vhca_create(struct mlx5_core_dev *dev)
61 static inline void mlx5_hv_vhca_destroy(struct mlx5_hv_vhca *hv_vhca)
65 static inline int mlx5_hv_vhca_init(struct mlx5_hv_vhca *hv_vhca)
70 static inline void mlx5_hv_vhca_cleanup(struct mlx5_hv_vhca *hv_vhca)
74 static inline void mlx5_hv_vhca_invalidate(void *context,
79 static inline struct mlx5_hv_vhca_agent *
80 mlx5_hv_vhca_agent_create(struct mlx5_hv_vhca *hv_vhca,
81 enum mlx5_hv_vhca_agent_type type,
82 void (*control)(struct mlx5_hv_vhca_agent*,
83 struct mlx5_hv_vhca_control_block *block),
84 void (*invalidate)(struct mlx5_hv_vhca_agent*,
86 void (*cleanup)(struct mlx5_hv_vhca_agent *agent),
92 static inline void mlx5_hv_vhca_agent_destroy(struct mlx5_hv_vhca_agent *agent)
97 mlx5_hv_vhca_write_agent(struct mlx5_hv_vhca_agent *agent,
104 #endif /* __LIB_HV_VHCA_H__ */