| 1 | /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
| 2 | /* |
| 3 | * Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved |
| 4 | */ |
| 5 | |
| 6 | #ifndef _IB_UCAPS_H_ |
| 7 | #define _IB_UCAPS_H_ |
| 8 | |
| 9 | #define UCAP_ENABLED(ucaps, type) (!!((ucaps) & (1U << (type)))) |
| 10 | |
| 11 | enum rdma_user_cap { |
| 12 | RDMA_UCAP_MLX5_CTRL_LOCAL, |
| 13 | RDMA_UCAP_MLX5_CTRL_OTHER_VHCA, |
| 14 | RDMA_UCAP_MAX |
| 15 | }; |
| 16 | |
| 17 | void ib_cleanup_ucaps(void); |
| 18 | int ib_get_ucaps(int *fds, int fd_count, uint64_t *idx_mask); |
| 19 | #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS) |
| 20 | int ib_create_ucap(enum rdma_user_cap type); |
| 21 | void ib_remove_ucap(enum rdma_user_cap type); |
| 22 | #else |
| 23 | static inline int ib_create_ucap(enum rdma_user_cap type) |
| 24 | { |
| 25 | return -EOPNOTSUPP; |
| 26 | } |
| 27 | static inline void ib_remove_ucap(enum rdma_user_cap type) {} |
| 28 | #endif /* CONFIG_INFINIBAND_USER_ACCESS */ |
| 29 | |
| 30 | #endif /* _IB_UCAPS_H_ */ |
| 31 | |