Merge tag 'irq-urgent-2020-04-05' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / drivers / net / ethernet / mellanox / mlx5 / core / lib / devcom.h
1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2 /* Copyright (c) 2018 Mellanox Technologies */
3
4 #ifndef __LIB_MLX5_DEVCOM_H__
5 #define __LIB_MLX5_DEVCOM_H__
6
7 #include <linux/mlx5/driver.h>
8
9 enum mlx5_devcom_components {
10         MLX5_DEVCOM_ESW_OFFLOADS,
11
12         MLX5_DEVCOM_NUM_COMPONENTS,
13 };
14
15 typedef int (*mlx5_devcom_event_handler_t)(int event,
16                                            void *my_data,
17                                            void *event_data);
18
19 struct mlx5_devcom *mlx5_devcom_register_device(struct mlx5_core_dev *dev);
20 void mlx5_devcom_unregister_device(struct mlx5_devcom *devcom);
21
22 void mlx5_devcom_register_component(struct mlx5_devcom *devcom,
23                                     enum mlx5_devcom_components id,
24                                     mlx5_devcom_event_handler_t handler,
25                                     void *data);
26 void mlx5_devcom_unregister_component(struct mlx5_devcom *devcom,
27                                       enum mlx5_devcom_components id);
28
29 int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
30                            enum mlx5_devcom_components id,
31                            int event,
32                            void *event_data);
33
34 void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
35                             enum mlx5_devcom_components id,
36                             bool paired);
37 bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
38                            enum mlx5_devcom_components id);
39
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);
44
45 #endif
46