ib_user_ioctl_verbs.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
  2. /*
  3. * Copyright (c) 2017-2018, Mellanox Technologies inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef IB_USER_IOCTL_VERBS_H
  34. #define IB_USER_IOCTL_VERBS_H
  35. #include <linux/types.h>
  36. #include <rdma/ib_user_verbs.h>
  37. #ifndef RDMA_UAPI_PTR
  38. #define RDMA_UAPI_PTR(_type, _name) __aligned_u64 _name
  39. #endif
  40. #define IB_UVERBS_ACCESS_OPTIONAL_FIRST (1 << 20)
  41. #define IB_UVERBS_ACCESS_OPTIONAL_LAST (1 << 29)
  42. enum ib_uverbs_core_support {
  43. IB_UVERBS_CORE_SUPPORT_OPTIONAL_MR_ACCESS = 1 << 0,
  44. };
  45. enum ib_uverbs_access_flags {
  46. IB_UVERBS_ACCESS_LOCAL_WRITE = 1 << 0,
  47. IB_UVERBS_ACCESS_REMOTE_WRITE = 1 << 1,
  48. IB_UVERBS_ACCESS_REMOTE_READ = 1 << 2,
  49. IB_UVERBS_ACCESS_REMOTE_ATOMIC = 1 << 3,
  50. IB_UVERBS_ACCESS_MW_BIND = 1 << 4,
  51. IB_UVERBS_ACCESS_ZERO_BASED = 1 << 5,
  52. IB_UVERBS_ACCESS_ON_DEMAND = 1 << 6,
  53. IB_UVERBS_ACCESS_HUGETLB = 1 << 7,
  54. IB_UVERBS_ACCESS_FLUSH_GLOBAL = 1 << 8,
  55. IB_UVERBS_ACCESS_FLUSH_PERSISTENT = 1 << 9,
  56. IB_UVERBS_ACCESS_RELAXED_ORDERING = IB_UVERBS_ACCESS_OPTIONAL_FIRST,
  57. IB_UVERBS_ACCESS_OPTIONAL_RANGE =
  58. ((IB_UVERBS_ACCESS_OPTIONAL_LAST << 1) - 1) &
  59. ~(IB_UVERBS_ACCESS_OPTIONAL_FIRST - 1)
  60. };
  61. enum ib_uverbs_srq_type {
  62. IB_UVERBS_SRQT_BASIC,
  63. IB_UVERBS_SRQT_XRC,
  64. IB_UVERBS_SRQT_TM,
  65. };
  66. enum ib_uverbs_wq_type {
  67. IB_UVERBS_WQT_RQ,
  68. };
  69. enum ib_uverbs_wq_flags {
  70. IB_UVERBS_WQ_FLAGS_CVLAN_STRIPPING = 1 << 0,
  71. IB_UVERBS_WQ_FLAGS_SCATTER_FCS = 1 << 1,
  72. IB_UVERBS_WQ_FLAGS_DELAY_DROP = 1 << 2,
  73. IB_UVERBS_WQ_FLAGS_PCI_WRITE_END_PADDING = 1 << 3,
  74. };
  75. enum ib_uverbs_qp_type {
  76. IB_UVERBS_QPT_RC = 2,
  77. IB_UVERBS_QPT_UC,
  78. IB_UVERBS_QPT_UD,
  79. IB_UVERBS_QPT_RAW_PACKET = 8,
  80. IB_UVERBS_QPT_XRC_INI,
  81. IB_UVERBS_QPT_XRC_TGT,
  82. IB_UVERBS_QPT_DRIVER = 0xFF,
  83. };
  84. enum ib_uverbs_qp_create_flags {
  85. IB_UVERBS_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
  86. IB_UVERBS_QP_CREATE_SCATTER_FCS = 1 << 8,
  87. IB_UVERBS_QP_CREATE_CVLAN_STRIPPING = 1 << 9,
  88. IB_UVERBS_QP_CREATE_PCI_WRITE_END_PADDING = 1 << 11,
  89. IB_UVERBS_QP_CREATE_SQ_SIG_ALL = 1 << 12,
  90. };
  91. enum ib_uverbs_query_port_cap_flags {
  92. IB_UVERBS_PCF_SM = 1 << 1,
  93. IB_UVERBS_PCF_NOTICE_SUP = 1 << 2,
  94. IB_UVERBS_PCF_TRAP_SUP = 1 << 3,
  95. IB_UVERBS_PCF_OPT_IPD_SUP = 1 << 4,
  96. IB_UVERBS_PCF_AUTO_MIGR_SUP = 1 << 5,
  97. IB_UVERBS_PCF_SL_MAP_SUP = 1 << 6,
  98. IB_UVERBS_PCF_MKEY_NVRAM = 1 << 7,
  99. IB_UVERBS_PCF_PKEY_NVRAM = 1 << 8,
  100. IB_UVERBS_PCF_LED_INFO_SUP = 1 << 9,
  101. IB_UVERBS_PCF_SM_DISABLED = 1 << 10,
  102. IB_UVERBS_PCF_SYS_IMAGE_GUID_SUP = 1 << 11,
  103. IB_UVERBS_PCF_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
  104. IB_UVERBS_PCF_EXTENDED_SPEEDS_SUP = 1 << 14,
  105. IB_UVERBS_PCF_CM_SUP = 1 << 16,
  106. IB_UVERBS_PCF_SNMP_TUNNEL_SUP = 1 << 17,
  107. IB_UVERBS_PCF_REINIT_SUP = 1 << 18,
  108. IB_UVERBS_PCF_DEVICE_MGMT_SUP = 1 << 19,
  109. IB_UVERBS_PCF_VENDOR_CLASS_SUP = 1 << 20,
  110. IB_UVERBS_PCF_DR_NOTICE_SUP = 1 << 21,
  111. IB_UVERBS_PCF_CAP_MASK_NOTICE_SUP = 1 << 22,
  112. IB_UVERBS_PCF_BOOT_MGMT_SUP = 1 << 23,
  113. IB_UVERBS_PCF_LINK_LATENCY_SUP = 1 << 24,
  114. IB_UVERBS_PCF_CLIENT_REG_SUP = 1 << 25,
  115. /*
  116. * IsOtherLocalChangesNoticeSupported is aliased by IP_BASED_GIDS and
  117. * is inaccessible
  118. */
  119. IB_UVERBS_PCF_LINK_SPEED_WIDTH_TABLE_SUP = 1 << 27,
  120. IB_UVERBS_PCF_VENDOR_SPECIFIC_MADS_TABLE_SUP = 1 << 28,
  121. IB_UVERBS_PCF_MCAST_PKEY_TRAP_SUPPRESSION_SUP = 1 << 29,
  122. IB_UVERBS_PCF_MCAST_FDB_TOP_SUP = 1 << 30,
  123. IB_UVERBS_PCF_HIERARCHY_INFO_SUP = 1ULL << 31,
  124. /* NOTE this is an internal flag, not an IBA flag */
  125. IB_UVERBS_PCF_IP_BASED_GIDS = 1 << 26,
  126. };
  127. enum ib_uverbs_query_port_flags {
  128. IB_UVERBS_QPF_GRH_REQUIRED = 1 << 0,
  129. };
  130. enum ib_uverbs_flow_action_esp_keymat {
  131. IB_UVERBS_FLOW_ACTION_ESP_KEYMAT_AES_GCM,
  132. };
  133. enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo {
  134. IB_UVERBS_FLOW_ACTION_IV_ALGO_SEQ,
  135. };
  136. struct ib_uverbs_flow_action_esp_keymat_aes_gcm {
  137. __aligned_u64 iv;
  138. __u32 iv_algo; /* Use enum ib_uverbs_flow_action_esp_keymat_aes_gcm_iv_algo */
  139. __u32 salt;
  140. __u32 icv_len;
  141. __u32 key_len;
  142. __u32 aes_key[256 / 32];
  143. };
  144. enum ib_uverbs_flow_action_esp_replay {
  145. IB_UVERBS_FLOW_ACTION_ESP_REPLAY_NONE,
  146. IB_UVERBS_FLOW_ACTION_ESP_REPLAY_BMP,
  147. };
  148. struct ib_uverbs_flow_action_esp_replay_bmp {
  149. __u32 size;
  150. };
  151. enum ib_uverbs_flow_action_esp_flags {
  152. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_INLINE_CRYPTO = 0UL << 0, /* Default */
  153. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_FULL_OFFLOAD = 1UL << 0,
  154. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TUNNEL = 0UL << 1, /* Default */
  155. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_TRANSPORT = 1UL << 1,
  156. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_DECRYPT = 0UL << 2, /* Default */
  157. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ENCRYPT = 1UL << 2,
  158. IB_UVERBS_FLOW_ACTION_ESP_FLAGS_ESN_NEW_WINDOW = 1UL << 3,
  159. };
  160. struct ib_uverbs_flow_action_esp_encap {
  161. /* This struct represents a list of pointers to flow_xxxx_filter that
  162. * encapsulates the payload in ESP tunnel mode.
  163. */
  164. RDMA_UAPI_PTR(void *, val_ptr); /* pointer to a flow_xxxx_filter */
  165. RDMA_UAPI_PTR(struct ib_uverbs_flow_action_esp_encap *, next_ptr);
  166. __u16 len; /* Len of the filter struct val_ptr points to */
  167. __u16 type; /* Use flow_spec_type enum */
  168. };
  169. struct ib_uverbs_flow_action_esp {
  170. __u32 spi;
  171. __u32 seq;
  172. __u32 tfc_pad;
  173. __u32 flags;
  174. __aligned_u64 hard_limit_pkts;
  175. };
  176. enum ib_uverbs_read_counters_flags {
  177. /* prefer read values from driver cache */
  178. IB_UVERBS_READ_COUNTERS_PREFER_CACHED = 1 << 0,
  179. };
  180. enum ib_uverbs_advise_mr_advice {
  181. IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH,
  182. IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_WRITE,
  183. IB_UVERBS_ADVISE_MR_ADVICE_PREFETCH_NO_FAULT,
  184. };
  185. enum ib_uverbs_advise_mr_flag {
  186. IB_UVERBS_ADVISE_MR_FLAG_FLUSH = 1 << 0,
  187. };
  188. struct ib_uverbs_query_port_resp_ex {
  189. struct ib_uverbs_query_port_resp legacy_resp;
  190. __u16 port_cap_flags2;
  191. __u8 reserved[6];
  192. };
  193. struct ib_uverbs_qp_cap {
  194. __u32 max_send_wr;
  195. __u32 max_recv_wr;
  196. __u32 max_send_sge;
  197. __u32 max_recv_sge;
  198. __u32 max_inline_data;
  199. };
  200. enum rdma_driver_id {
  201. RDMA_DRIVER_UNKNOWN,
  202. RDMA_DRIVER_MLX5,
  203. RDMA_DRIVER_MLX4,
  204. RDMA_DRIVER_CXGB3,
  205. RDMA_DRIVER_CXGB4,
  206. RDMA_DRIVER_MTHCA,
  207. RDMA_DRIVER_BNXT_RE,
  208. RDMA_DRIVER_OCRDMA,
  209. RDMA_DRIVER_NES,
  210. RDMA_DRIVER_I40IW,
  211. RDMA_DRIVER_IRDMA = RDMA_DRIVER_I40IW,
  212. RDMA_DRIVER_VMW_PVRDMA,
  213. RDMA_DRIVER_QEDR,
  214. RDMA_DRIVER_HNS,
  215. RDMA_DRIVER_USNIC,
  216. RDMA_DRIVER_RXE,
  217. RDMA_DRIVER_HFI1,
  218. RDMA_DRIVER_QIB,
  219. RDMA_DRIVER_EFA,
  220. RDMA_DRIVER_SIW,
  221. RDMA_DRIVER_ERDMA,
  222. RDMA_DRIVER_MANA,
  223. };
  224. enum ib_uverbs_gid_type {
  225. IB_UVERBS_GID_TYPE_IB,
  226. IB_UVERBS_GID_TYPE_ROCE_V1,
  227. IB_UVERBS_GID_TYPE_ROCE_V2,
  228. };
  229. struct ib_uverbs_gid_entry {
  230. __aligned_u64 gid[2];
  231. __u32 gid_index;
  232. __u32 port_num;
  233. __u32 gid_type;
  234. __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */
  235. };
  236. #endif