From: Or Gerlitz Date: Wed, 2 Jul 2008 18:53:49 +0000 (-0700) Subject: librdmacm: implement address change event X-Git-Tag: v1.0.8~4 X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=308b811d8d6bef1d45b70a06684516a1a699127b;p=~shefty%2Flibrdmacm.git librdmacm: implement address change event RDMA_CM_EVENT_ADDR_CHANGE event can be used by librdmacm consumers that wish to have their RDMA sessions always use the same links (eg ) as the IP stack does. In the current code, this does not happen when bonding is used and fail-over happened, but the IB link used by an already existing session is operating fine. The kernel rdma-cm code was enhanced to use netevent notification for sensing that a change has happened in the IP stack, and deliver this event for ID that is misaligned that respect with the IP stack. The user can act on the event or just ignore it Signed-off-by: Or Gerlitz Signed-off-by: Sean Hefty --- diff --git a/examples/rping.c b/examples/rping.c index 8bfa0532..a85f398e 100644 --- a/examples/rping.c +++ b/examples/rping.c @@ -227,9 +227,8 @@ static int rping_cma_event_handler(struct rdma_cm_id *cma_id, break; default: - fprintf(stderr, "oof bad type!\n"); - sem_post(&cb->sem); - ret = -1; + fprintf(stderr, "unhandled event: %s, ignoring\n", + rdma_event_str(event->event)); break; } diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h index 8b0f1d25..a516ab85 100644 --- a/include/rdma/rdma_cma.h +++ b/include/rdma/rdma_cma.h @@ -61,7 +61,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_ADDR_CHANGE }; enum rdma_port_space { diff --git a/man/rdma_get_cm_event.3 b/man/rdma_get_cm_event.3 index 1ba8797a..3537e558 100644 --- a/man/rdma_get_cm_event.3 +++ b/man/rdma_get_cm_event.3 @@ -140,6 +140,11 @@ The multicast join operation (rdma_join_multicast) completed successfully. An error either occurred joining a multicast group, or, if the group had already been joined, on an existing group. The specified multicast group is no longer accessible and should be rejoined, if desired. +.IP RDMA_CM_EVENT_ADDR_CHANGE_ +The network device associated with this ID through address resolution changed its +HW address, eg following of bonding failover. This event can serve as a hint for +applications who want the links used for their RDMA sessions to align with the +network stack. .SH "SEE ALSO" rdma_ack_cm_event(3), rdma_create_event_channel(3), rdma_resolve_addr(3), rdma_resolve_route(3), rdma_connect(3), rdma_listen(3), rdma_join_multicast(3), diff --git a/src/cma.c b/src/cma.c index fc98c8fe..ecb41bca 100644 --- a/src/cma.c +++ b/src/cma.c @@ -1438,6 +1438,8 @@ const char *rdma_event_str(enum rdma_cm_event_type event) return "RDMA_CM_EVENT_MULTICAST_JOIN"; case RDMA_CM_EVENT_MULTICAST_ERROR: return "RDMA_CM_EVENT_MULTICAST_ERROR"; + case RDMA_CM_EVENT_ADDR_CHANGE: + return "RDMA_CM_EVENT_ADDR_CHANGE"; default: return "UNKNOWN EVENT"; }