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