[ofa-general] [PATCH v2 2/6] Add support for event IB_CM_TIMEWAIT_EXIT

Amir Vadai amirv at mellanox.co.il
Thu Jul 10 00:48:49 PDT 2008


Notify the ULP when a IB_CM_TIMEWAIT_EXIT occurs.

Signed-off-by: Amir Vadai <amirv at mellanox.co.il>
---
 .../fixes/cma_0050_timewait_finished_event.patch   |   45 ++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)
 create mode 100644 kernel_patches/fixes/cma_0050_timewait_finished_event.patch

diff --git a/kernel_patches/fixes/cma_0050_timewait_finished_event.patch b/kernel_patches/fixes/cma_0050_timewait_finished_event.patch
new file mode 100644
index 0000000..d987529
--- /dev/null
+++ b/kernel_patches/fixes/cma_0050_timewait_finished_event.patch
@@ -0,0 +1,45 @@
+SDP needs to be notified when CM exits the TIMEWAIT state.
+CM does notify the CMA but CMA doesn't pass it to the upper layer.
+
+Below is a patch for the CMA code. I wasn't sure if it is ok to set
+CMA_DISCONNECT in the IB_CM_TIMEWAIT_EXIT instead of doing it in the
+IB_CM_DREQ_RECEIVED/IB_CM_DREP_RECEIVED as it is done today. Instead
+I changed the check at the beginning of cma_ib_handler() as you can
+see in the patch.
+
+Signed-off-by: Amir Vadai <amirv at mellanox.co.il>
+
+--- a/include/rdma/rdma_cm.h	2008-06-18 15:04:22.560904000 +0300
++++ b/include/rdma/rdma_cm.h	2008-06-11 11:55:26.758053000 +0300
+@@ -53,7 +53,8 @@ enum rdma_cm_event_type {
+ 	RDMA_CM_EVENT_DISCONNECTED,
+ 	RDMA_CM_EVENT_DEVICE_REMOVAL,
+ 	RDMA_CM_EVENT_MULTICAST_JOIN,
+-	RDMA_CM_EVENT_MULTICAST_ERROR
++	RDMA_CM_EVENT_MULTICAST_ERROR,
++	RDMA_CM_EVENT_TIMWAIT_EXIT
+ };
+ 
+ enum rdma_port_space {
+--- a/drivers/infiniband/core/cma.c	2008-06-11 11:24:38.021543000 +0300
++++ b/drivers/infiniband/core/cma.c	2008-06-18 13:27:08.098747000 +0300
+@@ -931,7 +931,8 @@ static int cma_ib_handler(struct ib_cm_i
+ 	struct rdma_cm_event event;
+ 	int ret = 0;
+ 
+-	if (cma_disable_remove(id_priv, CMA_CONNECT))
++	if ((ib_event->event != IB_CM_TIMEWAIT_EXIT && cma_disable_remove(id_priv, CMA_CONNECT)) ||
++	    (ib_event->event == IB_CM_TIMEWAIT_EXIT && cma_disable_remove(id_priv, CMA_DISCONNECT)))
+ 		return 0;
+ 
+ 	memset(&event, 0, sizeof event);
+@@ -967,6 +968,8 @@ static int cma_ib_handler(struct ib_cm_i
+ 		event.event = RDMA_CM_EVENT_DISCONNECTED;
+ 		break;
+ 	case IB_CM_TIMEWAIT_EXIT:
++		event.event = RDMA_CM_EVENT_TIMWAIT_EXIT;
++		break;
+ 	case IB_CM_MRA_RECEIVED:
+ 		/* ignore event */
+ 		goto out;
+
-- 
1.5.3




More information about the general mailing list