[openib-general] RDMA CM callback status

Eric Barton eeb at bartonsoftware.com
Wed Sep 20 22:40:11 PDT 2006


Sean,

I have some questions regarding my RDMA CM callback handler....

int
kiblnd_cm_callback(struct rdma_cm_id *cmid, struct rdma_cm_event *event)
{
	switch (event->event) {
	default:
                ASSERT (0);

	case RDMA_CM_EVENT_CONNECT_REQUEST:
		return kiblnd_passive_connect(...);
                
	case RDMA_CM_EVENT_ADDR_ERROR:
                ASSERT(event->status != 0);
		/* handle error */
                return event->status;

	case RDMA_CM_EVENT_ADDR_RESOLVED:
                if (event->status == 0)
			return kiblnd_resolve_route(...);
		/* handle error */
		return event->status;

	case RDMA_CM_EVENT_ROUTE_ERROR:
                ASSERT(event->status != 0);
		/* handle error */
                return event->status;

	case RDMA_CM_EVENT_ROUTE_RESOLVED:
                if (event->status == 0)
                        return kiblnd_active_connect(...);
		/* handle error */
                return event->status;
                
	case RDMA_CM_EVENT_UNREACHABLE:
                ASSERT (event->status != 0);
		/* handle error out-of-line */
                return 0;

	case RDMA_CM_EVENT_CONNECT_ERROR:
                ASSERT (event->status != 0);
		/* handle error out-of-line */
                return 0;

	case RDMA_CM_EVENT_REJECTED:
		/* handle error out-of-line */
                return 0;

	case RDMA_CM_EVENT_ESTABLISHED:
		/* handle success */
                return 0;

	case RDMA_CM_EVENT_DISCONNECTED:
		/* teardown */
                return 0;

	case RDMA_CM_EVENT_DEVICE_REMOVAL:
		/* bleat on the console */
		return 0;
	}
}

1. Should I even be looking at event->status or does the event type tell me
   everything I need to know?  I've had a report that the assertion
   (event->status != 0) is failing on RDMA_CM_EVENT_ROUTE_ERROR.

2. /* handle error out-of-line */ above means I record failure in my connection
   data structure, start teardown and drop the callback's reference on it.
   When the last reference goes, the connection data structure is queued for
   final destruction (including rdma_destroy_id(cmid)).

   Given that this might race with the callback's caller is this OK?

-- 

                Cheers,
                        Eric

---------------------------------------------------
|Eric Barton        Barton Software               |
|9 York Gardens     Tel:    +44 (117) 330 1575    |
|Clifton            Mobile: +44 (7909) 680 356    |
|Bristol BS8 4LL    Fax:    call first            |
|United Kingdom     E-Mail:                       |
---------------------------------------------------





More information about the general mailing list