rdma_post_recv

Posts a work request to receive an incoming message.

Syntax

#include <rdma/rdma_cma.h>
int rdma_post_recv (struct rdma_cm_id *id, void *context, void *addr, size_t length, 
struct ibv_mr *mr);       

Description

Posts a work request to the receive queue of the queue pair that is associated with the rdma_cm_id identifier. The posted buffer is queued to receive an incoming message that is sent by the remote peer.

Notes: You must make sure that a receive buffer is posted. The receive buffer must be large enough to contain all the sent data before the peer posts the corresponding send message. You must register the message buffer before it is posted by using the mr parameter specifying the registration. The buffer must be registered until the receive operation is completed. The messages can be posted to an rdma_cm_id identifier after a queue pair is associated with the message. If the rdma_cm_id identifier is allocated by using the rdma_create_id identifier, a queue pair is bound to an rdma_cm_id identifier after calling therdma_create_ep operation or rdma_create_qp operation. The user-defined context that is associated with the receive request is returned by using the work completion wr_id identifier, the work request identifier, and the work request identifier field.

Parameters

Item Description
addr Specifies the address of the memory buffer to post the work request.
context Specifies the user-defined context that is associated with the request.
id Specifies a reference to a communication identifier where the message buffer is posted.
length Specifies the length of the memory buffer.
mr Specifies the registered memory region that is associated with the posted buffer.

Return Values

Returns 0 on success, or -1 on error. If an error occurs, then errno is set to indicate the reason for failure.