xref: /OK3568_Linux_fs/kernel/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* This file is part of the Emulex RoCE Device Driver for
2*4882a593Smuzhiyun  * RoCE (RDMA over Converged Ethernet) adapters.
3*4882a593Smuzhiyun  * Copyright (C) 2012-2015 Emulex. All rights reserved.
4*4882a593Smuzhiyun  * EMULEX and SLI are trademarks of Emulex.
5*4882a593Smuzhiyun  * www.emulex.com
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * This software is available to you under a choice of one of two licenses.
8*4882a593Smuzhiyun  * You may choose to be licensed under the terms of the GNU General Public
9*4882a593Smuzhiyun  * License (GPL) Version 2, available from the file COPYING in the main
10*4882a593Smuzhiyun  * directory of this source tree, or the BSD license below:
11*4882a593Smuzhiyun  *
12*4882a593Smuzhiyun  * Redistribution and use in source and binary forms, with or without
13*4882a593Smuzhiyun  * modification, are permitted provided that the following conditions
14*4882a593Smuzhiyun  * are met:
15*4882a593Smuzhiyun  *
16*4882a593Smuzhiyun  * - Redistributions of source code must retain the above copyright notice,
17*4882a593Smuzhiyun  *   this list of conditions and the following disclaimer.
18*4882a593Smuzhiyun  *
19*4882a593Smuzhiyun  * - Redistributions in binary form must reproduce the above copyright
20*4882a593Smuzhiyun  *   notice, this list of conditions and the following disclaimer in
21*4882a593Smuzhiyun  *   the documentation and/or other materials provided with the distribution.
22*4882a593Smuzhiyun  *
23*4882a593Smuzhiyun  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24*4882a593Smuzhiyun  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE
25*4882a593Smuzhiyun  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26*4882a593Smuzhiyun  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27*4882a593Smuzhiyun  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28*4882a593Smuzhiyun  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29*4882a593Smuzhiyun  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30*4882a593Smuzhiyun  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31*4882a593Smuzhiyun  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32*4882a593Smuzhiyun  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
33*4882a593Smuzhiyun  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34*4882a593Smuzhiyun  *
35*4882a593Smuzhiyun  * Contact Information:
36*4882a593Smuzhiyun  * linux-drivers@emulex.com
37*4882a593Smuzhiyun  *
38*4882a593Smuzhiyun  * Emulex
39*4882a593Smuzhiyun  * 3333 Susan Street
40*4882a593Smuzhiyun  * Costa Mesa, CA 92626
41*4882a593Smuzhiyun  */
42*4882a593Smuzhiyun 
43*4882a593Smuzhiyun #ifndef __OCRDMA_VERBS_H__
44*4882a593Smuzhiyun #define __OCRDMA_VERBS_H__
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun int ocrdma_post_send(struct ib_qp *, const struct ib_send_wr *,
47*4882a593Smuzhiyun 		     const struct ib_send_wr **bad_wr);
48*4882a593Smuzhiyun int ocrdma_post_recv(struct ib_qp *, const struct ib_recv_wr *,
49*4882a593Smuzhiyun 		     const struct ib_recv_wr **bad_wr);
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun int ocrdma_poll_cq(struct ib_cq *, int num_entries, struct ib_wc *wc);
52*4882a593Smuzhiyun int ocrdma_arm_cq(struct ib_cq *, enum ib_cq_notify_flags flags);
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun int ocrdma_query_device(struct ib_device *, struct ib_device_attr *props,
55*4882a593Smuzhiyun 			struct ib_udata *uhw);
56*4882a593Smuzhiyun int ocrdma_query_port(struct ib_device *, u8 port, struct ib_port_attr *props);
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun enum rdma_protocol_type
59*4882a593Smuzhiyun ocrdma_query_protocol(struct ib_device *device, u8 port_num);
60*4882a593Smuzhiyun 
61*4882a593Smuzhiyun void ocrdma_get_guid(struct ocrdma_dev *, u8 *guid);
62*4882a593Smuzhiyun int ocrdma_query_pkey(struct ib_device *, u8 port, u16 index, u16 *pkey);
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun int ocrdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata);
65*4882a593Smuzhiyun void ocrdma_dealloc_ucontext(struct ib_ucontext *uctx);
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun int ocrdma_mmap(struct ib_ucontext *, struct vm_area_struct *vma);
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun int ocrdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
70*4882a593Smuzhiyun int ocrdma_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);
71*4882a593Smuzhiyun 
72*4882a593Smuzhiyun int ocrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
73*4882a593Smuzhiyun 		     struct ib_udata *udata);
74*4882a593Smuzhiyun int ocrdma_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
75*4882a593Smuzhiyun int ocrdma_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
76*4882a593Smuzhiyun 
77*4882a593Smuzhiyun struct ib_qp *ocrdma_create_qp(struct ib_pd *,
78*4882a593Smuzhiyun 			       struct ib_qp_init_attr *attrs,
79*4882a593Smuzhiyun 			       struct ib_udata *);
80*4882a593Smuzhiyun int _ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
81*4882a593Smuzhiyun 		      int attr_mask);
82*4882a593Smuzhiyun int ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
83*4882a593Smuzhiyun 		     int attr_mask, struct ib_udata *udata);
84*4882a593Smuzhiyun int ocrdma_query_qp(struct ib_qp *,
85*4882a593Smuzhiyun 		    struct ib_qp_attr *qp_attr,
86*4882a593Smuzhiyun 		    int qp_attr_mask, struct ib_qp_init_attr *);
87*4882a593Smuzhiyun int ocrdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
88*4882a593Smuzhiyun void ocrdma_del_flush_qp(struct ocrdma_qp *qp);
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun int ocrdma_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *attr,
91*4882a593Smuzhiyun 		      struct ib_udata *udata);
92*4882a593Smuzhiyun int ocrdma_modify_srq(struct ib_srq *, struct ib_srq_attr *,
93*4882a593Smuzhiyun 		      enum ib_srq_attr_mask, struct ib_udata *);
94*4882a593Smuzhiyun int ocrdma_query_srq(struct ib_srq *, struct ib_srq_attr *);
95*4882a593Smuzhiyun int ocrdma_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata);
96*4882a593Smuzhiyun int ocrdma_post_srq_recv(struct ib_srq *, const struct ib_recv_wr *,
97*4882a593Smuzhiyun 			 const struct ib_recv_wr **bad_recv_wr);
98*4882a593Smuzhiyun 
99*4882a593Smuzhiyun int ocrdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata);
100*4882a593Smuzhiyun struct ib_mr *ocrdma_get_dma_mr(struct ib_pd *, int acc);
101*4882a593Smuzhiyun struct ib_mr *ocrdma_reg_user_mr(struct ib_pd *, u64 start, u64 length,
102*4882a593Smuzhiyun 				 u64 virt, int acc, struct ib_udata *);
103*4882a593Smuzhiyun struct ib_mr *ocrdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
104*4882a593Smuzhiyun 			      u32 max_num_sg);
105*4882a593Smuzhiyun int ocrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
106*4882a593Smuzhiyun 		     unsigned int *sg_offset);
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun #endif				/* __OCRDMA_VERBS_H__ */
109