3 .TH IBV_POLL_CQ 3 2006-10-31 libibverbs "Libibverbs Programmer's Manual"
5 ibv_poll_cq \- poll a completion queue (CQ)
8 .B #include <infiniband/verbs.h>
10 .BI "int ibv_poll_cq(struct ibv_cq " "*cq" ", int " "num_entries" ,
11 .BI " struct ibv_wc " "*wc" );
17 for work completions and returns the first
19 (or all available completions if the CQ contains fewer than this number) in the array
23 is a pointer to an array of ibv_wc structs, as defined in <infiniband/verbs.h>.
28 uint64_t wr_id; /* ID of the completed Work Request (WR) */
29 enum ibv_wc_status status; /* Status of the operation */
30 enum ibv_wc_opcode opcode; /* Operation type specified in the completed WR */
31 uint32_t vendor_err; /* Vendor error syndrome */
32 uint32_t byte_len; /* Number of bytes transferred */
33 uint32_t imm_data; /* Immediate data (in network byte order) */
34 uint32_t qp_num; /* Local QP number of completed WR */
35 uint32_t src_qp; /* Source QP number (remote QP number) of completed WR (valid only for UD QPs) */
36 int wc_flags; /* Flags of the completed WR */
37 uint16_t pkey_index; /* P_Key index (valid only for GSI QPs) */
38 uint16_t slid; /* Source LID */
39 uint8_t sl; /* Service Level */
40 uint8_t dlid_path_bits; /* DLID path bits (not applicable for multicast messages) */
46 The attribute wc_flags describes the properties of the work completion.
47 It is either 0 or the bitwise OR of one or more of the following flags:
50 .B IBV_WC_GRH \fR GRH is present (valid only for UD QPs)
52 .B IBV_WC_WITH_IMM \fR Immediate data value is valid
56 attributes are always valid. If the completion status is other than
58 only the following attributes are valid: wr_id, status, qp_num, and vendor_err.
62 returns a non-negative value equal to the number of completions
63 found. On failure, a negative value is returned.
66 Each polled completion is removed from the CQ and cannot be returned to it.
68 The user should consume work completions at a rate that prevents CQ
69 overrun from occurrence. In case of a CQ overrun, the async event
71 will be triggered, and the CQ cannot be used.
73 .BR ibv_post_send (3),
77 Dotan Barak <dotanb@mellanox.co.il>