ib_ucaps.h 798 B

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