[ofa-general] librdmacm - okay to select on a cm channel's file descriptor?

Steven Dake sdake at redhat.com
Sun Aug 16 17:27:55 PDT 2009


On Sat, 2009-08-15 at 15:55 -0700, Bryan Green wrote:
> Hi,
> 
> I'm using librdmacm for connection management (on Linux).
> 
> In an attempt to get unexpected DISCONNECT notifications during
> ib communication, I'm trying to use 'select()' on the cm channel's file
> descriptor, testing it for readability.  I've found that this works some of
> the time, but not all of the time.
> 

What I have done is the following:
        struct rdma_event_channel *mcast_channel;

        mcast_channel = rdma_create_event_channel();

then select/poll on mcast_channel->fd and call my connection manager
event handler when there is a new event.

My event handler looks like:
        res = rdma_get_cm_event (mcast_channel, &event);

        switch (event->event) {
	}
        rdma_ack_cm_event (event);


This ack_cm_event removes the event from the file descriptor.

It isn't clear from your message if this is what your doing, but this
works for me.  Note I am using UD mode so I am not certain if there may
be a bug in disconnect events (since UD doesn't generate these) for your
application.

> Is this a legitimate way to test for disconnections, or am I required to
> either make the descriptor nonblocking and just poll, or use a background
> thread for receiving cm events?  I'd rather not use the nonblocking
> approach, because I'd like to simultaneously select on the cm channel
> descriptor and an ibv_comp_channel descriptor.  I'm not sure if
> selecting on the ibv_comp_channel descriptor is acceptable either, but it
> appears to work.
> 

selecting on ibv_comp_channel created descriptors works for me for the
completion queue events only.

Regards
-steve

> 

> I'd appreciate it if anyone can enlighten me on this.
> 
> Thanks,
> -bryan
> 
> _______________________________________________
> general mailing list
> general at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general




More information about the general mailing list