[ofa-general] cma: add support for TIMEWAIT_EXIT event (second try)

Amir Vadai amirv at mellanox.co.il
Wed Jun 18 06:38:58 PDT 2008


Sean Hi,

Sorry for the corrupted mail I sent before - had some problems with the
mail client.

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>

--- include/rdma/rdma_cm.h.orig    2008-06-18 15:04:22.560904000 +0300
+++ 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 {
--- drivers/infiniband/core/cma.c.orig    2008-06-11 11:24:38.021543000
+0300
+++ 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;



--
Amir Vadai
Mellanox Technologies LTD.
SW
Phone: +972 (3) 625 9500 (ext.539)
Mobile: +972 (52) 632 4714
E-mail: amirv at mellanox.co.il

----------------------------------------------------------------------
Emails belong on computers, trees belong in forests; if you must print
this, do it on recycled paper.
http://www.greenpeace.org/international/
----------------------------------------------------------------------


Disclaimer added by CodeTwo Exchange Rules
http://www.codetwo.com



More information about the general mailing list