xref: /freebsd/contrib/ofed/libirdma/irdma-abi.h (revision 5f4c09dd85bff675e0ca63c55ea3c517e0fddfcc)
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 /*$FreeBSD$*/
39 
40 #ifndef IRDMA_ABI_H
41 #define IRDMA_ABI_H
42 
43 #include <infiniband/types.h>
44 
45 /* irdma must support legacy GEN_1 i40iw kernel
46  * and user-space whose last ABI ver is 5
47  */
48 #define IRDMA_ABI_VER 5
49 
50 enum irdma_memreg_type {
51 	IRDMA_MEMREG_TYPE_MEM  = 0,
52 	IRDMA_MEMREG_TYPE_QP   = 1,
53 	IRDMA_MEMREG_TYPE_CQ   = 2,
54 };
55 
56 enum {
57 	IRDMA_ALLOC_UCTX_USE_RAW_ATTR = 1 << 0,
58 };
59 
60 struct irdma_alloc_ucontext_req {
61 	__u32 rsvd32;
62 	__u8 userspace_ver;
63 	__u8 rsvd8[3];
64 	__aligned_u64 comp_mask;
65 };
66 
67 struct irdma_alloc_ucontext_resp {
68 	__u32 max_pds;
69 	__u32 max_qps;
70 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
71 	__u8 kernel_ver;
72 	__u8 rsvd[3];
73 	__aligned_u64 feature_flags;
74 	__aligned_u64 db_mmap_key;
75 	__u32 max_hw_wq_frags;
76 	__u32 max_hw_read_sges;
77 	__u32 max_hw_inline;
78 	__u32 max_hw_rq_quanta;
79 	__u32 max_hw_wq_quanta;
80 	__u32 min_hw_cq_size;
81 	__u32 max_hw_cq_size;
82 	__u16 max_hw_sq_chunk;
83 	__u8 hw_rev;
84 	__u8 rsvd2;
85 	__aligned_u64 comp_mask;
86 };
87 
88 struct irdma_alloc_pd_resp {
89 	__u32 pd_id;
90 	__u8 rsvd[4];
91 };
92 
93 struct irdma_resize_cq_req {
94 	__aligned_u64 user_cq_buffer;
95 };
96 
97 struct irdma_create_cq_req {
98 	__aligned_u64 user_cq_buf;
99 	__aligned_u64 user_shadow_area;
100 };
101 
102 struct irdma_create_qp_req {
103 	__aligned_u64 user_wqe_bufs;
104 	__aligned_u64 user_compl_ctx;
105 };
106 
107 struct irdma_mem_reg_req {
108 	__u16 reg_type; /* enum irdma_memreg_type */
109 	__u16 cq_pages;
110 	__u16 rq_pages;
111 	__u16 sq_pages;
112 };
113 
114 struct irdma_modify_qp_req {
115 	__u8 sq_flush;
116 	__u8 rq_flush;
117 	__u8 rsvd[6];
118 };
119 
120 struct irdma_create_cq_resp {
121 	__u32 cq_id;
122 	__u32 cq_size;
123 };
124 
125 struct irdma_create_qp_resp {
126 	__u32 qp_id;
127 	__u32 actual_sq_size;
128 	__u32 actual_rq_size;
129 	__u32 irdma_drv_opt;
130 	__u16 push_idx;
131 	__u8 lsmm;
132 	__u8 rsvd;
133 	__u32 qp_caps;
134 };
135 
136 struct irdma_modify_qp_resp {
137 	__aligned_u64 push_wqe_mmap_key;
138 	__aligned_u64 push_db_mmap_key;
139 	__u16 push_offset;
140 	__u8 push_valid;
141 	__u8 rd_fence_rate;
142 	__u8 rsvd[4];
143 };
144 
145 struct irdma_create_ah_resp {
146 	__u32 ah_id;
147 	__u8 rsvd[4];
148 };
149 #endif /* IRDMA_ABI_H */
150