12ce62149SGal Pressman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 22ce62149SGal Pressman /* 3556c811fSGal Pressman * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved. 42ce62149SGal Pressman */ 52ce62149SGal Pressman 62ce62149SGal Pressman #ifndef EFA_ABI_USER_H 72ce62149SGal Pressman #define EFA_ABI_USER_H 82ce62149SGal Pressman 92ce62149SGal Pressman #include <linux/types.h> 102ce62149SGal Pressman 112ce62149SGal Pressman /* 122ce62149SGal Pressman * Increment this value if any changes that break userspace ABI 132ce62149SGal Pressman * compatibility are made. 142ce62149SGal Pressman */ 152ce62149SGal Pressman #define EFA_UVERBS_ABI_VERSION 1 162ce62149SGal Pressman 172ce62149SGal Pressman /* 182ce62149SGal Pressman * Keep structs aligned to 8 bytes. 192ce62149SGal Pressman * Keep reserved fields as arrays of __u8 named reserved_XXX where XXX is the 202ce62149SGal Pressman * hex bit offset of the field. 212ce62149SGal Pressman */ 222ce62149SGal Pressman 23a5d87b69SGal Pressman enum { 24a5d87b69SGal Pressman EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH = 1 << 0, 25a5d87b69SGal Pressman EFA_ALLOC_UCONTEXT_CMD_COMP_MIN_SQ_WR = 1 << 1, 26a5d87b69SGal Pressman }; 27a5d87b69SGal Pressman 28a5d87b69SGal Pressman struct efa_ibv_alloc_ucontext_cmd { 29a5d87b69SGal Pressman __u32 comp_mask; 30a5d87b69SGal Pressman __u8 reserved_20[4]; 31a5d87b69SGal Pressman }; 32a5d87b69SGal Pressman 332ce62149SGal Pressman enum efa_ibv_user_cmds_supp_udata { 342ce62149SGal Pressman EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0, 352ce62149SGal Pressman EFA_USER_CMDS_SUPP_UDATA_CREATE_AH = 1 << 1, 362ce62149SGal Pressman }; 372ce62149SGal Pressman 382ce62149SGal Pressman struct efa_ibv_alloc_ucontext_resp { 392ce62149SGal Pressman __u32 comp_mask; 402ce62149SGal Pressman __u32 cmds_supp_udata_mask; 412ce62149SGal Pressman __u16 sub_cqs_per_cq; 422ce62149SGal Pressman __u16 inline_buf_size; 432ce62149SGal Pressman __u32 max_llq_size; /* bytes */ 44556c811fSGal Pressman __u16 max_tx_batch; /* units of 64 bytes */ 45da2924bdSGal Pressman __u16 min_sq_wr; 46da2924bdSGal Pressman __u8 reserved_a0[4]; 472ce62149SGal Pressman }; 482ce62149SGal Pressman 492ce62149SGal Pressman struct efa_ibv_alloc_pd_resp { 502ce62149SGal Pressman __u32 comp_mask; 512ce62149SGal Pressman __u16 pdn; 522ce62149SGal Pressman __u8 reserved_30[2]; 532ce62149SGal Pressman }; 542ce62149SGal Pressman 552ce62149SGal Pressman struct efa_ibv_create_cq { 562ce62149SGal Pressman __u32 comp_mask; 572ce62149SGal Pressman __u32 cq_entry_size; 582ce62149SGal Pressman __u16 num_sub_cqs; 592ce62149SGal Pressman __u8 reserved_50[6]; 602ce62149SGal Pressman }; 612ce62149SGal Pressman 622ce62149SGal Pressman struct efa_ibv_create_cq_resp { 632ce62149SGal Pressman __u32 comp_mask; 642ce62149SGal Pressman __u8 reserved_20[4]; 652ce62149SGal Pressman __aligned_u64 q_mmap_key; 662ce62149SGal Pressman __aligned_u64 q_mmap_size; 672ce62149SGal Pressman __u16 cq_idx; 682ce62149SGal Pressman __u8 reserved_d0[6]; 692ce62149SGal Pressman }; 702ce62149SGal Pressman 712ce62149SGal Pressman enum { 722ce62149SGal Pressman EFA_QP_DRIVER_TYPE_SRD = 0, 732ce62149SGal Pressman }; 742ce62149SGal Pressman 752ce62149SGal Pressman struct efa_ibv_create_qp { 762ce62149SGal Pressman __u32 comp_mask; 772ce62149SGal Pressman __u32 rq_ring_size; /* bytes */ 782ce62149SGal Pressman __u32 sq_ring_size; /* bytes */ 792ce62149SGal Pressman __u32 driver_qp_type; 802ce62149SGal Pressman }; 812ce62149SGal Pressman 822ce62149SGal Pressman struct efa_ibv_create_qp_resp { 832ce62149SGal Pressman __u32 comp_mask; 842ce62149SGal Pressman /* the offset inside the page of the rq db */ 852ce62149SGal Pressman __u32 rq_db_offset; 862ce62149SGal Pressman /* the offset inside the page of the sq db */ 872ce62149SGal Pressman __u32 sq_db_offset; 882ce62149SGal Pressman /* the offset inside the page of descriptors buffer */ 892ce62149SGal Pressman __u32 llq_desc_offset; 902ce62149SGal Pressman __aligned_u64 rq_mmap_key; 912ce62149SGal Pressman __aligned_u64 rq_mmap_size; 922ce62149SGal Pressman __aligned_u64 rq_db_mmap_key; 932ce62149SGal Pressman __aligned_u64 sq_db_mmap_key; 942ce62149SGal Pressman __aligned_u64 llq_desc_mmap_key; 952ce62149SGal Pressman __u16 send_sub_cq_idx; 962ce62149SGal Pressman __u16 recv_sub_cq_idx; 972ce62149SGal Pressman __u8 reserved_1e0[4]; 982ce62149SGal Pressman }; 992ce62149SGal Pressman 1002ce62149SGal Pressman struct efa_ibv_create_ah_resp { 1012ce62149SGal Pressman __u32 comp_mask; 1022ce62149SGal Pressman __u16 efa_address_handle; 1032ce62149SGal Pressman __u8 reserved_30[2]; 1042ce62149SGal Pressman }; 1052ce62149SGal Pressman 106666e8ff5SDaniel Kranzdorf enum { 107666e8ff5SDaniel Kranzdorf EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0, 108*a4e6a1ddSGal Pressman EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1, 109666e8ff5SDaniel Kranzdorf }; 110666e8ff5SDaniel Kranzdorf 1112ce62149SGal Pressman struct efa_ibv_ex_query_device_resp { 1122ce62149SGal Pressman __u32 comp_mask; 1132ce62149SGal Pressman __u32 max_sq_wr; 1142ce62149SGal Pressman __u32 max_rq_wr; 1152ce62149SGal Pressman __u16 max_sq_sge; 1162ce62149SGal Pressman __u16 max_rq_sge; 117666e8ff5SDaniel Kranzdorf __u32 max_rdma_size; 118666e8ff5SDaniel Kranzdorf __u32 device_caps; 1192ce62149SGal Pressman }; 1202ce62149SGal Pressman 1212ce62149SGal Pressman #endif /* EFA_ABI_USER_H */ 122