xref: /freebsd/contrib/ofed/libirdma/abi.h (revision a91a2465)
1 /*-
2  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3  *
4  * Copyright (C) 2019 - 2023 Intel Corporation
5  *
6  * This software is available to you under a choice of one of two
7  * licenses.  You may choose to be licensed under the terms of the GNU
8  * General Public License (GPL) Version 2, available from the file
9  * COPYING in the main directory of this source tree, or the
10  * OpenFabrics.org BSD license below:
11  *
12  *   Redistribution and use in source and binary forms, with or
13  *   without modification, are permitted provided that the following
14  *   conditions are met:
15  *
16  *    - Redistributions of source code must retain the above
17  *	copyright notice, this list of conditions and the following
18  *	disclaimer.
19  *
20  *    - Redistributions in binary form must reproduce the above
21  *	copyright notice, this list of conditions and the following
22  *	disclaimer in the documentation and/or other materials
23  *	provided with the distribution.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32  * SOFTWARE.
33  */
34 
35 #ifndef PROVIDER_IRDMA_ABI_H
36 #define PROVIDER_IRDMA_ABI_H
37 
38 #include "irdma.h"
39 #include <infiniband/kern-abi.h>
40 #include "irdma-abi.h"
41 
42 #define IRDMA_MIN_ABI_VERSION	0
43 #define IRDMA_MAX_ABI_VERSION	5
44 
45 struct irdma_ualloc_pd_resp {
46 	struct ibv_alloc_pd_resp	ibv_resp;
47 	__u32 pd_id;
48 	__u8 rsvd[4];
49 
50 };
51 struct irdma_ucreate_cq {
52 	struct ibv_create_cq	ibv_cmd;
53 	__aligned_u64 user_cq_buf;
54 	__aligned_u64 user_shadow_area;
55 
56 };
57 struct irdma_ucreate_cq_resp {
58 	struct ibv_create_cq_resp	ibv_resp;
59 	__u32 cq_id;
60 	__u32 cq_size;
61 
62 };
63 struct irdma_ucreate_cq_ex {
64 	struct ibv_create_cq_ex	ibv_cmd;
65 	__aligned_u64 user_cq_buf;
66 	__aligned_u64 user_shadow_area;
67 
68 };
69 struct irdma_ucreate_cq_ex_resp {
70 	struct ibv_create_cq_resp_ex	ibv_resp;
71 	__u32 cq_id;
72 	__u32 cq_size;
73 
74 };
75 struct irdma_uresize_cq {
76 	struct ibv_resize_cq	ibv_cmd;
77 	__aligned_u64 user_cq_buffer;
78 
79 };
80 struct irdma_uresize_cq_resp {
81 	struct ibv_resize_cq_resp	ibv_resp;
82 
83 };
84 struct irdma_ucreate_qp {
85 	struct ibv_create_qp	ibv_cmd;
86 	__aligned_u64 user_wqe_bufs;
87 	__aligned_u64 user_compl_ctx;
88 	__aligned_u64 comp_mask;
89 
90 };
91 struct irdma_ucreate_qp_resp {
92 	struct ibv_create_qp_resp	ibv_resp;
93 	__u32 qp_id;
94 	__u32 actual_sq_size;
95 	__u32 actual_rq_size;
96 	__u32 irdma_drv_opt;
97 	__u16 push_idx;
98 	__u8 lsmm;
99 	__u8 rsvd;
100 	__u32 qp_caps;
101 	__aligned_u64 comp_mask;
102 	__u8 start_wqe_idx;
103 	__u8 rsvd2[7];
104 
105 };
106 struct irdma_umodify_qp_resp {
107 	struct ibv_modify_qp_resp_ex	ibv_resp;
108 	__aligned_u64 push_wqe_mmap_key;
109 	__aligned_u64 push_db_mmap_key;
110 	__u16 push_offset;
111 	__u8 push_valid;
112 	__u8 rd_fence_rate;
113 	__u8 rsvd[4];
114 
115 };
116 struct irdma_get_context {
117 	struct ibv_get_context	ibv_cmd;
118 	__u32 rsvd32;
119 	__u8 userspace_ver;
120 	__u8 rsvd8[3];
121 	__aligned_u64 comp_mask;
122 
123 };
124 struct irdma_get_context_resp {
125 	struct ibv_get_context_resp	ibv_resp;
126 	__u32 max_pds;
127 	__u32 max_qps;
128 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
129 	__u8 kernel_ver;
130 	__u8 rsvd[3];
131 	__aligned_u64 feature_flags;
132 	__aligned_u64 db_mmap_key;
133 	__u32 max_hw_wq_frags;
134 	__u32 max_hw_read_sges;
135 	__u32 max_hw_inline;
136 	__u32 max_hw_rq_quanta;
137 	__u32 max_hw_wq_quanta;
138 	__u32 min_hw_cq_size;
139 	__u32 max_hw_cq_size;
140 	__u16 max_hw_sq_chunk;
141 	__u8 hw_rev;
142 	__u8 rsvd2;
143 	__aligned_u64 comp_mask;
144 	__u16 min_hw_wq_size;
145 	__u8 rsvd3[6];
146 
147 };
148 struct irdma_ureg_mr {
149 	struct ibv_reg_mr	ibv_cmd;
150 	__u16 reg_type; /* enum irdma_memreg_type */
151 	__u16 cq_pages;
152 	__u16 rq_pages;
153 	__u16 sq_pages;
154 
155 };
156 struct irdma_urereg_mr {
157 	struct ibv_rereg_mr	ibv_cmd;
158 	__u16 reg_type; /* enum irdma_memreg_type */
159 	__u16 cq_pages;
160 	__u16 rq_pages;
161 	__u16 sq_pages;
162 
163 };
164 struct irdma_ucreate_ah_resp {
165 	struct ibv_create_ah_resp	ibv_resp;
166 	__u32 ah_id;
167 	__u8 rsvd[4];
168 
169 };
170 
171 struct irdma_modify_qp_cmd {
172 	struct ibv_modify_qp_ex ibv_cmd;
173 	__u8 sq_flush;
174 	__u8 rq_flush;
175 	__u8 rsvd[6];
176 };
177 
178 struct irdma_query_device_ex {
179 	struct ibv_query_device_ex ibv_cmd;
180 };
181 
182 struct irdma_query_device_ex_resp {
183 	struct ibv_query_device_resp_ex ibv_resp;
184 	__u32				comp_mask;
185 	__u32				response_length;
186 	struct ibv_odp_caps_resp	odp_caps;
187 	__u64				timestamp_mask;
188 	__u64				hca_core_clock;
189 	__u64				device_cap_flags_ex;
190 	struct ibv_rss_caps_resp	rss_caps;
191 	__u32				max_wq_type_rq;
192 	__u32				raw_packet_caps;
193 	struct ibv_tso_caps		tso_caps;
194 };
195 #endif /* PROVIDER_IRDMA_ABI_H */
196