xref: /illumos-gate/usr/src/uts/common/sys/ib/adapters/mlnx_umap.h (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_ADAPTERS_MLNX_UMAP_H
28 #define	_SYS_IB_ADAPTERS_MLNX_UMAP_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * mlnx_umap.h
36  *	Contains all of the definions necessary for communicating the data
37  *	needed for direct userland access to resources on Mellanox HCAs.
38  */
39 
40 /*
41  * Note: The structs in this file are used in the interface(s)
42  *	between kernel service drivers, e.g. daplt, and the libraries
43  *	on top of them, e.g. udapl_tavor.so.1.  When any of the
44  *	structs in this file change, any version control between the
45  *	kernel service driver and the library will need to change.
46  *
47  * There is a version control on the structs defined here.  The library
48  * (consumer of structs from ibt_ci_data_out()) must verify a version
49  * field to correctly read the data provided by the kernel driver
50  * (tavor, arbel, and hermon).
51  */
52 
53 #define	MLNX_UMAP_IF_VERSION	2
54 
55 /*
56  * The following defines are used in the database type field for each database
57  * entry.  They specify the type of object (UAR pages, PIDs, CQ, QP, and MR
58  * umemcookie) that corresponds to the database key value.  On database queries,
59  * this type value must match the search criterion.
60  */
61 #define	MLNX_UMAP_UARPG_RSRC		0x11
62 #define	MLNX_UMAP_BLUEFLAMEPG_RSRC	0x12
63 #define	MLNX_UMAP_PID_RSRC		0x22
64 #define	MLNX_UMAP_CQMEM_RSRC		0x33
65 #define	MLNX_UMAP_QPMEM_RSRC		0x44
66 #define	MLNX_UMAP_MRMEM_RSRC		0x55
67 #define	MLNX_UMAP_SRQMEM_RSRC		0x66
68 #define	MLNX_UMAP_DBRMEM_RSRC		0x77
69 #define	MLNX_UMAP_RSRC_TYPE_MASK	0xFF
70 #define	MLNX_UMAP_RSRC_TYPE_SHIFT	8
71 
72 /* umap structures */
73 
74 typedef struct mlnx_umap_cq_data_out_s {
75 	uint_t		mcq_rev;
76 	uint32_t	mcq_cqnum;
77 	uint64_t	mcq_mapoffset;
78 	uint64_t	mcq_maplen;
79 	uint32_t	mcq_numcqe;
80 	uint32_t	mcq_cqesz;
81 
82 	/* Arbel/Hermon doorbell records */
83 	uint64_t	mcq_armdbr_mapoffset;
84 	uint64_t	mcq_armdbr_maplen;
85 	uint64_t	mcq_polldbr_mapoffset;
86 	uint64_t	mcq_polldbr_maplen;
87 	uint32_t	mcq_armdbr_offset;
88 	uint32_t	mcq_polldbr_offset;
89 } mlnx_umap_cq_data_out_t;
90 
91 typedef struct mlnx_umap_qp_data_out_s {
92 	uint_t		mqp_rev;
93 	uint32_t	mqp_qpnum;
94 	uint64_t	mqp_mapoffset;
95 	uint64_t	mqp_maplen;
96 
97 	uint32_t	mqp_rq_off;
98 	uint32_t	mqp_rq_desc_addr;
99 	uint32_t	mqp_rq_numwqe;
100 	uint32_t	mqp_rq_wqesz;
101 
102 	uint32_t	mqp_sq_off;
103 	uint32_t	mqp_sq_desc_addr;
104 	uint32_t	mqp_sq_numwqe;
105 	uint32_t	mqp_sq_wqesz;
106 
107 	/* Arbel/Hermon doorbell records */
108 	uint64_t	mqp_sdbr_mapoffset;
109 	uint64_t	mqp_sdbr_maplen;
110 	uint64_t	mqp_rdbr_mapoffset;
111 	uint64_t	mqp_rdbr_maplen;
112 	uint32_t	mqp_sdbr_offset;
113 	uint32_t	mqp_rdbr_offset;
114 
115 	/* Hermon send queue headroom, in units of wqes */
116 	uint32_t	mqp_sq_headroomwqes;
117 } mlnx_umap_qp_data_out_t;
118 
119 typedef struct mlnx_umap_srq_data_out_s {
120 	uint_t		msrq_rev;
121 	uint32_t	msrq_srqnum;
122 	uint64_t	msrq_mapoffset;
123 	uint64_t	msrq_maplen;
124 	uint32_t	msrq_desc_addr;
125 	uint32_t	msrq_numwqe;
126 	uint32_t	msrq_wqesz;
127 	uint32_t	msrq_pad1;	/* reserved */
128 
129 	/* Arbel/Hermon doorbell records */
130 	uint64_t	msrq_rdbr_mapoffset;
131 	uint64_t	msrq_rdbr_maplen;
132 	uint32_t	msrq_rdbr_offset;
133 	uint32_t	msrq_reserved;
134 } mlnx_umap_srq_data_out_t;
135 
136 typedef struct mlnx_umap_pd_data_out_s {
137 	uint_t		mpd_rev;
138 	uint32_t	mpd_pdnum;
139 } mlnx_umap_pd_data_out_t;
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 #endif	/* _SYS_IB_ADAPTERS_MLNX_UMAP_H */
146