1IBV_POST_SEND(3) Libibverbs Programmer's Manual IBV_POST_SEND(3)
2
3
4
6 ibv_post_send - post a list of work requests (WRs) to a send queue
7
9 #include <infiniband/verbs.h>
10
11 int ibv_post_send(struct ibv_qp *qp, struct ibv_send_wr *wr,
12 struct ibv_send_wr **bad_wr);
13
15 ibv_post_send() posts the linked list of work requests (WRs) starting
16 with wr to the send queue of the queue pair qp. It stops processing
17 WRs from this list at the first failure (that can be detected immedi‐
18 ately while requests are being posted), and returns this failing WR
19 through bad_wr.
20
21 The argument wr is an ibv_send_wr struct, as defined in <infini‐
22 band/verbs.h>.
23
24 struct ibv_send_wr {
25 uint64_t wr_id; /* User defined WR ID */
26 struct ibv_send_wr *next; /* Pointer to next WR in list, NULL if last WR */
27 struct ibv_sge *sg_list; /* Pointer to the s/g array */
28 int num_sge; /* Size of the s/g array */
29 enum ibv_wr_opcode opcode; /* Operation type */
30 int send_flags; /* Flags of the WR properties */
31 union {
32 __be32 imm_data; /* Immediate data (in network byte order) */
33 uint32_t invalidate_rkey; /* Remote rkey to invalidate */
34 };
35 union {
36 struct {
37 uint64_t remote_addr; /* Start address of remote memory buffer */
38 uint32_t rkey; /* Key of the remote Memory Region */
39 } rdma;
40 struct {
41 uint64_t remote_addr; /* Start address of remote memory buffer */
42 uint64_t compare_add; /* Compare operand */
43 uint64_t swap; /* Swap operand */
44 uint32_t rkey; /* Key of the remote Memory Region */
45 } atomic;
46 struct {
47 struct ibv_ah *ah; /* Address handle (AH) for the remote node address */
48 uint32_t remote_qpn; /* QP number of the destination QP */
49 uint32_t remote_qkey; /* Q_Key number of the destination QP */
50 } ud;
51 } wr;
52 union {
53 struct {
54 uint32_t remote_srqn; /* Number of the remote SRQ */
55 } xrc;
56 } qp_type;
57 union {
58 struct {
59 struct ibv_mw *mw; /* Memory window (MW) of type 2 to bind */
60 uint32_t rkey; /* The desired new rkey of the MW */
61 struct ibv_mw_bind_info bind_info; /* MW additional bind information */
62 } bind_mw;
63 struct {
64 void *hdr; /* Pointer address of inline header */
65 uint16_t hdr_sz; /* Inline header size */
66 uint16_t mss; /* Maximum segment size for each TSO fragment */
67 } tso;
68 };
69 };
70
71 struct ibv_mw_bind_info {
72 struct ibv_mr *mr; /* The Memory region (MR) to bind the MW to */
73 uint64_t addr; /* The address the MW should start at */
74 uint64_t length; /* The length (in bytes) the MW should span */
75 int mw_access_flags; /* Access flags to the MW. Use ibv_access_flags */
76 };
77
78 struct ibv_sge {
79 uint64_t addr; /* Start address of the local memory buffer */
80 uint32_t length; /* Length of the buffer */
81 uint32_t lkey; /* Key of the local Memory Region */
82 };
83
84 Each QP Transport Service Type supports a specific set of opcodes, as
85 shown in the following table:
86
87 OPCODE | IBV_QPT_UD | IBV_QPT_UC | IBV_QPT_RC | IBV_QPT_XRC_SEND | IBV_QPT_RAW_PACKET
88 ----------------------------+------------+------------+------------+------------------+--------------------
89 IBV_WR_SEND | X | X | X | X | X
90 IBV_WR_SEND_WITH_IMM | X | X | X | X |
91 IBV_WR_RDMA_WRITE | | X | X | X |
92 IBV_WR_RDMA_WRITE_WITH_IMM | | X | X | X |
93 IBV_WR_RDMA_READ | | | X | X |
94 IBV_WR_ATOMIC_CMP_AND_SWP | | | X | X |
95 IBV_WR_ATOMIC_FETCH_AND_ADD | | | X | X |
96 IBV_WR_LOCAL_INV | | X | X | X |
97 IBV_WR_BIND_MW | | X | X | X |
98 IBV_WR_SEND_WITH_INV | | X | X | X |
99 IBV_WR_TSO | X | | | | X
100
101 The attribute send_flags describes the properties of the WR. It is
102 either 0 or the bitwise OR of one or more of the following flags:
103
104 IBV_SEND_FENCE Set the fence indicator. Valid only for QPs with Trans‐
105 port Service Type IBV_QPT_RC
106
107 IBV_SEND_SIGNALED Set the completion notification indicator. Relevant
108 only if QP was created with sq_sig_all=0
109
110 IBV_SEND_SOLICITED Set the solicited event indicator. Valid only for
111 Send and RDMA Write with immediate
112
113 IBV_SEND_INLINE Send data in given gather list as inline data
114 in a send WQE. Valid only for Send and RDMA Write. The L_Key
115 will not be checked.
116
117 IBV_SEND_IP_CSUM Offload the IPv4 and TCP/UDP checksum calculation.
118 Valid only when device_cap_flags in device_attr indicates cur‐
119 rent QP is supported by checksum offload.
120
122 ibv_post_send() returns 0 on success, or the value of errno on failure
123 (which indicates the failure reason).
124
126 The user should not alter or destroy AHs associated with WRs until
127 request is fully executed and a work completion has been retrieved from
128 the corresponding completion queue (CQ) to avoid unexpected behavior.
129
130 The buffers used by a WR can only be safely reused after WR the request
131 is fully executed and a work completion has been retrieved from the
132 corresponding completion queue (CQ). However, if the IBV_SEND_INLINE
133 flag was set, the buffer can be reused immediately after the call
134 returns.
135
137 ibv_create_qp(3), ibv_create_ah(3), ibv_post_recv(3),
138 ibv_post_srq_recv(3), ibv_poll_cq(3)
139
141 Dotan Barak <dotanba@gmail.com>
142
143 Majd Dibbiny <majd@mellanox.com>
144
145 Yishai Hadas <yishaih@mellanox.com>
146
147
148
149libibverbs 2006-10-31 IBV_POST_SEND(3)