.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2005 Voltaire Inc. All rights reserved. |
---|
3 | 4 | * 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. |
---|
32 | 5 | */ |
---|
33 | 6 | |
---|
34 | | -#if !defined(RDMA_CM_H) |
---|
| 7 | +#ifndef RDMA_CM_H |
---|
35 | 8 | #define RDMA_CM_H |
---|
36 | 9 | |
---|
37 | 10 | #include <linux/socket.h> |
---|
.. | .. |
---|
111 | 84 | struct rdma_conn_param conn; |
---|
112 | 85 | struct rdma_ud_param ud; |
---|
113 | 86 | } param; |
---|
| 87 | + struct rdma_ucm_ece ece; |
---|
114 | 88 | }; |
---|
115 | 89 | |
---|
116 | 90 | struct rdma_cm_id; |
---|
.. | .. |
---|
136 | 110 | u8 port_num; |
---|
137 | 111 | }; |
---|
138 | 112 | |
---|
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); |
---|
144 | 121 | |
---|
145 | 122 | /** |
---|
146 | 123 | * rdma_create_id - Create an RDMA identifier. |
---|
.. | .. |
---|
152 | 129 | * @ps: RDMA port space. |
---|
153 | 130 | * @qp_type: type of queue pair associated with the id. |
---|
154 | 131 | * |
---|
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. |
---|
156 | 137 | */ |
---|
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) |
---|
160 | 141 | |
---|
161 | 142 | /** |
---|
162 | 143 | * rdma_destroy_id - Destroys an RDMA identifier. |
---|
.. | .. |
---|
192 | 173 | * @timeout_ms: Time to wait for resolution to complete. |
---|
193 | 174 | */ |
---|
194 | 175 | 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); |
---|
196 | 178 | |
---|
197 | 179 | /** |
---|
198 | 180 | * rdma_resolve_route - Resolve the RDMA address bound to the RDMA identifier |
---|
.. | .. |
---|
202 | 184 | * Users must have first called rdma_resolve_addr to resolve a dst_addr |
---|
203 | 185 | * into an RDMA address before calling this routine. |
---|
204 | 186 | */ |
---|
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); |
---|
206 | 188 | |
---|
207 | 189 | /** |
---|
208 | 190 | * rdma_create_qp - Allocate a QP and associate it with the specified RDMA |
---|
.. | .. |
---|
245 | 227 | int rdma_init_qp_attr(struct rdma_cm_id *id, struct ib_qp_attr *qp_attr, |
---|
246 | 228 | int *qp_attr_mask); |
---|
247 | 229 | |
---|
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 | | - */ |
---|
260 | 230 | 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); |
---|
261 | 236 | |
---|
262 | 237 | /** |
---|
263 | 238 | * rdma_listen - This function is called by the passive side to |
---|
.. | .. |
---|
268 | 243 | */ |
---|
269 | 244 | int rdma_listen(struct rdma_cm_id *id, int backlog); |
---|
270 | 245 | |
---|
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); |
---|
273 | 247 | |
---|
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); |
---|
291 | 252 | |
---|
292 | 253 | /** |
---|
293 | 254 | * rdma_notify - Notifies the RDMA CM of an asynchronous event that has |
---|
.. | .. |
---|
308 | 269 | * rdma_reject - Called to reject a connection request or response. |
---|
309 | 270 | */ |
---|
310 | 271 | int rdma_reject(struct rdma_cm_id *id, const void *private_data, |
---|
311 | | - u8 private_data_len); |
---|
| 272 | + u8 private_data_len, u8 reason); |
---|
312 | 273 | |
---|
313 | 274 | /** |
---|
314 | 275 | * rdma_disconnect - This function disconnects the associated QP and |
---|
.. | .. |
---|
369 | 330 | */ |
---|
370 | 331 | int rdma_set_afonly(struct rdma_cm_id *id, int afonly); |
---|
371 | 332 | |
---|
| 333 | +int rdma_set_ack_timeout(struct rdma_cm_id *id, u8 timeout); |
---|
372 | 334 | /** |
---|
373 | 335 | * rdma_get_service_id - Return the IB service ID for a specified address. |
---|
374 | 336 | * @id: Communication identifier associated with the address. |
---|
.. | .. |
---|
383 | 345 | */ |
---|
384 | 346 | const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id, |
---|
385 | 347 | 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 | | - |
---|
394 | 348 | /** |
---|
395 | 349 | * rdma_consumer_reject_data - return the consumer reject private data and |
---|
396 | 350 | * length, if any. |
---|