xref: /openbmc/linux/include/uapi/rdma/efa-abi.h (revision 31e67366)
1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2 /*
3  * Copyright 2018-2020 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 struct efa_ibv_create_cq {
56 	__u32 comp_mask;
57 	__u32 cq_entry_size;
58 	__u16 num_sub_cqs;
59 	__u8 reserved_50[6];
60 };
61 
62 struct efa_ibv_create_cq_resp {
63 	__u32 comp_mask;
64 	__u8 reserved_20[4];
65 	__aligned_u64 q_mmap_key;
66 	__aligned_u64 q_mmap_size;
67 	__u16 cq_idx;
68 	__u8 reserved_d0[6];
69 };
70 
71 enum {
72 	EFA_QP_DRIVER_TYPE_SRD = 0,
73 };
74 
75 struct efa_ibv_create_qp {
76 	__u32 comp_mask;
77 	__u32 rq_ring_size; /* bytes */
78 	__u32 sq_ring_size; /* bytes */
79 	__u32 driver_qp_type;
80 };
81 
82 struct efa_ibv_create_qp_resp {
83 	__u32 comp_mask;
84 	/* the offset inside the page of the rq db */
85 	__u32 rq_db_offset;
86 	/* the offset inside the page of the sq db */
87 	__u32 sq_db_offset;
88 	/* the offset inside the page of descriptors buffer */
89 	__u32 llq_desc_offset;
90 	__aligned_u64 rq_mmap_key;
91 	__aligned_u64 rq_mmap_size;
92 	__aligned_u64 rq_db_mmap_key;
93 	__aligned_u64 sq_db_mmap_key;
94 	__aligned_u64 llq_desc_mmap_key;
95 	__u16 send_sub_cq_idx;
96 	__u16 recv_sub_cq_idx;
97 	__u8 reserved_1e0[4];
98 };
99 
100 struct efa_ibv_create_ah_resp {
101 	__u32 comp_mask;
102 	__u16 efa_address_handle;
103 	__u8 reserved_30[2];
104 };
105 
106 enum {
107 	EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
108 	EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
109 };
110 
111 struct efa_ibv_ex_query_device_resp {
112 	__u32 comp_mask;
113 	__u32 max_sq_wr;
114 	__u32 max_rq_wr;
115 	__u16 max_sq_sge;
116 	__u16 max_rq_sge;
117 	__u32 max_rdma_size;
118 	__u32 device_caps;
119 };
120 
121 #endif /* EFA_ABI_USER_H */
122