1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef RDMA_USER_CM_H
20 #define RDMA_USER_CM_H
21 #include <linux/types.h>
22 #include <linux/socket.h>
23 #include <linux/in6.h>
24 #include <rdma/ib_user_verbs.h>
25 #include <rdma/ib_user_sa.h>
26 #define RDMA_USER_CM_ABI_VERSION 4
27 #define RDMA_MAX_PRIVATE_DATA 256
28 enum {
29   RDMA_USER_CM_CMD_CREATE_ID,
30   RDMA_USER_CM_CMD_DESTROY_ID,
31   RDMA_USER_CM_CMD_BIND_IP,
32   RDMA_USER_CM_CMD_RESOLVE_IP,
33   RDMA_USER_CM_CMD_RESOLVE_ROUTE,
34   RDMA_USER_CM_CMD_QUERY_ROUTE,
35   RDMA_USER_CM_CMD_CONNECT,
36   RDMA_USER_CM_CMD_LISTEN,
37   RDMA_USER_CM_CMD_ACCEPT,
38   RDMA_USER_CM_CMD_REJECT,
39   RDMA_USER_CM_CMD_DISCONNECT,
40   RDMA_USER_CM_CMD_INIT_QP_ATTR,
41   RDMA_USER_CM_CMD_GET_EVENT,
42   RDMA_USER_CM_CMD_GET_OPTION,
43   RDMA_USER_CM_CMD_SET_OPTION,
44   RDMA_USER_CM_CMD_NOTIFY,
45   RDMA_USER_CM_CMD_JOIN_IP_MCAST,
46   RDMA_USER_CM_CMD_LEAVE_MCAST,
47   RDMA_USER_CM_CMD_MIGRATE_ID,
48   RDMA_USER_CM_CMD_QUERY,
49   RDMA_USER_CM_CMD_BIND,
50   RDMA_USER_CM_CMD_RESOLVE_ADDR,
51   RDMA_USER_CM_CMD_JOIN_MCAST
52 };
53 enum rdma_ucm_port_space {
54   RDMA_PS_IPOIB = 0x0002,
55   RDMA_PS_IB = 0x013F,
56   RDMA_PS_TCP = 0x0106,
57   RDMA_PS_UDP = 0x0111,
58 };
59 struct rdma_ucm_cmd_hdr {
60   __u32 cmd;
61   __u16 in;
62   __u16 out;
63 };
64 struct rdma_ucm_create_id {
65   __aligned_u64 uid;
66   __aligned_u64 response;
67   __u16 ps;
68   __u8 qp_type;
69   __u8 reserved[5];
70 };
71 struct rdma_ucm_create_id_resp {
72   __u32 id;
73 };
74 struct rdma_ucm_destroy_id {
75   __aligned_u64 response;
76   __u32 id;
77   __u32 reserved;
78 };
79 struct rdma_ucm_destroy_id_resp {
80   __u32 events_reported;
81 };
82 struct rdma_ucm_bind_ip {
83   __aligned_u64 response;
84   struct sockaddr_in6 addr;
85   __u32 id;
86 };
87 struct rdma_ucm_bind {
88   __u32 id;
89   __u16 addr_size;
90   __u16 reserved;
91   struct sockaddr_storage addr;
92 };
93 struct rdma_ucm_resolve_ip {
94   struct sockaddr_in6 src_addr;
95   struct sockaddr_in6 dst_addr;
96   __u32 id;
97   __u32 timeout_ms;
98 };
99 struct rdma_ucm_resolve_addr {
100   __u32 id;
101   __u32 timeout_ms;
102   __u16 src_size;
103   __u16 dst_size;
104   __u32 reserved;
105   struct sockaddr_storage src_addr;
106   struct sockaddr_storage dst_addr;
107 };
108 struct rdma_ucm_resolve_route {
109   __u32 id;
110   __u32 timeout_ms;
111 };
112 enum {
113   RDMA_USER_CM_QUERY_ADDR,
114   RDMA_USER_CM_QUERY_PATH,
115   RDMA_USER_CM_QUERY_GID
116 };
117 struct rdma_ucm_query {
118   __aligned_u64 response;
119   __u32 id;
120   __u32 option;
121 };
122 struct rdma_ucm_query_route_resp {
123   __aligned_u64 node_guid;
124   struct ib_user_path_rec ib_route[2];
125   struct sockaddr_in6 src_addr;
126   struct sockaddr_in6 dst_addr;
127   __u32 num_paths;
128   __u8 port_num;
129   __u8 reserved[3];
130 };
131 struct rdma_ucm_query_addr_resp {
132   __aligned_u64 node_guid;
133   __u8 port_num;
134   __u8 reserved;
135   __u16 pkey;
136   __u16 src_size;
137   __u16 dst_size;
138   struct sockaddr_storage src_addr;
139   struct sockaddr_storage dst_addr;
140 };
141 struct rdma_ucm_query_path_resp {
142   __u32 num_paths;
143   __u32 reserved;
144   struct ib_path_rec_data path_data[0];
145 };
146 struct rdma_ucm_conn_param {
147   __u32 qp_num;
148   __u32 qkey;
149   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
150   __u8 private_data_len;
151   __u8 srq;
152   __u8 responder_resources;
153   __u8 initiator_depth;
154   __u8 flow_control;
155   __u8 retry_count;
156   __u8 rnr_retry_count;
157   __u8 valid;
158 };
159 struct rdma_ucm_ud_param {
160   __u32 qp_num;
161   __u32 qkey;
162   struct ib_uverbs_ah_attr ah_attr;
163   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
164   __u8 private_data_len;
165   __u8 reserved[7];
166 };
167 struct rdma_ucm_connect {
168   struct rdma_ucm_conn_param conn_param;
169   __u32 id;
170   __u32 reserved;
171 };
172 struct rdma_ucm_listen {
173   __u32 id;
174   __u32 backlog;
175 };
176 struct rdma_ucm_accept {
177   __aligned_u64 uid;
178   struct rdma_ucm_conn_param conn_param;
179   __u32 id;
180   __u32 reserved;
181 };
182 struct rdma_ucm_reject {
183   __u32 id;
184   __u8 private_data_len;
185   __u8 reserved[3];
186   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
187 };
188 struct rdma_ucm_disconnect {
189   __u32 id;
190 };
191 struct rdma_ucm_init_qp_attr {
192   __aligned_u64 response;
193   __u32 id;
194   __u32 qp_state;
195 };
196 struct rdma_ucm_notify {
197   __u32 id;
198   __u32 event;
199 };
200 struct rdma_ucm_join_ip_mcast {
201   __aligned_u64 response;
202   __aligned_u64 uid;
203   struct sockaddr_in6 addr;
204   __u32 id;
205 };
206 enum {
207   RDMA_MC_JOIN_FLAG_FULLMEMBER,
208   RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER,
209   RDMA_MC_JOIN_FLAG_RESERVED,
210 };
211 struct rdma_ucm_join_mcast {
212   __aligned_u64 response;
213   __aligned_u64 uid;
214   __u32 id;
215   __u16 addr_size;
216   __u16 join_flags;
217   struct sockaddr_storage addr;
218 };
219 struct rdma_ucm_get_event {
220   __aligned_u64 response;
221 };
222 struct rdma_ucm_event_resp {
223   __aligned_u64 uid;
224   __u32 id;
225   __u32 event;
226   __u32 status;
227   union {
228     struct rdma_ucm_conn_param conn;
229     struct rdma_ucm_ud_param ud;
230   } param;
231   __u32 reserved;
232 };
233 enum {
234   RDMA_OPTION_ID = 0,
235   RDMA_OPTION_IB = 1
236 };
237 enum {
238   RDMA_OPTION_ID_TOS = 0,
239   RDMA_OPTION_ID_REUSEADDR = 1,
240   RDMA_OPTION_ID_AFONLY = 2,
241   RDMA_OPTION_ID_ACK_TIMEOUT = 3
242 };
243 enum {
244   RDMA_OPTION_IB_PATH = 1
245 };
246 struct rdma_ucm_set_option {
247   __aligned_u64 optval;
248   __u32 id;
249   __u32 level;
250   __u32 optname;
251   __u32 optlen;
252 };
253 struct rdma_ucm_migrate_id {
254   __aligned_u64 response;
255   __u32 id;
256   __u32 fd;
257 };
258 struct rdma_ucm_migrate_resp {
259   __u32 events_reported;
260 };
261 #endif
262