hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/infiniband/sw/rxe/rxe_loc.h
....@@ -1,40 +1,14 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
23 * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
34 * 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.
325 */
336
347 #ifndef RXE_LOC_H
358 #define RXE_LOC_H
369
3710 /* rxe_av.c */
11
+void rxe_init_av(struct rdma_ah_attr *attr, struct rxe_av *av);
3812
3913 int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr);
4014
....@@ -52,11 +26,12 @@
5226 int cqe, int comp_vector);
5327
5428 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,
5630 struct rxe_create_cq_resp __user *uresp);
5731
5832 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);
6035
6136 int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited);
6237
....@@ -90,10 +65,8 @@
9065
9166 void rxe_mmap_release(struct kref *ref);
9267
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);
9770
9871 int rxe_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
9972
....@@ -103,8 +76,8 @@
10376 from_mem_obj,
10477 };
10578
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);
10881
10982 int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
11083 u64 length, u64 iova, int access, struct ib_udata *udata,
....@@ -132,9 +105,6 @@
132105
133106 int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length);
134107
135
-int rxe_mem_map_pages(struct rxe_dev *rxe, struct rxe_mem *mem,
136
- u64 *page, int num_pages, u64 iova);
137
-
138108 void rxe_mem_cleanup(struct rxe_pool_entry *arg);
139109
140110 int advance_dma_data(struct rxe_dma_info *dma, unsigned int length);
....@@ -144,9 +114,7 @@
144114 int rxe_send(struct rxe_pkt_info *pkt, struct sk_buff *skb);
145115 struct sk_buff *rxe_init_packet(struct rxe_dev *rxe, struct rxe_av *av,
146116 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);
150118 const char *rxe_parent_name(struct rxe_dev *rxe, unsigned int port_num);
151119 struct device *rxe_dma_device(struct rxe_dev *rxe);
152120 int rxe_mcast_add(struct rxe_dev *rxe, union ib_gid *mgid);
....@@ -158,7 +126,7 @@
158126 int rxe_qp_from_init(struct rxe_dev *rxe, struct rxe_qp *qp, struct rxe_pd *pd,
159127 struct ib_qp_init_attr *init,
160128 struct rxe_create_qp_resp __user *uresp,
161
- struct ib_pd *ibpd);
129
+ struct ib_pd *ibpd, struct ib_udata *udata);
162130
163131 int rxe_qp_to_init(struct rxe_qp *qp, struct ib_qp_init_attr *init);
164132
....@@ -196,7 +164,7 @@
196164 if (qp->ibqp.qp_type == IB_QPT_RC || qp->ibqp.qp_type == IB_QPT_UC)
197165 return qp->attr.path_mtu;
198166 else
199
- return RXE_PORT_MAX_MTU;
167
+ return IB_MTU_4096;
200168 }
201169
202170 static inline int rcv_wqe_size(int max_sge)
....@@ -224,15 +192,14 @@
224192 struct ib_srq_attr *attr, enum ib_srq_attr_mask mask);
225193
226194 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,
229196 struct rxe_create_srq_resp __user *uresp);
230197
231198 int rxe_srq_from_attr(struct rxe_dev *rxe, struct rxe_srq *srq,
232199 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);
234201
235
-void rxe_release(struct kref *kref);
202
+void rxe_dealloc(struct ib_device *ib_dev);
236203
237204 int rxe_completer(void *arg);
238205 int rxe_requester(void *arg);
....@@ -240,22 +207,21 @@
240207
241208 u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb);
242209
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);
245211
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);
248213
249214 static inline unsigned int wr_opcode_mask(int opcode, struct rxe_qp *qp)
250215 {
251216 return rxe_wr_opcode_info[opcode].mask[qp->ibqp.qp_type];
252217 }
253218
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)
256221 {
257222 int err;
258223 int is_request = pkt->mask & RXE_REQ_MASK;
224
+ struct rxe_dev *rxe = to_rdev(qp->ibqp.device);
259225
260226 if ((is_request && (qp->req.state != QP_STATE_READY)) ||
261227 (!is_request && (qp->resp.state != QP_STATE_READY))) {