49 lines
1.6 KiB
C
49 lines
1.6 KiB
C
struct rdma_cm_event *event;
|
|
|
|
while (rdma_get_cm_event(event_channel, &event) == 0) {
|
|
|
|
switch (event->event) {
|
|
case RDMA_CM_EVENT_ADDR_RESOLVED:
|
|
// Create QP, receive CQ, and send CQ.
|
|
// Call rdma_resolve_route()
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_ADDR_ERROR:
|
|
// Try fallback and set mode rdma_cm_id to listening
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_ROUTE_RESOLVED:
|
|
// Call rdma_connect()
|
|
// State: PENDING_CONNECT
|
|
case RDMA_CM_EVENT_ROUTE_ERROR:
|
|
// Try fallback and set mode rdma_cm_id to listening
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_UNREACHABLE:
|
|
// Try fallback and set mode rdma_cm_id to listening
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_CONNECT_REQUEST:
|
|
// Create QP, receive CQ, and send CQ.
|
|
// Call rdma_accept()
|
|
// State: PENDING_CONNECT
|
|
case RDMA_CM_EVENT_CONNECT_ERROR:
|
|
// Try fallback and set mode rdma_cm_id to listening
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_REJECTED:
|
|
// Try fallback and set mode rdma_cm_id to listening
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_ESTABLISHED:
|
|
// In case of UD, save address handle from event struct
|
|
// State: CONNECTED
|
|
case RDMA_CM_EVENT_DISCONNECTED:
|
|
// Release all buffers and destroy everything
|
|
// State: STARTED
|
|
case RDMA_CM_EVENT_TIMEWAIT_EXIT:
|
|
break;
|
|
default:
|
|
// Error message: unkown event
|
|
}
|
|
|
|
rdma_ack_cm_event(event);
|
|
}
|
|
|
|
|
|
|