| 1 |
.\" -*- nroff -*- |
| 2 |
.\" Licensed under the OpenIB.org BSD license (FreeBSD Variant) - See COPYING.md |
| 3 |
.\" |
| 4 |
.TH IBV_POST_RECV 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual" |
| 5 |
.SH "NAME" |
| 6 |
ibv_post_recv \- post a list of work requests (WRs) to a receive queue |
| 7 |
.SH "SYNOPSIS" |
| 8 |
.nf |
| 9 |
.B #include <infiniband/verbs.h> |
| 10 |
.sp |
| 11 |
.BI "int ibv_post_recv(struct ibv_qp " "*qp" ", struct ibv_recv_wr " "*wr" , |
| 12 |
.BI " struct ibv_recv_wr " "**bad_wr" ); |
| 13 |
.fi |
| 14 |
.SH "DESCRIPTION" |
| 15 |
.B ibv_post_recv() |
| 16 |
posts the linked list of work requests (WRs) starting with |
| 17 |
.I wr |
| 18 |
to the receive queue of the queue pair |
| 19 |
.I qp\fR. |
| 20 |
It stops processing WRs from this list at the first failure (that can |
| 21 |
be detected immediately while requests are being posted), and returns |
| 22 |
this failing WR through |
| 23 |
.I bad_wr\fR. |
| 24 |
.PP |
| 25 |
The argument |
| 26 |
.I wr |
| 27 |
is an ibv_recv_wr struct, as defined in <infiniband/verbs.h>. |
| 28 |
.PP |
| 29 |
.nf |
| 30 |
struct ibv_recv_wr { |
| 31 |
.in +8 |
| 32 |
uint64_t wr_id; /* User defined WR ID */ |
| 33 |
struct ibv_recv_wr *next; /* Pointer to next WR in list, NULL if last WR */ |
| 34 |
struct ibv_sge *sg_list; /* Pointer to the s/g array */ |
| 35 |
int num_sge; /* Size of the s/g array */ |
| 36 |
.in -8 |
| 37 |
}; |
| 38 |
.sp |
| 39 |
.nf |
| 40 |
struct ibv_sge { |
| 41 |
.in +8 |
| 42 |
uint64_t addr; /* Start address of the local memory buffer */ |
| 43 |
uint32_t length; /* Length of the buffer */ |
| 44 |
uint32_t lkey; /* Key of the local Memory Region */ |
| 45 |
.in -8 |
| 46 |
}; |
| 47 |
.fi |
| 48 |
.SH "RETURN VALUE" |
| 49 |
.B ibv_post_recv() |
| 50 |
returns 0 on success, or the value of errno on failure (which indicates the failure reason). |
| 51 |
.SH "NOTES" |
| 52 |
The buffers used by a WR can only be safely reused after WR the |
| 53 |
request is fully executed and a work completion has been retrieved |
| 54 |
from the corresponding completion queue (CQ). |
| 55 |
.PP |
| 56 |
If the QP |
| 57 |
.I qp |
| 58 |
is associated with a shared receive queue, you must use the function |
| 59 |
.B ibv_post_srq_recv()\fR, |
| 60 |
and not |
| 61 |
.B ibv_post_recv()\fR, |
| 62 |
since the QP's own receive queue will not be used. |
| 63 |
.PP |
| 64 |
If a WR is being posted to a UD QP, the Global Routing Header (GRH) of |
| 65 |
the incoming message will be placed in the first 40 bytes of the |
| 66 |
buffer(s) in the scatter list. If no GRH is present in the incoming |
| 67 |
message, then the first bytes will be undefined. This means that in |
| 68 |
all cases, the actual data of the incoming message will start at an |
| 69 |
offset of 40 bytes into the buffer(s) in the scatter list. |
| 70 |
.SH "SEE ALSO" |
| 71 |
.BR ibv_create_qp (3), |
| 72 |
.BR ibv_post_send (3), |
| 73 |
.BR ibv_post_srq_recv (3), |
| 74 |
.BR ibv_poll_cq (3) |
| 75 |
.SH "AUTHORS" |
| 76 |
.TP |
| 77 |
Dotan Barak <[email protected]> |