int ibv_start_poll(struct ibv_cq_ex *cq,
struct ibv_poll_cq_attr *attr)
Start polling a batch of work completions. attr is given in order
to make this function easily extensible in the future. This function
either returns 0 on success or an error code otherwise. When no
completions are available on the CQ, ENOENT is returned, but the CQ
remains in a valid state. On success, querying the completion's
attribute could be done using the query functions described below. If an
error code is given, end_poll shouldn't be called.
int ibv_next_poll(struct ibv_cq_ex *cq)
This function is called in order to get the next work completion. It has
to be called after start_poll and before end_poll are
called. This function either returns 0 on success or an error code
otherwise. When no completions are available on the CQ, ENOENT is
returned, but the CQ remains in a valid state. On success, querying the
completion's attribute could be done using the query functions described
below. If an error code is given, end_poll should still be called,
indicating this is the end of the polled batch.
void ibv_end_poll(struct ibv_cq_ex *cq)
This function indicates the end of polling batch of work completions.
After calling this function, the user should start a new batch by
calling start_poll.
Below members and functions are used in order to poll the current
completion. The current completion is the completion which the iterator
points to (start_poll and next_poll advances this iterator). Only fields
that the user requested via wc_flags in ibv_create_cq_ex could be queried.
In addition, some fields are only valid in certain opcodes and status
codes.
uint64_t wr_id - Can be accessed directly from struct
ibv_cq_ex.
enum ibv_wc_status - Can be accessed directly from struct
ibv_cq_ex.
enum ibv_wc_opcode ibv_wc_read_opcode(struct ibv_cq_ex
*cq); Get the opcode from the current
completion.
uint32_t ibv_wc_read_vendor_err(struct ibv_cq_ex
*cq); Get the vendor error from the current
completion.
uint32_t ibv_wc_read_byte_len(struct ibv_cq_ex
*cq); Get the vendor error from the current
completion.
uint32_t ibv_wc_read_imm_data(struct ibv_cq_ex
*cq); Get the immediate data field from the
current completion.
uint32_t ibv_wc_read_qp_num(struct ibv_cq_ex
*cq); Get the QP number field from the current
completion.
uint32_t ibv_wc_read_src_qp(struct ibv_cq_ex
*cq); Get the source QP number field from the
current completion.
int ibv_wc_read_wc_flags(struct ibv_cq_ex
*cq); Get the QP flags field from the current
completion.
uint16_t ibv_wc_read_pkey_index(struct ibv_cq_ex
*cq); Get the pkey index field from the current
completion.
uint32_t ibv_wc_read_slid(struct ibv_cq_ex
*cq); Get the slid field from the current
completion.
uint8_t ibv_wc_read_sl(struct ibv_cq_ex
*cq); Get the sl field from the current
completion.
uint8_t ibv_wc_read_dlid_path_bits(struct ibv_cq_ex
*cq); Get the dlid_path_bits field from the
current completion.
uint64_t ibv_wc_read_completion_ts(struct ibv_cq_ex
*cq); Get the completion timestamp from the
current completion.
uint16_t ibv_wc_read_cvlan(struct ibv_cq_ex
*cq); Get the CVLAN field from the current
completion.
uint32_t ibv_wc_read_flow_tag(struct ibv_cq_ex
*cq); Get flow tag from the current
completion.