[ofw] How to block waiting for a CQE?

Diego Guella diego.guella at sircomtech.com
Wed Feb 18 07:52:32 PST 2009


>From: "Tzachi Dar"
>Sent: Wednesday, February 18, 2009 4:13 PM
>Subject: RE: [ofw] How to block waiting for a CQE?
>

>I assume that your application is in user mode. Please let me know if it
>isn't.
Yes, assumption correct. Sorry I missed to say that.

>The way to wait for completions is using the wait objects as you have
>suggested.
>
>In order to get all the notifications you should do something like this:
>
>While (1) {
>poll_cq();
>if (poll was succesful) {
>            handle_items
>continue; //(this will poll again)
>}
>arm_for_complition();
>wait_for_event();
>}
>
>If you have sent 32 items than count the number of items poll for CQ has
>returned.
>
>Please note that in this scenario you might have to arm once or 32 times
>depending on how fast the send is.
This sentence remainds me of the man page of ibv_get_cq_event:
-----
The following code example demonstrates one possible way to work with 
completion events. It performs the following steps:

Stage I: Preparation
1. Creates a CQ
2. Requests for notification upon a new (first) completion event

Stage II: Completion Handling Routine
3. Wait for the completion event and ack it
4. Request for notification upon the next completion event
5. Empty the CQ

Note that an extra event may be triggered without having a corresponding 
completion entry in the CQ. This occurs if a completion entry is added to 
the CQ between Step 4 and Step 5, and the CQ is then emptied (polled) in 
Step 5.
-----

Should I follow this procedure instead?:

While (1) {
arm_for_complition();
do {
    poll_cq();
    if (poll was succesful) {
        handle_items
    } while (poll returned 0 items);
wait_for_event();
}


I just noticed there is cl_waitobj_wait_on in cl_waitobj_osd.h.
Should I use it or is WaitForSingleObject ok?


>There is an example for such code on
>tools\perftests\user\send_bw\ib_send_bw.c
I'm sorry, I don't know how to get that example.
Is that on SVN? I'm downloading TortoiseSVN now.
What is the complete address?

>Thanks
>Tzachi
Many thanks to you :)
Diego




More information about the ofw mailing list