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 union {
27 __be32 imm_data; /* Immediate data (in network byte order) */
28 uint32_t invalidated_rkey; /* Local RKey that was invalidated */
29 };
30 uint32_t qp_num; /* Local QP number of completed WR */
31 uint32_t src_qp; /* Source QP number (remote QP number) of completed WR (valid only for UD QPs) */
32 unsigned int wc_flags; /* Flags of the completed WR */
33 uint16_t pkey_index; /* P_Key index (valid only for GSI QPs) */
34 uint16_t slid; /* Source LID */
35 uint8_t sl; /* Service Level */
36 uint8_t dlid_path_bits; /* DLID path bits (not applicable for multicast messages) */
37 };
38
39
40 The attribute wc_flags describes the properties of the work completion.
41 It is either 0 or the bitwise OR of one or more of the following flags:
42
43 IBV_WC_GRH GRH is present (valid only for UD QPs)
44
45 IBV_WC_WITH_IMM Immediate data value is valid
46
47 IBV_WC_WITH_INV Invalidated RKey data value is valid (cannot be com‐
48 bined with IBV_WC_WITH_IMM)
49
50 IBV_WC_IP_CSUM_OK TCP/UDP checksum over IPv4 and IPv4 header checksum
51 are
52 verified. Valid only when device_cap_flags in device_attr indi‐
53 cates current QP is supported by checksum offload.
54
55 Not all wc attributes are always valid. If the completion status is
56 other than IBV_WC_SUCCESS, only the following attributes are valid:
57 wr_id, status, qp_num, and vendor_err.
58
60 On success, ibv_poll_cq() returns a non-negative value equal to the
61 number of completions found. On failure, a negative value is returned.
62
64 Each polled completion is removed from the CQ and cannot be returned to
65 it.
66
67 The user should consume work completions at a rate that prevents CQ
68 overrun from occurrence. In case of a CQ overrun, the async event
69 IBV_EVENT_CQ_ERR will be triggered, and the CQ cannot be used.
70
71 IBV_WC_DRIVER1 will be reported as a response to IBV_WR_DRIVER1 opcode.
72
74 ibv_post_send(3), ibv_post_recv(3)
75
77 Dotan Barak <dotanba@gmail.com>
78
79
80
81libibverbs 2006-10-31 IBV_POLL_CQ(3)