xref: /freebsd/contrib/ofed/libirdma/abi.h (revision 2e3f49888ec8851bafb22011533217487764fdb0)
1 /*-
2  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3  *
4  * Copyright (C) 2019 - 2022 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 /*$FreeBSD$*/
35 
36 #ifndef PROVIDER_IRDMA_ABI_H
37 #define PROVIDER_IRDMA_ABI_H
38 
39 #include "irdma.h"
40 #include <infiniband/kern-abi.h>
41 #include "irdma-abi.h"
42 
43 #define IRDMA_MIN_ABI_VERSION	0
44 #define IRDMA_MAX_ABI_VERSION	5
45 
46 struct irdma_ualloc_pd_resp {
47 	struct ibv_alloc_pd_resp	ibv_resp;
48 	__u32 pd_id;
49 	__u8 rsvd[4];
50 
51 };
52 struct irdma_ucreate_cq {
53 	struct ibv_create_cq	ibv_cmd;
54 	__aligned_u64 user_cq_buf;
55 	__aligned_u64 user_shadow_area;
56 
57 };
58 struct irdma_ucreate_cq_resp {
59 	struct ibv_create_cq_resp	ibv_resp;
60 	__u32 cq_id;
61 	__u32 cq_size;
62 
63 };
64 struct irdma_ucreate_cq_ex {
65 	struct ibv_create_cq_ex	ibv_cmd;
66 	__aligned_u64 user_cq_buf;
67 	__aligned_u64 user_shadow_area;
68 
69 };
70 struct irdma_ucreate_cq_ex_resp {
71 	struct ibv_create_cq_resp_ex	ibv_resp;
72 	__u32 cq_id;
73 	__u32 cq_size;
74 
75 };
76 struct irdma_uresize_cq {
77 	struct ibv_resize_cq	ibv_cmd;
78 	__aligned_u64 user_cq_buffer;
79 
80 };
81 struct irdma_uresize_cq_resp {
82 	struct ibv_resize_cq_resp	ibv_resp;
83 
84 };
85 struct irdma_ucreate_qp {
86 	struct ibv_create_qp	ibv_cmd;
87 	__aligned_u64 user_wqe_bufs;
88 	__aligned_u64 user_compl_ctx;
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 
102 };
103 struct irdma_umodify_qp_resp {
104 	struct ibv_modify_qp_resp_ex	ibv_resp;
105 	__aligned_u64 push_wqe_mmap_key;
106 	__aligned_u64 push_db_mmap_key;
107 	__u16 push_offset;
108 	__u8 push_valid;
109 	__u8 rd_fence_rate;
110 	__u8 rsvd[4];
111 
112 };
113 struct irdma_get_context {
114 	struct ibv_get_context	ibv_cmd;
115 	__u32 rsvd32;
116 	__u8 userspace_ver;
117 	__u8 rsvd8[3];
118 	__aligned_u64 comp_mask;
119 
120 };
121 struct irdma_get_context_resp {
122 	struct ibv_get_context_resp	ibv_resp;
123 	__u32 max_pds;
124 	__u32 max_qps;
125 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
126 	__u8 kernel_ver;
127 	__u8 rsvd[3];
128 	__aligned_u64 feature_flags;
129 	__aligned_u64 db_mmap_key;
130 	__u32 max_hw_wq_frags;
131 	__u32 max_hw_read_sges;
132 	__u32 max_hw_inline;
133 	__u32 max_hw_rq_quanta;
134 	__u32 max_hw_wq_quanta;
135 	__u32 min_hw_cq_size;
136 	__u32 max_hw_cq_size;
137 	__u16 max_hw_sq_chunk;
138 	__u8 hw_rev;
139 	__u8 rsvd2;
140 	__aligned_u64 comp_mask;
141 
142 };
143 struct irdma_ureg_mr {
144 	struct ibv_reg_mr	ibv_cmd;
145 	__u16 reg_type; /* enum irdma_memreg_type */
146 	__u16 cq_pages;
147 	__u16 rq_pages;
148 	__u16 sq_pages;
149 
150 };
151 struct irdma_urereg_mr {
152 	struct ibv_rereg_mr	ibv_cmd;
153 	__u16 reg_type; /* enum irdma_memreg_type */
154 	__u16 cq_pages;
155 	__u16 rq_pages;
156 	__u16 sq_pages;
157 
158 };
159 struct irdma_ucreate_ah_resp {
160 	struct ibv_create_ah_resp	ibv_resp;
161 	__u32 ah_id;
162 	__u8 rsvd[4];
163 
164 };
165 
166 struct irdma_modify_qp_cmd {
167 	struct ibv_modify_qp_ex ibv_cmd;
168 	__u8 sq_flush;
169 	__u8 rq_flush;
170 	__u8 rsvd[6];
171 };
172 
173 struct irdma_query_device_ex {
174 	struct ibv_query_device_ex ibv_cmd;
175 };
176 
177 struct irdma_query_device_ex_resp {
178 	struct ibv_query_device_resp_ex ibv_resp;
179 	__u32				comp_mask;
180 	__u32				response_length;
181 	struct ibv_odp_caps_resp	odp_caps;
182 	__u64				timestamp_mask;
183 	__u64				hca_core_clock;
184 	__u64				device_cap_flags_ex;
185 	struct ibv_rss_caps_resp	rss_caps;
186 	__u32				max_wq_type_rq;
187 	__u32				raw_packet_caps;
188 	struct ibv_tso_caps		tso_caps;
189 };
190 #endif /* PROVIDER_IRDMA_ABI_H */
191