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
23 * - Redistributions of source code must retain the above
24 * copyright notice, this list of conditions and the following
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 __PVRDMA_VERBS_H__
47 #define __PVRDMA_VERBS_H__
49 #include <linux/types.h>
59 enum pvrdma_link_layer {
60 PVRDMA_LINK_LAYER_UNSPECIFIED,
61 PVRDMA_LINK_LAYER_INFINIBAND,
62 PVRDMA_LINK_LAYER_ETHERNET,
73 enum pvrdma_port_state {
77 PVRDMA_PORT_ARMED = 3,
78 PVRDMA_PORT_ACTIVE = 4,
79 PVRDMA_PORT_ACTIVE_DEFER = 5,
82 enum pvrdma_port_cap_flags {
83 PVRDMA_PORT_SM = 1 << 1,
84 PVRDMA_PORT_NOTICE_SUP = 1 << 2,
85 PVRDMA_PORT_TRAP_SUP = 1 << 3,
86 PVRDMA_PORT_OPT_IPD_SUP = 1 << 4,
87 PVRDMA_PORT_AUTO_MIGR_SUP = 1 << 5,
88 PVRDMA_PORT_SL_MAP_SUP = 1 << 6,
89 PVRDMA_PORT_MKEY_NVRAM = 1 << 7,
90 PVRDMA_PORT_PKEY_NVRAM = 1 << 8,
91 PVRDMA_PORT_LED_INFO_SUP = 1 << 9,
92 PVRDMA_PORT_SM_DISABLED = 1 << 10,
93 PVRDMA_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
94 PVRDMA_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
95 PVRDMA_PORT_EXTENDED_SPEEDS_SUP = 1 << 14,
96 PVRDMA_PORT_CM_SUP = 1 << 16,
97 PVRDMA_PORT_SNMP_TUNNEL_SUP = 1 << 17,
98 PVRDMA_PORT_REINIT_SUP = 1 << 18,
99 PVRDMA_PORT_DEVICE_MGMT_SUP = 1 << 19,
100 PVRDMA_PORT_VENDOR_CLASS_SUP = 1 << 20,
101 PVRDMA_PORT_DR_NOTICE_SUP = 1 << 21,
102 PVRDMA_PORT_CAP_MASK_NOTICE_SUP = 1 << 22,
103 PVRDMA_PORT_BOOT_MGMT_SUP = 1 << 23,
104 PVRDMA_PORT_LINK_LATENCY_SUP = 1 << 24,
105 PVRDMA_PORT_CLIENT_REG_SUP = 1 << 25,
106 PVRDMA_PORT_IP_BASED_GIDS = 1 << 26,
107 PVRDMA_PORT_CAP_FLAGS_MAX = PVRDMA_PORT_IP_BASED_GIDS,
110 enum pvrdma_port_width {
114 PVRDMA_WIDTH_12X = 8,
117 enum pvrdma_port_speed {
118 PVRDMA_SPEED_SDR = 1,
119 PVRDMA_SPEED_DDR = 2,
120 PVRDMA_SPEED_QDR = 4,
121 PVRDMA_SPEED_FDR10 = 8,
122 PVRDMA_SPEED_FDR = 16,
123 PVRDMA_SPEED_EDR = 32,
126 struct pvrdma_port_attr {
127 enum pvrdma_port_state state;
128 enum pvrdma_mtu max_mtu;
129 enum pvrdma_mtu active_mtu;
149 struct pvrdma_global_route {
150 union pvrdma_gid dgid;
159 __be32 version_tclass_flow;
163 union pvrdma_gid sgid;
164 union pvrdma_gid dgid;
167 enum pvrdma_ah_flags {
172 PVRDMA_RATE_PORT_CURRENT = 0,
173 PVRDMA_RATE_2_5_GBPS = 2,
174 PVRDMA_RATE_5_GBPS = 5,
175 PVRDMA_RATE_10_GBPS = 3,
176 PVRDMA_RATE_20_GBPS = 6,
177 PVRDMA_RATE_30_GBPS = 4,
178 PVRDMA_RATE_40_GBPS = 7,
179 PVRDMA_RATE_60_GBPS = 8,
180 PVRDMA_RATE_80_GBPS = 9,
181 PVRDMA_RATE_120_GBPS = 10,
182 PVRDMA_RATE_14_GBPS = 11,
183 PVRDMA_RATE_56_GBPS = 12,
184 PVRDMA_RATE_112_GBPS = 13,
185 PVRDMA_RATE_168_GBPS = 14,
186 PVRDMA_RATE_25_GBPS = 15,
187 PVRDMA_RATE_100_GBPS = 16,
188 PVRDMA_RATE_200_GBPS = 17,
189 PVRDMA_RATE_300_GBPS = 18,
192 struct pvrdma_ah_attr {
193 struct pvrdma_global_route grh;
205 enum pvrdma_cq_notify_flags {
206 PVRDMA_CQ_SOLICITED = 1 << 0,
207 PVRDMA_CQ_NEXT_COMP = 1 << 1,
208 PVRDMA_CQ_SOLICITED_MASK = PVRDMA_CQ_SOLICITED |
210 PVRDMA_CQ_REPORT_MISSED_EVENTS = 1 << 2,
213 struct pvrdma_qp_cap {
222 enum pvrdma_sig_type {
223 PVRDMA_SIGNAL_ALL_WR,
224 PVRDMA_SIGNAL_REQ_WR,
227 enum pvrdma_qp_type {
234 PVRDMA_QPT_RAW_ETHERTYPE,
235 PVRDMA_QPT_RAW_PACKET = 8,
236 PVRDMA_QPT_XRC_INI = 9,
241 enum pvrdma_qp_create_flags {
242 PVRDMA_QP_CREATE_IPOPVRDMA_UD_LSO = 1 << 0,
243 PVRDMA_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
246 enum pvrdma_qp_attr_mask {
247 PVRDMA_QP_STATE = 1 << 0,
248 PVRDMA_QP_CUR_STATE = 1 << 1,
249 PVRDMA_QP_EN_SQD_ASYNC_NOTIFY = 1 << 2,
250 PVRDMA_QP_ACCESS_FLAGS = 1 << 3,
251 PVRDMA_QP_PKEY_INDEX = 1 << 4,
252 PVRDMA_QP_PORT = 1 << 5,
253 PVRDMA_QP_QKEY = 1 << 6,
254 PVRDMA_QP_AV = 1 << 7,
255 PVRDMA_QP_PATH_MTU = 1 << 8,
256 PVRDMA_QP_TIMEOUT = 1 << 9,
257 PVRDMA_QP_RETRY_CNT = 1 << 10,
258 PVRDMA_QP_RNR_RETRY = 1 << 11,
259 PVRDMA_QP_RQ_PSN = 1 << 12,
260 PVRDMA_QP_MAX_QP_RD_ATOMIC = 1 << 13,
261 PVRDMA_QP_ALT_PATH = 1 << 14,
262 PVRDMA_QP_MIN_RNR_TIMER = 1 << 15,
263 PVRDMA_QP_SQ_PSN = 1 << 16,
264 PVRDMA_QP_MAX_DEST_RD_ATOMIC = 1 << 17,
265 PVRDMA_QP_PATH_MIG_STATE = 1 << 18,
266 PVRDMA_QP_CAP = 1 << 19,
267 PVRDMA_QP_DEST_QPN = 1 << 20,
268 PVRDMA_QP_ATTR_MASK_MAX = PVRDMA_QP_DEST_QPN,
271 enum pvrdma_qp_state {
281 enum pvrdma_mig_state {
287 enum pvrdma_mw_type {
288 PVRDMA_MW_TYPE_1 = 1,
289 PVRDMA_MW_TYPE_2 = 2,
292 struct pvrdma_srq_attr {
299 struct pvrdma_qp_attr {
300 enum pvrdma_qp_state qp_state;
301 enum pvrdma_qp_state cur_qp_state;
302 enum pvrdma_mtu path_mtu;
303 enum pvrdma_mig_state path_mig_state;
311 u8 en_sqd_async_notify;
314 u8 max_dest_rd_atomic;
323 struct pvrdma_qp_cap cap;
324 struct pvrdma_ah_attr ah_attr;
325 struct pvrdma_ah_attr alt_ah_attr;
328 enum pvrdma_send_flags {
329 PVRDMA_SEND_FENCE = 1 << 0,
330 PVRDMA_SEND_SIGNALED = 1 << 1,
331 PVRDMA_SEND_SOLICITED = 1 << 2,
332 PVRDMA_SEND_INLINE = 1 << 3,
333 PVRDMA_SEND_IP_CSUM = 1 << 4,
334 PVRDMA_SEND_FLAGS_MAX = PVRDMA_SEND_IP_CSUM,
337 enum pvrdma_access_flags {
338 PVRDMA_ACCESS_LOCAL_WRITE = 1 << 0,
339 PVRDMA_ACCESS_REMOTE_WRITE = 1 << 1,
340 PVRDMA_ACCESS_REMOTE_READ = 1 << 2,
341 PVRDMA_ACCESS_REMOTE_ATOMIC = 1 << 3,
342 PVRDMA_ACCESS_MW_BIND = 1 << 4,
343 PVRDMA_ZERO_BASED = 1 << 5,
344 PVRDMA_ACCESS_ON_DEMAND = 1 << 6,
345 PVRDMA_ACCESS_FLAGS_MAX = PVRDMA_ACCESS_ON_DEMAND,
348 int pvrdma_query_device(struct ib_device *ibdev,
349 struct ib_device_attr *props,
350 struct ib_udata *udata);
351 int pvrdma_query_port(struct ib_device *ibdev, u8 port,
352 struct ib_port_attr *props);
353 int pvrdma_query_gid(struct ib_device *ibdev, u8 port,
354 int index, union ib_gid *gid);
355 int pvrdma_query_pkey(struct ib_device *ibdev, u8 port,
356 u16 index, u16 *pkey);
357 enum rdma_link_layer pvrdma_port_link_layer(struct ib_device *ibdev,
359 int pvrdma_modify_device(struct ib_device *ibdev, int mask,
360 struct ib_device_modify *props);
361 int pvrdma_modify_port(struct ib_device *ibdev, u8 port,
362 int mask, struct ib_port_modify *props);
363 int pvrdma_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
364 int pvrdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata);
365 void pvrdma_dealloc_ucontext(struct ib_ucontext *context);
366 int pvrdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
367 int pvrdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
368 struct ib_mr *pvrdma_get_dma_mr(struct ib_pd *pd, int acc);
369 struct ib_mr *pvrdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
370 u64 virt_addr, int access_flags,
371 struct ib_udata *udata);
372 int pvrdma_dereg_mr(struct ib_mr *mr, struct ib_udata *udata);
373 struct ib_mr *pvrdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
375 int pvrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg,
376 int sg_nents, unsigned int *sg_offset);
377 int pvrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
378 struct ib_udata *udata);
379 int pvrdma_destroy_cq(struct ib_cq *cq, struct ib_udata *udata);
380 int pvrdma_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
381 int pvrdma_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
382 int pvrdma_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,
383 struct ib_udata *udata);
384 int pvrdma_destroy_ah(struct ib_ah *ah, u32 flags);
386 int pvrdma_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *init_attr,
387 struct ib_udata *udata);
388 int pvrdma_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
389 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
390 int pvrdma_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
391 int pvrdma_destroy_srq(struct ib_srq *srq, struct ib_udata *udata);
393 struct ib_qp *pvrdma_create_qp(struct ib_pd *pd,
394 struct ib_qp_init_attr *init_attr,
395 struct ib_udata *udata);
396 int pvrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
397 int attr_mask, struct ib_udata *udata);
398 int pvrdma_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
399 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
400 int pvrdma_destroy_qp(struct ib_qp *qp, struct ib_udata *udata);
401 int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
402 const struct ib_send_wr **bad_wr);
403 int pvrdma_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
404 const struct ib_recv_wr **bad_wr);
406 #endif /* __PVRDMA_VERBS_H__ */