tools, bpf_asm: simplify parser rule for BPF extensions
[linux-2.6-block.git] / drivers / staging / rdma / ehca / ehca_iverbs.h
CommitLineData
fab97220
HS
1/*
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
2528e33e
MB
47int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props,
48 struct ib_udata *uhw);
fab97220
HS
49
50int ehca_query_port(struct ib_device *ibdev, u8 port,
51 struct ib_port_attr *props);
52
6b90a6d6
MW
53enum rdma_protocol_type
54ehca_query_protocol(struct ib_device *device, u8 port_num);
55
8705ce5b
JF
56int ehca_query_sma_attr(struct ehca_shca *shca, u8 port,
57 struct ehca_sma_attr *attr);
58
fab97220
HS
59int ehca_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 * pkey);
60
61int ehca_query_gid(struct ib_device *ibdev, u8 port, int index,
62 union ib_gid *gid);
63
64int ehca_modify_port(struct ib_device *ibdev, u8 port, int port_modify_mask,
65 struct ib_port_modify *props);
66
67struct ib_pd *ehca_alloc_pd(struct ib_device *device,
68 struct ib_ucontext *context,
69 struct ib_udata *udata);
70
71int ehca_dealloc_pd(struct ib_pd *pd);
72
73struct ib_ah *ehca_create_ah(struct ib_pd *pd, struct ib_ah_attr *ah_attr);
74
75int ehca_modify_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
76
77int ehca_query_ah(struct ib_ah *ah, struct ib_ah_attr *ah_attr);
78
79int ehca_destroy_ah(struct ib_ah *ah);
80
81struct ib_mr *ehca_get_dma_mr(struct ib_pd *pd, int mr_access_flags);
82
2b94397a
HNN
83struct ib_mr *ehca_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
84 u64 virt, int mr_access_flags,
85 struct ib_udata *udata);
fab97220 86
fab97220
HS
87int ehca_dereg_mr(struct ib_mr *mr);
88
7083e42e 89struct ib_mw *ehca_alloc_mw(struct ib_pd *pd, enum ib_mw_type type);
fab97220 90
fab97220
HS
91int ehca_dealloc_mw(struct ib_mw *mw);
92
93struct ib_fmr *ehca_alloc_fmr(struct ib_pd *pd,
94 int mr_access_flags,
95 struct ib_fmr_attr *fmr_attr);
96
97int ehca_map_phys_fmr(struct ib_fmr *fmr,
98 u64 *page_list, int list_len, u64 iova);
99
100int ehca_unmap_fmr(struct list_head *fmr_list);
101
102int ehca_dealloc_fmr(struct ib_fmr *fmr);
103
104enum ehca_eq_type {
105 EHCA_EQ = 0, /* Event Queue */
106 EHCA_NEQ /* Notification Event Queue */
107};
108
109int ehca_create_eq(struct ehca_shca *shca, struct ehca_eq *eq,
110 enum ehca_eq_type type, const u32 length);
111
112int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq);
113
114void *ehca_poll_eq(struct ehca_shca *shca, struct ehca_eq *eq);
115
116
bcf4c1ea
MB
117struct ib_cq *ehca_create_cq(struct ib_device *device,
118 const struct ib_cq_init_attr *attr,
fab97220
HS
119 struct ib_ucontext *context,
120 struct ib_udata *udata);
121
122int ehca_destroy_cq(struct ib_cq *cq);
123
124int ehca_resize_cq(struct ib_cq *cq, int cqe, struct ib_udata *udata);
125
126int ehca_poll_cq(struct ib_cq *cq, int num_entries, struct ib_wc *wc);
127
128int ehca_peek_cq(struct ib_cq *cq, int wc_cnt);
129
ed23a727 130int ehca_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags notify_flags);
fab97220
HS
131
132struct ib_qp *ehca_create_qp(struct ib_pd *pd,
133 struct ib_qp_init_attr *init_attr,
134 struct ib_udata *udata);
135
136int ehca_destroy_qp(struct ib_qp *qp);
137
9bc57e2d
RC
138int ehca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask,
139 struct ib_udata *udata);
fab97220
HS
140
141int ehca_query_qp(struct ib_qp *qp, struct ib_qp_attr *qp_attr,
142 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
143
144int ehca_post_send(struct ib_qp *qp, struct ib_send_wr *send_wr,
145 struct ib_send_wr **bad_send_wr);
146
147int ehca_post_recv(struct ib_qp *qp, struct ib_recv_wr *recv_wr,
148 struct ib_recv_wr **bad_recv_wr);
149
a6a12947
JF
150int ehca_post_srq_recv(struct ib_srq *srq,
151 struct ib_recv_wr *recv_wr,
152 struct ib_recv_wr **bad_recv_wr);
153
154struct ib_srq *ehca_create_srq(struct ib_pd *pd,
155 struct ib_srq_init_attr *init_attr,
156 struct ib_udata *udata);
157
158int ehca_modify_srq(struct ib_srq *srq, struct ib_srq_attr *attr,
159 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
160
161int ehca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
162
163int ehca_destroy_srq(struct ib_srq *srq);
164
fab97220
HS
165u64 ehca_define_sqp(struct ehca_shca *shca, struct ehca_qp *ibqp,
166 struct ib_qp_init_attr *qp_init_attr);
167
168int ehca_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
169
170int ehca_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
171
172struct ib_ucontext *ehca_alloc_ucontext(struct ib_device *device,
173 struct ib_udata *udata);
174
175int ehca_dealloc_ucontext(struct ib_ucontext *context);
176
177int ehca_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
178
2b5e6b12 179int ehca_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
a97e2d86 180 const struct ib_wc *in_wc, const struct ib_grh *in_grh,
4cd7c947
IW
181 const struct ib_mad_hdr *in, size_t in_mad_size,
182 struct ib_mad_hdr *out, size_t *out_mad_size,
183 u16 *out_mad_pkey_index);
2b5e6b12 184
fab97220
HS
185void ehca_poll_eqs(unsigned long data);
186
51aaa54e
JF
187int ehca_calc_ipd(struct ehca_shca *shca, int port,
188 enum ib_rate path_rate, u32 *ipd);
189
b9012e0a
AS
190void ehca_add_to_err_list(struct ehca_qp *qp, int on_sq);
191
7e28db5d 192#ifdef CONFIG_PPC_64K_PAGES
f2d91361 193void *ehca_alloc_fw_ctrlblock(gfp_t flags);
7e28db5d
HNN
194void ehca_free_fw_ctrlblock(void *ptr);
195#else
2b94397a 196#define ehca_alloc_fw_ctrlblock(flags) ((void *)get_zeroed_page(flags))
7e28db5d
HNN
197#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))
198#endif
199
bbdd267e
HNN
200void ehca_recover_sqp(struct ib_qp *sqp);
201
fab97220 202#endif