blob: fd84a804814c87afd3fa0707b7eacfb1d4e255d7 [file] [log] [blame]
Heiko J Schickfab97222006-09-22 15:22:22 -07001/*
2 * IBM eServer eHCA Infiniband device driver for Linux on POWER
3 *
4 * Function definitions for internal functions
5 *
6 * Authors: Heiko J Schick <schickhj@de.ibm.com>
7 * Dietmar Decker <ddecker@de.ibm.com>
8 *
9 * Copyright (c) 2005 IBM Corporation
10 *
11 * All rights reserved.
12 *
13 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
14 * BSD.
15 *
16 * OpenIB BSD License
17 *
18 * Redistribution and use in source and binary forms, with or without
19 * modification, are permitted provided that the following conditions are met:
20 *
21 * Redistributions of source code must retain the above copyright notice, this
22 * list of conditions and the following disclaimer.
23 *
24 * Redistributions in binary form must reproduce the above copyright notice,
25 * this list of conditions and the following disclaimer in the documentation
26 * and/or other materials
27 * provided with the distribution.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
33 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
36 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
37 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGE.
40 */
41
42#ifndef __EHCA_IVERBS_H__
43#define __EHCA_IVERBS_H__
44
45#include "ehca_classes.h"
46
47int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props);
48
49int ehca_query_port(struct ib_device *ibdev, u8 port,
50 struct ib_port_attr *props);
51
52int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 * pkey);
53
54int ehca_query_gid(struct ib_device *ibdev, u8 port, int index,
55 union ib_gid *gid);
56
57int ehca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask,
58 struct ib_port_modify *props);
59
60struct ib_pd *ehca_alloc_pd(struct ib_device *device,
61 struct ib_ucontext *context,
62 struct ib_udata *udata);
63
64int ehca_dealloc_pd(struct ib_pd *pd);
65
66struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
67
68int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
69
70int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
71
72int ehca_destroy_ah(struct ib_ah *ah);
73
74struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
75
76struct ib_mr *ehca_reg_phys_mr(struct ib_pd *pd,
77 struct ib_phys_buf *phys_buf_array,
78 int num_phys_buf,
79 int mr_access_flags, u64 *iova_start);
80
Roland Dreierf7c6a7b2007-03-04 16:15:11 -080081struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, u64 virt,
Heiko J Schickfab97222006-09-22 15:22:22 -070082 int mr_access_flags, struct ib_udata *udata);
83
84int ehca_rereg_phys_mr(struct ib_mr *mr,
85 int mr_rereg_mask,
86 struct ib_pd *pd,
87 struct ib_phys_buf *phys_buf_array,
88 int num_phys_buf, int mr_access_flags, u64 *iova_start);
89
90int ehca_query_mr(struct ib_mr *mr, struct ib_mr_attr *mr_attr);
91
92int ehca_dereg_mr(struct ib_mr *mr);
93
94struct ib_mw *ehca_alloc_mw(struct ib_pd *pd);
95
96int ehca_bind_mw(struct ib_qp *qp, struct ib_mw *mw,
97 struct ib_mw_bind *mw_bind);
98
99int ehca_dealloc_mw(struct ib_mw *mw);
100
101struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,
102 int mr_access_flags,
103 struct ib_fmr_attr *fmr_attr);
104
105int ehca_map_phys_fmr(struct ib_fmr *fmr,
106 u64 *page_list, int list_len, u64 iova);
107
108int ehca_unmap_fmr(struct list_head *fmr_list);
109
110int ehca_dealloc_fmr(struct ib_fmr *fmr);
111
112enum ehca_eq_type {
113 EHCA_EQ = 0, /* Event Queue */
114 EHCA_NEQ /* Notification Event Queue */
115};
116
117int ehca_create_eq(struct ehca_shca *shca, struct ehca_eq *eq,
118 enum ehca_eq_type type, const u32 length);
119
120int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
121
122void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
123
124
Michael S. Tsirkinf4fd0b22007-05-03 13:48:47 +0300125struct ib_cq *ehca_create_cq(struct ib_device *device, int cqe, int comp_vector,
Heiko J Schickfab97222006-09-22 15:22:22 -0700126 struct ib_ucontext *context,
127 struct ib_udata *udata);
128
129int ehca_destroy_cq(struct ib_cq *cq);
130
131int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);
132
133int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
134
135int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);
136
Roland Dreiered23a722007-05-06 21:02:48 -0700137int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags);
Heiko J Schickfab97222006-09-22 15:22:22 -0700138
139struct ib_qp *ehca_create_qp(struct ib_pd *pd,
140 struct ib_qp_init_attr *init_attr,
141 struct ib_udata *udata);
142
143int ehca_destroy_qp(struct ib_qp *qp);
144
Ralph Campbell9bc57e22006-08-11 14:58:09 -0700145int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
146 struct ib_udata *udata);
Heiko J Schickfab97222006-09-22 15:22:22 -0700147
148int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
149 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
150
151int ehca_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr,
152 struct ib_send_wr **bad_send_wr);
153
154int ehca_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr,
155 struct ib_recv_wr **bad_recv_wr);
156
Joachim Fenkesa6a12942007-07-09 15:25:10 +0200157int ehca_post_srq_recv(struct ib_srq *srq,
158 struct ib_recv_wr *recv_wr,
159 struct ib_recv_wr **bad_recv_wr);
160
161struct ib_srq *ehca_create_srq(struct ib_pd *pd,
162 struct ib_srq_init_attr *init_attr,
163 struct ib_udata *udata);
164
165int ehca_modify_srq(struct ib_srq *srq, struct ib_srq_attr *attr,
166 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
167
168int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
169
170int ehca_destroy_srq(struct ib_srq *srq);
171
Heiko J Schickfab97222006-09-22 15:22:22 -0700172u64 ehca_define_sqp(struct ehca_shca *shca, struct ehca_qp *ibqp,
173 struct ib_qp_init_attr *qp_init_attr);
174
175int ehca_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
176
177int ehca_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
178
179struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device,
180 struct ib_udata *udata);
181
182int ehca_dealloc_ucontext(struct ib_ucontext *context);
183
184int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
185
186void ehca_poll_eqs(unsigned long data);
187
Hoang-Nam Nguyen7e28db52006-11-07 00:56:39 +0100188#ifdef CONFIG_PPC_64K_PAGES
Hoang-Nam Nguyenf2d91362007-01-09 18:04:14 +0100189void *ehca_alloc_fw_ctrlblock(gfp_t flags);
Hoang-Nam Nguyen7e28db52006-11-07 00:56:39 +0100190void ehca_free_fw_ctrlblock(void *ptr);
191#else
Hoang-Nam Nguyenf2d91362007-01-09 18:04:14 +0100192#define ehca_alloc_fw_ctrlblock(flags) ((void *) get_zeroed_page(flags))
Hoang-Nam Nguyen7e28db52006-11-07 00:56:39 +0100193#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))
194#endif
195
Heiko J Schickfab97222006-09-22 15:22:22 -0700196#endif