[ofw] How to block waiting for a CQE?

Tzachi Dar tzachid at mellanox.co.il
Wed Feb 18 08:08:42 PST 2009


Hi,

You can get the example doing an svn co from the addresses: 
svn://openib.tc.cornell.edu/gen1/trunk

>From the practical stand point you can use cl_waitobj_wait_on in as well
as WaitForSingleObject.
To work more correctly from the standpoint of software engneering you
should call cl_waitobj_wait_on. This is because this is the "standard"
way that ibal is using.
If you look at the implmentation you will see that cl_waitobj_wait_on is
being implmeanted by WaitForSingleObject.  

As for the code that you have suggested. I don't think that it will
work.
The main reason is that you don't do arm before you wait for
notification.
I guess that this might work since after the arming is done, you will
get an event
that will live your event signaled. This will trigger another loop of
arming and polling 
which should work but is probably not needed.

Please look at the example, there is a working example that you can play
with.

Thanks
Tzachi

> -----Original Message-----
> From: Diego Guella [mailto:diego.guella at sircomtech.com] 
> Sent: Wednesday, February 18, 2009 5:53 PM
> To: Tzachi Dar; ofw at lists.openfabrics.org
> Subject: Re: [ofw] How to block waiting for a CQE?
> 
> >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