hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/include/rdma/rdma_cm.h
....@@ -1,37 +1,10 @@
1
+/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
12 /*
23 * Copyright (c) 2005 Voltaire Inc. All rights reserved.
34 * Copyright (c) 2005 Intel Corporation. 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
34
-#if !defined(RDMA_CM_H)
7
+#ifndef RDMA_CM_H
358 #define RDMA_CM_H
369
3710 #include <linux/socket.h>
....@@ -111,6 +84,7 @@
11184 struct rdma_conn_param conn;
11285 struct rdma_ud_param ud;
11386 } param;
87
+ struct rdma_ucm_ece ece;
11488 };
11589
11690 struct rdma_cm_id;
....@@ -136,11 +110,14 @@
136110 u8 port_num;
137111 };
138112
139
-struct rdma_cm_id *__rdma_create_id(struct net *net,
140
- rdma_cm_event_handler event_handler,
141
- void *context, enum rdma_ucm_port_space ps,
142
- enum ib_qp_type qp_type,
143
- const char *caller);
113
+struct rdma_cm_id *
114
+__rdma_create_kernel_id(struct net *net, rdma_cm_event_handler event_handler,
115
+ void *context, enum rdma_ucm_port_space ps,
116
+ enum ib_qp_type qp_type, const char *caller);
117
+struct rdma_cm_id *rdma_create_user_id(rdma_cm_event_handler event_handler,
118
+ void *context,
119
+ enum rdma_ucm_port_space ps,
120
+ enum ib_qp_type qp_type);
144121
145122 /**
146123 * rdma_create_id - Create an RDMA identifier.
....@@ -152,11 +129,15 @@
152129 * @ps: RDMA port space.
153130 * @qp_type: type of queue pair associated with the id.
154131 *
155
- * The id holds a reference on the network namespace until it is destroyed.
132
+ * Returns a new rdma_cm_id. The id holds a reference on the network
133
+ * namespace until it is destroyed.
134
+ *
135
+ * The event handler callback serializes on the id's mutex and is
136
+ * allowed to sleep.
156137 */
157
-#define rdma_create_id(net, event_handler, context, ps, qp_type) \
158
- __rdma_create_id((net), (event_handler), (context), (ps), (qp_type), \
159
- KBUILD_MODNAME)
138
+#define rdma_create_id(net, event_handler, context, ps, qp_type) \
139
+ __rdma_create_kernel_id(net, event_handler, context, ps, qp_type, \
140
+ KBUILD_MODNAME)
160141
161142 /**
162143 * rdma_destroy_id - Destroys an RDMA identifier.
....@@ -192,7 +173,8 @@
192173 * @timeout_ms: Time to wait for resolution to complete.
193174 */
194175 int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
195
- const struct sockaddr *dst_addr, int timeout_ms);
176
+ const struct sockaddr *dst_addr,
177
+ unsigned long timeout_ms);
196178
197179 /**
198180 * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier
....@@ -202,7 +184,7 @@
202184 * Users must have first called rdma_resolve_addr to resolve a dst_addr
203185 * into an RDMA address before calling this routine.
204186 */
205
-int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
187
+int rdma_resolve_route(struct rdma_cm_id *id, unsigned long timeout_ms);
206188
207189 /**
208190 * rdma_create_qp - Allocate a QP and associate it with the specified RDMA
....@@ -245,19 +227,12 @@
245227 int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr,
246228 int *qp_attr_mask);
247229
248
-/**
249
- * rdma_connect - Initiate an active connection request.
250
- * @id: Connection identifier to connect.
251
- * @conn_param: Connection information used for connected QPs.
252
- *
253
- * Users must have resolved a route for the rdma_cm_id to connect with
254
- * by having called rdma_resolve_route before calling this routine.
255
- *
256
- * This call will either connect to a remote QP or obtain remote QP
257
- * information for unconnected rdma_cm_id's. The actual operation is
258
- * based on the rdma_cm_id's port space.
259
- */
260230 int rdma_connect(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
231
+int rdma_connect_locked(struct rdma_cm_id *id,
232
+ struct rdma_conn_param *conn_param);
233
+
234
+int rdma_connect_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
235
+ struct rdma_ucm_ece *ece);
261236
262237 /**
263238 * rdma_listen - This function is called by the passive side to
....@@ -268,26 +243,12 @@
268243 */
269244 int rdma_listen(struct rdma_cm_id *id, int backlog);
270245
271
-int __rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
272
- const char *caller);
246
+int rdma_accept(struct rdma_cm_id *id, struct rdma_conn_param *conn_param);
273247
274
-/**
275
- * rdma_accept - Called to accept a connection request or response.
276
- * @id: Connection identifier associated with the request.
277
- * @conn_param: Information needed to establish the connection. This must be
278
- * provided if accepting a connection request. If accepting a connection
279
- * response, this parameter must be NULL.
280
- *
281
- * Typically, this routine is only called by the listener to accept a connection
282
- * request. It must also be called on the active side of a connection if the
283
- * user is performing their own QP transitions.
284
- *
285
- * In the case of error, a reject message is sent to the remote side and the
286
- * state of the qp associated with the id is modified to error, such that any
287
- * previously posted receive buffers would be flushed.
288
- */
289
-#define rdma_accept(id, conn_param) \
290
- __rdma_accept((id), (conn_param), KBUILD_MODNAME)
248
+void rdma_lock_handler(struct rdma_cm_id *id);
249
+void rdma_unlock_handler(struct rdma_cm_id *id);
250
+int rdma_accept_ece(struct rdma_cm_id *id, struct rdma_conn_param *conn_param,
251
+ struct rdma_ucm_ece *ece);
291252
292253 /**
293254 * rdma_notify - Notifies the RDMA CM of an asynchronous event that has
....@@ -308,7 +269,7 @@
308269 * rdma_reject - Called to reject a connection request or response.
309270 */
310271 int rdma_reject(struct rdma_cm_id *id, const void *private_data,
311
- u8 private_data_len);
272
+ u8 private_data_len, u8 reason);
312273
313274 /**
314275 * rdma_disconnect - This function disconnects the associated QP and
....@@ -369,6 +330,7 @@
369330 */
370331 int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
371332
333
+int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout);
372334 /**
373335 * rdma_get_service_id - Return the IB service ID for a specified address.
374336 * @id: Communication identifier associated with the address.
....@@ -383,14 +345,6 @@
383345 */
384346 const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
385347 int reason);
386
-/**
387
- * rdma_is_consumer_reject - return true if the consumer rejected the connect
388
- * request.
389
- * @id: Communication identifier that received the REJECT event.
390
- * @reason: Value returned in the REJECT event status field.
391
- */
392
-bool rdma_is_consumer_reject(struct rdma_cm_id *id, int reason);
393
-
394348 /**
395349 * rdma_consumer_reject_data - return the consumer reject private data and
396350 * length, if any.