Re: [PATCH v5 net-next 3/3] rds: Extend RDS API for IPv6 support

2018-07-23 Thread santosh.shilim...@oracle.com

On 7/23/18 8:51 PM, Ka-Cheong Poon wrote:

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.

v4: Revert changes to SO_RDS_TRANSPORT

Signed-off-by: Ka-Cheong Poon
---

Acked-by: Santosh Shilimkar 


[PATCH v5 net-next 3/3] rds: Extend RDS API for IPv6 support

2018-07-23 Thread Ka-Cheong Poon
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.

v4: Revert changes to SO_RDS_TRANSPORT

Signed-off-by: Ka-Cheong Poon 
---
 include/uapi/linux/rds.h |  69 +++-
 net/rds/connection.c | 101 +++
 net/rds/ib.c |  52 
 net/rds/ib_mr.h  |   2 +
 net/rds/ib_rdma.c|  11 +-
 net/rds/recv.c   |  25 
 net/rds/tcp.c|  44 +
 7 files changed, 293 insertions(+), 11 deletions(-)

diff --git a/include/uapi/linux/rds.h b/include/uapi/linux/rds.h
index 20c6bd0..dc520e1 100644
--- a/include/uapi/linux/rds.h
+++ b/include/uapi/linux/rds.h
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR 
Linux-OpenIB) */
 /*
- * Copyright (c) 2008 Oracle.  All rights reserved.
+ * Copyright (c) 2008, 2018 Oracle and/or its affiliates. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -118,7 +118,17 @@
 #define RDS_INFO_IB_CONNECTIONS10008
 #define RDS_INFO_CONNECTION_STATS  10009
 #define RDS_INFO_IWARP_CONNECTIONS 10010
-#define RDS_INFO_LAST  10010
+
+/* PF_RDS6 options */
+#define RDS6_INFO_CONNECTIONS  10011
+#define RDS6_INFO_SEND_MESSAGES10012
+#define RDS6_INFO_RETRANS_MESSAGES 10013
+#define RDS6_INFO_RECV_MESSAGES10014
+#define RDS6_INFO_SOCKETS  10015
+#define RDS6_INFO_TCP_SOCKETS  10016
+#define RDS6_INFO_IB_CONNECTIONS   10017
+
+#define RDS_INFO_LAST  10017
 
 struct rds_info_counter {
__u8name[32];
@@ -140,6 +150,15 @@ struct rds_info_connection {
__u8flags;
 } __attribute__((packed));
 
+struct rds6_info_connection {
+   __u64   next_tx_seq;
+   __u64   next_rx_seq;
+   struct in6_addr laddr;
+   struct in6_addr faddr;
+   __u8transport[TRANSNAMSIZ]; /* null term ascii */
+   __u8flags;
+} __attribute__((packed));
+
 #define RDS_INFO_MESSAGE_FLAG_ACK   0x01
 #define RDS_INFO_MESSAGE_FLAG_FAST_ACK  0x02
 
@@ -153,6 +172,17 @@ struct rds_info_message {
__u8flags;
 } __attribute__((packed));
 
+struct rds6_info_message {
+   __u64   seq;
+   __u32   len;
+   struct in6_addr laddr;
+   struct in6_addr faddr;
+   __be16  lport;
+   __be16  fport;
+   __u8flags;
+   __u8tos;
+} __attribute__((packed));
+
 struct rds_info_socket {
__u32   sndbuf;
__be32  bound_addr;
@@ -163,6 +193,16 @@ struct rds_info_socket {
__u64   inum;
 } __attribute__((packed));
 
+struct rds6_info_socket {
+   __u32   sndbuf;
+   struct in6_addr bound_addr;
+   struct in6_addr connected_addr;
+   __be16  bound_port;
+   __be16  connected_port;
+   __u32   rcvbuf;
+   __u64   inum;
+} __attribute__((packed));
+
 struct rds_info_tcp_socket {
__be32  local_addr;
__be16  local_port;
@@ -175,6 +215,18 @@ struct rds_info_tcp_socket {
__u32   last_seen_una;
 } __attribute__((packed));
 
+struct rds6_info_tcp_socket {
+   struct in6_addr local_addr;
+   __be16  local_port;
+   struct in6_addr peer_addr;
+   __be16  peer_port;
+   __u64   hdr_rem;
+   __u64   data_rem;
+   __u32   last_sent_nxt;
+   __u32   last_expected_una;
+   __u32   last_seen_una;
+} __attribute__((packed));
+
 #define RDS_IB_GID_LEN 16
 struct rds_info_rdma_connection {
__be32  src_addr;
@@ -189,6 +241,19 @@ struct rds_info_rdma_connection {
__u32   rdma_mr_size;
 };
 
+struct rds6_info_rdma_connection {
+   struct in6_addr src_addr;
+   struct in6_addr dst_addr;
+   __u8src_gid[RDS_IB_GID_LEN];
+   __u8dst_gid[RDS_IB_GID_LEN];
+
+   __u32   max_send_wr;
+   __u32   max_recv_wr;
+   __u32   max_send_sge;
+   __u32   rdma_mr_max;
+   __u32   rdma_mr_size;
+};
+