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 33 #ifndef MLX5_USER_IOCTL_CMDS_H 34 #define MLX5_USER_IOCTL_CMDS_H 35 36 #include <linux/types.h> 37 #include <rdma/ib_user_ioctl_cmds.h> 38 39 enum mlx5_ib_create_flow_action_attrs { 40 /* This attribute belong to the driver namespace */ 41 MLX5_IB_ATTR_CREATE_FLOW_ACTION_FLAGS = (1U << UVERBS_ID_NS_SHIFT), 42 }; 43 44 enum mlx5_ib_alloc_dm_attrs { 45 MLX5_IB_ATTR_ALLOC_DM_RESP_START_OFFSET = (1U << UVERBS_ID_NS_SHIFT), 46 MLX5_IB_ATTR_ALLOC_DM_RESP_PAGE_INDEX, 47 MLX5_IB_ATTR_ALLOC_DM_REQ_TYPE, 48 }; 49 50 enum mlx5_ib_devx_methods { 51 MLX5_IB_METHOD_DEVX_OTHER = (1U << UVERBS_ID_NS_SHIFT), 52 MLX5_IB_METHOD_DEVX_QUERY_UAR, 53 MLX5_IB_METHOD_DEVX_QUERY_EQN, 54 MLX5_IB_METHOD_DEVX_SUBSCRIBE_EVENT, 55 }; 56 57 enum mlx5_ib_devx_other_attrs { 58 MLX5_IB_ATTR_DEVX_OTHER_CMD_IN = (1U << UVERBS_ID_NS_SHIFT), 59 MLX5_IB_ATTR_DEVX_OTHER_CMD_OUT, 60 }; 61 62 enum mlx5_ib_devx_obj_create_attrs { 63 MLX5_IB_ATTR_DEVX_OBJ_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 64 MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_IN, 65 MLX5_IB_ATTR_DEVX_OBJ_CREATE_CMD_OUT, 66 }; 67 68 enum mlx5_ib_devx_query_uar_attrs { 69 MLX5_IB_ATTR_DEVX_QUERY_UAR_USER_IDX = (1U << UVERBS_ID_NS_SHIFT), 70 MLX5_IB_ATTR_DEVX_QUERY_UAR_DEV_IDX, 71 }; 72 73 enum mlx5_ib_devx_obj_destroy_attrs { 74 MLX5_IB_ATTR_DEVX_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 75 }; 76 77 enum mlx5_ib_devx_obj_modify_attrs { 78 MLX5_IB_ATTR_DEVX_OBJ_MODIFY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 79 MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_IN, 80 MLX5_IB_ATTR_DEVX_OBJ_MODIFY_CMD_OUT, 81 }; 82 83 enum mlx5_ib_devx_obj_query_attrs { 84 MLX5_IB_ATTR_DEVX_OBJ_QUERY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 85 MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_IN, 86 MLX5_IB_ATTR_DEVX_OBJ_QUERY_CMD_OUT, 87 }; 88 89 enum mlx5_ib_devx_obj_query_async_attrs { 90 MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 91 MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_CMD_IN, 92 MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_FD, 93 MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_WR_ID, 94 MLX5_IB_ATTR_DEVX_OBJ_QUERY_ASYNC_OUT_LEN, 95 }; 96 97 enum mlx5_ib_devx_subscribe_event_attrs { 98 MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 99 MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_OBJ_HANDLE, 100 MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_TYPE_NUM_LIST, 101 MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_FD_NUM, 102 MLX5_IB_ATTR_DEVX_SUBSCRIBE_EVENT_COOKIE, 103 }; 104 105 enum mlx5_ib_devx_query_eqn_attrs { 106 MLX5_IB_ATTR_DEVX_QUERY_EQN_USER_VEC = (1U << UVERBS_ID_NS_SHIFT), 107 MLX5_IB_ATTR_DEVX_QUERY_EQN_DEV_EQN, 108 }; 109 110 enum mlx5_ib_devx_obj_methods { 111 MLX5_IB_METHOD_DEVX_OBJ_CREATE = (1U << UVERBS_ID_NS_SHIFT), 112 MLX5_IB_METHOD_DEVX_OBJ_DESTROY, 113 MLX5_IB_METHOD_DEVX_OBJ_MODIFY, 114 MLX5_IB_METHOD_DEVX_OBJ_QUERY, 115 MLX5_IB_METHOD_DEVX_OBJ_ASYNC_QUERY, 116 }; 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 125 enum mlx5_ib_var_obj_destroy_attrs { 126 MLX5_IB_ATTR_VAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 127 }; 128 129 enum mlx5_ib_var_obj_methods { 130 MLX5_IB_METHOD_VAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), 131 MLX5_IB_METHOD_VAR_OBJ_DESTROY, 132 }; 133 134 enum mlx5_ib_uar_alloc_attrs { 135 MLX5_IB_ATTR_UAR_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 136 MLX5_IB_ATTR_UAR_OBJ_ALLOC_TYPE, 137 MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_OFFSET, 138 MLX5_IB_ATTR_UAR_OBJ_ALLOC_MMAP_LENGTH, 139 MLX5_IB_ATTR_UAR_OBJ_ALLOC_PAGE_ID, 140 }; 141 142 enum mlx5_ib_uar_obj_destroy_attrs { 143 MLX5_IB_ATTR_UAR_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 144 }; 145 146 enum mlx5_ib_uar_obj_methods { 147 MLX5_IB_METHOD_UAR_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), 148 MLX5_IB_METHOD_UAR_OBJ_DESTROY, 149 }; 150 151 enum mlx5_ib_devx_umem_reg_attrs { 152 MLX5_IB_ATTR_DEVX_UMEM_REG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 153 MLX5_IB_ATTR_DEVX_UMEM_REG_ADDR, 154 MLX5_IB_ATTR_DEVX_UMEM_REG_LEN, 155 MLX5_IB_ATTR_DEVX_UMEM_REG_ACCESS, 156 MLX5_IB_ATTR_DEVX_UMEM_REG_OUT_ID, 157 }; 158 159 enum mlx5_ib_devx_umem_dereg_attrs { 160 MLX5_IB_ATTR_DEVX_UMEM_DEREG_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 161 }; 162 163 enum mlx5_ib_pp_obj_methods { 164 MLX5_IB_METHOD_PP_OBJ_ALLOC = (1U << UVERBS_ID_NS_SHIFT), 165 MLX5_IB_METHOD_PP_OBJ_DESTROY, 166 }; 167 168 enum mlx5_ib_pp_alloc_attrs { 169 MLX5_IB_ATTR_PP_OBJ_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 170 MLX5_IB_ATTR_PP_OBJ_ALLOC_CTX, 171 MLX5_IB_ATTR_PP_OBJ_ALLOC_FLAGS, 172 MLX5_IB_ATTR_PP_OBJ_ALLOC_INDEX, 173 }; 174 175 enum mlx5_ib_pp_obj_destroy_attrs { 176 MLX5_IB_ATTR_PP_OBJ_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 177 }; 178 179 enum mlx5_ib_devx_umem_methods { 180 MLX5_IB_METHOD_DEVX_UMEM_REG = (1U << UVERBS_ID_NS_SHIFT), 181 MLX5_IB_METHOD_DEVX_UMEM_DEREG, 182 }; 183 184 enum mlx5_ib_devx_async_cmd_fd_alloc_attrs { 185 MLX5_IB_ATTR_DEVX_ASYNC_CMD_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 186 }; 187 188 enum mlx5_ib_devx_async_event_fd_alloc_attrs { 189 MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 190 MLX5_IB_ATTR_DEVX_ASYNC_EVENT_FD_ALLOC_FLAGS, 191 }; 192 193 enum mlx5_ib_devx_async_cmd_fd_methods { 194 MLX5_IB_METHOD_DEVX_ASYNC_CMD_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), 195 }; 196 197 enum mlx5_ib_devx_async_event_fd_methods { 198 MLX5_IB_METHOD_DEVX_ASYNC_EVENT_FD_ALLOC = (1U << UVERBS_ID_NS_SHIFT), 199 }; 200 201 enum mlx5_ib_objects { 202 MLX5_IB_OBJECT_DEVX = (1U << UVERBS_ID_NS_SHIFT), 203 MLX5_IB_OBJECT_DEVX_OBJ, 204 MLX5_IB_OBJECT_DEVX_UMEM, 205 MLX5_IB_OBJECT_FLOW_MATCHER, 206 MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD, 207 MLX5_IB_OBJECT_DEVX_ASYNC_EVENT_FD, 208 MLX5_IB_OBJECT_VAR, 209 MLX5_IB_OBJECT_PP, 210 MLX5_IB_OBJECT_UAR, 211 }; 212 213 enum mlx5_ib_flow_matcher_create_attrs { 214 MLX5_IB_ATTR_FLOW_MATCHER_CREATE_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 215 MLX5_IB_ATTR_FLOW_MATCHER_MATCH_MASK, 216 MLX5_IB_ATTR_FLOW_MATCHER_FLOW_TYPE, 217 MLX5_IB_ATTR_FLOW_MATCHER_MATCH_CRITERIA, 218 MLX5_IB_ATTR_FLOW_MATCHER_FLOW_FLAGS, 219 MLX5_IB_ATTR_FLOW_MATCHER_FT_TYPE, 220 }; 221 222 enum mlx5_ib_flow_matcher_destroy_attrs { 223 MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 224 }; 225 226 enum mlx5_ib_flow_matcher_methods { 227 MLX5_IB_METHOD_FLOW_MATCHER_CREATE = (1U << UVERBS_ID_NS_SHIFT), 228 MLX5_IB_METHOD_FLOW_MATCHER_DESTROY, 229 }; 230 231 enum mlx5_ib_device_query_context_attrs { 232 MLX5_IB_ATTR_QUERY_CONTEXT_RESP_UCTX = (1U << UVERBS_ID_NS_SHIFT), 233 }; 234 235 #define MLX5_IB_DW_MATCH_PARAM 0x90 236 237 struct mlx5_ib_match_params { 238 __u32 match_params[MLX5_IB_DW_MATCH_PARAM]; 239 }; 240 241 enum mlx5_ib_flow_type { 242 MLX5_IB_FLOW_TYPE_NORMAL, 243 MLX5_IB_FLOW_TYPE_SNIFFER, 244 MLX5_IB_FLOW_TYPE_ALL_DEFAULT, 245 MLX5_IB_FLOW_TYPE_MC_DEFAULT, 246 }; 247 248 enum mlx5_ib_create_flow_flags { 249 MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DEFAULT_MISS = 1 << 0, 250 MLX5_IB_ATTR_CREATE_FLOW_FLAGS_DROP = 1 << 1, 251 }; 252 253 enum mlx5_ib_create_flow_attrs { 254 MLX5_IB_ATTR_CREATE_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 255 MLX5_IB_ATTR_CREATE_FLOW_MATCH_VALUE, 256 MLX5_IB_ATTR_CREATE_FLOW_DEST_QP, 257 MLX5_IB_ATTR_CREATE_FLOW_DEST_DEVX, 258 MLX5_IB_ATTR_CREATE_FLOW_MATCHER, 259 MLX5_IB_ATTR_CREATE_FLOW_ARR_FLOW_ACTIONS, 260 MLX5_IB_ATTR_CREATE_FLOW_TAG, 261 MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX, 262 MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET, 263 MLX5_IB_ATTR_CREATE_FLOW_FLAGS, 264 }; 265 266 enum mlx5_ib_destroy_flow_attrs { 267 MLX5_IB_ATTR_DESTROY_FLOW_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 268 }; 269 270 enum mlx5_ib_flow_methods { 271 MLX5_IB_METHOD_CREATE_FLOW = (1U << UVERBS_ID_NS_SHIFT), 272 MLX5_IB_METHOD_DESTROY_FLOW, 273 }; 274 275 enum mlx5_ib_flow_action_methods { 276 MLX5_IB_METHOD_FLOW_ACTION_CREATE_MODIFY_HEADER = (1U << UVERBS_ID_NS_SHIFT), 277 MLX5_IB_METHOD_FLOW_ACTION_CREATE_PACKET_REFORMAT, 278 }; 279 280 enum mlx5_ib_create_flow_action_create_modify_header_attrs { 281 MLX5_IB_ATTR_CREATE_MODIFY_HEADER_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 282 MLX5_IB_ATTR_CREATE_MODIFY_HEADER_ACTIONS_PRM, 283 MLX5_IB_ATTR_CREATE_MODIFY_HEADER_FT_TYPE, 284 }; 285 286 enum mlx5_ib_create_flow_action_create_packet_reformat_attrs { 287 MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 288 MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_TYPE, 289 MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_FT_TYPE, 290 MLX5_IB_ATTR_CREATE_PACKET_REFORMAT_DATA_BUF, 291 }; 292 293 enum mlx5_ib_query_pd_attrs { 294 MLX5_IB_ATTR_QUERY_PD_HANDLE = (1U << UVERBS_ID_NS_SHIFT), 295 MLX5_IB_ATTR_QUERY_PD_RESP_PDN, 296 }; 297 298 enum mlx5_ib_pd_methods { 299 MLX5_IB_METHOD_PD_QUERY = (1U << UVERBS_ID_NS_SHIFT), 300 301 }; 302 303 #endif 304