1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ 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 ib_uverbs_write_cmds { 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 IB_USER_VERBS_EX_CMD_MODIFY_CQ 106 }; 107 108 /* 109 * Make sure that all structs defined in this file remain laid out so 110 * that they pack the same way on 32-bit and 64-bit architectures (to 111 * avoid incompatibility between 32-bit userspace and 64-bit kernels). 112 * Specifically: 113 * - Do not use pointer types -- pass pointers in __u64 instead. 114 * - Make sure that any structure larger than 4 bytes is padded to a 115 * multiple of 8 bytes. Otherwise the structure size will be 116 * different between 32-bit and 64-bit architectures. 117 */ 118 119 struct ib_uverbs_async_event_desc { 120 __aligned_u64 element; 121 __u32 event_type; /* enum ib_event_type */ 122 __u32 reserved; 123 }; 124 125 struct ib_uverbs_comp_event_desc { 126 __aligned_u64 cq_handle; 127 }; 128 129 struct ib_uverbs_cq_moderation_caps { 130 __u16 max_cq_moderation_count; 131 __u16 max_cq_moderation_period; 132 __u32 reserved; 133 }; 134 135 /* 136 * All commands from userspace should start with a __u32 command field 137 * followed by __u16 in_words and out_words fields (which give the 138 * length of the command block and response buffer if any in 32-bit 139 * words). The kernel driver will read these fields first and read 140 * the rest of the command struct based on these value. 141 */ 142 143 #define IB_USER_VERBS_CMD_COMMAND_MASK 0xff 144 #define IB_USER_VERBS_CMD_FLAG_EXTENDED 0x80000000u 145 146 struct ib_uverbs_cmd_hdr { 147 __u32 command; 148 __u16 in_words; 149 __u16 out_words; 150 }; 151 152 struct ib_uverbs_ex_cmd_hdr { 153 __aligned_u64 response; 154 __u16 provider_in_words; 155 __u16 provider_out_words; 156 __u32 cmd_hdr_reserved; 157 }; 158 159 struct ib_uverbs_get_context { 160 __aligned_u64 response; 161 __aligned_u64 driver_data[0]; 162 }; 163 164 struct ib_uverbs_get_context_resp { 165 __u32 async_fd; 166 __u32 num_comp_vectors; 167 __aligned_u64 driver_data[0]; 168 }; 169 170 struct ib_uverbs_query_device { 171 __aligned_u64 response; 172 __aligned_u64 driver_data[0]; 173 }; 174 175 struct ib_uverbs_query_device_resp { 176 __aligned_u64 fw_ver; 177 __be64 node_guid; 178 __be64 sys_image_guid; 179 __aligned_u64 max_mr_size; 180 __aligned_u64 page_size_cap; 181 __u32 vendor_id; 182 __u32 vendor_part_id; 183 __u32 hw_ver; 184 __u32 max_qp; 185 __u32 max_qp_wr; 186 __u32 device_cap_flags; 187 __u32 max_sge; 188 __u32 max_sge_rd; 189 __u32 max_cq; 190 __u32 max_cqe; 191 __u32 max_mr; 192 __u32 max_pd; 193 __u32 max_qp_rd_atom; 194 __u32 max_ee_rd_atom; 195 __u32 max_res_rd_atom; 196 __u32 max_qp_init_rd_atom; 197 __u32 max_ee_init_rd_atom; 198 __u32 atomic_cap; 199 __u32 max_ee; 200 __u32 max_rdd; 201 __u32 max_mw; 202 __u32 max_raw_ipv6_qp; 203 __u32 max_raw_ethy_qp; 204 __u32 max_mcast_grp; 205 __u32 max_mcast_qp_attach; 206 __u32 max_total_mcast_qp_attach; 207 __u32 max_ah; 208 __u32 max_fmr; 209 __u32 max_map_per_fmr; 210 __u32 max_srq; 211 __u32 max_srq_wr; 212 __u32 max_srq_sge; 213 __u16 max_pkeys; 214 __u8 local_ca_ack_delay; 215 __u8 phys_port_cnt; 216 __u8 reserved[4]; 217 }; 218 219 struct ib_uverbs_ex_query_device { 220 __u32 comp_mask; 221 __u32 reserved; 222 }; 223 224 struct ib_uverbs_odp_caps { 225 __aligned_u64 general_caps; 226 struct { 227 __u32 rc_odp_caps; 228 __u32 uc_odp_caps; 229 __u32 ud_odp_caps; 230 } per_transport_caps; 231 __u32 reserved; 232 }; 233 234 struct ib_uverbs_rss_caps { 235 /* Corresponding bit will be set if qp type from 236 * 'enum ib_qp_type' is supported, e.g. 237 * supported_qpts |= 1 << IB_QPT_UD 238 */ 239 __u32 supported_qpts; 240 __u32 max_rwq_indirection_tables; 241 __u32 max_rwq_indirection_table_size; 242 __u32 reserved; 243 }; 244 245 struct ib_uverbs_tm_caps { 246 /* Max size of rendezvous request message */ 247 __u32 max_rndv_hdr_size; 248 /* Max number of entries in tag matching list */ 249 __u32 max_num_tags; 250 /* TM flags */ 251 __u32 flags; 252 /* Max number of outstanding list operations */ 253 __u32 max_ops; 254 /* Max number of SGE in tag matching entry */ 255 __u32 max_sge; 256 __u32 reserved; 257 }; 258 259 struct ib_uverbs_ex_query_device_resp { 260 struct ib_uverbs_query_device_resp base; 261 __u32 comp_mask; 262 __u32 response_length; 263 struct ib_uverbs_odp_caps odp_caps; 264 __aligned_u64 timestamp_mask; 265 __aligned_u64 hca_core_clock; /* in KHZ */ 266 __aligned_u64 device_cap_flags_ex; 267 struct ib_uverbs_rss_caps rss_caps; 268 __u32 max_wq_type_rq; 269 __u32 raw_packet_caps; 270 struct ib_uverbs_tm_caps tm_caps; 271 struct ib_uverbs_cq_moderation_caps cq_moderation_caps; 272 __aligned_u64 max_dm_size; 273 }; 274 275 struct ib_uverbs_query_port { 276 __aligned_u64 response; 277 __u8 port_num; 278 __u8 reserved[7]; 279 __aligned_u64 driver_data[0]; 280 }; 281 282 struct ib_uverbs_query_port_resp { 283 __u32 port_cap_flags; /* see ib_uverbs_query_port_cap_flags */ 284 __u32 max_msg_sz; 285 __u32 bad_pkey_cntr; 286 __u32 qkey_viol_cntr; 287 __u32 gid_tbl_len; 288 __u16 pkey_tbl_len; 289 __u16 lid; 290 __u16 sm_lid; 291 __u8 state; 292 __u8 max_mtu; 293 __u8 active_mtu; 294 __u8 lmc; 295 __u8 max_vl_num; 296 __u8 sm_sl; 297 __u8 subnet_timeout; 298 __u8 init_type_reply; 299 __u8 active_width; 300 __u8 active_speed; 301 __u8 phys_state; 302 __u8 link_layer; 303 __u8 flags; /* see ib_uverbs_query_port_flags */ 304 __u8 reserved; 305 }; 306 307 struct ib_uverbs_alloc_pd { 308 __aligned_u64 response; 309 __aligned_u64 driver_data[0]; 310 }; 311 312 struct ib_uverbs_alloc_pd_resp { 313 __u32 pd_handle; 314 __u32 driver_data[0]; 315 }; 316 317 struct ib_uverbs_dealloc_pd { 318 __u32 pd_handle; 319 }; 320 321 struct ib_uverbs_open_xrcd { 322 __aligned_u64 response; 323 __u32 fd; 324 __u32 oflags; 325 __aligned_u64 driver_data[0]; 326 }; 327 328 struct ib_uverbs_open_xrcd_resp { 329 __u32 xrcd_handle; 330 __u32 driver_data[0]; 331 }; 332 333 struct ib_uverbs_close_xrcd { 334 __u32 xrcd_handle; 335 }; 336 337 struct ib_uverbs_reg_mr { 338 __aligned_u64 response; 339 __aligned_u64 start; 340 __aligned_u64 length; 341 __aligned_u64 hca_va; 342 __u32 pd_handle; 343 __u32 access_flags; 344 __aligned_u64 driver_data[0]; 345 }; 346 347 struct ib_uverbs_reg_mr_resp { 348 __u32 mr_handle; 349 __u32 lkey; 350 __u32 rkey; 351 __u32 driver_data[0]; 352 }; 353 354 struct ib_uverbs_rereg_mr { 355 __aligned_u64 response; 356 __u32 mr_handle; 357 __u32 flags; 358 __aligned_u64 start; 359 __aligned_u64 length; 360 __aligned_u64 hca_va; 361 __u32 pd_handle; 362 __u32 access_flags; 363 __aligned_u64 driver_data[0]; 364 }; 365 366 struct ib_uverbs_rereg_mr_resp { 367 __u32 lkey; 368 __u32 rkey; 369 __aligned_u64 driver_data[0]; 370 }; 371 372 struct ib_uverbs_dereg_mr { 373 __u32 mr_handle; 374 }; 375 376 struct ib_uverbs_alloc_mw { 377 __aligned_u64 response; 378 __u32 pd_handle; 379 __u8 mw_type; 380 __u8 reserved[3]; 381 __aligned_u64 driver_data[0]; 382 }; 383 384 struct ib_uverbs_alloc_mw_resp { 385 __u32 mw_handle; 386 __u32 rkey; 387 __aligned_u64 driver_data[0]; 388 }; 389 390 struct ib_uverbs_dealloc_mw { 391 __u32 mw_handle; 392 }; 393 394 struct ib_uverbs_create_comp_channel { 395 __aligned_u64 response; 396 }; 397 398 struct ib_uverbs_create_comp_channel_resp { 399 __u32 fd; 400 }; 401 402 struct ib_uverbs_create_cq { 403 __aligned_u64 response; 404 __aligned_u64 user_handle; 405 __u32 cqe; 406 __u32 comp_vector; 407 __s32 comp_channel; 408 __u32 reserved; 409 __aligned_u64 driver_data[0]; 410 }; 411 412 enum ib_uverbs_ex_create_cq_flags { 413 IB_UVERBS_CQ_FLAGS_TIMESTAMP_COMPLETION = 1 << 0, 414 IB_UVERBS_CQ_FLAGS_IGNORE_OVERRUN = 1 << 1, 415 }; 416 417 struct ib_uverbs_ex_create_cq { 418 __aligned_u64 user_handle; 419 __u32 cqe; 420 __u32 comp_vector; 421 __s32 comp_channel; 422 __u32 comp_mask; 423 __u32 flags; /* bitmask of ib_uverbs_ex_create_cq_flags */ 424 __u32 reserved; 425 }; 426 427 struct ib_uverbs_create_cq_resp { 428 __u32 cq_handle; 429 __u32 cqe; 430 __aligned_u64 driver_data[0]; 431 }; 432 433 struct ib_uverbs_ex_create_cq_resp { 434 struct ib_uverbs_create_cq_resp base; 435 __u32 comp_mask; 436 __u32 response_length; 437 }; 438 439 struct ib_uverbs_resize_cq { 440 __aligned_u64 response; 441 __u32 cq_handle; 442 __u32 cqe; 443 __aligned_u64 driver_data[0]; 444 }; 445 446 struct ib_uverbs_resize_cq_resp { 447 __u32 cqe; 448 __u32 reserved; 449 __aligned_u64 driver_data[0]; 450 }; 451 452 struct ib_uverbs_poll_cq { 453 __aligned_u64 response; 454 __u32 cq_handle; 455 __u32 ne; 456 }; 457 458 struct ib_uverbs_wc { 459 __aligned_u64 wr_id; 460 __u32 status; 461 __u32 opcode; 462 __u32 vendor_err; 463 __u32 byte_len; 464 union { 465 __be32 imm_data; 466 __u32 invalidate_rkey; 467 } ex; 468 __u32 qp_num; 469 __u32 src_qp; 470 __u32 wc_flags; 471 __u16 pkey_index; 472 __u16 slid; 473 __u8 sl; 474 __u8 dlid_path_bits; 475 __u8 port_num; 476 __u8 reserved; 477 }; 478 479 struct ib_uverbs_poll_cq_resp { 480 __u32 count; 481 __u32 reserved; 482 struct ib_uverbs_wc wc[0]; 483 }; 484 485 struct ib_uverbs_req_notify_cq { 486 __u32 cq_handle; 487 __u32 solicited_only; 488 }; 489 490 struct ib_uverbs_destroy_cq { 491 __aligned_u64 response; 492 __u32 cq_handle; 493 __u32 reserved; 494 }; 495 496 struct ib_uverbs_destroy_cq_resp { 497 __u32 comp_events_reported; 498 __u32 async_events_reported; 499 }; 500 501 struct ib_uverbs_global_route { 502 __u8 dgid[16]; 503 __u32 flow_label; 504 __u8 sgid_index; 505 __u8 hop_limit; 506 __u8 traffic_class; 507 __u8 reserved; 508 }; 509 510 struct ib_uverbs_ah_attr { 511 struct ib_uverbs_global_route grh; 512 __u16 dlid; 513 __u8 sl; 514 __u8 src_path_bits; 515 __u8 static_rate; 516 __u8 is_global; 517 __u8 port_num; 518 __u8 reserved; 519 }; 520 521 struct ib_uverbs_qp_attr { 522 __u32 qp_attr_mask; 523 __u32 qp_state; 524 __u32 cur_qp_state; 525 __u32 path_mtu; 526 __u32 path_mig_state; 527 __u32 qkey; 528 __u32 rq_psn; 529 __u32 sq_psn; 530 __u32 dest_qp_num; 531 __u32 qp_access_flags; 532 533 struct ib_uverbs_ah_attr ah_attr; 534 struct ib_uverbs_ah_attr alt_ah_attr; 535 536 /* ib_qp_cap */ 537 __u32 max_send_wr; 538 __u32 max_recv_wr; 539 __u32 max_send_sge; 540 __u32 max_recv_sge; 541 __u32 max_inline_data; 542 543 __u16 pkey_index; 544 __u16 alt_pkey_index; 545 __u8 en_sqd_async_notify; 546 __u8 sq_draining; 547 __u8 max_rd_atomic; 548 __u8 max_dest_rd_atomic; 549 __u8 min_rnr_timer; 550 __u8 port_num; 551 __u8 timeout; 552 __u8 retry_cnt; 553 __u8 rnr_retry; 554 __u8 alt_port_num; 555 __u8 alt_timeout; 556 __u8 reserved[5]; 557 }; 558 559 struct ib_uverbs_create_qp { 560 __aligned_u64 response; 561 __aligned_u64 user_handle; 562 __u32 pd_handle; 563 __u32 send_cq_handle; 564 __u32 recv_cq_handle; 565 __u32 srq_handle; 566 __u32 max_send_wr; 567 __u32 max_recv_wr; 568 __u32 max_send_sge; 569 __u32 max_recv_sge; 570 __u32 max_inline_data; 571 __u8 sq_sig_all; 572 __u8 qp_type; 573 __u8 is_srq; 574 __u8 reserved; 575 __aligned_u64 driver_data[0]; 576 }; 577 578 enum ib_uverbs_create_qp_mask { 579 IB_UVERBS_CREATE_QP_MASK_IND_TABLE = 1UL << 0, 580 }; 581 582 enum { 583 IB_UVERBS_CREATE_QP_SUP_COMP_MASK = IB_UVERBS_CREATE_QP_MASK_IND_TABLE, 584 }; 585 586 enum { 587 /* 588 * This value is equal to IB_QP_DEST_QPN. 589 */ 590 IB_USER_LEGACY_LAST_QP_ATTR_MASK = 1ULL << 20, 591 }; 592 593 enum { 594 /* 595 * This value is equal to IB_QP_RATE_LIMIT. 596 */ 597 IB_USER_LAST_QP_ATTR_MASK = 1ULL << 25, 598 }; 599 600 struct ib_uverbs_ex_create_qp { 601 __aligned_u64 user_handle; 602 __u32 pd_handle; 603 __u32 send_cq_handle; 604 __u32 recv_cq_handle; 605 __u32 srq_handle; 606 __u32 max_send_wr; 607 __u32 max_recv_wr; 608 __u32 max_send_sge; 609 __u32 max_recv_sge; 610 __u32 max_inline_data; 611 __u8 sq_sig_all; 612 __u8 qp_type; 613 __u8 is_srq; 614 __u8 reserved; 615 __u32 comp_mask; 616 __u32 create_flags; 617 __u32 rwq_ind_tbl_handle; 618 __u32 source_qpn; 619 }; 620 621 struct ib_uverbs_open_qp { 622 __aligned_u64 response; 623 __aligned_u64 user_handle; 624 __u32 pd_handle; 625 __u32 qpn; 626 __u8 qp_type; 627 __u8 reserved[7]; 628 __aligned_u64 driver_data[0]; 629 }; 630 631 /* also used for open response */ 632 struct ib_uverbs_create_qp_resp { 633 __u32 qp_handle; 634 __u32 qpn; 635 __u32 max_send_wr; 636 __u32 max_recv_wr; 637 __u32 max_send_sge; 638 __u32 max_recv_sge; 639 __u32 max_inline_data; 640 __u32 reserved; 641 __u32 driver_data[0]; 642 }; 643 644 struct ib_uverbs_ex_create_qp_resp { 645 struct ib_uverbs_create_qp_resp base; 646 __u32 comp_mask; 647 __u32 response_length; 648 }; 649 650 /* 651 * This struct needs to remain a multiple of 8 bytes to keep the 652 * alignment of the modify QP parameters. 653 */ 654 struct ib_uverbs_qp_dest { 655 __u8 dgid[16]; 656 __u32 flow_label; 657 __u16 dlid; 658 __u16 reserved; 659 __u8 sgid_index; 660 __u8 hop_limit; 661 __u8 traffic_class; 662 __u8 sl; 663 __u8 src_path_bits; 664 __u8 static_rate; 665 __u8 is_global; 666 __u8 port_num; 667 }; 668 669 struct ib_uverbs_query_qp { 670 __aligned_u64 response; 671 __u32 qp_handle; 672 __u32 attr_mask; 673 __aligned_u64 driver_data[0]; 674 }; 675 676 struct ib_uverbs_query_qp_resp { 677 struct ib_uverbs_qp_dest dest; 678 struct ib_uverbs_qp_dest alt_dest; 679 __u32 max_send_wr; 680 __u32 max_recv_wr; 681 __u32 max_send_sge; 682 __u32 max_recv_sge; 683 __u32 max_inline_data; 684 __u32 qkey; 685 __u32 rq_psn; 686 __u32 sq_psn; 687 __u32 dest_qp_num; 688 __u32 qp_access_flags; 689 __u16 pkey_index; 690 __u16 alt_pkey_index; 691 __u8 qp_state; 692 __u8 cur_qp_state; 693 __u8 path_mtu; 694 __u8 path_mig_state; 695 __u8 sq_draining; 696 __u8 max_rd_atomic; 697 __u8 max_dest_rd_atomic; 698 __u8 min_rnr_timer; 699 __u8 port_num; 700 __u8 timeout; 701 __u8 retry_cnt; 702 __u8 rnr_retry; 703 __u8 alt_port_num; 704 __u8 alt_timeout; 705 __u8 sq_sig_all; 706 __u8 reserved[5]; 707 __aligned_u64 driver_data[0]; 708 }; 709 710 struct ib_uverbs_modify_qp { 711 struct ib_uverbs_qp_dest dest; 712 struct ib_uverbs_qp_dest alt_dest; 713 __u32 qp_handle; 714 __u32 attr_mask; 715 __u32 qkey; 716 __u32 rq_psn; 717 __u32 sq_psn; 718 __u32 dest_qp_num; 719 __u32 qp_access_flags; 720 __u16 pkey_index; 721 __u16 alt_pkey_index; 722 __u8 qp_state; 723 __u8 cur_qp_state; 724 __u8 path_mtu; 725 __u8 path_mig_state; 726 __u8 en_sqd_async_notify; 727 __u8 max_rd_atomic; 728 __u8 max_dest_rd_atomic; 729 __u8 min_rnr_timer; 730 __u8 port_num; 731 __u8 timeout; 732 __u8 retry_cnt; 733 __u8 rnr_retry; 734 __u8 alt_port_num; 735 __u8 alt_timeout; 736 __u8 reserved[2]; 737 __aligned_u64 driver_data[0]; 738 }; 739 740 struct ib_uverbs_ex_modify_qp { 741 struct ib_uverbs_modify_qp base; 742 __u32 rate_limit; 743 __u32 reserved; 744 }; 745 746 struct ib_uverbs_ex_modify_qp_resp { 747 __u32 comp_mask; 748 __u32 response_length; 749 }; 750 751 struct ib_uverbs_destroy_qp { 752 __aligned_u64 response; 753 __u32 qp_handle; 754 __u32 reserved; 755 }; 756 757 struct ib_uverbs_destroy_qp_resp { 758 __u32 events_reported; 759 }; 760 761 /* 762 * The ib_uverbs_sge structure isn't used anywhere, since we assume 763 * the ib_sge structure is packed the same way on 32-bit and 64-bit 764 * architectures in both kernel and user space. It's just here to 765 * document the ABI. 766 */ 767 struct ib_uverbs_sge { 768 __aligned_u64 addr; 769 __u32 length; 770 __u32 lkey; 771 }; 772 773 enum ib_uverbs_wr_opcode { 774 IB_UVERBS_WR_RDMA_WRITE = 0, 775 IB_UVERBS_WR_RDMA_WRITE_WITH_IMM = 1, 776 IB_UVERBS_WR_SEND = 2, 777 IB_UVERBS_WR_SEND_WITH_IMM = 3, 778 IB_UVERBS_WR_RDMA_READ = 4, 779 IB_UVERBS_WR_ATOMIC_CMP_AND_SWP = 5, 780 IB_UVERBS_WR_ATOMIC_FETCH_AND_ADD = 6, 781 IB_UVERBS_WR_LOCAL_INV = 7, 782 IB_UVERBS_WR_BIND_MW = 8, 783 IB_UVERBS_WR_SEND_WITH_INV = 9, 784 IB_UVERBS_WR_TSO = 10, 785 IB_UVERBS_WR_RDMA_READ_WITH_INV = 11, 786 IB_UVERBS_WR_MASKED_ATOMIC_CMP_AND_SWP = 12, 787 IB_UVERBS_WR_MASKED_ATOMIC_FETCH_AND_ADD = 13, 788 /* Review enum ib_wr_opcode before modifying this */ 789 }; 790 791 struct ib_uverbs_send_wr { 792 __aligned_u64 wr_id; 793 __u32 num_sge; 794 __u32 opcode; /* see enum ib_uverbs_wr_opcode */ 795 __u32 send_flags; 796 union { 797 __be32 imm_data; 798 __u32 invalidate_rkey; 799 } ex; 800 union { 801 struct { 802 __aligned_u64 remote_addr; 803 __u32 rkey; 804 __u32 reserved; 805 } rdma; 806 struct { 807 __aligned_u64 remote_addr; 808 __aligned_u64 compare_add; 809 __aligned_u64 swap; 810 __u32 rkey; 811 __u32 reserved; 812 } atomic; 813 struct { 814 __u32 ah; 815 __u32 remote_qpn; 816 __u32 remote_qkey; 817 __u32 reserved; 818 } ud; 819 } wr; 820 }; 821 822 struct ib_uverbs_post_send { 823 __aligned_u64 response; 824 __u32 qp_handle; 825 __u32 wr_count; 826 __u32 sge_count; 827 __u32 wqe_size; 828 struct ib_uverbs_send_wr send_wr[0]; 829 }; 830 831 struct ib_uverbs_post_send_resp { 832 __u32 bad_wr; 833 }; 834 835 struct ib_uverbs_recv_wr { 836 __aligned_u64 wr_id; 837 __u32 num_sge; 838 __u32 reserved; 839 }; 840 841 struct ib_uverbs_post_recv { 842 __aligned_u64 response; 843 __u32 qp_handle; 844 __u32 wr_count; 845 __u32 sge_count; 846 __u32 wqe_size; 847 struct ib_uverbs_recv_wr recv_wr[0]; 848 }; 849 850 struct ib_uverbs_post_recv_resp { 851 __u32 bad_wr; 852 }; 853 854 struct ib_uverbs_post_srq_recv { 855 __aligned_u64 response; 856 __u32 srq_handle; 857 __u32 wr_count; 858 __u32 sge_count; 859 __u32 wqe_size; 860 struct ib_uverbs_recv_wr recv[0]; 861 }; 862 863 struct ib_uverbs_post_srq_recv_resp { 864 __u32 bad_wr; 865 }; 866 867 struct ib_uverbs_create_ah { 868 __aligned_u64 response; 869 __aligned_u64 user_handle; 870 __u32 pd_handle; 871 __u32 reserved; 872 struct ib_uverbs_ah_attr attr; 873 __aligned_u64 driver_data[0]; 874 }; 875 876 struct ib_uverbs_create_ah_resp { 877 __u32 ah_handle; 878 __u32 driver_data[0]; 879 }; 880 881 struct ib_uverbs_destroy_ah { 882 __u32 ah_handle; 883 }; 884 885 struct ib_uverbs_attach_mcast { 886 __u8 gid[16]; 887 __u32 qp_handle; 888 __u16 mlid; 889 __u16 reserved; 890 __aligned_u64 driver_data[0]; 891 }; 892 893 struct ib_uverbs_detach_mcast { 894 __u8 gid[16]; 895 __u32 qp_handle; 896 __u16 mlid; 897 __u16 reserved; 898 __aligned_u64 driver_data[0]; 899 }; 900 901 struct ib_uverbs_flow_spec_hdr { 902 __u32 type; 903 __u16 size; 904 __u16 reserved; 905 /* followed by flow_spec */ 906 __aligned_u64 flow_spec_data[0]; 907 }; 908 909 struct ib_uverbs_flow_eth_filter { 910 __u8 dst_mac[6]; 911 __u8 src_mac[6]; 912 __be16 ether_type; 913 __be16 vlan_tag; 914 }; 915 916 struct ib_uverbs_flow_spec_eth { 917 union { 918 struct ib_uverbs_flow_spec_hdr hdr; 919 struct { 920 __u32 type; 921 __u16 size; 922 __u16 reserved; 923 }; 924 }; 925 struct ib_uverbs_flow_eth_filter val; 926 struct ib_uverbs_flow_eth_filter mask; 927 }; 928 929 struct ib_uverbs_flow_ipv4_filter { 930 __be32 src_ip; 931 __be32 dst_ip; 932 __u8 proto; 933 __u8 tos; 934 __u8 ttl; 935 __u8 flags; 936 }; 937 938 struct ib_uverbs_flow_spec_ipv4 { 939 union { 940 struct ib_uverbs_flow_spec_hdr hdr; 941 struct { 942 __u32 type; 943 __u16 size; 944 __u16 reserved; 945 }; 946 }; 947 struct ib_uverbs_flow_ipv4_filter val; 948 struct ib_uverbs_flow_ipv4_filter mask; 949 }; 950 951 struct ib_uverbs_flow_tcp_udp_filter { 952 __be16 dst_port; 953 __be16 src_port; 954 }; 955 956 struct ib_uverbs_flow_spec_tcp_udp { 957 union { 958 struct ib_uverbs_flow_spec_hdr hdr; 959 struct { 960 __u32 type; 961 __u16 size; 962 __u16 reserved; 963 }; 964 }; 965 struct ib_uverbs_flow_tcp_udp_filter val; 966 struct ib_uverbs_flow_tcp_udp_filter mask; 967 }; 968 969 struct ib_uverbs_flow_ipv6_filter { 970 __u8 src_ip[16]; 971 __u8 dst_ip[16]; 972 __be32 flow_label; 973 __u8 next_hdr; 974 __u8 traffic_class; 975 __u8 hop_limit; 976 __u8 reserved; 977 }; 978 979 struct ib_uverbs_flow_spec_ipv6 { 980 union { 981 struct ib_uverbs_flow_spec_hdr hdr; 982 struct { 983 __u32 type; 984 __u16 size; 985 __u16 reserved; 986 }; 987 }; 988 struct ib_uverbs_flow_ipv6_filter val; 989 struct ib_uverbs_flow_ipv6_filter mask; 990 }; 991 992 struct ib_uverbs_flow_spec_action_tag { 993 union { 994 struct ib_uverbs_flow_spec_hdr hdr; 995 struct { 996 __u32 type; 997 __u16 size; 998 __u16 reserved; 999 }; 1000 }; 1001 __u32 tag_id; 1002 __u32 reserved1; 1003 }; 1004 1005 struct ib_uverbs_flow_spec_action_drop { 1006 union { 1007 struct ib_uverbs_flow_spec_hdr hdr; 1008 struct { 1009 __u32 type; 1010 __u16 size; 1011 __u16 reserved; 1012 }; 1013 }; 1014 }; 1015 1016 struct ib_uverbs_flow_spec_action_handle { 1017 union { 1018 struct ib_uverbs_flow_spec_hdr hdr; 1019 struct { 1020 __u32 type; 1021 __u16 size; 1022 __u16 reserved; 1023 }; 1024 }; 1025 __u32 handle; 1026 __u32 reserved1; 1027 }; 1028 1029 struct ib_uverbs_flow_spec_action_count { 1030 union { 1031 struct ib_uverbs_flow_spec_hdr hdr; 1032 struct { 1033 __u32 type; 1034 __u16 size; 1035 __u16 reserved; 1036 }; 1037 }; 1038 __u32 handle; 1039 __u32 reserved1; 1040 }; 1041 1042 struct ib_uverbs_flow_tunnel_filter { 1043 __be32 tunnel_id; 1044 }; 1045 1046 struct ib_uverbs_flow_spec_tunnel { 1047 union { 1048 struct ib_uverbs_flow_spec_hdr hdr; 1049 struct { 1050 __u32 type; 1051 __u16 size; 1052 __u16 reserved; 1053 }; 1054 }; 1055 struct ib_uverbs_flow_tunnel_filter val; 1056 struct ib_uverbs_flow_tunnel_filter mask; 1057 }; 1058 1059 struct ib_uverbs_flow_spec_esp_filter { 1060 __u32 spi; 1061 __u32 seq; 1062 }; 1063 1064 struct ib_uverbs_flow_spec_esp { 1065 union { 1066 struct ib_uverbs_flow_spec_hdr hdr; 1067 struct { 1068 __u32 type; 1069 __u16 size; 1070 __u16 reserved; 1071 }; 1072 }; 1073 struct ib_uverbs_flow_spec_esp_filter val; 1074 struct ib_uverbs_flow_spec_esp_filter mask; 1075 }; 1076 1077 struct ib_uverbs_flow_gre_filter { 1078 /* c_ks_res0_ver field is bits 0-15 in offset 0 of a standard GRE header: 1079 * bit 0 - C - checksum bit. 1080 * bit 1 - reserved. set to 0. 1081 * bit 2 - key bit. 1082 * bit 3 - sequence number bit. 1083 * bits 4:12 - reserved. set to 0. 1084 * bits 13:15 - GRE version. 1085 */ 1086 __be16 c_ks_res0_ver; 1087 __be16 protocol; 1088 __be32 key; 1089 }; 1090 1091 struct ib_uverbs_flow_spec_gre { 1092 union { 1093 struct ib_uverbs_flow_spec_hdr hdr; 1094 struct { 1095 __u32 type; 1096 __u16 size; 1097 __u16 reserved; 1098 }; 1099 }; 1100 struct ib_uverbs_flow_gre_filter val; 1101 struct ib_uverbs_flow_gre_filter mask; 1102 }; 1103 1104 struct ib_uverbs_flow_mpls_filter { 1105 /* The field includes the entire MPLS label: 1106 * bits 0:19 - label field. 1107 * bits 20:22 - traffic class field. 1108 * bits 23 - bottom of stack bit. 1109 * bits 24:31 - ttl field. 1110 */ 1111 __be32 label; 1112 }; 1113 1114 struct ib_uverbs_flow_spec_mpls { 1115 union { 1116 struct ib_uverbs_flow_spec_hdr hdr; 1117 struct { 1118 __u32 type; 1119 __u16 size; 1120 __u16 reserved; 1121 }; 1122 }; 1123 struct ib_uverbs_flow_mpls_filter val; 1124 struct ib_uverbs_flow_mpls_filter mask; 1125 }; 1126 1127 struct ib_uverbs_flow_attr { 1128 __u32 type; 1129 __u16 size; 1130 __u16 priority; 1131 __u8 num_of_specs; 1132 __u8 reserved[2]; 1133 __u8 port; 1134 __u32 flags; 1135 /* Following are the optional layers according to user request 1136 * struct ib_flow_spec_xxx 1137 * struct ib_flow_spec_yyy 1138 */ 1139 struct ib_uverbs_flow_spec_hdr flow_specs[0]; 1140 }; 1141 1142 struct ib_uverbs_create_flow { 1143 __u32 comp_mask; 1144 __u32 qp_handle; 1145 struct ib_uverbs_flow_attr flow_attr; 1146 }; 1147 1148 struct ib_uverbs_create_flow_resp { 1149 __u32 comp_mask; 1150 __u32 flow_handle; 1151 }; 1152 1153 struct ib_uverbs_destroy_flow { 1154 __u32 comp_mask; 1155 __u32 flow_handle; 1156 }; 1157 1158 struct ib_uverbs_create_srq { 1159 __aligned_u64 response; 1160 __aligned_u64 user_handle; 1161 __u32 pd_handle; 1162 __u32 max_wr; 1163 __u32 max_sge; 1164 __u32 srq_limit; 1165 __aligned_u64 driver_data[0]; 1166 }; 1167 1168 struct ib_uverbs_create_xsrq { 1169 __aligned_u64 response; 1170 __aligned_u64 user_handle; 1171 __u32 srq_type; 1172 __u32 pd_handle; 1173 __u32 max_wr; 1174 __u32 max_sge; 1175 __u32 srq_limit; 1176 __u32 max_num_tags; 1177 __u32 xrcd_handle; 1178 __u32 cq_handle; 1179 __aligned_u64 driver_data[0]; 1180 }; 1181 1182 struct ib_uverbs_create_srq_resp { 1183 __u32 srq_handle; 1184 __u32 max_wr; 1185 __u32 max_sge; 1186 __u32 srqn; 1187 __u32 driver_data[0]; 1188 }; 1189 1190 struct ib_uverbs_modify_srq { 1191 __u32 srq_handle; 1192 __u32 attr_mask; 1193 __u32 max_wr; 1194 __u32 srq_limit; 1195 __aligned_u64 driver_data[0]; 1196 }; 1197 1198 struct ib_uverbs_query_srq { 1199 __aligned_u64 response; 1200 __u32 srq_handle; 1201 __u32 reserved; 1202 __aligned_u64 driver_data[0]; 1203 }; 1204 1205 struct ib_uverbs_query_srq_resp { 1206 __u32 max_wr; 1207 __u32 max_sge; 1208 __u32 srq_limit; 1209 __u32 reserved; 1210 }; 1211 1212 struct ib_uverbs_destroy_srq { 1213 __aligned_u64 response; 1214 __u32 srq_handle; 1215 __u32 reserved; 1216 }; 1217 1218 struct ib_uverbs_destroy_srq_resp { 1219 __u32 events_reported; 1220 }; 1221 1222 struct ib_uverbs_ex_create_wq { 1223 __u32 comp_mask; 1224 __u32 wq_type; 1225 __aligned_u64 user_handle; 1226 __u32 pd_handle; 1227 __u32 cq_handle; 1228 __u32 max_wr; 1229 __u32 max_sge; 1230 __u32 create_flags; /* Use enum ib_wq_flags */ 1231 __u32 reserved; 1232 }; 1233 1234 struct ib_uverbs_ex_create_wq_resp { 1235 __u32 comp_mask; 1236 __u32 response_length; 1237 __u32 wq_handle; 1238 __u32 max_wr; 1239 __u32 max_sge; 1240 __u32 wqn; 1241 }; 1242 1243 struct ib_uverbs_ex_destroy_wq { 1244 __u32 comp_mask; 1245 __u32 wq_handle; 1246 }; 1247 1248 struct ib_uverbs_ex_destroy_wq_resp { 1249 __u32 comp_mask; 1250 __u32 response_length; 1251 __u32 events_reported; 1252 __u32 reserved; 1253 }; 1254 1255 struct ib_uverbs_ex_modify_wq { 1256 __u32 attr_mask; 1257 __u32 wq_handle; 1258 __u32 wq_state; 1259 __u32 curr_wq_state; 1260 __u32 flags; /* Use enum ib_wq_flags */ 1261 __u32 flags_mask; /* Use enum ib_wq_flags */ 1262 }; 1263 1264 /* Prevent memory allocation rather than max expected size */ 1265 #define IB_USER_VERBS_MAX_LOG_IND_TBL_SIZE 0x0d 1266 struct ib_uverbs_ex_create_rwq_ind_table { 1267 __u32 comp_mask; 1268 __u32 log_ind_tbl_size; 1269 /* Following are the wq handles according to log_ind_tbl_size 1270 * wq_handle1 1271 * wq_handle2 1272 */ 1273 __u32 wq_handles[0]; 1274 }; 1275 1276 struct ib_uverbs_ex_create_rwq_ind_table_resp { 1277 __u32 comp_mask; 1278 __u32 response_length; 1279 __u32 ind_tbl_handle; 1280 __u32 ind_tbl_num; 1281 }; 1282 1283 struct ib_uverbs_ex_destroy_rwq_ind_table { 1284 __u32 comp_mask; 1285 __u32 ind_tbl_handle; 1286 }; 1287 1288 struct ib_uverbs_cq_moderation { 1289 __u16 cq_count; 1290 __u16 cq_period; 1291 }; 1292 1293 struct ib_uverbs_ex_modify_cq { 1294 __u32 cq_handle; 1295 __u32 attr_mask; 1296 struct ib_uverbs_cq_moderation attr; 1297 __u32 reserved; 1298 }; 1299 1300 #define IB_DEVICE_NAME_MAX 64 1301 1302 #endif /* IB_USER_VERBS_H */ 1303