xref: /linux/include/rdma/ib_ucaps.h (revision 3dc7c001169d112b3e514cacff6c93091c57af9a)
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 int ib_get_ucaps(int *fds, int fd_count, uint64_t *idx_mask);
18 #if IS_ENABLED(CONFIG_INFINIBAND_USER_ACCESS)
19 int ib_create_ucap(enum rdma_user_cap type);
20 void ib_remove_ucap(enum rdma_user_cap type);
21 #else
22 static inline int ib_create_ucap(enum rdma_user_cap type)
23 {
24 	return -EOPNOTSUPP;
25 }
26 static inline void ib_remove_ucap(enum rdma_user_cap type) {}
27 #endif /* CONFIG_INFINIBAND_USER_ACCESS */
28 
29 #endif /* _IB_UCAPS_H_ */
30