xref: /openbmc/linux/include/uapi/rdma/efa-abi.h (revision f8e17c17)
1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
2 /*
3  * Copyright 2018-2019 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 efa_ibv_user_cmds_supp_udata {
24 	EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0,
25 	EFA_USER_CMDS_SUPP_UDATA_CREATE_AH    = 1 << 1,
26 };
27 
28 struct efa_ibv_alloc_ucontext_resp {
29 	__u32 comp_mask;
30 	__u32 cmds_supp_udata_mask;
31 	__u16 sub_cqs_per_cq;
32 	__u16 inline_buf_size;
33 	__u32 max_llq_size; /* bytes */
34 };
35 
36 struct efa_ibv_alloc_pd_resp {
37 	__u32 comp_mask;
38 	__u16 pdn;
39 	__u8 reserved_30[2];
40 };
41 
42 struct efa_ibv_create_cq {
43 	__u32 comp_mask;
44 	__u32 cq_entry_size;
45 	__u16 num_sub_cqs;
46 	__u8 reserved_50[6];
47 };
48 
49 struct efa_ibv_create_cq_resp {
50 	__u32 comp_mask;
51 	__u8 reserved_20[4];
52 	__aligned_u64 q_mmap_key;
53 	__aligned_u64 q_mmap_size;
54 	__u16 cq_idx;
55 	__u8 reserved_d0[6];
56 };
57 
58 enum {
59 	EFA_QP_DRIVER_TYPE_SRD = 0,
60 };
61 
62 struct efa_ibv_create_qp {
63 	__u32 comp_mask;
64 	__u32 rq_ring_size; /* bytes */
65 	__u32 sq_ring_size; /* bytes */
66 	__u32 driver_qp_type;
67 };
68 
69 struct efa_ibv_create_qp_resp {
70 	__u32 comp_mask;
71 	/* the offset inside the page of the rq db */
72 	__u32 rq_db_offset;
73 	/* the offset inside the page of the sq db */
74 	__u32 sq_db_offset;
75 	/* the offset inside the page of descriptors buffer */
76 	__u32 llq_desc_offset;
77 	__aligned_u64 rq_mmap_key;
78 	__aligned_u64 rq_mmap_size;
79 	__aligned_u64 rq_db_mmap_key;
80 	__aligned_u64 sq_db_mmap_key;
81 	__aligned_u64 llq_desc_mmap_key;
82 	__u16 send_sub_cq_idx;
83 	__u16 recv_sub_cq_idx;
84 	__u8 reserved_1e0[4];
85 };
86 
87 struct efa_ibv_create_ah_resp {
88 	__u32 comp_mask;
89 	__u16 efa_address_handle;
90 	__u8 reserved_30[2];
91 };
92 
93 enum {
94 	EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
95 };
96 
97 struct efa_ibv_ex_query_device_resp {
98 	__u32 comp_mask;
99 	__u32 max_sq_wr;
100 	__u32 max_rq_wr;
101 	__u16 max_sq_sge;
102 	__u16 max_rq_sge;
103 	__u32 max_rdma_size;
104 	__u32 device_caps;
105 };
106 
107 #endif /* EFA_ABI_USER_H */
108