Posts a list of work requests (WRs) to a receive queue.
Syntax
#include <rdma/verbs.h>
int ibv_post_recv(struct ibv_qp *qp, struct ibv_recv_wr *wr, struct ibv_recv_wr **bad_wr)
Description
The ibv_post_recv() routine
posts the linked list of work requests (WRs) starting with wr to
the receive queue of the queue pair qp. The routine stops processing
WRs from the list at the first failure that can be detected immediately
while requests are being posted, and returns the failing WR through bad_wr.
The
argument
wr is an ibv_recv_wr struct, as defined in <rdma/verbs.h>.
struct ibv_recv_wr {
uint64_t wr_id; /* User defined WR ID */
struct ibv_recv_wr *next; /* Pointer to next WR in list, NULL if last WR */
struct ibv_sge *sg_list; /* Pointer to the s/g array */
int num_sge; /* Size of the s/g array */
};
struct ibv_sge {
uint64_t addr; /* Start address of the local memory buffer */
uint32_t length; /* Length of the buffer */
uint32_t lkey; /* Key of the local Memory Region */
};
Note: The buffers used by a WR can only be safely
reused after the request is complete and a work completion is retrieved
from the corresponding completion queue (CQ).
Input Parameters
qp |
Specifies the struct ibv_qp from ibv_create_qp. |
wr |
Specifies the first work request (WR) containing
receive buffers. |
Output Parameter
bad_wr |
Specifies the pointer to first rejected WR. |
Return Values
0 |
On success. |
errno |
On failure. |
EINVAL |
If qp, qp->context, wr, or wr->sg_list is NULL. |