include/standard-headers: add pvrdma related headers
[qemu.git] / include / standard-headers / rdma / vmw_pvrdma-abi.h
blob0d0f7a8acae9f1a20e4394ad021879e7ff104090
1 /*
2 * Copyright (c) 2012-2016 VMware, Inc. All rights reserved.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of EITHER the GNU General Public License
6 * version 2 as published by the Free Software Foundation or the BSD
7 * 2-Clause License. This program is distributed in the hope that it
8 * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED
9 * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
10 * See the GNU General Public License version 2 for more details at
11 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
13 * You should have received a copy of the GNU General Public License
14 * along with this program available in the file COPYING in the main
15 * directory of this source tree.
17 * The BSD 2-Clause License
19 * Redistribution and use in source and binary forms, with or
20 * without modification, are permitted provided that the following
21 * conditions are met:
23 * - Redistributions of source code must retain the above
24 * copyright notice, this list of conditions and the following
25 * disclaimer.
27 * - Redistributions in binary form must reproduce the above
28 * copyright notice, this list of conditions and the following
29 * disclaimer in the documentation and/or other materials
30 * provided with the distribution.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
35 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
36 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
37 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
43 * OF THE POSSIBILITY OF SUCH DAMAGE.
46 #ifndef __VMW_PVRDMA_ABI_H__
47 #define __VMW_PVRDMA_ABI_H__
49 #include "standard-headers/linux/types.h"
51 #define PVRDMA_UVERBS_ABI_VERSION 3 /* ABI Version. */
52 #define PVRDMA_UAR_HANDLE_MASK 0x00FFFFFF /* Bottom 24 bits. */
53 #define PVRDMA_UAR_QP_OFFSET 0 /* QP doorbell. */
54 #define PVRDMA_UAR_QP_SEND BIT(30) /* Send bit. */
55 #define PVRDMA_UAR_QP_RECV BIT(31) /* Recv bit. */
56 #define PVRDMA_UAR_CQ_OFFSET 4 /* CQ doorbell. */
57 #define PVRDMA_UAR_CQ_ARM_SOL BIT(29) /* Arm solicited bit. */
58 #define PVRDMA_UAR_CQ_ARM BIT(30) /* Arm bit. */
59 #define PVRDMA_UAR_CQ_POLL BIT(31) /* Poll bit. */
61 enum pvrdma_wr_opcode {
62 PVRDMA_WR_RDMA_WRITE,
63 PVRDMA_WR_RDMA_WRITE_WITH_IMM,
64 PVRDMA_WR_SEND,
65 PVRDMA_WR_SEND_WITH_IMM,
66 PVRDMA_WR_RDMA_READ,
67 PVRDMA_WR_ATOMIC_CMP_AND_SWP,
68 PVRDMA_WR_ATOMIC_FETCH_AND_ADD,
69 PVRDMA_WR_LSO,
70 PVRDMA_WR_SEND_WITH_INV,
71 PVRDMA_WR_RDMA_READ_WITH_INV,
72 PVRDMA_WR_LOCAL_INV,
73 PVRDMA_WR_FAST_REG_MR,
74 PVRDMA_WR_MASKED_ATOMIC_CMP_AND_SWP,
75 PVRDMA_WR_MASKED_ATOMIC_FETCH_AND_ADD,
76 PVRDMA_WR_BIND_MW,
77 PVRDMA_WR_REG_SIG_MR,
80 enum pvrdma_wc_status {
81 PVRDMA_WC_SUCCESS,
82 PVRDMA_WC_LOC_LEN_ERR,
83 PVRDMA_WC_LOC_QP_OP_ERR,
84 PVRDMA_WC_LOC_EEC_OP_ERR,
85 PVRDMA_WC_LOC_PROT_ERR,
86 PVRDMA_WC_WR_FLUSH_ERR,
87 PVRDMA_WC_MW_BIND_ERR,
88 PVRDMA_WC_BAD_RESP_ERR,
89 PVRDMA_WC_LOC_ACCESS_ERR,
90 PVRDMA_WC_REM_INV_REQ_ERR,
91 PVRDMA_WC_REM_ACCESS_ERR,
92 PVRDMA_WC_REM_OP_ERR,
93 PVRDMA_WC_RETRY_EXC_ERR,
94 PVRDMA_WC_RNR_RETRY_EXC_ERR,
95 PVRDMA_WC_LOC_RDD_VIOL_ERR,
96 PVRDMA_WC_REM_INV_RD_REQ_ERR,
97 PVRDMA_WC_REM_ABORT_ERR,
98 PVRDMA_WC_INV_EECN_ERR,
99 PVRDMA_WC_INV_EEC_STATE_ERR,
100 PVRDMA_WC_FATAL_ERR,
101 PVRDMA_WC_RESP_TIMEOUT_ERR,
102 PVRDMA_WC_GENERAL_ERR,
105 enum pvrdma_wc_opcode {
106 PVRDMA_WC_SEND,
107 PVRDMA_WC_RDMA_WRITE,
108 PVRDMA_WC_RDMA_READ,
109 PVRDMA_WC_COMP_SWAP,
110 PVRDMA_WC_FETCH_ADD,
111 PVRDMA_WC_BIND_MW,
112 PVRDMA_WC_LSO,
113 PVRDMA_WC_LOCAL_INV,
114 PVRDMA_WC_FAST_REG_MR,
115 PVRDMA_WC_MASKED_COMP_SWAP,
116 PVRDMA_WC_MASKED_FETCH_ADD,
117 PVRDMA_WC_RECV = 1 << 7,
118 PVRDMA_WC_RECV_RDMA_WITH_IMM,
121 enum pvrdma_wc_flags {
122 PVRDMA_WC_GRH = 1 << 0,
123 PVRDMA_WC_WITH_IMM = 1 << 1,
124 PVRDMA_WC_WITH_INVALIDATE = 1 << 2,
125 PVRDMA_WC_IP_CSUM_OK = 1 << 3,
126 PVRDMA_WC_WITH_SMAC = 1 << 4,
127 PVRDMA_WC_WITH_VLAN = 1 << 5,
128 PVRDMA_WC_WITH_NETWORK_HDR_TYPE = 1 << 6,
129 PVRDMA_WC_FLAGS_MAX = PVRDMA_WC_WITH_NETWORK_HDR_TYPE,
132 struct pvrdma_alloc_ucontext_resp {
133 uint32_t qp_tab_size;
134 uint32_t reserved;
137 struct pvrdma_alloc_pd_resp {
138 uint32_t pdn;
139 uint32_t reserved;
142 struct pvrdma_create_cq {
143 uint64_t buf_addr;
144 uint32_t buf_size;
145 uint32_t reserved;
148 struct pvrdma_create_cq_resp {
149 uint32_t cqn;
150 uint32_t reserved;
153 struct pvrdma_resize_cq {
154 uint64_t buf_addr;
155 uint32_t buf_size;
156 uint32_t reserved;
159 struct pvrdma_create_srq {
160 uint64_t buf_addr;
161 uint32_t buf_size;
162 uint32_t reserved;
165 struct pvrdma_create_srq_resp {
166 uint32_t srqn;
167 uint32_t reserved;
170 struct pvrdma_create_qp {
171 uint64_t rbuf_addr;
172 uint64_t sbuf_addr;
173 uint32_t rbuf_size;
174 uint32_t sbuf_size;
175 uint64_t qp_addr;
178 /* PVRDMA masked atomic compare and swap */
179 struct pvrdma_ex_cmp_swap {
180 uint64_t swap_val;
181 uint64_t compare_val;
182 uint64_t swap_mask;
183 uint64_t compare_mask;
186 /* PVRDMA masked atomic fetch and add */
187 struct pvrdma_ex_fetch_add {
188 uint64_t add_val;
189 uint64_t field_boundary;
192 /* PVRDMA address vector. */
193 struct pvrdma_av {
194 uint32_t port_pd;
195 uint32_t sl_tclass_flowlabel;
196 uint8_t dgid[16];
197 uint8_t src_path_bits;
198 uint8_t gid_index;
199 uint8_t stat_rate;
200 uint8_t hop_limit;
201 uint8_t dmac[6];
202 uint8_t reserved[6];
205 /* PVRDMA scatter/gather entry */
206 struct pvrdma_sge {
207 uint64_t addr;
208 uint32_t length;
209 uint32_t lkey;
212 /* PVRDMA receive queue work request */
213 struct pvrdma_rq_wqe_hdr {
214 uint64_t wr_id; /* wr id */
215 uint32_t num_sge; /* size of s/g array */
216 uint32_t total_len; /* reserved */
218 /* Use pvrdma_sge (ib_sge) for receive queue s/g array elements. */
220 /* PVRDMA send queue work request */
221 struct pvrdma_sq_wqe_hdr {
222 uint64_t wr_id; /* wr id */
223 uint32_t num_sge; /* size of s/g array */
224 uint32_t total_len; /* reserved */
225 uint32_t opcode; /* operation type */
226 uint32_t send_flags; /* wr flags */
227 union {
228 uint32_t imm_data;
229 uint32_t invalidate_rkey;
230 } ex;
231 uint32_t reserved;
232 union {
233 struct {
234 uint64_t remote_addr;
235 uint32_t rkey;
236 uint8_t reserved[4];
237 } rdma;
238 struct {
239 uint64_t remote_addr;
240 uint64_t compare_add;
241 uint64_t swap;
242 uint32_t rkey;
243 uint32_t reserved;
244 } atomic;
245 struct {
246 uint64_t remote_addr;
247 uint32_t log_arg_sz;
248 uint32_t rkey;
249 union {
250 struct pvrdma_ex_cmp_swap cmp_swap;
251 struct pvrdma_ex_fetch_add fetch_add;
252 } wr_data;
253 } masked_atomics;
254 struct {
255 uint64_t iova_start;
256 uint64_t pl_pdir_dma;
257 uint32_t page_shift;
258 uint32_t page_list_len;
259 uint32_t length;
260 uint32_t access_flags;
261 uint32_t rkey;
262 } fast_reg;
263 struct {
264 uint32_t remote_qpn;
265 uint32_t remote_qkey;
266 struct pvrdma_av av;
267 } ud;
268 } wr;
270 /* Use pvrdma_sge (ib_sge) for send queue s/g array elements. */
272 /* Completion queue element. */
273 struct pvrdma_cqe {
274 uint64_t wr_id;
275 uint64_t qp;
276 uint32_t opcode;
277 uint32_t status;
278 uint32_t byte_len;
279 uint32_t imm_data;
280 uint32_t src_qp;
281 uint32_t wc_flags;
282 uint32_t vendor_err;
283 uint16_t pkey_index;
284 uint16_t slid;
285 uint8_t sl;
286 uint8_t dlid_path_bits;
287 uint8_t port_num;
288 uint8_t smac[6];
289 uint8_t network_hdr_type;
290 uint8_t reserved2[6]; /* Pad to next power of 2 (64). */
293 #endif /* __VMW_PVRDMA_ABI_H__ */