ibv_destroy_ah()
Contents
int ibv_destroy_ah(struct ibv_ah *ah); |
Description
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.
Parameters
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 |
Examples
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; ah_attr.sl = 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; } |
FAQs
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:
- Wait until the outstanding Send Requests will be completed
- 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).
Comments
Tell us what do you think.
There are no comments on this entry.