[ewg] [GIT PULL ofed-1.4] RDMA/CMA: Add unified ports patch.

Steve Wise swise at opengridcomputing.com
Thu Aug 14 15:45:30 PDT 2008


Vlad,

Please pull this patch from:

git://git.openfabrics.org/~swise/ofed-1.4 ofed_kernel

Thanks,

Steve.


-------- Original Message --------
Subject: 	[PATCH] RDMA/CMA: Add unified ports patch.
Date: 	Thu, 14 Aug 2008 17:35:36 -0500
From: 	Steve Wise <swise at opengridcomputing.com>
To: 	swise at opengridcomputing.com



From: Steve Wise <swise at opengridcomputing.com>

Signed-off-by: Steve Wise <swise at opengridcomputing.com>
---

 .../fixes/cma_0100_unified_tcp_ports.patch         |   96 +++++++++++++++++++++++
 1 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/kernel_patches/fixes/cma_0100_unified_tcp_ports.patch b/kernel_patches/fixes/cma_0100_unified_tcp_ports.patch
new file mode 100644
index 0000000..f164a29
--- /dev/null
+++ b/kernel_patches/fixes/cma_0100_unified_tcp_ports.patch
@@ -0,0 +1,96 @@
+RDMA/CMA: Allocate PS_TCP ports from the host TCP port space.
+
+From: Steve Wise <swise at opengridcomputing.com>
+
+This is needed for iwarp providers that support native and rdma
+connections over the same interface.
+
+Optionally turned on by the new rdma_cm unify_tcp_port_space module
+option.
+
+Signed-off-by: Steve Wise <swise at opengridcomputing.com>
+---
+
+ drivers/infiniband/core/cma.c |   34 +++++++++++++++++++++++++++++++++-
+ 1 files changed, 33 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
+index e980ff3..bffc8df 100644
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -54,6 +54,11 @@ MODULE_AUTHOR("Sean Hefty");
+ MODULE_DESCRIPTION("Generic RDMA CM Agent");
+ MODULE_LICENSE("Dual BSD/GPL");
+ 
++int unify_tcp_port_space = 0;
++module_param(unify_tcp_port_space, int, 0644);
++MODULE_PARM_DESC(unify_tcp_port_space, "Unify the host TCP and RDMA port "
++		 "space allocation (default=0)");
++
+ #define CMA_CM_RESPONSE_TIMEOUT 20
+ #define CMA_MAX_CM_RETRIES 15
+ #define CMA_CM_MRA_SETTING (IB_CM_MRA_FLAG_DELAY | 24)
+@@ -117,6 +122,7 @@ struct rdma_id_private {
+ 	struct rdma_cm_id	id;
+ 
+ 	struct rdma_bind_list	*bind_list;
++	struct socket		*sock;
+ 	struct hlist_node	node;
+ 	struct list_head	list; /* listen_any_list or cma_device.list */
+ 	struct list_head	listen_list; /* per device listens */
+@@ -809,6 +815,8 @@ static void cma_release_port(struct rdma_id_private *id_priv)
+ 		kfree(bind_list);
+ 	}
+ 	mutex_unlock(&lock);
++	if (id_priv->sock)
++		sock_release(id_priv->sock);
+ }
+ 
+ static void cma_leave_mc_groups(struct rdma_id_private *id_priv)
+@@ -2037,6 +2045,25 @@ static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv)
+ 	return 0;
+ }
+ 
++static int cma_get_tcp_port(struct rdma_id_private *id_priv)
++{
++	int ret;
++	struct socket *sock;
++
++	ret = sock_create_kern(AF_INET, SOCK_STREAM, IPPROTO_TCP, &sock);
++	if (ret)
++		return ret;
++	ret = sock->ops->bind(sock,
++			(struct sockaddr *)&id_priv->id.route.addr.src_addr,
++			ip_addr_size(&id_priv->id.route.addr.src_addr));
++	if (ret) {
++		sock_release(sock);
++		return ret;
++	}
++	id_priv->sock = sock;
++	return 0;	
++}
++
+ static int cma_get_port(struct rdma_id_private *id_priv)
+ {
+ 	struct idr *ps;
+@@ -2048,6 +2075,11 @@ static int cma_get_port(struct rdma_id_private *id_priv)
+ 		break;
+ 	case RDMA_PS_TCP:
+ 		ps = &tcp_ps;
++		if (unify_tcp_port_space) {
++			ret = cma_get_tcp_port(id_priv);
++			if (ret)
++				goto out;
++		}
+ 		break;
+ 	case RDMA_PS_UDP:
+ 		ps = &udp_ps;
+@@ -2065,7 +2097,7 @@ static int cma_get_port(struct rdma_id_private *id_priv)
+ 	else
+ 		ret = cma_use_port(ps, id_priv);
+ 	mutex_unlock(&lock);
+-
++out:
+ 	return ret;
+ }
+ 




More information about the ewg mailing list