[ofw] How to block waiting for a CQE?

Tzachi Dar tzachid at mellanox.co.il
Wed Feb 18 07:13:28 PST 2009


I assume that your application is in user mode. Please let me know if it
isn't.

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.

There is an example for such code on
tools\perftests\user\send_bw\ib_send_bw.c

Thanks
Tzachi

> -----Original Message-----
> From: ofw-bounces at lists.openfabrics.org 
> [mailto:ofw-bounces at lists.openfabrics.org] On Behalf Of Diego Guella
> Sent: Wednesday, February 18, 2009 5:03 PM
> To: ofw at lists.openfabrics.org
> Subject: [ofw] How to block waiting for a CQE?
> 
> On Linux, I can block waiting for CQE using a comp_channel 
> and blocking on the ibv_get_cq_events function.
> It seems that on Windows there isn't such function.
> 
> Looking into iba/ib_al.h it seems to me that the same 
> behavior can be achieved creating a CQ with an associated h_wait_obj:
> -----
> HANDLE event_h;
> ib_cq_create_t cq_create;
> 
> event_h = CreateEvent(NULL, false, false, NULL); 
> cq_create.size = 10; cq_create.pfn_comp_cb = NULL; 
> cq_create.h_wait_obj = event_h; ib_create_cq(hca_h, 
> &cq_create, NULL, NULL, &cq_h);
> -----
> 
> Then, I should call ib_rearm_cq to get a notification.
> But, if I expect 32 CQE, can I call ib_rearm_cq 32 times to 
> get 32 notifications?
> for (i=0; i<32; i++)
>     ib_rearm_cq(cq_h, 0);
> 
> 
> Is this the recommended way to achieve the blocking behavior, 
> or there is a 
> better approach?
> 
> Thanks,
> Diego
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
> 



More information about the ofw mailing list