xref: /linux/drivers/infiniband/hw/ocrdma/ocrdma_verbs.h (revision 4f6b838c378a52ea3ae0b15f12ca8a20849072fa)
171ee6730SDevesh Sharma /* This file is part of the Emulex RoCE Device Driver for
271ee6730SDevesh Sharma  * RoCE (RDMA over Converged Ethernet) adapters.
371ee6730SDevesh Sharma  * Copyright (C) 2012-2015 Emulex. All rights reserved.
471ee6730SDevesh Sharma  * EMULEX and SLI are trademarks of Emulex.
571ee6730SDevesh Sharma  * www.emulex.com
671ee6730SDevesh Sharma  *
771ee6730SDevesh Sharma  * This software is available to you under a choice of one of two licenses.
871ee6730SDevesh Sharma  * You may choose to be licensed under the terms of the GNU General Public
971ee6730SDevesh Sharma  * License (GPL) Version 2, available from the file COPYING in the main
1071ee6730SDevesh Sharma  * directory of this source tree, or the BSD license below:
1171ee6730SDevesh Sharma  *
1271ee6730SDevesh Sharma  * Redistribution and use in source and binary forms, with or without
1371ee6730SDevesh Sharma  * modification, are permitted provided that the following conditions
1471ee6730SDevesh Sharma  * are met:
1571ee6730SDevesh Sharma  *
1671ee6730SDevesh Sharma  * - Redistributions of source code must retain the above copyright notice,
1771ee6730SDevesh Sharma  *   this list of conditions and the following disclaimer.
1871ee6730SDevesh Sharma  *
1971ee6730SDevesh Sharma  * - Redistributions in binary form must reproduce the above copyright
2071ee6730SDevesh Sharma  *   notice, this list of conditions and the following disclaimer in
2171ee6730SDevesh Sharma  *   the documentation and/or other materials provided with the distribution.
2271ee6730SDevesh Sharma  *
2371ee6730SDevesh Sharma  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2471ee6730SDevesh Sharma  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,THE
2571ee6730SDevesh Sharma  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2671ee6730SDevesh Sharma  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
2771ee6730SDevesh Sharma  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2871ee6730SDevesh Sharma  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2971ee6730SDevesh Sharma  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
3071ee6730SDevesh Sharma  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
3171ee6730SDevesh Sharma  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
3271ee6730SDevesh Sharma  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
3371ee6730SDevesh Sharma  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34fe2caefcSParav Pandit  *
35fe2caefcSParav Pandit  * Contact Information:
36fe2caefcSParav Pandit  * linux-drivers@emulex.com
37fe2caefcSParav Pandit  *
38fe2caefcSParav Pandit  * Emulex
39fe2caefcSParav Pandit  * 3333 Susan Street
40fe2caefcSParav Pandit  * Costa Mesa, CA 92626
4171ee6730SDevesh Sharma  */
42fe2caefcSParav Pandit 
43fe2caefcSParav Pandit #ifndef __OCRDMA_VERBS_H__
44fe2caefcSParav Pandit #define __OCRDMA_VERBS_H__
45fe2caefcSParav Pandit 
46d34ac5cdSBart Van Assche int ocrdma_post_send(struct ib_qp *, const struct ib_send_wr *,
47d34ac5cdSBart Van Assche 		     const struct ib_send_wr **bad_wr);
48d34ac5cdSBart Van Assche int ocrdma_post_recv(struct ib_qp *, const struct ib_recv_wr *,
49d34ac5cdSBart Van Assche 		     const struct ib_recv_wr **bad_wr);
50fe2caefcSParav Pandit 
51fe2caefcSParav Pandit int ocrdma_poll_cq(struct ib_cq *, int num_entries, struct ib_wc *wc);
52fe2caefcSParav Pandit int ocrdma_arm_cq(struct ib_cq *, enum ib_cq_notify_flags flags);
53fe2caefcSParav Pandit 
542528e33eSMatan Barak int ocrdma_query_device(struct ib_device *, struct ib_device_attr *props,
552528e33eSMatan Barak 			struct ib_udata *uhw);
56fe2caefcSParav Pandit int ocrdma_query_port(struct ib_device *, u8 port, struct ib_port_attr *props);
57fe2caefcSParav Pandit 
586b90a6d6SMichael Wang enum rdma_protocol_type
596b90a6d6SMichael Wang ocrdma_query_protocol(struct ib_device *device, u8 port_num);
606b90a6d6SMichael Wang 
61fe2caefcSParav Pandit void ocrdma_get_guid(struct ocrdma_dev *, u8 *guid);
62fe2caefcSParav Pandit int ocrdma_query_pkey(struct ib_device *, u8 port, u16 index, u16 *pkey);
63fe2caefcSParav Pandit 
64a2a074efSLeon Romanovsky int ocrdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata);
65a2a074efSLeon Romanovsky void ocrdma_dealloc_ucontext(struct ib_ucontext *uctx);
66fe2caefcSParav Pandit 
67fe2caefcSParav Pandit int ocrdma_mmap(struct ib_ucontext *, struct vm_area_struct *vma);
68fe2caefcSParav Pandit 
69ff23dfa1SShamir Rabinovitch int ocrdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
7091a7c58fSLeon Romanovsky int ocrdma_dealloc_pd(struct ib_pd *pd, struct ib_udata *udata);
71fe2caefcSParav Pandit 
72e39afe3dSLeon Romanovsky int ocrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
73bcf4c1eaSMatan Barak 		     struct ib_udata *udata);
74fe2caefcSParav Pandit int ocrdma_resize_cq(struct ib_cq *, int cqe, struct ib_udata *);
75*43d781b9SLeon Romanovsky int ocrdma_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata);
76fe2caefcSParav Pandit 
77fe2caefcSParav Pandit struct ib_qp *ocrdma_create_qp(struct ib_pd *,
78fe2caefcSParav Pandit 			       struct ib_qp_init_attr *attrs,
79fe2caefcSParav Pandit 			       struct ib_udata *);
80fe2caefcSParav Pandit int _ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
81fe2caefcSParav Pandit 		      int attr_mask);
82fe2caefcSParav Pandit int ocrdma_modify_qp(struct ib_qp *, struct ib_qp_attr *attr,
83fe2caefcSParav Pandit 		     int attr_mask, struct ib_udata *udata);
84fe2caefcSParav Pandit int ocrdma_query_qp(struct ib_qp *,
85fe2caefcSParav Pandit 		    struct ib_qp_attr *qp_attr,
86fe2caefcSParav Pandit 		    int qp_attr_mask, struct ib_qp_init_attr *);
87c4367a26SShamir Rabinovitch int ocrdma_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata);
88f11220eeSNaresh Gottumukkala void ocrdma_del_flush_qp(struct ocrdma_qp *qp);
89fe2caefcSParav Pandit 
9068e326deSLeon Romanovsky int ocrdma_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *attr,
9168e326deSLeon Romanovsky 		      struct ib_udata *udata);
92fe2caefcSParav Pandit int ocrdma_modify_srq(struct ib_srq *, struct ib_srq_attr *,
93fe2caefcSParav Pandit 		      enum ib_srq_attr_mask, struct ib_udata *);
94fe2caefcSParav Pandit int ocrdma_query_srq(struct ib_srq *, struct ib_srq_attr *);
95119181d1SLeon Romanovsky int ocrdma_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata);
96d34ac5cdSBart Van Assche int ocrdma_post_srq_recv(struct ib_srq *, const struct ib_recv_wr *,
97d34ac5cdSBart Van Assche 			 const struct ib_recv_wr **bad_recv_wr);
98fe2caefcSParav Pandit 
99c4367a26SShamir Rabinovitch int ocrdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata);
100fe2caefcSParav Pandit struct ib_mr *ocrdma_get_dma_mr(struct ib_pd *, int acc);
101fe2caefcSParav Pandit struct ib_mr *ocrdma_reg_user_mr(struct ib_pd *, u64 start, u64 length,
102fe2caefcSParav Pandit 				 u64 virt, int acc, struct ib_udata *);
103c4367a26SShamir Rabinovitch struct ib_mr *ocrdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
10442a3b153SGal Pressman 			      u32 max_num_sg);
105ff2ba993SChristoph Hellwig int ocrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
1069aa8b321SBart Van Assche 		     unsigned int *sg_offset);
107fe2caefcSParav Pandit 
108fe2caefcSParav Pandit #endif				/* __OCRDMA_VERBS_H__ */
109