1 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */
3 * Copyright (c) 2005-2006 Intel Corporation. All rights reserved.
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:
11 * Redistribution and use in source and binary forms, with or
12 * without modification, are permitted provided that the following
15 * - Redistributions of source code must retain the above
16 * copyright notice, this list of conditions and the following
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.
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
34 #ifndef RDMA_USER_CM_H
35 #define RDMA_USER_CM_H
37 #include <linux/types.h>
38 #include <linux/socket.h>
39 #include <linux/in6.h>
40 #include <rdma/ib_user_verbs.h>
41 #include <rdma/ib_user_sa.h>
43 #define RDMA_USER_CM_ABI_VERSION 4
45 #define RDMA_MAX_PRIVATE_DATA 256
48 RDMA_USER_CM_CMD_CREATE_ID
,
49 RDMA_USER_CM_CMD_DESTROY_ID
,
50 RDMA_USER_CM_CMD_BIND_IP
,
51 RDMA_USER_CM_CMD_RESOLVE_IP
,
52 RDMA_USER_CM_CMD_RESOLVE_ROUTE
,
53 RDMA_USER_CM_CMD_QUERY_ROUTE
,
54 RDMA_USER_CM_CMD_CONNECT
,
55 RDMA_USER_CM_CMD_LISTEN
,
56 RDMA_USER_CM_CMD_ACCEPT
,
57 RDMA_USER_CM_CMD_REJECT
,
58 RDMA_USER_CM_CMD_DISCONNECT
,
59 RDMA_USER_CM_CMD_INIT_QP_ATTR
,
60 RDMA_USER_CM_CMD_GET_EVENT
,
61 RDMA_USER_CM_CMD_GET_OPTION
,
62 RDMA_USER_CM_CMD_SET_OPTION
,
63 RDMA_USER_CM_CMD_NOTIFY
,
64 RDMA_USER_CM_CMD_JOIN_IP_MCAST
,
65 RDMA_USER_CM_CMD_LEAVE_MCAST
,
66 RDMA_USER_CM_CMD_MIGRATE_ID
,
67 RDMA_USER_CM_CMD_QUERY
,
68 RDMA_USER_CM_CMD_BIND
,
69 RDMA_USER_CM_CMD_RESOLVE_ADDR
,
70 RDMA_USER_CM_CMD_JOIN_MCAST
73 /* See IBTA Annex A11, servies ID bytes 4 & 5 */
74 enum rdma_ucm_port_space
{
75 RDMA_PS_IPOIB
= 0x0002,
82 * command ABI structures.
84 struct rdma_ucm_cmd_hdr
{
90 struct rdma_ucm_create_id
{
92 __aligned_u64 response
;
93 __u16 ps
; /* use enum rdma_ucm_port_space */
98 struct rdma_ucm_create_id_resp
{
102 struct rdma_ucm_destroy_id
{
103 __aligned_u64 response
;
108 struct rdma_ucm_destroy_id_resp
{
109 __u32 events_reported
;
112 struct rdma_ucm_bind_ip
{
113 __aligned_u64 response
;
114 struct sockaddr_in6 addr
;
118 struct rdma_ucm_bind
{
122 struct __kernel_sockaddr_storage addr
;
125 struct rdma_ucm_resolve_ip
{
126 struct sockaddr_in6 src_addr
;
127 struct sockaddr_in6 dst_addr
;
132 struct rdma_ucm_resolve_addr
{
138 struct __kernel_sockaddr_storage src_addr
;
139 struct __kernel_sockaddr_storage dst_addr
;
142 struct rdma_ucm_resolve_route
{
148 RDMA_USER_CM_QUERY_ADDR
,
149 RDMA_USER_CM_QUERY_PATH
,
150 RDMA_USER_CM_QUERY_GID
153 struct rdma_ucm_query
{
154 __aligned_u64 response
;
159 struct rdma_ucm_query_route_resp
{
160 __aligned_u64 node_guid
;
161 struct ib_user_path_rec ib_route
[2];
162 struct sockaddr_in6 src_addr
;
163 struct sockaddr_in6 dst_addr
;
169 struct rdma_ucm_query_addr_resp
{
170 __aligned_u64 node_guid
;
176 struct __kernel_sockaddr_storage src_addr
;
177 struct __kernel_sockaddr_storage dst_addr
;
180 struct rdma_ucm_query_path_resp
{
183 struct ib_path_rec_data path_data
[0];
186 struct rdma_ucm_conn_param
{
189 __u8 private_data
[RDMA_MAX_PRIVATE_DATA
];
190 __u8 private_data_len
;
192 __u8 responder_resources
;
193 __u8 initiator_depth
;
196 __u8 rnr_retry_count
;
200 struct rdma_ucm_ud_param
{
203 struct ib_uverbs_ah_attr ah_attr
;
204 __u8 private_data
[RDMA_MAX_PRIVATE_DATA
];
205 __u8 private_data_len
;
209 struct rdma_ucm_connect
{
210 struct rdma_ucm_conn_param conn_param
;
215 struct rdma_ucm_listen
{
220 struct rdma_ucm_accept
{
222 struct rdma_ucm_conn_param conn_param
;
227 struct rdma_ucm_reject
{
229 __u8 private_data_len
;
231 __u8 private_data
[RDMA_MAX_PRIVATE_DATA
];
234 struct rdma_ucm_disconnect
{
238 struct rdma_ucm_init_qp_attr
{
239 __aligned_u64 response
;
244 struct rdma_ucm_notify
{
249 struct rdma_ucm_join_ip_mcast
{
250 __aligned_u64 response
; /* rdma_ucm_create_id_resp */
252 struct sockaddr_in6 addr
;
256 /* Multicast join flags */
258 RDMA_MC_JOIN_FLAG_FULLMEMBER
,
259 RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER
,
260 RDMA_MC_JOIN_FLAG_RESERVED
,
263 struct rdma_ucm_join_mcast
{
264 __aligned_u64 response
; /* rdma_ucma_create_id_resp */
269 struct __kernel_sockaddr_storage addr
;
272 struct rdma_ucm_get_event
{
273 __aligned_u64 response
;
276 struct rdma_ucm_event_resp
{
282 * NOTE: This union is not aligned to 8 bytes so none of the union
283 * members may contain a u64 or anything with higher alignment than 4.
286 struct rdma_ucm_conn_param conn
;
287 struct rdma_ucm_ud_param ud
;
300 RDMA_OPTION_ID_TOS
= 0,
301 RDMA_OPTION_ID_REUSEADDR
= 1,
302 RDMA_OPTION_ID_AFONLY
= 2,
303 RDMA_OPTION_ID_ACK_TIMEOUT
= 3
307 RDMA_OPTION_IB_PATH
= 1
310 struct rdma_ucm_set_option
{
311 __aligned_u64 optval
;
318 struct rdma_ucm_migrate_id
{
319 __aligned_u64 response
;
324 struct rdma_ucm_migrate_resp
{
325 __u32 events_reported
;
328 #endif /* RDMA_USER_CM_H */