• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #define MLX5_DEVCOM_PORTS_SUPPORTED 2
10 
11 enum mlx5_devcom_components {
12 	MLX5_DEVCOM_ESW_OFFLOADS,
13 
14 	MLX5_DEVCOM_NUM_COMPONENTS,
15 };
16 
17 typedef int (*mlx5_devcom_event_handler_t)(int event,
18 					   void *my_data,
19 					   void *event_data);
20 
21 struct mlx5_devcom *mlx5_devcom_register_device(struct mlx5_core_dev *dev);
22 void mlx5_devcom_unregister_device(struct mlx5_devcom *devcom);
23 
24 void mlx5_devcom_register_component(struct mlx5_devcom *devcom,
25 				    enum mlx5_devcom_components id,
26 				    mlx5_devcom_event_handler_t handler,
27 				    void *data);
28 void mlx5_devcom_unregister_component(struct mlx5_devcom *devcom,
29 				      enum mlx5_devcom_components id);
30 
31 int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
32 			   enum mlx5_devcom_components id,
33 			   int event,
34 			   void *event_data);
35 
36 void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
37 			    enum mlx5_devcom_components id,
38 			    bool paired);
39 bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
40 			   enum mlx5_devcom_components id);
41 
42 void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
43 				enum mlx5_devcom_components id);
44 void mlx5_devcom_release_peer_data(struct mlx5_devcom *devcom,
45 				   enum mlx5_devcom_components id);
46 
47 #endif
48 
49