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
*/
#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,
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,
__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;
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;
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,
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;