.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved. |
---|
3 | 4 | * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved. |
---|
4 | | - * |
---|
5 | | - * This software is available to you under a choice of one of two |
---|
6 | | - * licenses. You may choose to be licensed under the terms of the GNU |
---|
7 | | - * General Public License (GPL) Version 2, available from the file |
---|
8 | | - * COPYING in the main directory of this source tree, or the |
---|
9 | | - * OpenIB.org BSD license below: |
---|
10 | | - * |
---|
11 | | - * Redistribution and use in source and binary forms, with or |
---|
12 | | - * without modification, are permitted provided that the following |
---|
13 | | - * conditions are met: |
---|
14 | | - * |
---|
15 | | - * - Redistributions of source code must retain the above |
---|
16 | | - * copyright notice, this list of conditions and the following |
---|
17 | | - * disclaimer. |
---|
18 | | - * |
---|
19 | | - * - Redistributions in binary form must reproduce the above |
---|
20 | | - * copyright notice, this list of conditions and the following |
---|
21 | | - * disclaimer in the documentation and/or other materials |
---|
22 | | - * provided with the distribution. |
---|
23 | | - * |
---|
24 | | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
---|
25 | | - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
---|
26 | | - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
---|
27 | | - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
---|
28 | | - * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
---|
29 | | - * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
---|
30 | | - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
---|
31 | | - * SOFTWARE. |
---|
32 | 5 | */ |
---|
33 | 6 | |
---|
34 | 7 | #ifndef RXE_LOC_H |
---|
35 | 8 | #define RXE_LOC_H |
---|
36 | 9 | |
---|
37 | 10 | /* rxe_av.c */ |
---|
| 11 | +void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av); |
---|
38 | 12 | |
---|
39 | 13 | int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr); |
---|
40 | 14 | |
---|
.. | .. |
---|
52 | 26 | int cqe, int comp_vector); |
---|
53 | 27 | |
---|
54 | 28 | int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *cq, int cqe, |
---|
55 | | - int comp_vector, struct ib_ucontext *context, |
---|
| 29 | + int comp_vector, struct ib_udata *udata, |
---|
56 | 30 | struct rxe_create_cq_resp __user *uresp); |
---|
57 | 31 | |
---|
58 | 32 | int rxe_cq_resize_queue(struct rxe_cq *cq, int new_cqe, |
---|
59 | | - struct rxe_resize_cq_resp __user *uresp); |
---|
| 33 | + struct rxe_resize_cq_resp __user *uresp, |
---|
| 34 | + struct ib_udata *udata); |
---|
60 | 35 | |
---|
61 | 36 | int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited); |
---|
62 | 37 | |
---|
.. | .. |
---|
90 | 65 | |
---|
91 | 66 | void rxe_mmap_release(struct kref *ref); |
---|
92 | 67 | |
---|
93 | | -struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *dev, |
---|
94 | | - u32 size, |
---|
95 | | - struct ib_ucontext *context, |
---|
96 | | - void *obj); |
---|
| 68 | +struct rxe_mmap_info *rxe_create_mmap_info(struct rxe_dev *dev, u32 size, |
---|
| 69 | + struct ib_udata *udata, void *obj); |
---|
97 | 70 | |
---|
98 | 71 | int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma); |
---|
99 | 72 | |
---|
.. | .. |
---|
103 | 76 | from_mem_obj, |
---|
104 | 77 | }; |
---|
105 | 78 | |
---|
106 | | -int rxe_mem_init_dma(struct rxe_pd *pd, |
---|
107 | | - int access, struct rxe_mem *mem); |
---|
| 79 | +void rxe_mem_init_dma(struct rxe_pd *pd, |
---|
| 80 | + int access, struct rxe_mem *mem); |
---|
108 | 81 | |
---|
109 | 82 | int rxe_mem_init_user(struct rxe_pd *pd, u64 start, |
---|
110 | 83 | u64 length, u64 iova, int access, struct ib_udata *udata, |
---|
.. | .. |
---|
132 | 105 | |
---|
133 | 106 | int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length); |
---|
134 | 107 | |
---|
135 | | -int rxe_mem_map_pages(struct rxe_dev *rxe, struct rxe_mem *mem, |
---|
136 | | - u64 *page, int num_pages, u64 iova); |
---|
137 | | - |
---|
138 | 108 | void rxe_mem_cleanup(struct rxe_pool_entry *arg); |
---|
139 | 109 | |
---|
140 | 110 | int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); |
---|
.. | .. |
---|
144 | 114 | int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb); |
---|
145 | 115 | struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av, |
---|
146 | 116 | int paylen, struct rxe_pkt_info *pkt); |
---|
147 | | -int rxe_prepare(struct rxe_dev *rxe, struct rxe_pkt_info *pkt, |
---|
148 | | - struct sk_buff *skb, u32 *crc); |
---|
149 | | -enum rdma_link_layer rxe_link_layer(struct rxe_dev *rxe, unsigned int port_num); |
---|
| 117 | +int rxe_prepare(struct rxe_pkt_info *pkt, struct sk_buff *skb, u32 *crc); |
---|
150 | 118 | const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num); |
---|
151 | 119 | struct device *rxe_dma_device(struct rxe_dev *rxe); |
---|
152 | 120 | int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid); |
---|
.. | .. |
---|
158 | 126 | int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd, |
---|
159 | 127 | struct ib_qp_init_attr *init, |
---|
160 | 128 | struct rxe_create_qp_resp __user *uresp, |
---|
161 | | - struct ib_pd *ibpd); |
---|
| 129 | + struct ib_pd *ibpd, struct ib_udata *udata); |
---|
162 | 130 | |
---|
163 | 131 | int rxe_qp_to_init(struct rxe_qp *qp, struct ib_qp_init_attr *init); |
---|
164 | 132 | |
---|
.. | .. |
---|
196 | 164 | if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC) |
---|
197 | 165 | return qp->attr.path_mtu; |
---|
198 | 166 | else |
---|
199 | | - return RXE_PORT_MAX_MTU; |
---|
| 167 | + return IB_MTU_4096; |
---|
200 | 168 | } |
---|
201 | 169 | |
---|
202 | 170 | static inline int rcv_wqe_size(int max_sge) |
---|
.. | .. |
---|
224 | 192 | struct ib_srq_attr *attr, enum ib_srq_attr_mask mask); |
---|
225 | 193 | |
---|
226 | 194 | int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq *srq, |
---|
227 | | - struct ib_srq_init_attr *init, |
---|
228 | | - struct ib_ucontext *context, |
---|
| 195 | + struct ib_srq_init_attr *init, struct ib_udata *udata, |
---|
229 | 196 | struct rxe_create_srq_resp __user *uresp); |
---|
230 | 197 | |
---|
231 | 198 | int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq, |
---|
232 | 199 | struct ib_srq_attr *attr, enum ib_srq_attr_mask mask, |
---|
233 | | - struct rxe_modify_srq_cmd *ucmd); |
---|
| 200 | + struct rxe_modify_srq_cmd *ucmd, struct ib_udata *udata); |
---|
234 | 201 | |
---|
235 | | -void rxe_release(struct kref *kref); |
---|
| 202 | +void rxe_dealloc(struct ib_device *ib_dev); |
---|
236 | 203 | |
---|
237 | 204 | int rxe_completer(void *arg); |
---|
238 | 205 | int rxe_requester(void *arg); |
---|
.. | .. |
---|
240 | 207 | |
---|
241 | 208 | u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb); |
---|
242 | 209 | |
---|
243 | | -void rxe_resp_queue_pkt(struct rxe_dev *rxe, |
---|
244 | | - struct rxe_qp *qp, struct sk_buff *skb); |
---|
| 210 | +void rxe_resp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb); |
---|
245 | 211 | |
---|
246 | | -void rxe_comp_queue_pkt(struct rxe_dev *rxe, |
---|
247 | | - struct rxe_qp *qp, struct sk_buff *skb); |
---|
| 212 | +void rxe_comp_queue_pkt(struct rxe_qp *qp, struct sk_buff *skb); |
---|
248 | 213 | |
---|
249 | 214 | static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp) |
---|
250 | 215 | { |
---|
251 | 216 | return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type]; |
---|
252 | 217 | } |
---|
253 | 218 | |
---|
254 | | -static inline int rxe_xmit_packet(struct rxe_dev *rxe, struct rxe_qp *qp, |
---|
255 | | - struct rxe_pkt_info *pkt, struct sk_buff *skb) |
---|
| 219 | +static inline int rxe_xmit_packet(struct rxe_qp *qp, struct rxe_pkt_info *pkt, |
---|
| 220 | + struct sk_buff *skb) |
---|
256 | 221 | { |
---|
257 | 222 | int err; |
---|
258 | 223 | int is_request = pkt->mask & RXE_REQ_MASK; |
---|
| 224 | + struct rxe_dev *rxe = to_rdev(qp->ibqp.device); |
---|
259 | 225 | |
---|
260 | 226 | if ((is_request && (qp->req.state != QP_STATE_READY)) || |
---|
261 | 227 | (!is_request && (qp->resp.state != QP_STATE_READY))) { |
---|