From c3922e5ddbba38024842a2246e57d09acf792d5e Mon Sep 17 00:00:00 2001 From: Sean Hefty Date: Wed, 29 Nov 2006 11:30:35 -0800 Subject: [PATCH] Fixes to support path migration. 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 | 15 +++++++++++---- include/infiniband/cm_abi.h | 12 +++++++++--- src/cm.c | 27 ++++++++++++++++++++++++++- src/libibcm.map | 2 +- 4 files changed, 47 insertions(+), 9 deletions(-) diff --git a/include/infiniband/cm.h b/include/infiniband/cm.h index 72c5db1..5032e96 100644 --- a/include/infiniband/cm.h +++ b/include/infiniband/cm.h @@ -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 diff --git a/include/infiniband/cm_abi.h b/include/infiniband/cm_abi.h index f3653ea..8fd10dd 100644 --- a/include/infiniband/cm_abi.h +++ b/include/infiniband/cm_abi.h @@ -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; diff --git a/src/cm.c b/src/cm.c index 74ef77f..85403b4 100644 --- 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, diff --git a/src/libibcm.map b/src/libibcm.map index be81d7b..4c8ba10 100644 --- a/src/libibcm.map +++ b/src/libibcm.map @@ -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; -- 2.41.0