[ofa-general] [PATCH] rds: use separate ports for TCP and IB

Jon Mason jon at opengridcomputing.com
Thu May 29 15:58:24 PDT 2008


[PATCH] rds: use separate ports for TCP and IB

Currently, RDS will bind to a single port during bring up of both the IB and TCP
sub-modules.  This binding of 2 different processes to a single port causes a
port space collision to devices which are aware of both (e.g., iWARP).  This
prevents iWARP devices from working with RDS if both TCP and IB are compiled in.

This patch works around this issue by having IB and TCP bind to separate ports,
thus avoiding the port space collision.  This enables iWARP to work over RDS TCP.

Signed-off-by: Jon Mason <jon at opengridcomputing.com>

diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index a49e394..9935c9b 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -628,7 +628,7 @@ int rds_ib_conn_connect(struct rds_connection *conn)
 
 	dest.sin_family = AF_INET;
 	dest.sin_addr.s_addr = (__force u32)conn->c_faddr;
-	dest.sin_port = (__force u16)htons(RDS_PORT);
+	dest.sin_port = (__force u16)htons(RDS_IB_PORT);
 
 	ret = rdma_resolve_addr(ic->i_cm_id, (struct sockaddr *)&src,
 				(struct sockaddr *)&dest,
@@ -813,7 +813,7 @@ int __init rds_ib_listen_init(void)
 
 	sin.sin_family = PF_INET,
 	sin.sin_addr.s_addr = (__force u32)htonl(INADDR_ANY);
-	sin.sin_port = (__force u16)htons(RDS_PORT);
+	sin.sin_port = (__force u16)htons(RDS_IB_PORT);
 
 	/*
 	 * XXX I bet this binds the cm_id to a device.  If we want to support
@@ -833,7 +833,7 @@ int __init rds_ib_listen_init(void)
 		goto out;
 	}
 
-	rdsdebug("cm %p listening on port %u\n", cm_id, RDS_PORT);
+	rdsdebug("cm %p listening on port %u\n", cm_id, RDS_IB_PORT);
 
 	rds_ib_listen_id = cm_id;
 	cm_id = NULL;
diff --git a/net/rds/rds.h b/net/rds/rds.h
index 03031e2..aa14fa6 100644
--- a/net/rds/rds.h
+++ b/net/rds/rds.h
@@ -25,9 +25,11 @@
  * userspace from listening.
  *
  * port 18633 was the version that had ack frames on the wire.
+ * port 18634 was the version that had both TCP and IB transports on the
+ * same port.
  */
-#define RDS_PORT	18634
-
+#define RDS_IB_PORT	18635
+#define RDS_TCP_PORT	18636
 
 #ifndef AF_RDS
 #define AF_RDS          28      /* Reliable Datagram Socket     */
diff --git a/net/rds/tcp_connect.c b/net/rds/tcp_connect.c
index 0389a99..298e372 100644
--- a/net/rds/tcp_connect.c
+++ b/net/rds/tcp_connect.c
@@ -96,7 +96,7 @@ int rds_tcp_conn_connect(struct rds_connection *conn)
 
 	dest.sin_family = AF_INET;
 	dest.sin_addr.s_addr = (__force u32)conn->c_faddr;
-	dest.sin_port = (__force u16)htons(RDS_PORT);
+	dest.sin_port = (__force u16)htons(RDS_TCP_PORT);
 
 	/* 
 	 * once we call connect() we can start getting callbacks and they
diff --git a/net/rds/tcp_listen.c b/net/rds/tcp_listen.c
index caeacbe..50709b7 100644
--- a/net/rds/tcp_listen.c
+++ b/net/rds/tcp_listen.c
@@ -159,7 +159,7 @@ int __init rds_tcp_listen_init(void)
 
 	sin.sin_family = PF_INET,
 	sin.sin_addr.s_addr = (__force u32)htonl(INADDR_ANY);
-	sin.sin_port = (__force u16)htons(RDS_PORT);
+	sin.sin_port = (__force u16)htons(RDS_TCP_PORT);
 
 	ret = sock->ops->bind(sock, (struct sockaddr *)&sin, sizeof(sin));
 	if (ret < 0)



More information about the general mailing list