xref: /freebsd/contrib/ofed/libirdma/abi.h (revision bc7512cc58af2e8bbe5bbf5ca0059b1daa1da897)
1 /*-
2  * SPDX-License-Identifier: GPL-2.0 or Linux-OpenIB
3  *
4  * Copyright (C) 2019 - 2020 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 
119 };
120 struct irdma_get_context_resp {
121 	struct ibv_get_context_resp	ibv_resp;
122 	__u32 max_pds;
123 	__u32 max_qps;
124 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
125 	__u8 kernel_ver;
126 	__u8 rsvd[3];
127 	__aligned_u64 feature_flags;
128 	__aligned_u64 db_mmap_key;
129 	__u32 max_hw_wq_frags;
130 	__u32 max_hw_read_sges;
131 	__u32 max_hw_inline;
132 	__u32 max_hw_rq_quanta;
133 	__u32 max_hw_wq_quanta;
134 	__u32 min_hw_cq_size;
135 	__u32 max_hw_cq_size;
136 	__u16 max_hw_sq_chunk;
137 	__u8 hw_rev;
138 	__u8 rsvd2;
139 
140 };
141 struct irdma_ureg_mr {
142 	struct ibv_reg_mr	ibv_cmd;
143 	__u16 reg_type; /* enum irdma_memreg_type */
144 	__u16 cq_pages;
145 	__u16 rq_pages;
146 	__u16 sq_pages;
147 
148 };
149 struct irdma_ucreate_ah_resp {
150 	struct ibv_create_ah_resp	ibv_resp;
151 	__u32 ah_id;
152 	__u8 rsvd[4];
153 
154 };
155 
156 struct irdma_modify_qp_cmd {
157 	struct ibv_modify_qp_ex ibv_cmd;
158 	__u8 sq_flush;
159 	__u8 rq_flush;
160 	__u8 rsvd[6];
161 };
162 
163 struct irdma_query_device_ex {
164 	struct ibv_query_device_ex ibv_cmd;
165 };
166 
167 struct irdma_query_device_ex_resp {
168 	struct ibv_query_device_resp_ex ibv_resp;
169 	__u32				comp_mask;
170 	__u32				response_length;
171 	struct ibv_odp_caps_resp	odp_caps;
172 	__u64				timestamp_mask;
173 	__u64				hca_core_clock;
174 	__u64				device_cap_flags_ex;
175 	struct ibv_rss_caps_resp	rss_caps;
176 	__u32				max_wq_type_rq;
177 	__u32				raw_packet_caps;
178 	struct ibv_tso_caps		tso_caps;
179 };
180 #endif /* PROVIDER_IRDMA_ABI_H */
181