Skip to content

ibv_destroy_srq()

Contents

0.00 avg. rating (0% score) - 0 votes
int ibv_destroy_srq(struct ibv_srq *srq);

Description

ibv_destroy_srq() destroys a Shared Receive Queue.

The destruction of a Shared Receive Queue will fail if any QP is still associated with it.

If there is any affiliated asynchronous event on that SRQ that was read, using ibv_get_async_event(), but still wasn't acknowledged, using ibv_ack_async_event(), calling to ibv_destroy_srq() will never end until that event will be acknowledged.

An SRQ can be destroyed either if it is empty or contains outstanding Work Requests that weren't completed. Also, it can be destroyed if the limit event was requested on that SRQ using ibv_modify_srq() before the affiliated asynchronous event IBV_EVENT_SRQ_LIMIT_REACHED was generated.

Parameters

Name Direction Description
srq in SRQ that was returned from ibv_create_srq()

Return Values

Value Description
0 On success
errno On failure
EBUSY One or more QPs is still associated with the SRQ

Examples

Create an SRQ and destroy it:

struct ibv_pd *pd;
struct ibv_srq *srq;
struct ibv_srq_init_attr srq_init_attr;
 
memset(&srq_init_attr, 0, sizeof(srq_init_attr));
 
srq_init_attr.attr.max_wr  = 1;
srq_init_attr.attr.max_sge = 2;
 
srq = ibv_create_srq(pd, &srq_init_attr);
if (!srq) {
	fprintf(stderr, "Error, ibv_create_srq() failed\n");
	return -1;
}
 
if (ibv_destroy_srq(srq)) {
	fprintf(stderr, "Error, ibv_destroy_srq() failed\n");
	return -1;
}

FAQs

ibv_destroy_srq() failed, what will happen to the QPs which are associated with it?

Nothing at all. You can continue working with them without any side-effect.

ibv_destroy_srq() failed, can I know which QPs are associated with it and caused this failure?

No, currently the RDMA stack doesn’t have this capability.

Can I destroy an SRQ that holds outstanding Work Requests?

Yes, you can. When an SRQ is being destroyed, it doesn't matter if it contains Work Requests or not.

I called ibv_modify_srq() on an SRQ to set the limit event and didn't get this event yet. Can I destroy that SRQ?

Yes, you can.

I called ibv_destroy_srq(), but it never ended. What happened?

There is at least one affiliated asynchronous event on that SRQ that was read without a proper acknowledgement.

Share Our Posts

Share this post through social bookmarks.

  • Delicious
  • Digg
  • Newsvine
  • RSS
  • StumbleUpon
  • Technorati

Comments

Tell us what do you think.

There are no comments on this entry.

Add a Comment

This comment will be moderated; answer may be provided within 14 days.

Time limit is exhausted. Please reload CAPTCHA.