mlx5_user_ioctl_cmds.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350
  1. /*
  2. * Copyright (c) 2018, Mellanox Technologies inc. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef MLX5_USER_IOCTL_CMDS_H
  33. #define MLX5_USER_IOCTL_CMDS_H
  34. #include <linux/types.h>
  35. #include <rdma/ib_user_ioctl_cmds.h>
  36. enum mlx5_ib_create_flow_action_attrs {
  37. /* This attribute belong to the driver namespace */
  38. MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT),
  39. };
  40. enum mlx5_ib_dm_methods {
  41. MLX5_IB_METHOD_DM_MAP_OP_ADDR = (1U << UVERBS_ID_NS_SHIFT),
  42. MLX5_IB_METHOD_DM_QUERY,
  43. };
  44. enum mlx5_ib_dm_map_op_addr_attrs {
  45. MLX5_IB_ATTR_DM_MAP_OP_ADDR_REQ_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  46. MLX5_IB_ATTR_DM_MAP_OP_ADDR_REQ_OP,
  47. MLX5_IB_ATTR_DM_MAP_OP_ADDR_RESP_START_OFFSET,
  48. MLX5_IB_ATTR_DM_MAP_OP_ADDR_RESP_PAGE_INDEX,
  49. };
  50. enum mlx5_ib_query_dm_attrs {
  51. MLX5_IB_ATTR_QUERY_DM_REQ_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  52. MLX5_IB_ATTR_QUERY_DM_RESP_START_OFFSET,
  53. MLX5_IB_ATTR_QUERY_DM_RESP_PAGE_INDEX,
  54. MLX5_IB_ATTR_QUERY_DM_RESP_LENGTH,
  55. };
  56. enum mlx5_ib_alloc_dm_attrs {
  57. MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT),
  58. MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX,
  59. MLX5_IB_ATTR_ALLOC_DM_REQ_TYPE,
  60. };
  61. enum mlx5_ib_devx_methods {
  62. MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT),
  63. MLX5_IB_METHOD_DEVX_QUERY_UAR,
  64. MLX5_IB_METHOD_DEVX_QUERY_EQN,
  65. MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT,
  66. };
  67. enum mlx5_ib_devx_other_attrs {
  68. MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT),
  69. MLX5_IB_ATTR_DEVX_OTHER_CMD_OUT,
  70. };
  71. enum mlx5_ib_devx_obj_create_attrs {
  72. MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  73. MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_IN,
  74. MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT,
  75. };
  76. enum mlx5_ib_devx_query_uar_attrs {
  77. MLX5_IB_ATTR_DEVX_QUERY_UAR_USER_IDX = (1U << UVERBS_ID_NS_SHIFT),
  78. MLX5_IB_ATTR_DEVX_QUERY_UAR_DEV_IDX,
  79. };
  80. enum mlx5_ib_devx_obj_destroy_attrs {
  81. MLX5_IB_ATTR_DEVX_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  82. };
  83. enum mlx5_ib_devx_obj_modify_attrs {
  84. MLX5_IB_ATTR_DEVX_OBJ_MODIFY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  85. MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN,
  86. MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_OUT,
  87. };
  88. enum mlx5_ib_devx_obj_query_attrs {
  89. MLX5_IB_ATTR_DEVX_OBJ_QUERY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  90. MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_IN,
  91. MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_OUT,
  92. };
  93. enum mlx5_ib_devx_obj_query_async_attrs {
  94. MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  95. MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_CMD_IN,
  96. MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_FD,
  97. MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_WR_ID,
  98. MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN,
  99. };
  100. enum mlx5_ib_devx_subscribe_event_attrs {
  101. MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  102. MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE,
  103. MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST,
  104. MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM,
  105. MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE,
  106. };
  107. enum mlx5_ib_devx_query_eqn_attrs {
  108. MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT),
  109. MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN,
  110. };
  111. enum mlx5_ib_devx_obj_methods {
  112. MLX5_IB_METHOD_DEVX_OBJ_CREATE = (1U << UVERBS_ID_NS_SHIFT),
  113. MLX5_IB_METHOD_DEVX_OBJ_DESTROY,
  114. MLX5_IB_METHOD_DEVX_OBJ_MODIFY,
  115. MLX5_IB_METHOD_DEVX_OBJ_QUERY,
  116. MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY,
  117. };
  118. enum mlx5_ib_var_alloc_attrs {
  119. MLX5_IB_ATTR_VAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  120. MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_OFFSET,
  121. MLX5_IB_ATTR_VAR_OBJ_ALLOC_MMAP_LENGTH,
  122. MLX5_IB_ATTR_VAR_OBJ_ALLOC_PAGE_ID,
  123. };
  124. enum mlx5_ib_var_obj_destroy_attrs {
  125. MLX5_IB_ATTR_VAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  126. };
  127. enum mlx5_ib_var_obj_methods {
  128. MLX5_IB_METHOD_VAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
  129. MLX5_IB_METHOD_VAR_OBJ_DESTROY,
  130. };
  131. enum mlx5_ib_uar_alloc_attrs {
  132. MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  133. MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE,
  134. MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET,
  135. MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH,
  136. MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID,
  137. };
  138. enum mlx5_ib_uar_obj_destroy_attrs {
  139. MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  140. };
  141. enum mlx5_ib_uar_obj_methods {
  142. MLX5_IB_METHOD_UAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
  143. MLX5_IB_METHOD_UAR_OBJ_DESTROY,
  144. };
  145. enum mlx5_ib_devx_umem_reg_attrs {
  146. MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  147. MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR,
  148. MLX5_IB_ATTR_DEVX_UMEM_REG_LEN,
  149. MLX5_IB_ATTR_DEVX_UMEM_REG_ACCESS,
  150. MLX5_IB_ATTR_DEVX_UMEM_REG_OUT_ID,
  151. MLX5_IB_ATTR_DEVX_UMEM_REG_PGSZ_BITMAP,
  152. MLX5_IB_ATTR_DEVX_UMEM_REG_DMABUF_FD,
  153. };
  154. enum mlx5_ib_devx_umem_dereg_attrs {
  155. MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  156. };
  157. enum mlx5_ib_pp_obj_methods {
  158. MLX5_IB_METHOD_PP_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
  159. MLX5_IB_METHOD_PP_OBJ_DESTROY,
  160. };
  161. enum mlx5_ib_pp_alloc_attrs {
  162. MLX5_IB_ATTR_PP_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  163. MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX,
  164. MLX5_IB_ATTR_PP_OBJ_ALLOC_FLAGS,
  165. MLX5_IB_ATTR_PP_OBJ_ALLOC_INDEX,
  166. };
  167. enum mlx5_ib_pp_obj_destroy_attrs {
  168. MLX5_IB_ATTR_PP_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  169. };
  170. enum mlx5_ib_devx_umem_methods {
  171. MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT),
  172. MLX5_IB_METHOD_DEVX_UMEM_DEREG,
  173. };
  174. enum mlx5_ib_devx_async_cmd_fd_alloc_attrs {
  175. MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  176. };
  177. enum mlx5_ib_devx_async_event_fd_alloc_attrs {
  178. MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  179. MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS,
  180. };
  181. enum mlx5_ib_devx_async_cmd_fd_methods {
  182. MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
  183. };
  184. enum mlx5_ib_devx_async_event_fd_methods {
  185. MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT),
  186. };
  187. enum mlx5_ib_objects {
  188. MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT),
  189. MLX5_IB_OBJECT_DEVX_OBJ,
  190. MLX5_IB_OBJECT_DEVX_UMEM,
  191. MLX5_IB_OBJECT_FLOW_MATCHER,
  192. MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD,
  193. MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD,
  194. MLX5_IB_OBJECT_VAR,
  195. MLX5_IB_OBJECT_PP,
  196. MLX5_IB_OBJECT_UAR,
  197. MLX5_IB_OBJECT_STEERING_ANCHOR,
  198. };
  199. enum mlx5_ib_flow_matcher_create_attrs {
  200. MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  201. MLX5_IB_ATTR_FLOW_MATCHER_MATCH_MASK,
  202. MLX5_IB_ATTR_FLOW_MATCHER_FLOW_TYPE,
  203. MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA,
  204. MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS,
  205. MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE,
  206. };
  207. enum mlx5_ib_flow_matcher_destroy_attrs {
  208. MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  209. };
  210. enum mlx5_ib_flow_matcher_methods {
  211. MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT),
  212. MLX5_IB_METHOD_FLOW_MATCHER_DESTROY,
  213. };
  214. enum mlx5_ib_flow_steering_anchor_create_attrs {
  215. MLX5_IB_ATTR_STEERING_ANCHOR_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  216. MLX5_IB_ATTR_STEERING_ANCHOR_FT_TYPE,
  217. MLX5_IB_ATTR_STEERING_ANCHOR_PRIORITY,
  218. MLX5_IB_ATTR_STEERING_ANCHOR_FT_ID,
  219. };
  220. enum mlx5_ib_flow_steering_anchor_destroy_attrs {
  221. MLX5_IB_ATTR_STEERING_ANCHOR_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  222. };
  223. enum mlx5_ib_steering_anchor_methods {
  224. MLX5_IB_METHOD_STEERING_ANCHOR_CREATE = (1U << UVERBS_ID_NS_SHIFT),
  225. MLX5_IB_METHOD_STEERING_ANCHOR_DESTROY,
  226. };
  227. enum mlx5_ib_device_query_context_attrs {
  228. MLX5_IB_ATTR_QUERY_CONTEXT_RESP_UCTX = (1U << UVERBS_ID_NS_SHIFT),
  229. };
  230. #define MLX5_IB_DW_MATCH_PARAM 0xA0
  231. struct mlx5_ib_match_params {
  232. __u32 match_params[MLX5_IB_DW_MATCH_PARAM];
  233. };
  234. enum mlx5_ib_flow_type {
  235. MLX5_IB_FLOW_TYPE_NORMAL,
  236. MLX5_IB_FLOW_TYPE_SNIFFER,
  237. MLX5_IB_FLOW_TYPE_ALL_DEFAULT,
  238. MLX5_IB_FLOW_TYPE_MC_DEFAULT,
  239. };
  240. enum mlx5_ib_create_flow_flags {
  241. MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DEFAULT_MISS = 1 << 0,
  242. MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP = 1 << 1,
  243. };
  244. enum mlx5_ib_create_flow_attrs {
  245. MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  246. MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE,
  247. MLX5_IB_ATTR_CREATE_FLOW_DEST_QP,
  248. MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX,
  249. MLX5_IB_ATTR_CREATE_FLOW_MATCHER,
  250. MLX5_IB_ATTR_CREATE_FLOW_ARR_FLOW_ACTIONS,
  251. MLX5_IB_ATTR_CREATE_FLOW_TAG,
  252. MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX,
  253. MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET,
  254. MLX5_IB_ATTR_CREATE_FLOW_FLAGS,
  255. };
  256. enum mlx5_ib_destroy_flow_attrs {
  257. MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  258. };
  259. enum mlx5_ib_flow_methods {
  260. MLX5_IB_METHOD_CREATE_FLOW = (1U << UVERBS_ID_NS_SHIFT),
  261. MLX5_IB_METHOD_DESTROY_FLOW,
  262. };
  263. enum mlx5_ib_flow_action_methods {
  264. MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER = (1U << UVERBS_ID_NS_SHIFT),
  265. MLX5_IB_METHOD_FLOW_ACTION_CREATE_PACKET_REFORMAT,
  266. };
  267. enum mlx5_ib_create_flow_action_create_modify_header_attrs {
  268. MLX5_IB_ATTR_CREATE_MODIFY_HEADER_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  269. MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM,
  270. MLX5_IB_ATTR_CREATE_MODIFY_HEADER_FT_TYPE,
  271. };
  272. enum mlx5_ib_create_flow_action_create_packet_reformat_attrs {
  273. MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  274. MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_TYPE,
  275. MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_FT_TYPE,
  276. MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_DATA_BUF,
  277. };
  278. enum mlx5_ib_query_pd_attrs {
  279. MLX5_IB_ATTR_QUERY_PD_HANDLE = (1U << UVERBS_ID_NS_SHIFT),
  280. MLX5_IB_ATTR_QUERY_PD_RESP_PDN,
  281. };
  282. enum mlx5_ib_pd_methods {
  283. MLX5_IB_METHOD_PD_QUERY = (1U << UVERBS_ID_NS_SHIFT),
  284. };
  285. enum mlx5_ib_device_methods {
  286. MLX5_IB_METHOD_QUERY_PORT = (1U << UVERBS_ID_NS_SHIFT),
  287. };
  288. enum mlx5_ib_query_port_attrs {
  289. MLX5_IB_ATTR_QUERY_PORT_PORT_NUM = (1U << UVERBS_ID_NS_SHIFT),
  290. MLX5_IB_ATTR_QUERY_PORT,
  291. };
  292. #endif