[openib-general] [PATCH] [RFC] ofed_1_2 - SLES9SP3 Backport - IWCM workaround for ip_dev_find() bug.

Steve Wise swise at opengridcomputing.com
Tue Feb 6 09:28:26 PST 2007


I propose the following fix for supporting iWARP on SLES9SP3.  

This fixes bug 325.

Sean, can you please review this?  

Steve.


-----------

SLES9SP3 Backport - IWCM workaround for ip_dev_find() bug.

Acquire the cma_dev based on the ib device of the incoming
connect request.

This overcomes a sles9sp3 bug where ip_dev_find(local_ipaddr) always
returns the loopback net_device pointer instead of the actual local
interface pointer.  Note: this workaround leaves the rdma_dev_addr in
the new connection request rdma_cm_id incomplete.  But ULPs don't really
use this, so we'll have to live with it for SLES9SP3.

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

 .../iwcm_ip_dev_find_workaround.patch              |   91 +++++++++++++++++++++++
 1 files changed, 91 insertions(+), 0 deletions(-)

diff --git a/kernel_patches/backport/2.6.5_sles9_sp3/iwcm_ip_dev_find_workaround.patch b/kernel_patches/backport/2.6.5_sles9_sp3/iwcm_ip_dev_find_workaround.patch
new file mode 100644
index 0000000..a9d5bfe
--- /dev/null
+++ b/kernel_patches/backport/2.6.5_sles9_sp3/iwcm_ip_dev_find_workaround.patch
@@ -0,0 +1,91 @@
+SLES9SP3 Backport - IWCM workaround for ip_dev_find() bug.
+
+From: Steve Wise <swise at opengridcomputing.com>
+
+Acquire the cma_dev based on the ib device of the incoming
+connect request.
+
+This overcomes a sles9sp3 bug where ip_dev_find(local_ipaddr) always
+returns the loopback net_device pointer instead of the actual local
+interface pointer.  Note: this workaround leaves the rdma_dev_addr in
+the new connection request rdma_cm_id incomplete.  But ULPs don't really
+use this, so we'll have to live with it for SLES9SP3.
+
+Signed-off-by: Steve Wise <swise at opengridcomputing.com>
+---
+
+ drivers/infiniband/core/cma.c |   33 +++++++++++++++------------------
+ 1 files changed, 15 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
+index 9e0ab04..c89b611 100644
+--- a/drivers/infiniband/core/cma.c
++++ b/drivers/infiniband/core/cma.c
+@@ -1128,13 +1128,25 @@ static int cma_iw_handler(struct iw_cm_i
+ 	return ret;
+ }
+ 
++static int iw_cma_acquire_dev(struct iw_cm_id *cm_id, struct rdma_id_private *id_priv)
++{
++	struct cma_device *cma_dev;
++
++	list_for_each_entry(cma_dev, &dev_list, list) {
++		if (cma_dev->device == cm_id->device) {
++			cma_attach_to_dev(id_priv, cma_dev);
++			return 0;
++		}
++	}
++	return -ENODEV;
++}
++
+ static int iw_conn_req_handler(struct iw_cm_id *cm_id,
+ 			       struct iw_cm_event *iw_event)
+ {
+ 	struct rdma_cm_id *new_cm_id;
+ 	struct rdma_id_private *listen_id, *conn_id;
+ 	struct sockaddr_in *sin;
+-	struct net_device *dev = NULL;
+ 	struct rdma_cm_event event;
+ 	int ret;
+ 
+@@ -1157,22 +1169,8 @@ static int iw_conn_req_handler(struct iw
+ 	atomic_inc(&conn_id->dev_remove);
+ 	conn_id->state = CMA_CONNECT;
+ 
+-	dev = ip_dev_find(iw_event->local_addr.sin_addr.s_addr);
+-	if (!dev) {
+-		ret = -EADDRNOTAVAIL;
+-		cma_release_remove(conn_id);
+-		rdma_destroy_id(new_cm_id);
+-		goto out;
+-	}
+-	ret = rdma_copy_addr(&conn_id->id.route.addr.dev_addr, dev, NULL);
+-	if (ret) {
+-		cma_release_remove(conn_id);
+-		rdma_destroy_id(new_cm_id);
+-		goto out;
+-	}
+-
+ 	mutex_lock(&lock);
+-	ret = cma_acquire_dev(conn_id);
++	ret = iw_cma_acquire_dev(cm_id, conn_id);
+ 	mutex_unlock(&lock);
+ 	if (ret) {
+ 		cma_release_remove(conn_id);
+@@ -1184,6 +1182,7 @@ static int iw_conn_req_handler(struct iw
+ 	cm_id->context = conn_id;
+ 	cm_id->cm_handler = cma_iw_handler;
+ 
++	new_cm_id->route.addr.dev_addr.dev_type = RDMA_NODE_RNIC;
+ 	sin = (struct sockaddr_in *) &new_cm_id->route.addr.src_addr;
+ 	*sin = iw_event->local_addr;
+ 	sin = (struct sockaddr_in *) &new_cm_id->route.addr.dst_addr;
+@@ -1203,8 +1202,6 @@ static int iw_conn_req_handler(struct iw
+ 	}
+ 
+ out:
+-	if (dev)
+-		dev_put(dev);
+ 	cma_release_remove(listen_id);
+ 	return ret;
+ }





More information about the general mailing list