[ofa-general] rdma cm poll() POLLHUP?
Sean Hefty
mshefty at ichips.intel.com
Wed Nov 7 10:10:25 PST 2007
> rdma_event_channel *cm_channel = rdma_create_event_channel();
> rdma_create_id(cm_channel, &cm_id, NULL, RDMA_PS_TCP);
> ... // various rdma_bind, listen, etc
> ibv_comp_channel *ch = ibv_comp_channel(context); // follows ib_rdma_bw
> example init sequence with ibv_ calls
> ... // now connection is established and known to work sending/receiving
> data
> ... // and I've pre-posted some wr's to the receive queue on the server
>
> ... // next I want the server to wait for data from remote client:
> struct pollfd fds[1];
> fds[0].fd = ch->fd;
> fds[0].events = POLLIN; // also have tried explicitly adding POLLHUP and
> POLLERR but no change
> fds[0].revents = 0;
> ret = poll(fds,1,-1);
>
> This returns with revents POLLIN as expected when the remote side sends
> something,
> but poll() does not seem to return POLLHUP (or anything) when
> the remote side gets killed.
>
> For a tcp socket, this would normally cause a POLLHUP event, but for
> rdma cm there appears to be no indication,
> we just wait in this case indefinitely for some input.
>
> My question is, should it be possible to get a disconnected-type
> notification
> with rdma cm, and what do I need to do to detect it?
The rdma cm events should be reported on your 'cm_channel', separate
from the ibv_comp_channel. A disconnect notification will be received
when the remote side disconnects.
- Sean
More information about the general
mailing list