Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005 Topspin Communications. All rights reserved. |
| 3 | * Copyright (c) 2005 Cisco Systems. 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 | * $Id: ib_user_verbs.h 2708 2005-06-24 17:27:21Z roland $ |
| 34 | */ |
| 35 | |
| 36 | #ifndef IB_USER_VERBS_H |
| 37 | #define IB_USER_VERBS_H |
| 38 | |
| 39 | #include <linux/types.h> |
| 40 | |
| 41 | /* |
| 42 | * Increment this value if any changes that break userspace ABI |
| 43 | * compatibility are made. |
| 44 | */ |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 45 | #define IB_USER_VERBS_ABI_VERSION 2 |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 46 | |
| 47 | enum { |
| 48 | IB_USER_VERBS_CMD_QUERY_PARAMS, |
| 49 | IB_USER_VERBS_CMD_GET_CONTEXT, |
| 50 | IB_USER_VERBS_CMD_QUERY_DEVICE, |
| 51 | IB_USER_VERBS_CMD_QUERY_PORT, |
| 52 | IB_USER_VERBS_CMD_QUERY_GID, |
| 53 | IB_USER_VERBS_CMD_QUERY_PKEY, |
| 54 | IB_USER_VERBS_CMD_ALLOC_PD, |
| 55 | IB_USER_VERBS_CMD_DEALLOC_PD, |
| 56 | IB_USER_VERBS_CMD_CREATE_AH, |
| 57 | IB_USER_VERBS_CMD_MODIFY_AH, |
| 58 | IB_USER_VERBS_CMD_QUERY_AH, |
| 59 | IB_USER_VERBS_CMD_DESTROY_AH, |
| 60 | IB_USER_VERBS_CMD_REG_MR, |
| 61 | IB_USER_VERBS_CMD_REG_SMR, |
| 62 | IB_USER_VERBS_CMD_REREG_MR, |
| 63 | IB_USER_VERBS_CMD_QUERY_MR, |
| 64 | IB_USER_VERBS_CMD_DEREG_MR, |
| 65 | IB_USER_VERBS_CMD_ALLOC_MW, |
| 66 | IB_USER_VERBS_CMD_BIND_MW, |
| 67 | IB_USER_VERBS_CMD_DEALLOC_MW, |
| 68 | IB_USER_VERBS_CMD_CREATE_CQ, |
| 69 | IB_USER_VERBS_CMD_RESIZE_CQ, |
| 70 | IB_USER_VERBS_CMD_DESTROY_CQ, |
| 71 | IB_USER_VERBS_CMD_POLL_CQ, |
| 72 | IB_USER_VERBS_CMD_PEEK_CQ, |
| 73 | IB_USER_VERBS_CMD_REQ_NOTIFY_CQ, |
| 74 | IB_USER_VERBS_CMD_CREATE_QP, |
| 75 | IB_USER_VERBS_CMD_QUERY_QP, |
| 76 | IB_USER_VERBS_CMD_MODIFY_QP, |
| 77 | IB_USER_VERBS_CMD_DESTROY_QP, |
| 78 | IB_USER_VERBS_CMD_POST_SEND, |
| 79 | IB_USER_VERBS_CMD_POST_RECV, |
| 80 | IB_USER_VERBS_CMD_ATTACH_MCAST, |
Roland Dreier | f520ba5 | 2005-08-18 12:24:13 -0700 | [diff] [blame] | 81 | IB_USER_VERBS_CMD_DETACH_MCAST, |
| 82 | IB_USER_VERBS_CMD_CREATE_SRQ, |
| 83 | IB_USER_VERBS_CMD_MODIFY_SRQ, |
| 84 | IB_USER_VERBS_CMD_QUERY_SRQ, |
| 85 | IB_USER_VERBS_CMD_DESTROY_SRQ, |
| 86 | IB_USER_VERBS_CMD_POST_SRQ_RECV |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | /* |
| 90 | * Make sure that all structs defined in this file remain laid out so |
| 91 | * that they pack the same way on 32-bit and 64-bit architectures (to |
| 92 | * avoid incompatibility between 32-bit userspace and 64-bit kernels). |
| 93 | * In particular do not use pointer types -- pass pointers in __u64 |
| 94 | * instead. |
| 95 | */ |
| 96 | |
| 97 | struct ib_uverbs_async_event_desc { |
| 98 | __u64 element; |
| 99 | __u32 event_type; /* enum ib_event_type */ |
| 100 | __u32 reserved; |
| 101 | }; |
| 102 | |
| 103 | struct ib_uverbs_comp_event_desc { |
| 104 | __u64 cq_handle; |
| 105 | }; |
| 106 | |
| 107 | /* |
| 108 | * All commands from userspace should start with a __u32 command field |
| 109 | * followed by __u16 in_words and out_words fields (which give the |
| 110 | * length of the command block and response buffer if any in 32-bit |
| 111 | * words). The kernel driver will read these fields first and read |
| 112 | * the rest of the command struct based on these value. |
| 113 | */ |
| 114 | |
| 115 | struct ib_uverbs_cmd_hdr { |
| 116 | __u32 command; |
| 117 | __u16 in_words; |
| 118 | __u16 out_words; |
| 119 | }; |
| 120 | |
| 121 | /* |
| 122 | * No driver_data for "query params" command, since this is intended |
| 123 | * to be a core function with no possible device dependence. |
| 124 | */ |
| 125 | struct ib_uverbs_query_params { |
| 126 | __u64 response; |
| 127 | }; |
| 128 | |
| 129 | struct ib_uverbs_query_params_resp { |
| 130 | __u32 num_cq_events; |
| 131 | }; |
| 132 | |
| 133 | struct ib_uverbs_get_context { |
| 134 | __u64 response; |
| 135 | __u64 cq_fd_tab; |
| 136 | __u64 driver_data[0]; |
| 137 | }; |
| 138 | |
| 139 | struct ib_uverbs_get_context_resp { |
| 140 | __u32 async_fd; |
| 141 | __u32 reserved; |
| 142 | }; |
| 143 | |
| 144 | struct ib_uverbs_query_device { |
| 145 | __u64 response; |
| 146 | __u64 driver_data[0]; |
| 147 | }; |
| 148 | |
| 149 | struct ib_uverbs_query_device_resp { |
| 150 | __u64 fw_ver; |
Sean Hefty | 97f52eb | 2005-08-13 21:05:57 -0700 | [diff] [blame] | 151 | __be64 node_guid; |
| 152 | __be64 sys_image_guid; |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 153 | __u64 max_mr_size; |
| 154 | __u64 page_size_cap; |
| 155 | __u32 vendor_id; |
| 156 | __u32 vendor_part_id; |
| 157 | __u32 hw_ver; |
| 158 | __u32 max_qp; |
| 159 | __u32 max_qp_wr; |
| 160 | __u32 device_cap_flags; |
| 161 | __u32 max_sge; |
| 162 | __u32 max_sge_rd; |
| 163 | __u32 max_cq; |
| 164 | __u32 max_cqe; |
| 165 | __u32 max_mr; |
| 166 | __u32 max_pd; |
| 167 | __u32 max_qp_rd_atom; |
| 168 | __u32 max_ee_rd_atom; |
| 169 | __u32 max_res_rd_atom; |
| 170 | __u32 max_qp_init_rd_atom; |
| 171 | __u32 max_ee_init_rd_atom; |
| 172 | __u32 atomic_cap; |
| 173 | __u32 max_ee; |
| 174 | __u32 max_rdd; |
| 175 | __u32 max_mw; |
| 176 | __u32 max_raw_ipv6_qp; |
| 177 | __u32 max_raw_ethy_qp; |
| 178 | __u32 max_mcast_grp; |
| 179 | __u32 max_mcast_qp_attach; |
| 180 | __u32 max_total_mcast_qp_attach; |
| 181 | __u32 max_ah; |
| 182 | __u32 max_fmr; |
| 183 | __u32 max_map_per_fmr; |
| 184 | __u32 max_srq; |
| 185 | __u32 max_srq_wr; |
| 186 | __u32 max_srq_sge; |
| 187 | __u16 max_pkeys; |
| 188 | __u8 local_ca_ack_delay; |
| 189 | __u8 phys_port_cnt; |
| 190 | __u8 reserved[4]; |
| 191 | }; |
| 192 | |
| 193 | struct ib_uverbs_query_port { |
| 194 | __u64 response; |
| 195 | __u8 port_num; |
| 196 | __u8 reserved[7]; |
| 197 | __u64 driver_data[0]; |
| 198 | }; |
| 199 | |
| 200 | struct ib_uverbs_query_port_resp { |
| 201 | __u32 port_cap_flags; |
| 202 | __u32 max_msg_sz; |
| 203 | __u32 bad_pkey_cntr; |
| 204 | __u32 qkey_viol_cntr; |
| 205 | __u32 gid_tbl_len; |
| 206 | __u16 pkey_tbl_len; |
| 207 | __u16 lid; |
| 208 | __u16 sm_lid; |
| 209 | __u8 state; |
| 210 | __u8 max_mtu; |
| 211 | __u8 active_mtu; |
| 212 | __u8 lmc; |
| 213 | __u8 max_vl_num; |
| 214 | __u8 sm_sl; |
| 215 | __u8 subnet_timeout; |
| 216 | __u8 init_type_reply; |
| 217 | __u8 active_width; |
| 218 | __u8 active_speed; |
| 219 | __u8 phys_state; |
| 220 | __u8 reserved[3]; |
| 221 | }; |
| 222 | |
| 223 | struct ib_uverbs_query_gid { |
| 224 | __u64 response; |
| 225 | __u8 port_num; |
| 226 | __u8 index; |
| 227 | __u8 reserved[6]; |
| 228 | __u64 driver_data[0]; |
| 229 | }; |
| 230 | |
| 231 | struct ib_uverbs_query_gid_resp { |
| 232 | __u8 gid[16]; |
| 233 | }; |
| 234 | |
| 235 | struct ib_uverbs_query_pkey { |
| 236 | __u64 response; |
| 237 | __u8 port_num; |
| 238 | __u8 index; |
| 239 | __u8 reserved[6]; |
| 240 | __u64 driver_data[0]; |
| 241 | }; |
| 242 | |
| 243 | struct ib_uverbs_query_pkey_resp { |
| 244 | __u16 pkey; |
| 245 | __u16 reserved; |
| 246 | }; |
| 247 | |
| 248 | struct ib_uverbs_alloc_pd { |
| 249 | __u64 response; |
| 250 | __u64 driver_data[0]; |
| 251 | }; |
| 252 | |
| 253 | struct ib_uverbs_alloc_pd_resp { |
| 254 | __u32 pd_handle; |
| 255 | }; |
| 256 | |
| 257 | struct ib_uverbs_dealloc_pd { |
| 258 | __u32 pd_handle; |
| 259 | }; |
| 260 | |
| 261 | struct ib_uverbs_reg_mr { |
| 262 | __u64 response; |
| 263 | __u64 start; |
| 264 | __u64 length; |
| 265 | __u64 hca_va; |
| 266 | __u32 pd_handle; |
| 267 | __u32 access_flags; |
| 268 | __u64 driver_data[0]; |
| 269 | }; |
| 270 | |
| 271 | struct ib_uverbs_reg_mr_resp { |
| 272 | __u32 mr_handle; |
| 273 | __u32 lkey; |
| 274 | __u32 rkey; |
| 275 | }; |
| 276 | |
| 277 | struct ib_uverbs_dereg_mr { |
| 278 | __u32 mr_handle; |
| 279 | }; |
| 280 | |
| 281 | struct ib_uverbs_create_cq { |
| 282 | __u64 response; |
| 283 | __u64 user_handle; |
| 284 | __u32 cqe; |
| 285 | __u32 event_handler; |
| 286 | __u64 driver_data[0]; |
| 287 | }; |
| 288 | |
| 289 | struct ib_uverbs_create_cq_resp { |
| 290 | __u32 cq_handle; |
| 291 | __u32 cqe; |
| 292 | }; |
| 293 | |
| 294 | struct ib_uverbs_destroy_cq { |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 295 | __u64 response; |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 296 | __u32 cq_handle; |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 297 | __u32 reserved; |
| 298 | }; |
| 299 | |
| 300 | struct ib_uverbs_destroy_cq_resp { |
| 301 | __u32 comp_events_reported; |
| 302 | __u32 async_events_reported; |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 303 | }; |
| 304 | |
| 305 | struct ib_uverbs_create_qp { |
| 306 | __u64 response; |
| 307 | __u64 user_handle; |
| 308 | __u32 pd_handle; |
| 309 | __u32 send_cq_handle; |
| 310 | __u32 recv_cq_handle; |
| 311 | __u32 srq_handle; |
| 312 | __u32 max_send_wr; |
| 313 | __u32 max_recv_wr; |
| 314 | __u32 max_send_sge; |
| 315 | __u32 max_recv_sge; |
| 316 | __u32 max_inline_data; |
| 317 | __u8 sq_sig_all; |
| 318 | __u8 qp_type; |
| 319 | __u8 is_srq; |
| 320 | __u8 reserved; |
| 321 | __u64 driver_data[0]; |
| 322 | }; |
| 323 | |
| 324 | struct ib_uverbs_create_qp_resp { |
| 325 | __u32 qp_handle; |
| 326 | __u32 qpn; |
| 327 | }; |
| 328 | |
| 329 | /* |
| 330 | * This struct needs to remain a multiple of 8 bytes to keep the |
| 331 | * alignment of the modify QP parameters. |
| 332 | */ |
| 333 | struct ib_uverbs_qp_dest { |
| 334 | __u8 dgid[16]; |
| 335 | __u32 flow_label; |
| 336 | __u16 dlid; |
| 337 | __u16 reserved; |
| 338 | __u8 sgid_index; |
| 339 | __u8 hop_limit; |
| 340 | __u8 traffic_class; |
| 341 | __u8 sl; |
| 342 | __u8 src_path_bits; |
| 343 | __u8 static_rate; |
| 344 | __u8 is_global; |
| 345 | __u8 port_num; |
| 346 | }; |
| 347 | |
| 348 | struct ib_uverbs_modify_qp { |
| 349 | struct ib_uverbs_qp_dest dest; |
| 350 | struct ib_uverbs_qp_dest alt_dest; |
| 351 | __u32 qp_handle; |
| 352 | __u32 attr_mask; |
| 353 | __u32 qkey; |
| 354 | __u32 rq_psn; |
| 355 | __u32 sq_psn; |
| 356 | __u32 dest_qp_num; |
| 357 | __u32 qp_access_flags; |
| 358 | __u16 pkey_index; |
| 359 | __u16 alt_pkey_index; |
| 360 | __u8 qp_state; |
| 361 | __u8 cur_qp_state; |
| 362 | __u8 path_mtu; |
| 363 | __u8 path_mig_state; |
| 364 | __u8 en_sqd_async_notify; |
| 365 | __u8 max_rd_atomic; |
| 366 | __u8 max_dest_rd_atomic; |
| 367 | __u8 min_rnr_timer; |
| 368 | __u8 port_num; |
| 369 | __u8 timeout; |
| 370 | __u8 retry_cnt; |
| 371 | __u8 rnr_retry; |
| 372 | __u8 alt_port_num; |
| 373 | __u8 alt_timeout; |
| 374 | __u8 reserved[2]; |
| 375 | __u64 driver_data[0]; |
| 376 | }; |
| 377 | |
| 378 | struct ib_uverbs_modify_qp_resp { |
| 379 | }; |
| 380 | |
| 381 | struct ib_uverbs_destroy_qp { |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 382 | __u64 response; |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 383 | __u32 qp_handle; |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 384 | __u32 reserved; |
| 385 | }; |
| 386 | |
| 387 | struct ib_uverbs_destroy_qp_resp { |
| 388 | __u32 events_reported; |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 389 | }; |
| 390 | |
| 391 | struct ib_uverbs_attach_mcast { |
| 392 | __u8 gid[16]; |
| 393 | __u32 qp_handle; |
| 394 | __u16 mlid; |
| 395 | __u16 reserved; |
| 396 | __u64 driver_data[0]; |
| 397 | }; |
| 398 | |
| 399 | struct ib_uverbs_detach_mcast { |
| 400 | __u8 gid[16]; |
| 401 | __u32 qp_handle; |
| 402 | __u16 mlid; |
| 403 | __u16 reserved; |
| 404 | __u64 driver_data[0]; |
| 405 | }; |
| 406 | |
Roland Dreier | f520ba5 | 2005-08-18 12:24:13 -0700 | [diff] [blame] | 407 | struct ib_uverbs_create_srq { |
| 408 | __u64 response; |
| 409 | __u64 user_handle; |
| 410 | __u32 pd_handle; |
| 411 | __u32 max_wr; |
| 412 | __u32 max_sge; |
| 413 | __u32 srq_limit; |
| 414 | __u64 driver_data[0]; |
| 415 | }; |
| 416 | |
| 417 | struct ib_uverbs_create_srq_resp { |
| 418 | __u32 srq_handle; |
| 419 | }; |
| 420 | |
| 421 | struct ib_uverbs_modify_srq { |
| 422 | __u32 srq_handle; |
| 423 | __u32 attr_mask; |
| 424 | __u32 max_wr; |
| 425 | __u32 max_sge; |
| 426 | __u32 srq_limit; |
| 427 | __u32 reserved; |
| 428 | __u64 driver_data[0]; |
| 429 | }; |
| 430 | |
| 431 | struct ib_uverbs_destroy_srq { |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 432 | __u64 response; |
Roland Dreier | f520ba5 | 2005-08-18 12:24:13 -0700 | [diff] [blame] | 433 | __u32 srq_handle; |
Roland Dreier | 63aaf64 | 2005-09-09 15:55:08 -0700 | [diff] [blame] | 434 | __u32 reserved; |
| 435 | }; |
| 436 | |
| 437 | struct ib_uverbs_destroy_srq_resp { |
| 438 | __u32 events_reported; |
Roland Dreier | f520ba5 | 2005-08-18 12:24:13 -0700 | [diff] [blame] | 439 | }; |
| 440 | |
Roland Dreier | 8a96b3f | 2005-07-07 17:57:12 -0700 | [diff] [blame] | 441 | #endif /* IB_USER_VERBS_H */ |