ibv_post_recv

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() function posts the linked list of work requests (WRs) starting with the wr parameter to the receive queue of the queue pair. The function 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 the bad_wr parameter.

The wr argument is an ibv_recv_wr struct, as defined in the<rdma/verbs.h> file.
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 scatter-gather array */
        int									num_sge;	/* Size of the scatter-gather 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 that is used by a WR can be safely reused after the request is completed, and a work completion is retrieved from the corresponding completion queue (CQ).

Input Parameters

Item Descriptor
qp Specifies the ibv_qp struct for the ibv_create_qp function.
wr Specifies the first work request (WR) that contains the receive buffers.

Output Parameter

Item Descriptor
bad_wr Specifies the pointer to the first rejected WR.

Return Values

Item Descriptor
0 On success.
errno On failure.