1IBV_POLL_CQ(3) Libibverbs Programmer's Manual IBV_POLL_CQ(3)
2
3
4
6 ibv_poll_cq - poll a completion queue (CQ)
7
9 #include <infiniband/verbs.h>
10
11 int ibv_poll_cq(struct ibv_cq *cq, int num_entries,
12 struct ibv_wc *wc);
13
15 ibv_poll_cq() polls the CQ cq for work completions and returns the
16 first num_entries (or all available completions if the CQ contains
17 fewer than this number) in the array wc. The argument wc is a pointer
18 to an array of ibv_wc structs, as defined in <infiniband/verbs.h>.
19
20 struct ibv_wc {
21 uint64_t wr_id; /* ID of the completed Work Request (WR) */
22 enum ibv_wc_status status; /* Status of the operation */
23 enum ibv_wc_opcode opcode; /* Operation type specified in the completed WR */
24 uint32_t vendor_err; /* Vendor error syndrome */
25 uint32_t byte_len; /* Number of bytes transferred */
26 uint32_t imm_data; /* Immediate data (in network byte order) */
27 uint32_t qp_num; /* Local QP number of completed WR */
28 uint32_t src_qp; /* Source QP number (remote QP number) of completed WR */
29 enum ibv_wc_flags wc_flags; /* Flags of the completed WR */
30 uint16_t pkey_index; /* P_Key index (valid only for GSI QPs) */
31 uint16_t slid; /* Source LID */
32 uint8_t sl; /* Service Level */
33 uint8_t dlid_path_bits; /* DLID path bits (not applicable for multicast messages) */
34 };
35
36
37 The attribute wc_flags describes the properties of the work completion.
38 It is either 0 or the bitwise OR of one or more of the following flags:
39
40 IBV_WC_GRH GRH is present
41
42 IBV_WC_WITH_IMM Immediate data value is valid
43
44 Not all wc attributes are always valid. If the completion status is
45 other than IBV_WC_SUCCESS, only the following attributes are valid:
46 wr_id, status, qp_num, and vendor_err.
47
49 On success, ibv_poll_cq() returns a non-negative value equal to the
50 number of completions found. On failure, a negative value is returned.
51
53 Each polled completion is removed from the CQ and cannot be returned to
54 it.
55
56 The user should consume work completions at a rate that prevents CQ
57 overrun from occurrence. In case of a CQ overrun, the async event
58 IBV_EVENT_CQ_ERR will be triggered, and the CQ cannot be used.
59
61 ibv_post_send(3), ibv_post_recv(3)
62
64 Dotan Barak <dotanb@mellanox.co.il>
65
66
67
68libibverbs 2006-10-31 IBV_POLL_CQ(3)