Skip to content

Commit 160bb96

Browse files
kcp-gitLinuxMinion
authored andcommitted
rds: Enable RDS IPv6 support
This patch enables RDS to use IPv6 addresses. There are many data structures (RDS socket options) used by RDS apps which use a 32 bit integer to store IP address. To support IPv6, struct in6_addr needs to be used. To ensure backward compatibility, a new data structure is introduced for each of those data structures which use a 32 bit integer to represent an IP address. And new socket options are introduced to use those new structures. This means that existing apps should work without a problem with the new RDS module. For apps which want to use IPv6, those new data structures and socket options can be used. IPv4 mapped address is used to represent IPv4 address in the new data structures. RDS/RDMA/IB uses a private data (struct rds_ib_connect_private) exchange between endpoints at RDS connection establishment time to support RDMA. This private data exchange uses a 32 bit integer to represent an IP address. This needs to be changed in order to support IPv6. A new private data struct rds6_ib_connect_private is introduced to handle this. To ensure backward compatibility, an IPv6 capable RDS stack uses another RDMA listener port (RDS_CM_PORT which is 16385, the same value as the RDS/TCP listener port number) to accept IPv6 connection. And it continues to use the original RDS_PORT for IPv4 RDS connections. When it needs to communicate with an IPv6 peer, it uses the RDS_CM_PORT to send the connection set up request. Orabug: 25410192 Signed-off-by: Ka-Cheong Poon <[email protected]> Reviewed-by: Håkon Bugge <[email protected]>
1 parent 4d2cc57 commit 160bb96

File tree

19 files changed

+767
-127
lines changed

19 files changed

+767
-127
lines changed

include/uapi/linux/rds.h

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,24 +67,24 @@
6767
#define RDS_GET_MR_FOR_DEST 7
6868
#define RDS_CONN_RESET 8
6969
#define SO_RDS_TRANSPORT 9
70+
/* Socket option to tap receive path latency
71+
* SO_RDS: SO_RDS_MSG_RXPATH_LATENCY
72+
* Format used struct rds_rx_trace_so
73+
*/
74+
#define SO_RDS_MSG_RXPATH_LATENCY 10
75+
#define RDS6_CONN_RESET 11
7076

7177
/* supported values for SO_RDS_TRANSPORT */
7278
#define RDS_TRANS_IB 0
7379
#define RDS_TRANS_TCP 2
7480
#define RDS_TRANS_COUNT 3
7581
#define RDS_TRANS_NONE (~0)
7682

77-
/* Socket option to tap receive path latency
78-
* SO_RDS: SO_RDS_MSG_RXPATH_LATENCY
79-
* Format used struct rds_rx_trace_so
80-
*/
81-
#define SO_RDS_MSG_RXPATH_LATENCY 10
82-
8383
/*
8484
* ioctl commands for SOL_RDS
8585
*/
8686
#define SIOCRDSSETTOS (SIOCPROTOPRIVATE)
87-
#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1)
87+
#define SIOCRDSGETTOS (SIOCPROTOPRIVATE + 1)
8888
#define SIOCRDSENABLENETFILTER (SIOCPROTOPRIVATE + 2)
8989

9090
#define IPPROTO_OKA (142)
@@ -142,9 +142,9 @@ struct rds_cmsg_rx_trace {
142142
#define RDS_CMSG_CONG_UPDATE 5
143143
#define RDS_CMSG_ATOMIC_FADD 6
144144
#define RDS_CMSG_ATOMIC_CSWP 7
145-
#define RDS_CMSG_MASKED_ATOMIC_FADD 8
146-
#define RDS_CMSG_MASKED_ATOMIC_CSWP 9
147-
#define RDS_CMSG_ASYNC_SEND 10
145+
#define RDS_CMSG_MASKED_ATOMIC_FADD 8
146+
#define RDS_CMSG_MASKED_ATOMIC_CSWP 9
147+
#define RDS_CMSG_ASYNC_SEND 10
148148
#define RDS_CMSG_RXPATH_LATENCY 11
149149

150150
#define RDS_INFO_FIRST 10000
@@ -159,7 +159,17 @@ struct rds_cmsg_rx_trace {
159159
#define RDS_INFO_IB_CONNECTIONS 10008
160160
#define RDS_INFO_CONNECTION_STATS 10009
161161
#define RDS_INFO_IWARP_CONNECTIONS 10010
162-
#define RDS_INFO_LAST 10010
162+
163+
/* PF_RDS6 options */
164+
#define RDS6_INFO_CONNECTIONS 10011
165+
#define RDS6_INFO_SEND_MESSAGES 10012
166+
#define RDS6_INFO_RETRANS_MESSAGES 10013
167+
#define RDS6_INFO_RECV_MESSAGES 10014
168+
#define RDS6_INFO_SOCKETS 10015
169+
#define RDS6_INFO_TCP_SOCKETS 10016
170+
#define RDS6_INFO_IB_CONNECTIONS 10017
171+
172+
#define RDS_INFO_LAST 10017
163173

164174
struct rds_info_counter {
165175
u_int8_t name[32];
@@ -169,7 +179,7 @@ struct rds_info_counter {
169179
#define RDS_INFO_CONNECTION_FLAG_SENDING 0x01
170180
#define RDS_INFO_CONNECTION_FLAG_CONNECTING 0x02
171181
#define RDS_INFO_CONNECTION_FLAG_CONNECTED 0x04
172-
#define RDS_INFO_CONNECTION_FLAG_ERROR 0x08
182+
#define RDS_INFO_CONNECTION_FLAG_ERROR 0x08
173183

174184
#define TRANSNAMSIZ 16
175185

@@ -183,12 +193,14 @@ struct rds_info_connection {
183193
u_int8_t tos;
184194
} __attribute__((packed));
185195

186-
struct rds_info_flow {
187-
__be32 laddr;
188-
__be32 faddr;
189-
u_int32_t bytes;
190-
__be16 lport;
191-
__be16 fport;
196+
struct rds6_info_connection {
197+
uint64_t next_tx_seq;
198+
uint64_t next_rx_seq;
199+
struct in6_addr laddr;
200+
struct in6_addr faddr;
201+
uint8_t transport[TRANSNAMSIZ]; /* null term ascii */
202+
uint8_t flags;
203+
uint8_t tos;
192204
} __attribute__((packed));
193205

194206
#define RDS_INFO_MESSAGE_FLAG_ACK 0x01
@@ -205,6 +217,17 @@ struct rds_info_message {
205217
u_int8_t tos;
206218
} __attribute__((packed));
207219

220+
struct rds6_info_message {
221+
uint64_t seq;
222+
uint32_t len;
223+
struct in6_addr laddr;
224+
struct in6_addr faddr;
225+
__be16 lport;
226+
__be16 fport;
227+
uint8_t flags;
228+
uint8_t tos;
229+
} __attribute__((packed));
230+
208231
struct rds_info_socket {
209232
u_int32_t sndbuf;
210233
__be32 bound_addr;
@@ -215,6 +238,16 @@ struct rds_info_socket {
215238
u_int64_t inum;
216239
} __attribute__((packed));
217240

241+
struct rds6_info_socket {
242+
uint32_t sndbuf;
243+
struct in6_addr bound_addr;
244+
struct in6_addr connected_addr;
245+
__be16 bound_port;
246+
__be16 connected_port;
247+
uint32_t rcvbuf;
248+
uint64_t inum;
249+
} __attribute__((packed));
250+
218251
struct rds_info_tcp_socket {
219252
__be32 local_addr;
220253
__be16 local_port;
@@ -227,6 +260,18 @@ struct rds_info_tcp_socket {
227260
u_int32_t last_seen_una;
228261
} __attribute__((packed));
229262

263+
struct rds6_info_tcp_socket {
264+
struct in6_addr local_addr;
265+
__be16 local_port;
266+
struct in6_addr peer_addr;
267+
__be16 peer_port;
268+
uint64_t hdr_rem;
269+
uint64_t data_rem;
270+
uint32_t last_sent_nxt;
271+
uint32_t last_expected_una;
272+
uint32_t last_seen_una;
273+
} __attribute__((packed));
274+
230275
#define RDS_IB_GID_LEN 16
231276
struct rds_info_rdma_connection {
232277
__be32 src_addr;
@@ -251,6 +296,28 @@ struct rds_info_rdma_connection {
251296

252297
};
253298

299+
struct rds6_info_rdma_connection {
300+
struct in6_addr src_addr;
301+
struct in6_addr dst_addr;
302+
uint8_t src_gid[RDS_IB_GID_LEN];
303+
uint8_t dst_gid[RDS_IB_GID_LEN];
304+
305+
uint32_t max_send_wr;
306+
uint32_t max_recv_wr;
307+
uint32_t max_send_sge;
308+
uint32_t rdma_mr_max;
309+
uint32_t rdma_mr_size;
310+
uint8_t tos;
311+
uint8_t sl;
312+
uint32_t cache_allocs;
313+
uint32_t frag;
314+
uint16_t flow_ctl_post_credit;
315+
uint16_t flow_ctl_send_credit;
316+
uint32_t qp_num;
317+
uint32_t w_alloc_ctr;
318+
uint32_t w_free_ctr;
319+
};
320+
254321
/*
255322
* Congestion monitoring.
256323
* Congestion control in RDS happens at the host connection
@@ -339,6 +406,12 @@ struct rds_reset {
339406
struct in_addr dst;
340407
};
341408

409+
struct rds6_reset {
410+
uint8_t tos;
411+
struct in6_addr src;
412+
struct in6_addr dst;
413+
};
414+
342415
struct rds_asend_args {
343416
u_int64_t user_token;
344417
u_int64_t flags;
@@ -349,10 +422,10 @@ struct rds_rdma_send_notify {
349422
int32_t status;
350423
};
351424

352-
#define RDS_RDMA_SEND_SUCCESS 0
353-
#define RDS_RDMA_REMOTE_ERROR 1
354-
#define RDS_RDMA_SEND_CANCELED 2
355-
#define RDS_RDMA_SEND_DROPPED 3
425+
#define RDS_RDMA_SEND_SUCCESS 0
426+
#define RDS_RDMA_REMOTE_ERROR 1
427+
#define RDS_RDMA_SEND_CANCELED 2
428+
#define RDS_RDMA_SEND_DROPPED 3
356429
#define RDS_RDMA_SEND_OTHER_ERROR 4
357430

358431
/*

0 commit comments

Comments
 (0)