1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */ 2 /* 3 * Copyright 2018-2023 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 EFA_CREATE_CQ_WITH_SGID = 1 << 1, 58 }; 59 60 struct efa_ibv_create_cq { 61 __u32 comp_mask; 62 __u32 cq_entry_size; 63 __u16 num_sub_cqs; 64 __u8 flags; 65 __u8 reserved_58[5]; 66 }; 67 68 enum { 69 EFA_CREATE_CQ_RESP_DB_OFF = 1 << 0, 70 }; 71 72 struct efa_ibv_create_cq_resp { 73 __u32 comp_mask; 74 __u8 reserved_20[4]; 75 __aligned_u64 q_mmap_key; 76 __aligned_u64 q_mmap_size; 77 __u16 cq_idx; 78 __u8 reserved_d0[2]; 79 __u32 db_off; 80 __aligned_u64 db_mmap_key; 81 }; 82 83 enum { 84 EFA_QP_DRIVER_TYPE_SRD = 0, 85 }; 86 87 struct efa_ibv_create_qp { 88 __u32 comp_mask; 89 __u32 rq_ring_size; /* bytes */ 90 __u32 sq_ring_size; /* bytes */ 91 __u32 driver_qp_type; 92 }; 93 94 struct efa_ibv_create_qp_resp { 95 __u32 comp_mask; 96 /* the offset inside the page of the rq db */ 97 __u32 rq_db_offset; 98 /* the offset inside the page of the sq db */ 99 __u32 sq_db_offset; 100 /* the offset inside the page of descriptors buffer */ 101 __u32 llq_desc_offset; 102 __aligned_u64 rq_mmap_key; 103 __aligned_u64 rq_mmap_size; 104 __aligned_u64 rq_db_mmap_key; 105 __aligned_u64 sq_db_mmap_key; 106 __aligned_u64 llq_desc_mmap_key; 107 __u16 send_sub_cq_idx; 108 __u16 recv_sub_cq_idx; 109 __u8 reserved_1e0[4]; 110 }; 111 112 struct efa_ibv_create_ah_resp { 113 __u32 comp_mask; 114 __u16 efa_address_handle; 115 __u8 reserved_30[2]; 116 }; 117 118 enum { 119 EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0, 120 EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1, 121 EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2, 122 EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID = 1 << 3, 123 EFA_QUERY_DEVICE_CAPS_DATA_POLLING_128 = 1 << 4, 124 EFA_QUERY_DEVICE_CAPS_RDMA_WRITE = 1 << 5, 125 }; 126 127 struct efa_ibv_ex_query_device_resp { 128 __u32 comp_mask; 129 __u32 max_sq_wr; 130 __u32 max_rq_wr; 131 __u16 max_sq_sge; 132 __u16 max_rq_sge; 133 __u32 max_rdma_size; 134 __u32 device_caps; 135 }; 136 137 #endif /* EFA_ABI_USER_H */ 138