Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
0002 /* Copyright (c) 2018 Mellanox Technologies */
0003 
0004 #ifndef __LIB_MLX5_DEVCOM_H__
0005 #define __LIB_MLX5_DEVCOM_H__
0006 
0007 #include <linux/mlx5/driver.h>
0008 
0009 #define MLX5_DEVCOM_PORTS_SUPPORTED 2
0010 
0011 enum mlx5_devcom_components {
0012     MLX5_DEVCOM_ESW_OFFLOADS,
0013 
0014     MLX5_DEVCOM_NUM_COMPONENTS,
0015 };
0016 
0017 typedef int (*mlx5_devcom_event_handler_t)(int event,
0018                        void *my_data,
0019                        void *event_data);
0020 
0021 struct mlx5_devcom *mlx5_devcom_register_device(struct mlx5_core_dev *dev);
0022 void mlx5_devcom_unregister_device(struct mlx5_devcom *devcom);
0023 
0024 void mlx5_devcom_register_component(struct mlx5_devcom *devcom,
0025                     enum mlx5_devcom_components id,
0026                     mlx5_devcom_event_handler_t handler,
0027                     void *data);
0028 void mlx5_devcom_unregister_component(struct mlx5_devcom *devcom,
0029                       enum mlx5_devcom_components id);
0030 
0031 int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
0032                enum mlx5_devcom_components id,
0033                int event,
0034                void *event_data);
0035 
0036 void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
0037                 enum mlx5_devcom_components id,
0038                 bool paired);
0039 bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
0040                enum mlx5_devcom_components id);
0041 
0042 void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
0043                 enum mlx5_devcom_components id);
0044 void mlx5_devcom_release_peer_data(struct mlx5_devcom *devcom,
0045                    enum mlx5_devcom_components id);
0046 
0047 #endif
0048