xref: /openbmc/linux/drivers/infiniband/hw/mlx5/devx.h (revision d8b7515e25ec0a294c18e366f98e85fcb4a035e3)
1f7c4ffdaSLeon Romanovsky /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
2f7c4ffdaSLeon Romanovsky /*
3f7c4ffdaSLeon Romanovsky  * Copyright (c) 2019-2020, Mellanox Technologies inc. All rights reserved.
4f7c4ffdaSLeon Romanovsky  */
5f7c4ffdaSLeon Romanovsky 
6f7c4ffdaSLeon Romanovsky #ifndef _MLX5_IB_DEVX_H
7f7c4ffdaSLeon Romanovsky #define _MLX5_IB_DEVX_H
8f7c4ffdaSLeon Romanovsky 
9f7c4ffdaSLeon Romanovsky #include "mlx5_ib.h"
10f7c4ffdaSLeon Romanovsky 
11f7c4ffdaSLeon Romanovsky #define MLX5_MAX_DESTROY_INBOX_SIZE_DW MLX5_ST_SZ_DW(delete_fte_in)
12f7c4ffdaSLeon Romanovsky struct devx_obj {
13f7c4ffdaSLeon Romanovsky 	struct mlx5_ib_dev	*ib_dev;
14f7c4ffdaSLeon Romanovsky 	u64			obj_id;
15f7c4ffdaSLeon Romanovsky 	u32			dinlen; /* destroy inbox length */
16f7c4ffdaSLeon Romanovsky 	u32			dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW];
17f7c4ffdaSLeon Romanovsky 	u32			flags;
18f7c4ffdaSLeon Romanovsky 	union {
19f7c4ffdaSLeon Romanovsky 		struct mlx5_ib_devx_mr	devx_mr;
20f7c4ffdaSLeon Romanovsky 		struct mlx5_core_dct	core_dct;
21f7c4ffdaSLeon Romanovsky 		struct mlx5_core_cq	core_cq;
22f7c4ffdaSLeon Romanovsky 		u32			flow_counter_bulk_size;
23f7c4ffdaSLeon Romanovsky 	};
24f7c4ffdaSLeon Romanovsky 	struct list_head event_sub; /* holds devx_event_subscription entries */
25f7c4ffdaSLeon Romanovsky };
26*d8b7515eSLeon Romanovsky #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
27*d8b7515eSLeon Romanovsky int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user);
28*d8b7515eSLeon Romanovsky void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid);
29*d8b7515eSLeon Romanovsky int mlx5_ib_devx_init(struct mlx5_ib_dev *dev);
30*d8b7515eSLeon Romanovsky void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev);
31*d8b7515eSLeon Romanovsky #else
32*d8b7515eSLeon Romanovsky static inline int mlx5_ib_devx_create(struct mlx5_ib_dev *dev, bool is_user)
33*d8b7515eSLeon Romanovsky {
34*d8b7515eSLeon Romanovsky 	return -EOPNOTSUPP;
35*d8b7515eSLeon Romanovsky }
36*d8b7515eSLeon Romanovsky static inline void mlx5_ib_devx_destroy(struct mlx5_ib_dev *dev, u16 uid) {}
37*d8b7515eSLeon Romanovsky static inline int mlx5_ib_devx_init(struct mlx5_ib_dev *dev)
38*d8b7515eSLeon Romanovsky {
39*d8b7515eSLeon Romanovsky 	return 0;
40*d8b7515eSLeon Romanovsky }
41*d8b7515eSLeon Romanovsky static inline void mlx5_ib_devx_cleanup(struct mlx5_ib_dev *dev)
42*d8b7515eSLeon Romanovsky {
43*d8b7515eSLeon Romanovsky }
44*d8b7515eSLeon Romanovsky #endif
45f7c4ffdaSLeon Romanovsky #endif /* _MLX5_IB_DEVX_H */
46