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 _LINUX_RDS_H
20 #define _LINUX_RDS_H
21 #include <linux/types.h>
22 #include <linux/socket.h>
23 #include <linux/in6.h>
24 #define RDS_IB_ABI_VERSION 0x301
25 #define SOL_RDS 276
26 #define RDS_CANCEL_SENT_TO 1
27 #define RDS_GET_MR 2
28 #define RDS_FREE_MR 3
29 #define RDS_RECVERR 5
30 #define RDS_CONG_MONITOR 6
31 #define RDS_GET_MR_FOR_DEST 7
32 #define SO_RDS_TRANSPORT 8
33 #define SO_RDS_MSG_RXPATH_LATENCY 10
34 #define RDS_TRANS_IB 0
35 #define RDS_TRANS_IWARP 1
36 #define RDS_TRANS_TCP 2
37 #define RDS_TRANS_COUNT 3
38 #define RDS_TRANS_NONE (~0)
39 #define SIOCRDSSETTOS (SIOCPROTOPRIVATE)
40 #define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1)
41 typedef __u8 rds_tos_t;
42 #define RDS_CMSG_RDMA_ARGS 1
43 #define RDS_CMSG_RDMA_DEST 2
44 #define RDS_CMSG_RDMA_MAP 3
45 #define RDS_CMSG_RDMA_STATUS 4
46 #define RDS_CMSG_CONG_UPDATE 5
47 #define RDS_CMSG_ATOMIC_FADD 6
48 #define RDS_CMSG_ATOMIC_CSWP 7
49 #define RDS_CMSG_MASKED_ATOMIC_FADD 8
50 #define RDS_CMSG_MASKED_ATOMIC_CSWP 9
51 #define RDS_CMSG_RXPATH_LATENCY 11
52 #define RDS_CMSG_ZCOPY_COOKIE 12
53 #define RDS_CMSG_ZCOPY_COMPLETION 13
54 #define RDS_INFO_FIRST 10000
55 #define RDS_INFO_COUNTERS 10000
56 #define RDS_INFO_CONNECTIONS 10001
57 #define RDS_INFO_SEND_MESSAGES 10003
58 #define RDS_INFO_RETRANS_MESSAGES 10004
59 #define RDS_INFO_RECV_MESSAGES 10005
60 #define RDS_INFO_SOCKETS 10006
61 #define RDS_INFO_TCP_SOCKETS 10007
62 #define RDS_INFO_IB_CONNECTIONS 10008
63 #define RDS_INFO_CONNECTION_STATS 10009
64 #define RDS_INFO_IWARP_CONNECTIONS 10010
65 #define RDS6_INFO_CONNECTIONS 10011
66 #define RDS6_INFO_SEND_MESSAGES 10012
67 #define RDS6_INFO_RETRANS_MESSAGES 10013
68 #define RDS6_INFO_RECV_MESSAGES 10014
69 #define RDS6_INFO_SOCKETS 10015
70 #define RDS6_INFO_TCP_SOCKETS 10016
71 #define RDS6_INFO_IB_CONNECTIONS 10017
72 #define RDS_INFO_LAST 10017
73 struct rds_info_counter {
74   __u8 name[32];
75   __u64 value;
76 } __attribute__((packed));
77 #define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
78 #define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
79 #define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04
80 #define TRANSNAMSIZ 16
81 struct rds_info_connection {
82   __u64 next_tx_seq;
83   __u64 next_rx_seq;
84   __be32 laddr;
85   __be32 faddr;
86   __u8 transport[TRANSNAMSIZ];
87   __u8 flags;
88   __u8 tos;
89 } __attribute__((packed));
90 struct rds6_info_connection {
91   __u64 next_tx_seq;
92   __u64 next_rx_seq;
93   struct in6_addr laddr;
94   struct in6_addr faddr;
95   __u8 transport[TRANSNAMSIZ];
96   __u8 flags;
97 } __attribute__((packed));
98 #define RDS_INFO_MESSAGE_FLAG_ACK 0x01
99 #define RDS_INFO_MESSAGE_FLAG_FAST_ACK 0x02
100 struct rds_info_message {
101   __u64 seq;
102   __u32 len;
103   __be32 laddr;
104   __be32 faddr;
105   __be16 lport;
106   __be16 fport;
107   __u8 flags;
108   __u8 tos;
109 } __attribute__((packed));
110 struct rds6_info_message {
111   __u64 seq;
112   __u32 len;
113   struct in6_addr laddr;
114   struct in6_addr faddr;
115   __be16 lport;
116   __be16 fport;
117   __u8 flags;
118   __u8 tos;
119 } __attribute__((packed));
120 struct rds_info_socket {
121   __u32 sndbuf;
122   __be32 bound_addr;
123   __be32 connected_addr;
124   __be16 bound_port;
125   __be16 connected_port;
126   __u32 rcvbuf;
127   __u64 inum;
128 } __attribute__((packed));
129 struct rds6_info_socket {
130   __u32 sndbuf;
131   struct in6_addr bound_addr;
132   struct in6_addr connected_addr;
133   __be16 bound_port;
134   __be16 connected_port;
135   __u32 rcvbuf;
136   __u64 inum;
137 } __attribute__((packed));
138 struct rds_info_tcp_socket {
139   __be32 local_addr;
140   __be16 local_port;
141   __be32 peer_addr;
142   __be16 peer_port;
143   __u64 hdr_rem;
144   __u64 data_rem;
145   __u32 last_sent_nxt;
146   __u32 last_expected_una;
147   __u32 last_seen_una;
148   __u8 tos;
149 } __attribute__((packed));
150 struct rds6_info_tcp_socket {
151   struct in6_addr local_addr;
152   __be16 local_port;
153   struct in6_addr peer_addr;
154   __be16 peer_port;
155   __u64 hdr_rem;
156   __u64 data_rem;
157   __u32 last_sent_nxt;
158   __u32 last_expected_una;
159   __u32 last_seen_una;
160 } __attribute__((packed));
161 #define RDS_IB_GID_LEN 16
162 struct rds_info_rdma_connection {
163   __be32 src_addr;
164   __be32 dst_addr;
165   __u8 src_gid[RDS_IB_GID_LEN];
166   __u8 dst_gid[RDS_IB_GID_LEN];
167   __u32 max_send_wr;
168   __u32 max_recv_wr;
169   __u32 max_send_sge;
170   __u32 rdma_mr_max;
171   __u32 rdma_mr_size;
172   __u8 tos;
173   __u8 sl;
174   __u32 cache_allocs;
175 };
176 struct rds6_info_rdma_connection {
177   struct in6_addr src_addr;
178   struct in6_addr dst_addr;
179   __u8 src_gid[RDS_IB_GID_LEN];
180   __u8 dst_gid[RDS_IB_GID_LEN];
181   __u32 max_send_wr;
182   __u32 max_recv_wr;
183   __u32 max_send_sge;
184   __u32 rdma_mr_max;
185   __u32 rdma_mr_size;
186   __u8 tos;
187   __u8 sl;
188   __u32 cache_allocs;
189 };
190 enum rds_message_rxpath_latency {
191   RDS_MSG_RX_HDR_TO_DGRAM_START = 0,
192   RDS_MSG_RX_DGRAM_REASSEMBLE,
193   RDS_MSG_RX_DGRAM_DELIVERED,
194   RDS_MSG_RX_DGRAM_TRACE_MAX
195 };
196 struct rds_rx_trace_so {
197   __u8 rx_traces;
198   __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX];
199 };
200 struct rds_cmsg_rx_trace {
201   __u8 rx_traces;
202   __u8 rx_trace_pos[RDS_MSG_RX_DGRAM_TRACE_MAX];
203   __u64 rx_trace[RDS_MSG_RX_DGRAM_TRACE_MAX];
204 };
205 #define RDS_CONG_MONITOR_SIZE 64
206 #define RDS_CONG_MONITOR_BIT(port) (((unsigned int) port) % RDS_CONG_MONITOR_SIZE)
207 #define RDS_CONG_MONITOR_MASK(port) (1ULL << RDS_CONG_MONITOR_BIT(port))
208 typedef __u64 rds_rdma_cookie_t;
209 struct rds_iovec {
210   __u64 addr;
211   __u64 bytes;
212 };
213 struct rds_get_mr_args {
214   struct rds_iovec vec;
215   __u64 cookie_addr;
216   __u64 flags;
217 };
218 struct rds_get_mr_for_dest_args {
219   struct sockaddr_storage dest_addr;
220   struct rds_iovec vec;
221   __u64 cookie_addr;
222   __u64 flags;
223 };
224 struct rds_free_mr_args {
225   rds_rdma_cookie_t cookie;
226   __u64 flags;
227 };
228 struct rds_rdma_args {
229   rds_rdma_cookie_t cookie;
230   struct rds_iovec remote_vec;
231   __u64 local_vec_addr;
232   __u64 nr_local;
233   __u64 flags;
234   __u64 user_token;
235 };
236 struct rds_atomic_args {
237   rds_rdma_cookie_t cookie;
238   __u64 local_addr;
239   __u64 remote_addr;
240   union {
241     struct {
242       __u64 compare;
243       __u64 swap;
244     } cswp;
245     struct {
246       __u64 add;
247     } fadd;
248     struct {
249       __u64 compare;
250       __u64 swap;
251       __u64 compare_mask;
252       __u64 swap_mask;
253     } m_cswp;
254     struct {
255       __u64 add;
256       __u64 nocarry_mask;
257     } m_fadd;
258   };
259   __u64 flags;
260   __u64 user_token;
261 };
262 struct rds_rdma_notify {
263   __u64 user_token;
264   __s32 status;
265 };
266 #define RDS_RDMA_SUCCESS 0
267 #define RDS_RDMA_REMOTE_ERROR 1
268 #define RDS_RDMA_CANCELED 2
269 #define RDS_RDMA_DROPPED 3
270 #define RDS_RDMA_OTHER_ERROR 4
271 #define RDS_MAX_ZCOOKIES 8
272 struct rds_zcopy_cookies {
273   __u32 num;
274   __u32 cookies[RDS_MAX_ZCOOKIES];
275 };
276 #define RDS_RDMA_READWRITE 0x0001
277 #define RDS_RDMA_FENCE 0x0002
278 #define RDS_RDMA_INVALIDATE 0x0004
279 #define RDS_RDMA_USE_ONCE 0x0008
280 #define RDS_RDMA_DONTWAIT 0x0010
281 #define RDS_RDMA_NOTIFY_ME 0x0020
282 #define RDS_RDMA_SILENT 0x0040
283 #endif
284