Skip to content


0.00 avg. rating (0% score) - 0 votes
int ibv_destroy_ah(struct ibv_ah *ah);


ibv_destroy_ah() destroys an Address Handle.

It is up to the user waiting for all outstanding Send Requests, that were posted with this AH, to be completed or flushed before he destroys the AH. Not doing so, may lead to Work Completion errors or segmentation fault.


Name Direction Description
ah in AH that was returned from ibv_create_ah() or ibv_create_ah_from_wc()

Return Values

Value Description
0 On success
errno On failure
EINVAL AH context is invalid


Create an AH and destroy it (this example assumed that the variables dlid, sl and port are declared and initialized with valid values):

struct ibv_pd *pd;
struct ibv_ah *ah;
struct ibv_ah_attr ah_attr;
memset(&ah_attr, 0, sizeof(ah_attr));
ah_attr.is_global     = 0;
ah_attr.dlid          = dlid;            = sl;
ah_attr.src_path_bits = 0;
ah_attr.port_num      = port;
ah = ibv_create_ah(pd, &ah_attr);
if (!ah) {
	fprintf(stderr, "Error, ibv_create_ah() failed\n");
	return -1;
if (ibv_destroy_ah(ah)) {
	fprintf(stderr, "Error, ibv_destroy_ah() failed\n");
	return -1;


What will happen if I will destroy an AH when there are still outstanding Send Requests that use it?

Doing this may lead to Work Completion with error or a segmentation fault.

I want to destroy an AH, but there are still outstanding Send Requests that still use it, what can I do?

You have two options:

  1. Wait until the outstanding Send Requests will be completed
  2. Flush the Send Queue that those Send Requested were posted to (this can be done, for example, by changing the state of the QP that those Send Requests were posted to into theĀ IBV_QPS_ERR state).

Share Our Posts

Share this post through social bookmarks.

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


Tell us what do you think.

There are no comments on this entry.

Add a Comment

Fill in the form and submit.

Time limit is exhausted. Please reload CAPTCHA.