1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
2 /*
3  * Copyright (c) 2006 - 2011 Intel Corporation.  All rights reserved.
4  * Copyright (c) 2005 Topspin Communications.  All rights reserved.
5  * Copyright (c) 2005 Cisco Systems.  All rights reserved.
6  * Copyright (c) 2005 Open Grid Computing, Inc. All rights reserved.
7  *
8  * This software is available to you under a choice of one of two
9  * licenses.  You may choose to be licensed under the terms of the GNU
10  * General Public License (GPL) Version 2, available from the file
11  * COPYING in the main directory of this source tree, or the
12  * OpenIB.org BSD license below:
13  *
14  *     Redistribution and use in source and binary forms, with or
15  *     without modification, are permitted provided that the following
16  *     conditions are met:
17  *
18  *      - Redistributions of source code must retain the above
19  *        copyright notice, this list of conditions and the following
20  *        disclaimer.
21  *
22  *      - Redistributions in binary form must reproduce the above
23  *        copyright notice, this list of conditions and the following
24  *        disclaimer in the documentation and/or other materials
25  *        provided with the distribution.
26  *
27  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34  * SOFTWARE.
35  *
36  */
37 
38 #ifndef NES_ABI_USER_H
39 #define NES_ABI_USER_H
40 
41 #include <linux/types.h>
42 
43 #define NES_ABI_USERSPACE_VER 2
44 #define NES_ABI_KERNEL_VER    2
45 
46 /*
47  * Make sure that all structs defined in this file remain laid out so
48  * that they pack the same way on 32-bit and 64-bit architectures (to
49  * avoid incompatibility between 32-bit userspace and 64-bit kernels).
50  * In particular do not use pointer types -- pass pointers in __u64
51  * instead.
52  */
53 
54 struct nes_alloc_ucontext_req {
55 	__u32 reserved32;
56 	__u8  userspace_ver;
57 	__u8  reserved8[3];
58 };
59 
60 struct nes_alloc_ucontext_resp {
61 	__u32 max_pds; /* maximum pds allowed for this user process */
62 	__u32 max_qps; /* maximum qps allowed for this user process */
63 	__u32 wq_size; /* size of the WQs (sq+rq) allocated to the mmaped area */
64 	__u8  virtwq;  /* flag to indicate if virtual WQ are to be used or not */
65 	__u8  kernel_ver;
66 	__u8  reserved[2];
67 };
68 
69 struct nes_alloc_pd_resp {
70 	__u32 pd_id;
71 	__u32 mmap_db_index;
72 };
73 
74 struct nes_create_cq_req {
75 	__aligned_u64 user_cq_buffer;
76 	__u32 mcrqf;
77 	__u8 reserved[4];
78 };
79 
80 struct nes_create_qp_req {
81 	__aligned_u64 user_wqe_buffers;
82 	__aligned_u64 user_qp_buffer;
83 };
84 
85 enum iwnes_memreg_type {
86 	IWNES_MEMREG_TYPE_MEM = 0x0000,
87 	IWNES_MEMREG_TYPE_QP = 0x0001,
88 	IWNES_MEMREG_TYPE_CQ = 0x0002,
89 	IWNES_MEMREG_TYPE_MW = 0x0003,
90 	IWNES_MEMREG_TYPE_FMR = 0x0004,
91 	IWNES_MEMREG_TYPE_FMEM = 0x0005,
92 };
93 
94 struct nes_mem_reg_req {
95 	__u32 reg_type;	/* indicates if id is memory, QP or CQ */
96 	__u32 reserved;
97 };
98 
99 struct nes_create_cq_resp {
100 	__u32 cq_id;
101 	__u32 cq_size;
102 	__u32 mmap_db_index;
103 	__u32 reserved;
104 };
105 
106 struct nes_create_qp_resp {
107 	__u32 qp_id;
108 	__u32 actual_sq_size;
109 	__u32 actual_rq_size;
110 	__u32 mmap_sq_db_index;
111 	__u32 mmap_rq_db_index;
112 	__u32 nes_drv_opt;
113 };
114 
115 #endif	/* NES_ABI_USER_H */
116