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