]> git.openfabrics.org - ~shefty/libibcm.git/commitdiff
Fixes to support path migration.
authorSean Hefty <sean.hefty@intel.com>
Wed, 29 Nov 2006 19:30:35 +0000 (11:30 -0800)
committerSean Hefty <sean.hefty@intel.com>
Wed, 29 Nov 2006 23:56:24 +0000 (15:56 -0800)
Replace ib_cm_establish with ib_cm_notify to allow user to report
multiple events to the CM, including path migration.  Update kernel
ABI to match kernel changes.

include/infiniband/cm.h
include/infiniband/cm_abi.h
src/cm.c
src/libibcm.map

index 72c5db1f3b842970395a188024db7eca3c03fad8..5032e96789683ad1bf2780f3f012e6089cdd5e9a 100644 (file)
@@ -433,13 +433,20 @@ int ib_cm_send_drep(struct ib_cm_id *cm_id,
                    uint8_t private_data_len);
 
 /**
- * ib_cm_establish - Forces a connection state to established.
+ * ib_cm_notify - Notifies the CM of an event reported to the consumer.
  * @cm_id: Connection identifier to transition to established.
+ * @event: Type of event.
  *
- * This routine should be invoked by users who receive messages on a
- * connected QP before an RTU has been received.
+ * This routine should be invoked by users to notify the CM of relevant
+ * communication events.  Events that should be reported to the CM and
+ * when to report them are:
+ *
+ * IBV_EVENT_COMM_EST - Used when a message is received on a connected
+ *    QP before an RTU has been received.
+ * IBV_EVENT_PATH_MIG - Notifies the CM that the connection has failed over
+ *   to the alternate path.
  */
-int ib_cm_establish(struct ib_cm_id *cm_id);
+int ib_cm_notify(struct ib_cm_id *cm_id, enum ibv_event_type event);
 
 /**
  * ib_cm_send_rej - Sends a connection rejection message to the
index f3653eae672b07567a97d09a8ae984b0fbff12c5..8fd10dd56150c3f0f7b975421498f667b24011cd 100644 (file)
@@ -45,7 +45,7 @@
  */
 
 #define IB_USER_CM_MIN_ABI_VERSION     4
-#define IB_USER_CM_MAX_ABI_VERSION     4
+#define IB_USER_CM_MAX_ABI_VERSION     5
 
 enum {
        IB_USER_CM_CMD_CREATE_ID,
@@ -53,7 +53,8 @@ enum {
        IB_USER_CM_CMD_ATTR_ID,
 
        IB_USER_CM_CMD_LISTEN,
-       IB_USER_CM_CMD_ESTABLISH,
+       IB_USER_CM_CMD_NOTIFY,
+       IB_USER_CM_CMD_ESTABLISH = IB_USER_CM_CMD_NOTIFY, /* ABI 4 support */
        
        IB_USER_CM_CMD_SEND_REQ,
        IB_USER_CM_CMD_SEND_REP,
@@ -124,10 +125,15 @@ struct cm_abi_listen {
        __u32 reserved;
 };
 
-struct cm_abi_establish {
+struct cm_abi_establish {      /* ABI 4 support */
        __u32 id;
 };
 
+struct cm_abi_notify {
+       __u32 id;
+       __u32 event;
+};
+
 struct cm_abi_private_data {
        __u64 data;
        __u32 id;
index 74ef77fc0de4447e8c85b9707ce8c33cb7640795..85403b49a2de092f47e060e1946a2f48476ea535 100644 (file)
--- a/src/cm.c
+++ b/src/cm.c
@@ -475,7 +475,7 @@ int ib_cm_send_drep(struct ib_cm_id *cm_id,
                                    private_data, private_data_len);
 }
 
-int ib_cm_establish(struct ib_cm_id *cm_id)
+static int cm_establish(struct ib_cm_id *cm_id)
 {
        struct cm_abi_establish *cmd;
        void *msg;
@@ -492,6 +492,31 @@ int ib_cm_establish(struct ib_cm_id *cm_id)
        return 0;
 }
 
+int ib_cm_notify(struct ib_cm_id *cm_id, enum ibv_event_type event)
+{
+       struct cm_abi_notify *cmd;
+       void *msg;
+       int result;
+       int size;
+       
+       if (abi_ver == 4) {
+               if (event == IBV_EVENT_COMM_EST)
+                       return cm_establish(cm_id);
+               else
+                       return -EINVAL;
+       }
+
+       CM_CREATE_MSG_CMD(msg, cmd, IB_USER_CM_CMD_NOTIFY, size);
+       cmd->id = cm_id->handle;
+       cmd->event = event;
+
+       result = write(cm_id->device->fd, msg, size);
+       if (result != size)
+               return (result > 0) ? -ENODATA : result;
+
+       return 0;
+}
+
 static inline int cm_send_status(struct ib_cm_id *cm_id,
                                 uint32_t type,
                                 int status,
index be81d7bf12deb5388e815c6346f1ae52d03d8dd0..4c8ba105194a2c9e1a214ca943f79146e3974812 100644 (file)
@@ -13,7 +13,7 @@ IBCM_4.0 {
                ib_cm_send_rtu;
                ib_cm_send_dreq;
                ib_cm_send_drep;
-               ib_cm_establish;
+               ib_cm_notify;
                ib_cm_send_rej;
                ib_cm_send_mra;
                ib_cm_send_lap;