[ofa-general] missed cq event
Steve Wise
swise at opengridcomputing.com
Fri Jun 6 10:25:31 PDT 2008
Philip Frey1 wrote:
>
> Hello,
>
> what is the correct way to get completions from the CQ without missing
> any?
> I am currently using two separate CQs for the SQ and for the RQ.
> In pseudocode I do about the following to wait for a completion:
>
> ibv_get_cq_event(channel, &dst_cq, &ctx); //blocking wait for
> CQ event
> <-- EVENT -->
> ibv_req_notify_cq(dst_cq, 0); // request event
> for next completion
> ibv_poll_cq(dest_cq, 1, wc); // get the WC from
> the CQ
> ibv_ack_cq_events(dst_cq, 1); // ack the event
>
> It might now happen on the RQ, that two consecutive inbound sends consume
> receive WRs and therefore generate two WCs on the RQ. If the second is
> generated
> before I get the first one, I will miss it and wait infinitely long
> for it since I already got the event
> but that event does not tell me how many WCs are pending on the
> respective CQ.
>
> One way to handle this issue would be to do an ibv_poll_cq() before
> waiting for the event
> in case there is something on the CQ for which I missed the event.
>
> Is there a more elegant way to get all events pending on the CQ or
> find out how many
> completions are pending? I could also do a ibv_poll_cq() and request
> say 10 completions
> and see how many I got but that is kind of a hack...
you need to poll the cq until it is empty instead of just polling once.
get_cq_event()
req_notify_cq()
do {
ne = poll_cq();
} while (ne != 0);
ack_cq_event()
Steve.
More information about the general
mailing list