1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2018 Mellanox Technologies */
4 #ifndef __LIB_MLX5_DEVCOM_H__
5 #define __LIB_MLX5_DEVCOM_H__
7 #include <linux/mlx5/driver.h>
9 enum mlx5_devcom_components {
10 MLX5_DEVCOM_ESW_OFFLOADS,
12 MLX5_DEVCOM_NUM_COMPONENTS,
15 typedef int (*mlx5_devcom_event_handler_t)(int event,
19 struct mlx5_devcom *mlx5_devcom_register_device(struct mlx5_core_dev *dev);
20 void mlx5_devcom_unregister_device(struct mlx5_devcom *devcom);
22 void mlx5_devcom_register_component(struct mlx5_devcom *devcom,
23 enum mlx5_devcom_components id,
24 mlx5_devcom_event_handler_t handler,
26 void mlx5_devcom_unregister_component(struct mlx5_devcom *devcom,
27 enum mlx5_devcom_components id);
29 int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
30 enum mlx5_devcom_components id,
34 void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
35 enum mlx5_devcom_components id,
37 bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
38 enum mlx5_devcom_components id);
40 void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
41 enum mlx5_devcom_components id);
42 void mlx5_devcom_release_peer_data(struct mlx5_devcom *devcom,
43 enum mlx5_devcom_components id);