xref: /freebsd/contrib/ofed/libirdma/irdma-abi.h (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1 /*-
2  * SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB)
3  *
4  *
5  * Copyright (c) 2006 - 2022 Intel Corporation.  All rights reserved.
6  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
7  * Copyright (c) 2005 Cisco Systems.  All rights reserved.
8  * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
9  *
10  * This software is available to you under a choice of one of two
11  * licenses.  You may choose to be licensed under the terms of the GNU
12  * General Public License (GPL) Version 2, available from the file
13  * COPYING in the main directory of this source tree, or the
14  * OpenFabrics.org BSD license below:
15  *
16  *   Redistribution and use in source and binary forms, with or
17  *   without modification, are permitted provided that the following
18  *   conditions are met:
19  *
20  *    - Redistributions of source code must retain the above
21  *	copyright notice, this list of conditions and the following
22  *	disclaimer.
23  *
24  *    - Redistributions in binary form must reproduce the above
25  *	copyright notice, this list of conditions and the following
26  *	disclaimer in the documentation and/or other materials
27  *	provided with the distribution.
28  *
29  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
30  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
31  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
32  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
33  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
34  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
35  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36  * SOFTWARE.
37  */
38 
39 #ifndef IRDMA_ABI_H
40 #define IRDMA_ABI_H
41 
42 #include <infiniband/types.h>
43 
44 /* irdma must support legacy GEN_1 i40iw kernel
45  * and user-space whose last ABI ver is 5
46  */
47 #define IRDMA_ABI_VER 5
48 
49 enum irdma_memreg_type {
50 	IRDMA_MEMREG_TYPE_MEM  = 0,
51 	IRDMA_MEMREG_TYPE_QP   = 1,
52 	IRDMA_MEMREG_TYPE_CQ   = 2,
53 };
54 
55 enum {
56 	IRDMA_ALLOC_UCTX_USE_RAW_ATTR = 1 << 0,
57 	IRDMA_ALLOC_UCTX_MIN_HW_WQ_SIZE = 1 << 1,
58 };
59 
60 enum {
61 	IRDMA_CREATE_QP_USE_START_WQE_IDX = 1 << 0,
62 };
63 
64 struct irdma_alloc_ucontext_req {
65 	__u32 rsvd32;
66 	__u8 userspace_ver;
67 	__u8 rsvd8[3];
68 	__aligned_u64 comp_mask;
69 };
70 
71 struct irdma_alloc_ucontext_resp {
72 	__u32 max_pds;
73 	__u32 max_qps;
74 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
75 	__u8 kernel_ver;
76 	__u8 rsvd[3];
77 	__aligned_u64 feature_flags;
78 	__aligned_u64 db_mmap_key;
79 	__u32 max_hw_wq_frags;
80 	__u32 max_hw_read_sges;
81 	__u32 max_hw_inline;
82 	__u32 max_hw_rq_quanta;
83 	__u32 max_hw_wq_quanta;
84 	__u32 min_hw_cq_size;
85 	__u32 max_hw_cq_size;
86 	__u16 max_hw_sq_chunk;
87 	__u8 hw_rev;
88 	__u8 rsvd2;
89 	__aligned_u64 comp_mask;
90 	__u16 min_hw_wq_size;
91 	__u8 rsvd3[6];
92 };
93 
94 struct irdma_alloc_pd_resp {
95 	__u32 pd_id;
96 	__u8 rsvd[4];
97 };
98 
99 struct irdma_resize_cq_req {
100 	__aligned_u64 user_cq_buffer;
101 };
102 
103 struct irdma_create_cq_req {
104 	__aligned_u64 user_cq_buf;
105 	__aligned_u64 user_shadow_area;
106 };
107 
108 struct irdma_create_qp_req {
109 	__aligned_u64 user_wqe_bufs;
110 	__aligned_u64 user_compl_ctx;
111 	__aligned_u64 comp_mask;
112 };
113 
114 struct irdma_mem_reg_req {
115 	__u16 reg_type; /* enum irdma_memreg_type */
116 	__u16 cq_pages;
117 	__u16 rq_pages;
118 	__u16 sq_pages;
119 };
120 
121 struct irdma_modify_qp_req {
122 	__u8 sq_flush;
123 	__u8 rq_flush;
124 	__u8 rsvd[6];
125 };
126 
127 struct irdma_create_cq_resp {
128 	__u32 cq_id;
129 	__u32 cq_size;
130 };
131 
132 struct irdma_create_qp_resp {
133 	__u32 qp_id;
134 	__u32 actual_sq_size;
135 	__u32 actual_rq_size;
136 	__u32 irdma_drv_opt;
137 	__u16 push_idx;
138 	__u8 lsmm;
139 	__u8 rsvd;
140 	__u32 qp_caps;
141 	__aligned_u64 comp_mask;
142 	__u8 start_wqe_idx;
143 	__u8 rsvd2[7];
144 };
145 
146 struct irdma_modify_qp_resp {
147 	__aligned_u64 push_wqe_mmap_key;
148 	__aligned_u64 push_db_mmap_key;
149 	__u16 push_offset;
150 	__u8 push_valid;
151 	__u8 rd_fence_rate;
152 	__u8 rsvd[4];
153 };
154 
155 struct irdma_create_ah_resp {
156 	__u32 ah_id;
157 	__u8 rsvd[4];
158 };
159 #endif /* IRDMA_ABI_H */
160