ib_user_ioctl_cmds.h 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. /*
  2. * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved.
  3. * Copyright (c) 2020, Intel Corporation. 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_CMDS_H
  34. #define IB_USER_IOCTL_CMDS_H
  35. #define UVERBS_ID_NS_MASK 0xF000
  36. #define UVERBS_ID_NS_SHIFT 12
  37. #define UVERBS_UDATA_DRIVER_DATA_NS 1
  38. #define UVERBS_UDATA_DRIVER_DATA_FLAG (1UL << UVERBS_ID_NS_SHIFT)
  39. enum uverbs_default_objects {
  40. UVERBS_OBJECT_DEVICE, /* No instances of DEVICE are allowed */
  41. UVERBS_OBJECT_PD,
  42. UVERBS_OBJECT_COMP_CHANNEL,
  43. UVERBS_OBJECT_CQ,
  44. UVERBS_OBJECT_QP,
  45. UVERBS_OBJECT_SRQ,
  46. UVERBS_OBJECT_AH,
  47. UVERBS_OBJECT_MR,
  48. UVERBS_OBJECT_MW,
  49. UVERBS_OBJECT_FLOW,
  50. UVERBS_OBJECT_XRCD,
  51. UVERBS_OBJECT_RWQ_IND_TBL,
  52. UVERBS_OBJECT_WQ,
  53. UVERBS_OBJECT_FLOW_ACTION,
  54. UVERBS_OBJECT_DM,
  55. UVERBS_OBJECT_COUNTERS,
  56. UVERBS_OBJECT_ASYNC_EVENT,
  57. };
  58. enum {
  59. UVERBS_ATTR_UHW_IN = UVERBS_UDATA_DRIVER_DATA_FLAG,
  60. UVERBS_ATTR_UHW_OUT,
  61. };
  62. enum uverbs_methods_device {
  63. UVERBS_METHOD_INVOKE_WRITE,
  64. UVERBS_METHOD_INFO_HANDLES,
  65. UVERBS_METHOD_QUERY_PORT,
  66. UVERBS_METHOD_GET_CONTEXT,
  67. UVERBS_METHOD_QUERY_CONTEXT,
  68. UVERBS_METHOD_QUERY_GID_TABLE,
  69. UVERBS_METHOD_QUERY_GID_ENTRY,
  70. };
  71. enum uverbs_attrs_invoke_write_cmd_attr_ids {
  72. UVERBS_ATTR_CORE_IN,
  73. UVERBS_ATTR_CORE_OUT,
  74. UVERBS_ATTR_WRITE_CMD,
  75. };
  76. enum uverbs_attrs_query_port_cmd_attr_ids {
  77. UVERBS_ATTR_QUERY_PORT_PORT_NUM,
  78. UVERBS_ATTR_QUERY_PORT_RESP,
  79. };
  80. enum uverbs_attrs_get_context_attr_ids {
  81. UVERBS_ATTR_GET_CONTEXT_NUM_COMP_VECTORS,
  82. UVERBS_ATTR_GET_CONTEXT_CORE_SUPPORT,
  83. };
  84. enum uverbs_attrs_query_context_attr_ids {
  85. UVERBS_ATTR_QUERY_CONTEXT_NUM_COMP_VECTORS,
  86. UVERBS_ATTR_QUERY_CONTEXT_CORE_SUPPORT,
  87. };
  88. enum uverbs_attrs_create_cq_cmd_attr_ids {
  89. UVERBS_ATTR_CREATE_CQ_HANDLE,
  90. UVERBS_ATTR_CREATE_CQ_CQE,
  91. UVERBS_ATTR_CREATE_CQ_USER_HANDLE,
  92. UVERBS_ATTR_CREATE_CQ_COMP_CHANNEL,
  93. UVERBS_ATTR_CREATE_CQ_COMP_VECTOR,
  94. UVERBS_ATTR_CREATE_CQ_FLAGS,
  95. UVERBS_ATTR_CREATE_CQ_RESP_CQE,
  96. UVERBS_ATTR_CREATE_CQ_EVENT_FD,
  97. };
  98. enum uverbs_attrs_destroy_cq_cmd_attr_ids {
  99. UVERBS_ATTR_DESTROY_CQ_HANDLE,
  100. UVERBS_ATTR_DESTROY_CQ_RESP,
  101. };
  102. enum uverbs_attrs_create_flow_action_esp {
  103. UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
  104. UVERBS_ATTR_FLOW_ACTION_ESP_ATTRS,
  105. UVERBS_ATTR_FLOW_ACTION_ESP_ESN,
  106. UVERBS_ATTR_FLOW_ACTION_ESP_KEYMAT,
  107. UVERBS_ATTR_FLOW_ACTION_ESP_REPLAY,
  108. UVERBS_ATTR_FLOW_ACTION_ESP_ENCAP,
  109. };
  110. enum uverbs_attrs_modify_flow_action_esp {
  111. UVERBS_ATTR_MODIFY_FLOW_ACTION_ESP_HANDLE =
  112. UVERBS_ATTR_CREATE_FLOW_ACTION_ESP_HANDLE,
  113. };
  114. enum uverbs_attrs_destroy_flow_action_esp {
  115. UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE,
  116. };
  117. enum uverbs_attrs_create_qp_cmd_attr_ids {
  118. UVERBS_ATTR_CREATE_QP_HANDLE,
  119. UVERBS_ATTR_CREATE_QP_XRCD_HANDLE,
  120. UVERBS_ATTR_CREATE_QP_PD_HANDLE,
  121. UVERBS_ATTR_CREATE_QP_SRQ_HANDLE,
  122. UVERBS_ATTR_CREATE_QP_SEND_CQ_HANDLE,
  123. UVERBS_ATTR_CREATE_QP_RECV_CQ_HANDLE,
  124. UVERBS_ATTR_CREATE_QP_IND_TABLE_HANDLE,
  125. UVERBS_ATTR_CREATE_QP_USER_HANDLE,
  126. UVERBS_ATTR_CREATE_QP_CAP,
  127. UVERBS_ATTR_CREATE_QP_TYPE,
  128. UVERBS_ATTR_CREATE_QP_FLAGS,
  129. UVERBS_ATTR_CREATE_QP_SOURCE_QPN,
  130. UVERBS_ATTR_CREATE_QP_EVENT_FD,
  131. UVERBS_ATTR_CREATE_QP_RESP_CAP,
  132. UVERBS_ATTR_CREATE_QP_RESP_QP_NUM,
  133. };
  134. enum uverbs_attrs_destroy_qp_cmd_attr_ids {
  135. UVERBS_ATTR_DESTROY_QP_HANDLE,
  136. UVERBS_ATTR_DESTROY_QP_RESP,
  137. };
  138. enum uverbs_methods_qp {
  139. UVERBS_METHOD_QP_CREATE,
  140. UVERBS_METHOD_QP_DESTROY,
  141. };
  142. enum uverbs_attrs_create_srq_cmd_attr_ids {
  143. UVERBS_ATTR_CREATE_SRQ_HANDLE,
  144. UVERBS_ATTR_CREATE_SRQ_PD_HANDLE,
  145. UVERBS_ATTR_CREATE_SRQ_XRCD_HANDLE,
  146. UVERBS_ATTR_CREATE_SRQ_CQ_HANDLE,
  147. UVERBS_ATTR_CREATE_SRQ_USER_HANDLE,
  148. UVERBS_ATTR_CREATE_SRQ_MAX_WR,
  149. UVERBS_ATTR_CREATE_SRQ_MAX_SGE,
  150. UVERBS_ATTR_CREATE_SRQ_LIMIT,
  151. UVERBS_ATTR_CREATE_SRQ_MAX_NUM_TAGS,
  152. UVERBS_ATTR_CREATE_SRQ_TYPE,
  153. UVERBS_ATTR_CREATE_SRQ_EVENT_FD,
  154. UVERBS_ATTR_CREATE_SRQ_RESP_MAX_WR,
  155. UVERBS_ATTR_CREATE_SRQ_RESP_MAX_SGE,
  156. UVERBS_ATTR_CREATE_SRQ_RESP_SRQ_NUM,
  157. };
  158. enum uverbs_attrs_destroy_srq_cmd_attr_ids {
  159. UVERBS_ATTR_DESTROY_SRQ_HANDLE,
  160. UVERBS_ATTR_DESTROY_SRQ_RESP,
  161. };
  162. enum uverbs_methods_srq {
  163. UVERBS_METHOD_SRQ_CREATE,
  164. UVERBS_METHOD_SRQ_DESTROY,
  165. };
  166. enum uverbs_methods_cq {
  167. UVERBS_METHOD_CQ_CREATE,
  168. UVERBS_METHOD_CQ_DESTROY,
  169. };
  170. enum uverbs_attrs_create_wq_cmd_attr_ids {
  171. UVERBS_ATTR_CREATE_WQ_HANDLE,
  172. UVERBS_ATTR_CREATE_WQ_PD_HANDLE,
  173. UVERBS_ATTR_CREATE_WQ_CQ_HANDLE,
  174. UVERBS_ATTR_CREATE_WQ_USER_HANDLE,
  175. UVERBS_ATTR_CREATE_WQ_TYPE,
  176. UVERBS_ATTR_CREATE_WQ_EVENT_FD,
  177. UVERBS_ATTR_CREATE_WQ_MAX_WR,
  178. UVERBS_ATTR_CREATE_WQ_MAX_SGE,
  179. UVERBS_ATTR_CREATE_WQ_FLAGS,
  180. UVERBS_ATTR_CREATE_WQ_RESP_MAX_WR,
  181. UVERBS_ATTR_CREATE_WQ_RESP_MAX_SGE,
  182. UVERBS_ATTR_CREATE_WQ_RESP_WQ_NUM,
  183. };
  184. enum uverbs_attrs_destroy_wq_cmd_attr_ids {
  185. UVERBS_ATTR_DESTROY_WQ_HANDLE,
  186. UVERBS_ATTR_DESTROY_WQ_RESP,
  187. };
  188. enum uverbs_methods_wq {
  189. UVERBS_METHOD_WQ_CREATE,
  190. UVERBS_METHOD_WQ_DESTROY,
  191. };
  192. enum uverbs_methods_actions_flow_action_ops {
  193. UVERBS_METHOD_FLOW_ACTION_ESP_CREATE,
  194. UVERBS_METHOD_FLOW_ACTION_DESTROY,
  195. UVERBS_METHOD_FLOW_ACTION_ESP_MODIFY,
  196. };
  197. enum uverbs_attrs_alloc_dm_cmd_attr_ids {
  198. UVERBS_ATTR_ALLOC_DM_HANDLE,
  199. UVERBS_ATTR_ALLOC_DM_LENGTH,
  200. UVERBS_ATTR_ALLOC_DM_ALIGNMENT,
  201. };
  202. enum uverbs_attrs_free_dm_cmd_attr_ids {
  203. UVERBS_ATTR_FREE_DM_HANDLE,
  204. };
  205. enum uverbs_methods_dm {
  206. UVERBS_METHOD_DM_ALLOC,
  207. UVERBS_METHOD_DM_FREE,
  208. };
  209. enum uverbs_attrs_reg_dm_mr_cmd_attr_ids {
  210. UVERBS_ATTR_REG_DM_MR_HANDLE,
  211. UVERBS_ATTR_REG_DM_MR_OFFSET,
  212. UVERBS_ATTR_REG_DM_MR_LENGTH,
  213. UVERBS_ATTR_REG_DM_MR_PD_HANDLE,
  214. UVERBS_ATTR_REG_DM_MR_ACCESS_FLAGS,
  215. UVERBS_ATTR_REG_DM_MR_DM_HANDLE,
  216. UVERBS_ATTR_REG_DM_MR_RESP_LKEY,
  217. UVERBS_ATTR_REG_DM_MR_RESP_RKEY,
  218. };
  219. enum uverbs_methods_mr {
  220. UVERBS_METHOD_DM_MR_REG,
  221. UVERBS_METHOD_MR_DESTROY,
  222. UVERBS_METHOD_ADVISE_MR,
  223. UVERBS_METHOD_QUERY_MR,
  224. UVERBS_METHOD_REG_DMABUF_MR,
  225. };
  226. enum uverbs_attrs_mr_destroy_ids {
  227. UVERBS_ATTR_DESTROY_MR_HANDLE,
  228. };
  229. enum uverbs_attrs_advise_mr_cmd_attr_ids {
  230. UVERBS_ATTR_ADVISE_MR_PD_HANDLE,
  231. UVERBS_ATTR_ADVISE_MR_ADVICE,
  232. UVERBS_ATTR_ADVISE_MR_FLAGS,
  233. UVERBS_ATTR_ADVISE_MR_SGE_LIST,
  234. };
  235. enum uverbs_attrs_query_mr_cmd_attr_ids {
  236. UVERBS_ATTR_QUERY_MR_HANDLE,
  237. UVERBS_ATTR_QUERY_MR_RESP_LKEY,
  238. UVERBS_ATTR_QUERY_MR_RESP_RKEY,
  239. UVERBS_ATTR_QUERY_MR_RESP_LENGTH,
  240. UVERBS_ATTR_QUERY_MR_RESP_IOVA,
  241. };
  242. enum uverbs_attrs_reg_dmabuf_mr_cmd_attr_ids {
  243. UVERBS_ATTR_REG_DMABUF_MR_HANDLE,
  244. UVERBS_ATTR_REG_DMABUF_MR_PD_HANDLE,
  245. UVERBS_ATTR_REG_DMABUF_MR_OFFSET,
  246. UVERBS_ATTR_REG_DMABUF_MR_LENGTH,
  247. UVERBS_ATTR_REG_DMABUF_MR_IOVA,
  248. UVERBS_ATTR_REG_DMABUF_MR_FD,
  249. UVERBS_ATTR_REG_DMABUF_MR_ACCESS_FLAGS,
  250. UVERBS_ATTR_REG_DMABUF_MR_RESP_LKEY,
  251. UVERBS_ATTR_REG_DMABUF_MR_RESP_RKEY,
  252. };
  253. enum uverbs_attrs_create_counters_cmd_attr_ids {
  254. UVERBS_ATTR_CREATE_COUNTERS_HANDLE,
  255. };
  256. enum uverbs_attrs_destroy_counters_cmd_attr_ids {
  257. UVERBS_ATTR_DESTROY_COUNTERS_HANDLE,
  258. };
  259. enum uverbs_attrs_read_counters_cmd_attr_ids {
  260. UVERBS_ATTR_READ_COUNTERS_HANDLE,
  261. UVERBS_ATTR_READ_COUNTERS_BUFF,
  262. UVERBS_ATTR_READ_COUNTERS_FLAGS,
  263. };
  264. enum uverbs_methods_actions_counters_ops {
  265. UVERBS_METHOD_COUNTERS_CREATE,
  266. UVERBS_METHOD_COUNTERS_DESTROY,
  267. UVERBS_METHOD_COUNTERS_READ,
  268. };
  269. enum uverbs_attrs_info_handles_id {
  270. UVERBS_ATTR_INFO_OBJECT_ID,
  271. UVERBS_ATTR_INFO_TOTAL_HANDLES,
  272. UVERBS_ATTR_INFO_HANDLES_LIST,
  273. };
  274. enum uverbs_methods_pd {
  275. UVERBS_METHOD_PD_DESTROY,
  276. };
  277. enum uverbs_attrs_pd_destroy_ids {
  278. UVERBS_ATTR_DESTROY_PD_HANDLE,
  279. };
  280. enum uverbs_methods_mw {
  281. UVERBS_METHOD_MW_DESTROY,
  282. };
  283. enum uverbs_attrs_mw_destroy_ids {
  284. UVERBS_ATTR_DESTROY_MW_HANDLE,
  285. };
  286. enum uverbs_methods_xrcd {
  287. UVERBS_METHOD_XRCD_DESTROY,
  288. };
  289. enum uverbs_attrs_xrcd_destroy_ids {
  290. UVERBS_ATTR_DESTROY_XRCD_HANDLE,
  291. };
  292. enum uverbs_methods_ah {
  293. UVERBS_METHOD_AH_DESTROY,
  294. };
  295. enum uverbs_attrs_ah_destroy_ids {
  296. UVERBS_ATTR_DESTROY_AH_HANDLE,
  297. };
  298. enum uverbs_methods_rwq_ind_tbl {
  299. UVERBS_METHOD_RWQ_IND_TBL_DESTROY,
  300. };
  301. enum uverbs_attrs_rwq_ind_tbl_destroy_ids {
  302. UVERBS_ATTR_DESTROY_RWQ_IND_TBL_HANDLE,
  303. };
  304. enum uverbs_methods_flow {
  305. UVERBS_METHOD_FLOW_DESTROY,
  306. };
  307. enum uverbs_attrs_flow_destroy_ids {
  308. UVERBS_ATTR_DESTROY_FLOW_HANDLE,
  309. };
  310. enum uverbs_method_async_event {
  311. UVERBS_METHOD_ASYNC_EVENT_ALLOC,
  312. };
  313. enum uverbs_attrs_async_event_create {
  314. UVERBS_ATTR_ASYNC_EVENT_ALLOC_FD_HANDLE,
  315. };
  316. enum uverbs_attrs_query_gid_table_cmd_attr_ids {
  317. UVERBS_ATTR_QUERY_GID_TABLE_ENTRY_SIZE,
  318. UVERBS_ATTR_QUERY_GID_TABLE_FLAGS,
  319. UVERBS_ATTR_QUERY_GID_TABLE_RESP_ENTRIES,
  320. UVERBS_ATTR_QUERY_GID_TABLE_RESP_NUM_ENTRIES,
  321. };
  322. enum uverbs_attrs_query_gid_entry_cmd_attr_ids {
  323. UVERBS_ATTR_QUERY_GID_ENTRY_PORT,
  324. UVERBS_ATTR_QUERY_GID_ENTRY_GID_INDEX,
  325. UVERBS_ATTR_QUERY_GID_ENTRY_FLAGS,
  326. UVERBS_ATTR_QUERY_GID_ENTRY_RESP_ENTRY,
  327. };
  328. #endif