xref: /freebsd/sys/dev/irdma/irdma-abi.h (revision 8e93258f2686c76b4e3b384a904d8b4413976229)
1 /*-
2  * SPDX-License-Identifier: (GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB)
3  *
4  *
5  * Copyright (c) 2006 - 2021 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 <linux/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 struct irdma_alloc_ucontext_req {
57 	__u32 rsvd32;
58 	__u8 userspace_ver;
59 	__u8 rsvd8[3];
60 };
61 
62 struct irdma_alloc_ucontext_resp {
63 	__u32 max_pds;
64 	__u32 max_qps;
65 	__u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */
66 	__u8 kernel_ver;
67 	__u8 rsvd[3];
68 	__aligned_u64 feature_flags;
69 	__aligned_u64 db_mmap_key;
70 	__u32 max_hw_wq_frags;
71 	__u32 max_hw_read_sges;
72 	__u32 max_hw_inline;
73 	__u32 max_hw_rq_quanta;
74 	__u32 max_hw_wq_quanta;
75 	__u32 min_hw_cq_size;
76 	__u32 max_hw_cq_size;
77 	__u16 max_hw_sq_chunk;
78 	__u8 hw_rev;
79 	__u8 rsvd2;
80 };
81 
82 struct irdma_alloc_pd_resp {
83 	__u32 pd_id;
84 	__u8 rsvd[4];
85 };
86 
87 struct irdma_resize_cq_req {
88 	__aligned_u64 user_cq_buffer;
89 };
90 
91 struct irdma_create_cq_req {
92 	__aligned_u64 user_cq_buf;
93 	__aligned_u64 user_shadow_area;
94 };
95 
96 struct irdma_create_qp_req {
97 	__aligned_u64 user_wqe_bufs;
98 	__aligned_u64 user_compl_ctx;
99 };
100 
101 struct irdma_mem_reg_req {
102 	__u16 reg_type; /* enum irdma_memreg_type */
103 	__u16 cq_pages;
104 	__u16 rq_pages;
105 	__u16 sq_pages;
106 };
107 
108 struct irdma_modify_qp_req {
109 	__u8 sq_flush;
110 	__u8 rq_flush;
111 	__u8 rsvd[6];
112 };
113 
114 struct irdma_create_cq_resp {
115 	__u32 cq_id;
116 	__u32 cq_size;
117 };
118 
119 struct irdma_create_qp_resp {
120 	__u32 qp_id;
121 	__u32 actual_sq_size;
122 	__u32 actual_rq_size;
123 	__u32 irdma_drv_opt;
124 	__u16 push_idx;
125 	__u8 lsmm;
126 	__u8 rsvd;
127 	__u32 qp_caps;
128 };
129 
130 struct irdma_modify_qp_resp {
131 	__aligned_u64 push_wqe_mmap_key;
132 	__aligned_u64 push_db_mmap_key;
133 	__u16 push_offset;
134 	__u8 push_valid;
135 	__u8 rd_fence_rate;
136 	__u8 rsvd[4];
137 };
138 
139 struct irdma_create_ah_resp {
140 	__u32 ah_id;
141 	__u8 rsvd[4];
142 };
143 #endif /* IRDMA_ABI_H */
144