ibv_query_srq()
Contents
int ibv_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr); |
Description
ibv_query_srq() returns the attributes of a Shared Receive Queue.
struct ibv_srq_attr describes the attributes of the Shared Receive Queue.
struct ibv_srq_attr { uint32_t max_wr; uint32_t max_sge; uint32_t srq_limit; }; |
Here is the full description of struct ibv_srq_attr:
max_wr | The maximum number of outstanding Work Requests that can be posted to this Shared Receive Queue |
max_sge | The maximum number of scatter/gather elements in any Work Request that can be posted to this Shared Receive Queue |
srq_limit | The value that the SRQ is armed with. 0 means that the SRQ limit event won’t be generated (since the number of outstanding WRs in the SRQ can’t be negative) |
Parameters
Name | Direction | Description |
---|---|---|
srq | in | SRQ that was returned from ibv_create_srq() |
srq_attr | out | The current SRQ attributed will be filled in it |
Return Values
Value | Description |
---|---|
0 | On success |
errno | On failure |
ENOMEM | Not enough resources to complete this operation | ENOSYS | Query Shared Receive Queue isn’t supported by this RDMA device |
Examples
Query an SRQ for its attributes:
struct ibv_srq *srq; struct ibv_srq_attr srq_attr; if (ibv_query_srq(srq, &srq_attr)) { fprintf(stderr, "Error, ibv_query_srq() failed\n"); return -1; } |
FAQs
Calling every time to ibv_query_srq() when I need an SRQ attribute takes time, can I cache some of the attributes?
Actually, yes. The attributes, which indicates the SRQ size, i.e. max_wr and max_sge, won't change unless this SRQ will be resized using ibv_modify_srq(). The srq_limit value may change: when the SRQ is armed, it will hold the low watermark value. After the SRQ limit event will be generated, it will hold the value 0 (unless the SRQ will be rearmed again).
Comments
Tell us what do you think.
There are no comments on this entry.