1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2 /* 3 * Copyright (c) 2005 Topspin Communications. All rights reserved. 4 * Copyright (c) 2005, 2006 Cisco Systems. All rights reserved. 5 * Copyright (c) 2005 PathScale, Inc. All rights reserved. 6 * Copyright (c) 2006 Mellanox Technologies. All rights reserved. 7 * 8 * This software is available to you under a choice of one of two 9 * licenses. You may choose to be licensed under the terms of the GNU 10 * General Public License (GPL) Version 2, available from the file 11 * COPYING in the main directory of this source tree, or the 12 * OpenIB.org BSD license below: 13 * 14 * Redistribution and use in source and binary forms, with or 15 * without modification, are permitted provided that the following 16 * conditions are met: 17 * 18 * - Redistributions of source code must retain the above 19 * copyright notice, this list of conditions and the following 20 * disclaimer. 21 * 22 * - Redistributions in binary form must reproduce the above 23 * copyright notice, this list of conditions and the following 24 * disclaimer in the documentation and/or other materials 25 * provided with the distribution. 26 * 27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34 * SOFTWARE. 35 */ 36 37 #ifndef IB_USER_VERBS_H 38 #define IB_USER_VERBS_H 39 40 #include <linux/types.h> 41 42 /* 43 * Increment this value if any changes that break userspace ABI 44 * compatibility are made. 45 */ 46 #define IB_USER_VERBS_ABI_VERSION 6 47 #define IB_USER_VERBS_CMD_THRESHOLD 50 48 49 enum { 50 IB_USER_VERBS_CMD_GET_CONTEXT, 51 IB_USER_VERBS_CMD_QUERY_DEVICE, 52 IB_USER_VERBS_CMD_QUERY_PORT, 53 IB_USER_VERBS_CMD_ALLOC_PD, 54 IB_USER_VERBS_CMD_DEALLOC_PD, 55 IB_USER_VERBS_CMD_CREATE_AH, 56 IB_USER_VERBS_CMD_MODIFY_AH, 57 IB_USER_VERBS_CMD_QUERY_AH, 58 IB_USER_VERBS_CMD_DESTROY_AH, 59 IB_USER_VERBS_CMD_REG_MR, 60 IB_USER_VERBS_CMD_REG_SMR, 61 IB_USER_VERBS_CMD_REREG_MR, 62 IB_USER_VERBS_CMD_QUERY_MR, 63 IB_USER_VERBS_CMD_DEREG_MR, 64 IB_USER_VERBS_CMD_ALLOC_MW, 65 IB_USER_VERBS_CMD_BIND_MW, 66 IB_USER_VERBS_CMD_DEALLOC_MW, 67 IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL, 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, 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, 87 IB_USER_VERBS_CMD_OPEN_XRCD, 88 IB_USER_VERBS_CMD_CLOSE_XRCD, 89 IB_USER_VERBS_CMD_CREATE_XSRQ, 90 IB_USER_VERBS_CMD_OPEN_QP, 91 }; 92 93 enum { 94 IB_USER_VERBS_EX_CMD_QUERY_DEVICE = IB_USER_VERBS_CMD_QUERY_DEVICE, 95 IB_USER_VERBS_EX_CMD_CREATE_CQ = IB_USER_VERBS_CMD_CREATE_CQ, 96 IB_USER_VERBS_EX_CMD_CREATE_QP = IB_USER_VERBS_CMD_CREATE_QP, 97 IB_USER_VERBS_EX_CMD_MODIFY_QP = IB_USER_VERBS_CMD_MODIFY_QP, 98 IB_USER_VERBS_EX_CMD_CREATE_FLOW = IB_USER_VERBS_CMD_THRESHOLD, 99 IB_USER_VERBS_EX_CMD_DESTROY_FLOW, 100 IB_USER_VERBS_EX_CMD_CREATE_WQ, 101 IB_USER_VERBS_EX_CMD_MODIFY_WQ, 102 IB_USER_VERBS_EX_CMD_DESTROY_WQ, 103 IB_USER_VERBS_EX_CMD_CREATE_RWQ_IND_TBL, 104 IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL 105 }; 106 107 /* 108 * Make sure that all structs defined in this file remain laid out so 109 * that they pack the same way on 32-bit and 64-bit architectures (to 110 * avoid incompatibility between 32-bit userspace and 64-bit kernels). 111 * Specifically: 112 * - Do not use pointer types -- pass pointers in __u64 instead. 113 * - Make sure that any structure larger than 4 bytes is padded to a 114 * multiple of 8 bytes. Otherwise the structure size will be 115 * different between 32-bit and 64-bit architectures. 116 */ 117 118 struct ib_uverbs_async_event_desc { 119 __u64 element; 120 __u32 event_type; /* enum ib_event_type */ 121 __u32 reserved; 122 }; 123 124 struct ib_uverbs_comp_event_desc { 125 __u64 cq_handle; 126 }; 127 128 /* 129 * All commands from userspace should start with a __u32 command field 130 * followed by __u16 in_words and out_words fields (which give the 131 * length of the command block and response buffer if any in 32-bit 132 * words). The kernel driver will read these fields first and read 133 * the rest of the command struct based on these value. 134 */ 135 136 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff 137 #define IB_USER_VERBS_CMD_FLAGS_MASK 0xff000000u 138 #define IB_USER_VERBS_CMD_FLAGS_SHIFT 24 139 140 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80 141 142 struct ib_uverbs_cmd_hdr { 143 __u32 command; 144 __u16 in_words; 145 __u16 out_words; 146 }; 147 148 struct ib_uverbs_ex_cmd_hdr { 149 __u64 response; 150 __u16 provider_in_words; 151 __u16 provider_out_words; 152 __u32 cmd_hdr_reserved; 153 }; 154 155 struct ib_uverbs_get_context { 156 __u64 response; 157 __u64 driver_data[0]; 158 }; 159 160 struct ib_uverbs_get_context_resp { 161 __u32 async_fd; 162 __u32 num_comp_vectors; 163 }; 164 165 struct ib_uverbs_query_device { 166 __u64 response; 167 __u64 driver_data[0]; 168 }; 169 170 struct ib_uverbs_query_device_resp { 171 __u64 fw_ver; 172 __be64 node_guid; 173 __be64 sys_image_guid; 174 __u64 max_mr_size; 175 __u64 page_size_cap; 176 __u32 vendor_id; 177 __u32 vendor_part_id; 178 __u32 hw_ver; 179 __u32 max_qp; 180 __u32 max_qp_wr; 181 __u32 device_cap_flags; 182 __u32 max_sge; 183 __u32 max_sge_rd; 184 __u32 max_cq; 185 __u32 max_cqe; 186 __u32 max_mr; 187 __u32 max_pd; 188 __u32 max_qp_rd_atom; 189 __u32 max_ee_rd_atom; 190 __u32 max_res_rd_atom; 191 __u32 max_qp_init_rd_atom; 192 __u32 max_ee_init_rd_atom; 193 __u32 atomic_cap; 194 __u32 max_ee; 195 __u32 max_rdd; 196 __u32 max_mw; 197 __u32 max_raw_ipv6_qp; 198 __u32 max_raw_ethy_qp; 199 __u32 max_mcast_grp; 200 __u32 max_mcast_qp_attach; 201 __u32 max_total_mcast_qp_attach; 202 __u32 max_ah; 203 __u32 max_fmr; 204 __u32 max_map_per_fmr; 205 __u32 max_srq; 206 __u32 max_srq_wr; 207 __u32 max_srq_sge; 208 __u16 max_pkeys; 209 __u8 local_ca_ack_delay; 210 __u8 phys_port_cnt; 211 __u8 reserved[4]; 212 }; 213 214 struct ib_uverbs_ex_query_device { 215 __u32 comp_mask; 216 __u32 reserved; 217 }; 218 219 struct ib_uverbs_odp_caps { 220 __u64 general_caps; 221 struct { 222 __u32 rc_odp_caps; 223 __u32 uc_odp_caps; 224 __u32 ud_odp_caps; 225 } per_transport_caps; 226 __u32 reserved; 227 }; 228 229 struct ib_uverbs_rss_caps { 230 /* Corresponding bit will be set if qp type from 231 * 'enum ib_qp_type' is supported, e.g. 232 * supported_qpts |= 1 << IB_QPT_UD 233 */ 234 __u32 supported_qpts; 235 __u32 max_rwq_indirection_tables; 236 __u32 max_rwq_indirection_table_size; 237 __u32 reserved; 238 }; 239 240 struct ib_uverbs_tm_caps { 241 /* Max size of rendezvous request message */ 242 __u32 max_rndv_hdr_size; 243 /* Max number of entries in tag matching list */ 244 __u32 max_num_tags; 245 /* TM flags */ 246 __u32 flags; 247 /* Max number of outstanding list operations */ 248 __u32 max_ops; 249 /* Max number of SGE in tag matching entry */ 250 __u32 max_sge; 251 __u32 reserved; 252 }; 253 254 struct ib_uverbs_ex_query_device_resp { 255 struct ib_uverbs_query_device_resp base; 256 __u32 comp_mask; 257 __u32 response_length; 258 struct ib_uverbs_odp_caps odp_caps; 259 __u64 timestamp_mask; 260 __u64 hca_core_clock; /* in KHZ */ 261 __u64 device_cap_flags_ex; 262 struct ib_uverbs_rss_caps rss_caps; 263 __u32 max_wq_type_rq; 264 __u32 raw_packet_caps; 265 struct ib_uverbs_tm_caps tm_caps; 266 }; 267 268 struct ib_uverbs_query_port { 269 __u64 response; 270 __u8 port_num; 271 __u8 reserved[7]; 272 __u64 driver_data[0]; 273 }; 274 275 struct ib_uverbs_query_port_resp { 276 __u32 port_cap_flags; 277 __u32 max_msg_sz; 278 __u32 bad_pkey_cntr; 279 __u32 qkey_viol_cntr; 280 __u32 gid_tbl_len; 281 __u16 pkey_tbl_len; 282 __u16 lid; 283 __u16 sm_lid; 284 __u8 state; 285 __u8 max_mtu; 286 __u8 active_mtu; 287 __u8 lmc; 288 __u8 max_vl_num; 289 __u8 sm_sl; 290 __u8 subnet_timeout; 291 __u8 init_type_reply; 292 __u8 active_width; 293 __u8 active_speed; 294 __u8 phys_state; 295 __u8 link_layer; 296 __u8 reserved[2]; 297 }; 298 299 struct ib_uverbs_alloc_pd { 300 __u64 response; 301 __u64 driver_data[0]; 302 }; 303 304 struct ib_uverbs_alloc_pd_resp { 305 __u32 pd_handle; 306 }; 307 308 struct ib_uverbs_dealloc_pd { 309 __u32 pd_handle; 310 }; 311 312 struct ib_uverbs_open_xrcd { 313 __u64 response; 314 __u32 fd; 315 __u32 oflags; 316 __u64 driver_data[0]; 317 }; 318 319 struct ib_uverbs_open_xrcd_resp { 320 __u32 xrcd_handle; 321 }; 322 323 struct ib_uverbs_close_xrcd { 324 __u32 xrcd_handle; 325 }; 326 327 struct ib_uverbs_reg_mr { 328 __u64 response; 329 __u64 start; 330 __u64 length; 331 __u64 hca_va; 332 __u32 pd_handle; 333 __u32 access_flags; 334 __u64 driver_data[0]; 335 }; 336 337 struct ib_uverbs_reg_mr_resp { 338 __u32 mr_handle; 339 __u32 lkey; 340 __u32 rkey; 341 }; 342 343 struct ib_uverbs_rereg_mr { 344 __u64 response; 345 __u32 mr_handle; 346 __u32 flags; 347 __u64 start; 348 __u64 length; 349 __u64 hca_va; 350 __u32 pd_handle; 351 __u32 access_flags; 352 }; 353 354 struct ib_uverbs_rereg_mr_resp { 355 __u32 lkey; 356 __u32 rkey; 357 }; 358 359 struct ib_uverbs_dereg_mr { 360 __u32 mr_handle; 361 }; 362 363 struct ib_uverbs_alloc_mw { 364 __u64 response; 365 __u32 pd_handle; 366 __u8 mw_type; 367 __u8 reserved[3]; 368 }; 369 370 struct ib_uverbs_alloc_mw_resp { 371 __u32 mw_handle; 372 __u32 rkey; 373 }; 374 375 struct ib_uverbs_dealloc_mw { 376 __u32 mw_handle; 377 }; 378 379 struct ib_uverbs_create_comp_channel { 380 __u64 response; 381 }; 382 383 struct ib_uverbs_create_comp_channel_resp { 384 __u32 fd; 385 }; 386 387 struct ib_uverbs_create_cq { 388 __u64 response; 389 __u64 user_handle; 390 __u32 cqe; 391 __u32 comp_vector; 392 __s32 comp_channel; 393 __u32 reserved; 394 __u64 driver_data[0]; 395 }; 396 397 struct ib_uverbs_ex_create_cq { 398 __u64 user_handle; 399 __u32 cqe; 400 __u32 comp_vector; 401 __s32 comp_channel; 402 __u32 comp_mask; 403 __u32 flags; 404 __u32 reserved; 405 }; 406 407 struct ib_uverbs_create_cq_resp { 408 __u32 cq_handle; 409 __u32 cqe; 410 }; 411 412 struct ib_uverbs_ex_create_cq_resp { 413 struct ib_uverbs_create_cq_resp base; 414 __u32 comp_mask; 415 __u32 response_length; 416 }; 417 418 struct ib_uverbs_resize_cq { 419 __u64 response; 420 __u32 cq_handle; 421 __u32 cqe; 422 __u64 driver_data[0]; 423 }; 424 425 struct ib_uverbs_resize_cq_resp { 426 __u32 cqe; 427 __u32 reserved; 428 __u64 driver_data[0]; 429 }; 430 431 struct ib_uverbs_poll_cq { 432 __u64 response; 433 __u32 cq_handle; 434 __u32 ne; 435 }; 436 437 struct ib_uverbs_wc { 438 __u64 wr_id; 439 __u32 status; 440 __u32 opcode; 441 __u32 vendor_err; 442 __u32 byte_len; 443 union { 444 __u32 imm_data; 445 __u32 invalidate_rkey; 446 } ex; 447 __u32 qp_num; 448 __u32 src_qp; 449 __u32 wc_flags; 450 __u16 pkey_index; 451 __u16 slid; 452 __u8 sl; 453 __u8 dlid_path_bits; 454 __u8 port_num; 455 __u8 reserved; 456 }; 457 458 struct ib_uverbs_poll_cq_resp { 459 __u32 count; 460 __u32 reserved; 461 struct ib_uverbs_wc wc[0]; 462 }; 463 464 struct ib_uverbs_req_notify_cq { 465 __u32 cq_handle; 466 __u32 solicited_only; 467 }; 468 469 struct ib_uverbs_destroy_cq { 470 __u64 response; 471 __u32 cq_handle; 472 __u32 reserved; 473 }; 474 475 struct ib_uverbs_destroy_cq_resp { 476 __u32 comp_events_reported; 477 __u32 async_events_reported; 478 }; 479 480 struct ib_uverbs_global_route { 481 __u8 dgid[16]; 482 __u32 flow_label; 483 __u8 sgid_index; 484 __u8 hop_limit; 485 __u8 traffic_class; 486 __u8 reserved; 487 }; 488 489 struct ib_uverbs_ah_attr { 490 struct ib_uverbs_global_route grh; 491 __u16 dlid; 492 __u8 sl; 493 __u8 src_path_bits; 494 __u8 static_rate; 495 __u8 is_global; 496 __u8 port_num; 497 __u8 reserved; 498 }; 499 500 struct ib_uverbs_qp_attr { 501 __u32 qp_attr_mask; 502 __u32 qp_state; 503 __u32 cur_qp_state; 504 __u32 path_mtu; 505 __u32 path_mig_state; 506 __u32 qkey; 507 __u32 rq_psn; 508 __u32 sq_psn; 509 __u32 dest_qp_num; 510 __u32 qp_access_flags; 511 512 struct ib_uverbs_ah_attr ah_attr; 513 struct ib_uverbs_ah_attr alt_ah_attr; 514 515 /* ib_qp_cap */ 516 __u32 max_send_wr; 517 __u32 max_recv_wr; 518 __u32 max_send_sge; 519 __u32 max_recv_sge; 520 __u32 max_inline_data; 521 522 __u16 pkey_index; 523 __u16 alt_pkey_index; 524 __u8 en_sqd_async_notify; 525 __u8 sq_draining; 526 __u8 max_rd_atomic; 527 __u8 max_dest_rd_atomic; 528 __u8 min_rnr_timer; 529 __u8 port_num; 530 __u8 timeout; 531 __u8 retry_cnt; 532 __u8 rnr_retry; 533 __u8 alt_port_num; 534 __u8 alt_timeout; 535 __u8 reserved[5]; 536 }; 537 538 struct ib_uverbs_create_qp { 539 __u64 response; 540 __u64 user_handle; 541 __u32 pd_handle; 542 __u32 send_cq_handle; 543 __u32 recv_cq_handle; 544 __u32 srq_handle; 545 __u32 max_send_wr; 546 __u32 max_recv_wr; 547 __u32 max_send_sge; 548 __u32 max_recv_sge; 549 __u32 max_inline_data; 550 __u8 sq_sig_all; 551 __u8 qp_type; 552 __u8 is_srq; 553 __u8 reserved; 554 __u64 driver_data[0]; 555 }; 556 557 enum ib_uverbs_create_qp_mask { 558 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0, 559 }; 560 561 enum { 562 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE, 563 }; 564 565 enum { 566 /* 567 * This value is equal to IB_QP_DEST_QPN. 568 */ 569 IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20, 570 }; 571 572 enum { 573 /* 574 * This value is equal to IB_QP_RATE_LIMIT. 575 */ 576 IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25, 577 }; 578 579 struct ib_uverbs_ex_create_qp { 580 __u64 user_handle; 581 __u32 pd_handle; 582 __u32 send_cq_handle; 583 __u32 recv_cq_handle; 584 __u32 srq_handle; 585 __u32 max_send_wr; 586 __u32 max_recv_wr; 587 __u32 max_send_sge; 588 __u32 max_recv_sge; 589 __u32 max_inline_data; 590 __u8 sq_sig_all; 591 __u8 qp_type; 592 __u8 is_srq; 593 __u8 reserved; 594 __u32 comp_mask; 595 __u32 create_flags; 596 __u32 rwq_ind_tbl_handle; 597 __u32 source_qpn; 598 }; 599 600 struct ib_uverbs_open_qp { 601 __u64 response; 602 __u64 user_handle; 603 __u32 pd_handle; 604 __u32 qpn; 605 __u8 qp_type; 606 __u8 reserved[7]; 607 __u64 driver_data[0]; 608 }; 609 610 /* also used for open response */ 611 struct ib_uverbs_create_qp_resp { 612 __u32 qp_handle; 613 __u32 qpn; 614 __u32 max_send_wr; 615 __u32 max_recv_wr; 616 __u32 max_send_sge; 617 __u32 max_recv_sge; 618 __u32 max_inline_data; 619 __u32 reserved; 620 }; 621 622 struct ib_uverbs_ex_create_qp_resp { 623 struct ib_uverbs_create_qp_resp base; 624 __u32 comp_mask; 625 __u32 response_length; 626 }; 627 628 /* 629 * This struct needs to remain a multiple of 8 bytes to keep the 630 * alignment of the modify QP parameters. 631 */ 632 struct ib_uverbs_qp_dest { 633 __u8 dgid[16]; 634 __u32 flow_label; 635 __u16 dlid; 636 __u16 reserved; 637 __u8 sgid_index; 638 __u8 hop_limit; 639 __u8 traffic_class; 640 __u8 sl; 641 __u8 src_path_bits; 642 __u8 static_rate; 643 __u8 is_global; 644 __u8 port_num; 645 }; 646 647 struct ib_uverbs_query_qp { 648 __u64 response; 649 __u32 qp_handle; 650 __u32 attr_mask; 651 __u64 driver_data[0]; 652 }; 653 654 struct ib_uverbs_query_qp_resp { 655 struct ib_uverbs_qp_dest dest; 656 struct ib_uverbs_qp_dest alt_dest; 657 __u32 max_send_wr; 658 __u32 max_recv_wr; 659 __u32 max_send_sge; 660 __u32 max_recv_sge; 661 __u32 max_inline_data; 662 __u32 qkey; 663 __u32 rq_psn; 664 __u32 sq_psn; 665 __u32 dest_qp_num; 666 __u32 qp_access_flags; 667 __u16 pkey_index; 668 __u16 alt_pkey_index; 669 __u8 qp_state; 670 __u8 cur_qp_state; 671 __u8 path_mtu; 672 __u8 path_mig_state; 673 __u8 sq_draining; 674 __u8 max_rd_atomic; 675 __u8 max_dest_rd_atomic; 676 __u8 min_rnr_timer; 677 __u8 port_num; 678 __u8 timeout; 679 __u8 retry_cnt; 680 __u8 rnr_retry; 681 __u8 alt_port_num; 682 __u8 alt_timeout; 683 __u8 sq_sig_all; 684 __u8 reserved[5]; 685 __u64 driver_data[0]; 686 }; 687 688 struct ib_uverbs_modify_qp { 689 struct ib_uverbs_qp_dest dest; 690 struct ib_uverbs_qp_dest alt_dest; 691 __u32 qp_handle; 692 __u32 attr_mask; 693 __u32 qkey; 694 __u32 rq_psn; 695 __u32 sq_psn; 696 __u32 dest_qp_num; 697 __u32 qp_access_flags; 698 __u16 pkey_index; 699 __u16 alt_pkey_index; 700 __u8 qp_state; 701 __u8 cur_qp_state; 702 __u8 path_mtu; 703 __u8 path_mig_state; 704 __u8 en_sqd_async_notify; 705 __u8 max_rd_atomic; 706 __u8 max_dest_rd_atomic; 707 __u8 min_rnr_timer; 708 __u8 port_num; 709 __u8 timeout; 710 __u8 retry_cnt; 711 __u8 rnr_retry; 712 __u8 alt_port_num; 713 __u8 alt_timeout; 714 __u8 reserved[2]; 715 __u64 driver_data[0]; 716 }; 717 718 struct ib_uverbs_ex_modify_qp { 719 struct ib_uverbs_modify_qp base; 720 __u32 rate_limit; 721 __u32 reserved; 722 }; 723 724 struct ib_uverbs_modify_qp_resp { 725 }; 726 727 struct ib_uverbs_ex_modify_qp_resp { 728 __u32 comp_mask; 729 __u32 response_length; 730 }; 731 732 struct ib_uverbs_destroy_qp { 733 __u64 response; 734 __u32 qp_handle; 735 __u32 reserved; 736 }; 737 738 struct ib_uverbs_destroy_qp_resp { 739 __u32 events_reported; 740 }; 741 742 /* 743 * The ib_uverbs_sge structure isn't used anywhere, since we assume 744 * the ib_sge structure is packed the same way on 32-bit and 64-bit 745 * architectures in both kernel and user space. It's just here to 746 * document the ABI. 747 */ 748 struct ib_uverbs_sge { 749 __u64 addr; 750 __u32 length; 751 __u32 lkey; 752 }; 753 754 struct ib_uverbs_send_wr { 755 __u64 wr_id; 756 __u32 num_sge; 757 __u32 opcode; 758 __u32 send_flags; 759 union { 760 __u32 imm_data; 761 __u32 invalidate_rkey; 762 } ex; 763 union { 764 struct { 765 __u64 remote_addr; 766 __u32 rkey; 767 __u32 reserved; 768 } rdma; 769 struct { 770 __u64 remote_addr; 771 __u64 compare_add; 772 __u64 swap; 773 __u32 rkey; 774 __u32 reserved; 775 } atomic; 776 struct { 777 __u32 ah; 778 __u32 remote_qpn; 779 __u32 remote_qkey; 780 __u32 reserved; 781 } ud; 782 } wr; 783 }; 784 785 struct ib_uverbs_post_send { 786 __u64 response; 787 __u32 qp_handle; 788 __u32 wr_count; 789 __u32 sge_count; 790 __u32 wqe_size; 791 struct ib_uverbs_send_wr send_wr[0]; 792 }; 793 794 struct ib_uverbs_post_send_resp { 795 __u32 bad_wr; 796 }; 797 798 struct ib_uverbs_recv_wr { 799 __u64 wr_id; 800 __u32 num_sge; 801 __u32 reserved; 802 }; 803 804 struct ib_uverbs_post_recv { 805 __u64 response; 806 __u32 qp_handle; 807 __u32 wr_count; 808 __u32 sge_count; 809 __u32 wqe_size; 810 struct ib_uverbs_recv_wr recv_wr[0]; 811 }; 812 813 struct ib_uverbs_post_recv_resp { 814 __u32 bad_wr; 815 }; 816 817 struct ib_uverbs_post_srq_recv { 818 __u64 response; 819 __u32 srq_handle; 820 __u32 wr_count; 821 __u32 sge_count; 822 __u32 wqe_size; 823 struct ib_uverbs_recv_wr recv[0]; 824 }; 825 826 struct ib_uverbs_post_srq_recv_resp { 827 __u32 bad_wr; 828 }; 829 830 struct ib_uverbs_create_ah { 831 __u64 response; 832 __u64 user_handle; 833 __u32 pd_handle; 834 __u32 reserved; 835 struct ib_uverbs_ah_attr attr; 836 }; 837 838 struct ib_uverbs_create_ah_resp { 839 __u32 ah_handle; 840 }; 841 842 struct ib_uverbs_destroy_ah { 843 __u32 ah_handle; 844 }; 845 846 struct ib_uverbs_attach_mcast { 847 __u8 gid[16]; 848 __u32 qp_handle; 849 __u16 mlid; 850 __u16 reserved; 851 __u64 driver_data[0]; 852 }; 853 854 struct ib_uverbs_detach_mcast { 855 __u8 gid[16]; 856 __u32 qp_handle; 857 __u16 mlid; 858 __u16 reserved; 859 __u64 driver_data[0]; 860 }; 861 862 struct ib_uverbs_flow_spec_hdr { 863 __u32 type; 864 __u16 size; 865 __u16 reserved; 866 /* followed by flow_spec */ 867 __u64 flow_spec_data[0]; 868 }; 869 870 struct ib_uverbs_flow_eth_filter { 871 __u8 dst_mac[6]; 872 __u8 src_mac[6]; 873 __be16 ether_type; 874 __be16 vlan_tag; 875 }; 876 877 struct ib_uverbs_flow_spec_eth { 878 union { 879 struct ib_uverbs_flow_spec_hdr hdr; 880 struct { 881 __u32 type; 882 __u16 size; 883 __u16 reserved; 884 }; 885 }; 886 struct ib_uverbs_flow_eth_filter val; 887 struct ib_uverbs_flow_eth_filter mask; 888 }; 889 890 struct ib_uverbs_flow_ipv4_filter { 891 __be32 src_ip; 892 __be32 dst_ip; 893 __u8 proto; 894 __u8 tos; 895 __u8 ttl; 896 __u8 flags; 897 }; 898 899 struct ib_uverbs_flow_spec_ipv4 { 900 union { 901 struct ib_uverbs_flow_spec_hdr hdr; 902 struct { 903 __u32 type; 904 __u16 size; 905 __u16 reserved; 906 }; 907 }; 908 struct ib_uverbs_flow_ipv4_filter val; 909 struct ib_uverbs_flow_ipv4_filter mask; 910 }; 911 912 struct ib_uverbs_flow_tcp_udp_filter { 913 __be16 dst_port; 914 __be16 src_port; 915 }; 916 917 struct ib_uverbs_flow_spec_tcp_udp { 918 union { 919 struct ib_uverbs_flow_spec_hdr hdr; 920 struct { 921 __u32 type; 922 __u16 size; 923 __u16 reserved; 924 }; 925 }; 926 struct ib_uverbs_flow_tcp_udp_filter val; 927 struct ib_uverbs_flow_tcp_udp_filter mask; 928 }; 929 930 struct ib_uverbs_flow_ipv6_filter { 931 __u8 src_ip[16]; 932 __u8 dst_ip[16]; 933 __be32 flow_label; 934 __u8 next_hdr; 935 __u8 traffic_class; 936 __u8 hop_limit; 937 __u8 reserved; 938 }; 939 940 struct ib_uverbs_flow_spec_ipv6 { 941 union { 942 struct ib_uverbs_flow_spec_hdr hdr; 943 struct { 944 __u32 type; 945 __u16 size; 946 __u16 reserved; 947 }; 948 }; 949 struct ib_uverbs_flow_ipv6_filter val; 950 struct ib_uverbs_flow_ipv6_filter mask; 951 }; 952 953 struct ib_uverbs_flow_spec_action_tag { 954 union { 955 struct ib_uverbs_flow_spec_hdr hdr; 956 struct { 957 __u32 type; 958 __u16 size; 959 __u16 reserved; 960 }; 961 }; 962 __u32 tag_id; 963 __u32 reserved1; 964 }; 965 966 struct ib_uverbs_flow_spec_action_drop { 967 union { 968 struct ib_uverbs_flow_spec_hdr hdr; 969 struct { 970 __u32 type; 971 __u16 size; 972 __u16 reserved; 973 }; 974 }; 975 }; 976 977 struct ib_uverbs_flow_tunnel_filter { 978 __be32 tunnel_id; 979 }; 980 981 struct ib_uverbs_flow_spec_tunnel { 982 union { 983 struct ib_uverbs_flow_spec_hdr hdr; 984 struct { 985 __u32 type; 986 __u16 size; 987 __u16 reserved; 988 }; 989 }; 990 struct ib_uverbs_flow_tunnel_filter val; 991 struct ib_uverbs_flow_tunnel_filter mask; 992 }; 993 994 struct ib_uverbs_flow_attr { 995 __u32 type; 996 __u16 size; 997 __u16 priority; 998 __u8 num_of_specs; 999 __u8 reserved[2]; 1000 __u8 port; 1001 __u32 flags; 1002 /* Following are the optional layers according to user request 1003 * struct ib_flow_spec_xxx 1004 * struct ib_flow_spec_yyy 1005 */ 1006 struct ib_uverbs_flow_spec_hdr flow_specs[0]; 1007 }; 1008 1009 struct ib_uverbs_create_flow { 1010 __u32 comp_mask; 1011 __u32 qp_handle; 1012 struct ib_uverbs_flow_attr flow_attr; 1013 }; 1014 1015 struct ib_uverbs_create_flow_resp { 1016 __u32 comp_mask; 1017 __u32 flow_handle; 1018 }; 1019 1020 struct ib_uverbs_destroy_flow { 1021 __u32 comp_mask; 1022 __u32 flow_handle; 1023 }; 1024 1025 struct ib_uverbs_create_srq { 1026 __u64 response; 1027 __u64 user_handle; 1028 __u32 pd_handle; 1029 __u32 max_wr; 1030 __u32 max_sge; 1031 __u32 srq_limit; 1032 __u64 driver_data[0]; 1033 }; 1034 1035 struct ib_uverbs_create_xsrq { 1036 __u64 response; 1037 __u64 user_handle; 1038 __u32 srq_type; 1039 __u32 pd_handle; 1040 __u32 max_wr; 1041 __u32 max_sge; 1042 __u32 srq_limit; 1043 __u32 max_num_tags; 1044 __u32 xrcd_handle; 1045 __u32 cq_handle; 1046 __u64 driver_data[0]; 1047 }; 1048 1049 struct ib_uverbs_create_srq_resp { 1050 __u32 srq_handle; 1051 __u32 max_wr; 1052 __u32 max_sge; 1053 __u32 srqn; 1054 }; 1055 1056 struct ib_uverbs_modify_srq { 1057 __u32 srq_handle; 1058 __u32 attr_mask; 1059 __u32 max_wr; 1060 __u32 srq_limit; 1061 __u64 driver_data[0]; 1062 }; 1063 1064 struct ib_uverbs_query_srq { 1065 __u64 response; 1066 __u32 srq_handle; 1067 __u32 reserved; 1068 __u64 driver_data[0]; 1069 }; 1070 1071 struct ib_uverbs_query_srq_resp { 1072 __u32 max_wr; 1073 __u32 max_sge; 1074 __u32 srq_limit; 1075 __u32 reserved; 1076 }; 1077 1078 struct ib_uverbs_destroy_srq { 1079 __u64 response; 1080 __u32 srq_handle; 1081 __u32 reserved; 1082 }; 1083 1084 struct ib_uverbs_destroy_srq_resp { 1085 __u32 events_reported; 1086 }; 1087 1088 struct ib_uverbs_ex_create_wq { 1089 __u32 comp_mask; 1090 __u32 wq_type; 1091 __u64 user_handle; 1092 __u32 pd_handle; 1093 __u32 cq_handle; 1094 __u32 max_wr; 1095 __u32 max_sge; 1096 __u32 create_flags; /* Use enum ib_wq_flags */ 1097 __u32 reserved; 1098 }; 1099 1100 struct ib_uverbs_ex_create_wq_resp { 1101 __u32 comp_mask; 1102 __u32 response_length; 1103 __u32 wq_handle; 1104 __u32 max_wr; 1105 __u32 max_sge; 1106 __u32 wqn; 1107 }; 1108 1109 struct ib_uverbs_ex_destroy_wq { 1110 __u32 comp_mask; 1111 __u32 wq_handle; 1112 }; 1113 1114 struct ib_uverbs_ex_destroy_wq_resp { 1115 __u32 comp_mask; 1116 __u32 response_length; 1117 __u32 events_reported; 1118 __u32 reserved; 1119 }; 1120 1121 struct ib_uverbs_ex_modify_wq { 1122 __u32 attr_mask; 1123 __u32 wq_handle; 1124 __u32 wq_state; 1125 __u32 curr_wq_state; 1126 __u32 flags; /* Use enum ib_wq_flags */ 1127 __u32 flags_mask; /* Use enum ib_wq_flags */ 1128 }; 1129 1130 /* Prevent memory allocation rather than max expected size */ 1131 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d 1132 struct ib_uverbs_ex_create_rwq_ind_table { 1133 __u32 comp_mask; 1134 __u32 log_ind_tbl_size; 1135 /* Following are the wq handles according to log_ind_tbl_size 1136 * wq_handle1 1137 * wq_handle2 1138 */ 1139 __u32 wq_handles[0]; 1140 }; 1141 1142 struct ib_uverbs_ex_create_rwq_ind_table_resp { 1143 __u32 comp_mask; 1144 __u32 response_length; 1145 __u32 ind_tbl_handle; 1146 __u32 ind_tbl_num; 1147 }; 1148 1149 struct ib_uverbs_ex_destroy_rwq_ind_table { 1150 __u32 comp_mask; 1151 __u32 ind_tbl_handle; 1152 }; 1153 1154 #define IB_DEVICE_NAME_MAX 64 1155 1156 #endif /* IB_USER_VERBS_H */ 1157