1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2 /* 3 * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved. 4 */ 5 6 #ifndef EFA_ABI_USER_H 7 #define EFA_ABI_USER_H 8 9 #include <linux/types.h> 10 11 /* 12 * Increment this value if any changes that break userspace ABI 13 * compatibility are made. 14 */ 15 #define EFA_UVERBS_ABI_VERSION 1 16 17 /* 18 * Keep structs aligned to 8 bytes. 19 * Keep reserved fields as arrays of __u8 named reserved_XXX where XXX is the 20 * hex bit offset of the field. 21 */ 22 23 enum { 24 EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH = 1 << 0, 25 EFA_ALLOC_UCONTEXT_CMD_COMP_MIN_SQ_WR = 1 << 1, 26 }; 27 28 struct efa_ibv_alloc_ucontext_cmd { 29 __u32 comp_mask; 30 __u8 reserved_20[4]; 31 }; 32 33 enum efa_ibv_user_cmds_supp_udata { 34 EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0, 35 EFA_USER_CMDS_SUPP_UDATA_CREATE_AH = 1 << 1, 36 }; 37 38 struct efa_ibv_alloc_ucontext_resp { 39 __u32 comp_mask; 40 __u32 cmds_supp_udata_mask; 41 __u16 sub_cqs_per_cq; 42 __u16 inline_buf_size; 43 __u32 max_llq_size; /* bytes */ 44 __u16 max_tx_batch; /* units of 64 bytes */ 45 __u16 min_sq_wr; 46 __u8 reserved_a0[4]; 47 }; 48 49 struct efa_ibv_alloc_pd_resp { 50 __u32 comp_mask; 51 __u16 pdn; 52 __u8 reserved_30[2]; 53 }; 54 55 enum { 56 EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0, 57 }; 58 59 struct efa_ibv_create_cq { 60 __u32 comp_mask; 61 __u32 cq_entry_size; 62 __u16 num_sub_cqs; 63 __u8 flags; 64 __u8 reserved_58[5]; 65 }; 66 67 enum { 68 EFA_CREATE_CQ_RESP_DB_OFF = 1 << 0, 69 }; 70 71 struct efa_ibv_create_cq_resp { 72 __u32 comp_mask; 73 __u8 reserved_20[4]; 74 __aligned_u64 q_mmap_key; 75 __aligned_u64 q_mmap_size; 76 __u16 cq_idx; 77 __u8 reserved_d0[2]; 78 __u32 db_off; 79 __aligned_u64 db_mmap_key; 80 }; 81 82 enum { 83 EFA_QP_DRIVER_TYPE_SRD = 0, 84 }; 85 86 struct efa_ibv_create_qp { 87 __u32 comp_mask; 88 __u32 rq_ring_size; /* bytes */ 89 __u32 sq_ring_size; /* bytes */ 90 __u32 driver_qp_type; 91 }; 92 93 struct efa_ibv_create_qp_resp { 94 __u32 comp_mask; 95 /* the offset inside the page of the rq db */ 96 __u32 rq_db_offset; 97 /* the offset inside the page of the sq db */ 98 __u32 sq_db_offset; 99 /* the offset inside the page of descriptors buffer */ 100 __u32 llq_desc_offset; 101 __aligned_u64 rq_mmap_key; 102 __aligned_u64 rq_mmap_size; 103 __aligned_u64 rq_db_mmap_key; 104 __aligned_u64 sq_db_mmap_key; 105 __aligned_u64 llq_desc_mmap_key; 106 __u16 send_sub_cq_idx; 107 __u16 recv_sub_cq_idx; 108 __u8 reserved_1e0[4]; 109 }; 110 111 struct efa_ibv_create_ah_resp { 112 __u32 comp_mask; 113 __u16 efa_address_handle; 114 __u8 reserved_30[2]; 115 }; 116 117 enum { 118 EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0, 119 EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1, 120 EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2, 121 }; 122 123 struct efa_ibv_ex_query_device_resp { 124 __u32 comp_mask; 125 __u32 max_sq_wr; 126 __u32 max_rq_wr; 127 __u16 max_sq_sge; 128 __u16 max_rq_sge; 129 __u32 max_rdma_size; 130 __u32 device_caps; 131 }; 132 133 #endif /* EFA_ABI_USER_H */ 134