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