1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef RDMA_USER_CM_H
8 #define RDMA_USER_CM_H
9 #include <linux/types.h>
10 #include <linux/socket.h>
11 #include <linux/in6.h>
12 #include <rdma/ib_user_verbs.h>
13 #include <rdma/ib_user_sa.h>
14 #define RDMA_USER_CM_ABI_VERSION 4
15 #define RDMA_MAX_PRIVATE_DATA 256
16 enum {
17   RDMA_USER_CM_CMD_CREATE_ID,
18   RDMA_USER_CM_CMD_DESTROY_ID,
19   RDMA_USER_CM_CMD_BIND_IP,
20   RDMA_USER_CM_CMD_RESOLVE_IP,
21   RDMA_USER_CM_CMD_RESOLVE_ROUTE,
22   RDMA_USER_CM_CMD_QUERY_ROUTE,
23   RDMA_USER_CM_CMD_CONNECT,
24   RDMA_USER_CM_CMD_LISTEN,
25   RDMA_USER_CM_CMD_ACCEPT,
26   RDMA_USER_CM_CMD_REJECT,
27   RDMA_USER_CM_CMD_DISCONNECT,
28   RDMA_USER_CM_CMD_INIT_QP_ATTR,
29   RDMA_USER_CM_CMD_GET_EVENT,
30   RDMA_USER_CM_CMD_GET_OPTION,
31   RDMA_USER_CM_CMD_SET_OPTION,
32   RDMA_USER_CM_CMD_NOTIFY,
33   RDMA_USER_CM_CMD_JOIN_IP_MCAST,
34   RDMA_USER_CM_CMD_LEAVE_MCAST,
35   RDMA_USER_CM_CMD_MIGRATE_ID,
36   RDMA_USER_CM_CMD_QUERY,
37   RDMA_USER_CM_CMD_BIND,
38   RDMA_USER_CM_CMD_RESOLVE_ADDR,
39   RDMA_USER_CM_CMD_JOIN_MCAST
40 };
41 enum rdma_ucm_port_space {
42   RDMA_PS_IPOIB = 0x0002,
43   RDMA_PS_IB = 0x013F,
44   RDMA_PS_TCP = 0x0106,
45   RDMA_PS_UDP = 0x0111,
46 };
47 struct rdma_ucm_cmd_hdr {
48   __u32 cmd;
49   __u16 in;
50   __u16 out;
51 };
52 struct rdma_ucm_create_id {
53   __aligned_u64 uid;
54   __aligned_u64 response;
55   __u16 ps;
56   __u8 qp_type;
57   __u8 reserved[5];
58 };
59 struct rdma_ucm_create_id_resp {
60   __u32 id;
61 };
62 struct rdma_ucm_destroy_id {
63   __aligned_u64 response;
64   __u32 id;
65   __u32 reserved;
66 };
67 struct rdma_ucm_destroy_id_resp {
68   __u32 events_reported;
69 };
70 struct rdma_ucm_bind_ip {
71   __aligned_u64 response;
72   struct sockaddr_in6 addr;
73   __u32 id;
74 };
75 struct rdma_ucm_bind {
76   __u32 id;
77   __u16 addr_size;
78   __u16 reserved;
79   struct sockaddr_storage addr;
80 };
81 struct rdma_ucm_resolve_ip {
82   struct sockaddr_in6 src_addr;
83   struct sockaddr_in6 dst_addr;
84   __u32 id;
85   __u32 timeout_ms;
86 };
87 struct rdma_ucm_resolve_addr {
88   __u32 id;
89   __u32 timeout_ms;
90   __u16 src_size;
91   __u16 dst_size;
92   __u32 reserved;
93   struct sockaddr_storage src_addr;
94   struct sockaddr_storage dst_addr;
95 };
96 struct rdma_ucm_resolve_route {
97   __u32 id;
98   __u32 timeout_ms;
99 };
100 enum {
101   RDMA_USER_CM_QUERY_ADDR,
102   RDMA_USER_CM_QUERY_PATH,
103   RDMA_USER_CM_QUERY_GID
104 };
105 struct rdma_ucm_query {
106   __aligned_u64 response;
107   __u32 id;
108   __u32 option;
109 };
110 struct rdma_ucm_query_route_resp {
111   __aligned_u64 node_guid;
112   struct ib_user_path_rec ib_route[2];
113   struct sockaddr_in6 src_addr;
114   struct sockaddr_in6 dst_addr;
115   __u32 num_paths;
116   __u8 port_num;
117   __u8 reserved[3];
118   __u32 ibdev_index;
119   __u32 reserved1;
120 };
121 struct rdma_ucm_query_addr_resp {
122   __aligned_u64 node_guid;
123   __u8 port_num;
124   __u8 reserved;
125   __u16 pkey;
126   __u16 src_size;
127   __u16 dst_size;
128   struct sockaddr_storage src_addr;
129   struct sockaddr_storage dst_addr;
130   __u32 ibdev_index;
131   __u32 reserved1;
132 };
133 struct rdma_ucm_query_path_resp {
134   __u32 num_paths;
135   __u32 reserved;
136   struct ib_path_rec_data path_data[];
137 };
138 struct rdma_ucm_conn_param {
139   __u32 qp_num;
140   __u32 qkey;
141   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
142   __u8 private_data_len;
143   __u8 srq;
144   __u8 responder_resources;
145   __u8 initiator_depth;
146   __u8 flow_control;
147   __u8 retry_count;
148   __u8 rnr_retry_count;
149   __u8 valid;
150 };
151 struct rdma_ucm_ud_param {
152   __u32 qp_num;
153   __u32 qkey;
154   struct ib_uverbs_ah_attr ah_attr;
155   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
156   __u8 private_data_len;
157   __u8 reserved[7];
158 };
159 struct rdma_ucm_ece {
160   __u32 vendor_id;
161   __u32 attr_mod;
162 };
163 struct rdma_ucm_connect {
164   struct rdma_ucm_conn_param conn_param;
165   __u32 id;
166   __u32 reserved;
167   struct rdma_ucm_ece ece;
168 };
169 struct rdma_ucm_listen {
170   __u32 id;
171   __u32 backlog;
172 };
173 struct rdma_ucm_accept {
174   __aligned_u64 uid;
175   struct rdma_ucm_conn_param conn_param;
176   __u32 id;
177   __u32 reserved;
178   struct rdma_ucm_ece ece;
179 };
180 struct rdma_ucm_reject {
181   __u32 id;
182   __u8 private_data_len;
183   __u8 reason;
184   __u8 reserved[2];
185   __u8 private_data[RDMA_MAX_PRIVATE_DATA];
186 };
187 struct rdma_ucm_disconnect {
188   __u32 id;
189 };
190 struct rdma_ucm_init_qp_attr {
191   __aligned_u64 response;
192   __u32 id;
193   __u32 qp_state;
194 };
195 struct rdma_ucm_notify {
196   __u32 id;
197   __u32 event;
198 };
199 struct rdma_ucm_join_ip_mcast {
200   __aligned_u64 response;
201   __aligned_u64 uid;
202   struct sockaddr_in6 addr;
203   __u32 id;
204 };
205 enum {
206   RDMA_MC_JOIN_FLAG_FULLMEMBER,
207   RDMA_MC_JOIN_FLAG_SENDONLY_FULLMEMBER,
208   RDMA_MC_JOIN_FLAG_RESERVED,
209 };
210 struct rdma_ucm_join_mcast {
211   __aligned_u64 response;
212   __aligned_u64 uid;
213   __u32 id;
214   __u16 addr_size;
215   __u16 join_flags;
216   struct sockaddr_storage addr;
217 };
218 struct rdma_ucm_get_event {
219   __aligned_u64 response;
220 };
221 struct rdma_ucm_event_resp {
222   __aligned_u64 uid;
223   __u32 id;
224   __u32 event;
225   __u32 status;
226   union {
227     struct rdma_ucm_conn_param conn;
228     struct rdma_ucm_ud_param ud;
229   } param;
230   __u32 reserved;
231   struct rdma_ucm_ece ece;
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