|
| 1 | + |
| 2 | +// Polling for work completion |
| 3 | + |
| 4 | +int ibv_poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc); |
| 5 | + |
| 6 | +//Work Completion for each entry |
| 7 | + |
| 8 | +struct ibv_wc { |
| 9 | + uint64_t wr_id; // Private context that was posted in the corresponding Work Request |
| 10 | + enum ibv_wc_status status; // The status of the Work Completion |
| 11 | + enum ibv_wc_opcode opcode; // The opcode of the Work Completion |
| 12 | + uint32_t vendor_err; // Vendor specific error syndrome |
| 13 | + uint32_t byte_len; // Number of bytes that were received |
| 14 | + uint32_t imm_data; // Immediate data, in network order, if the flags indicate that such exists |
| 15 | + uint32_t qp_num; // The local QP number that this Work Completion ended in |
| 16 | + uint32_t src_qp; // The remote QP number |
| 17 | + int wc_flags; // Work Completion flags. Or of the following flags: |
| 18 | + |
| 19 | + /* IBV_WC_GRH – Indicator that the first 40 bytes of the receive buffer(s) contain a valid GRH |
| 20 | + IBV_WC_WITH_IMM – Indicator that the received message contains immediate data */ |
| 21 | + |
| 22 | + uint16_t pkey_index; |
| 23 | + uint16_t slid; // For UD QP: the source LID |
| 24 | + uint8_t sl; // For UD QP: the source Service Level |
| 25 | + uint8_t dlid_path_bits; // For UD QP: the destination LID path bits |
| 26 | +}; |
| 27 | + |
| 28 | + |
| 29 | +// typical completion statuses |
| 30 | + |
| 31 | +IBV_WC_SUCCESS – Operation completed successfully |
| 32 | +IBV_WC_LOC_LEN_ERR – Local length error when processing SR or RR |
| 33 | +IBV_WC_LOC_PROT_ERR – Local Protection error; S/G entries doesn’t point to a valid MR |
| 34 | +IBV_WC_WR_FLUSH_ERR – Work Request flush error; it was processed when the QP was in Error state |
| 35 | + |
| 36 | +IBV_WC_RETRY_EXC_ERR – Retry exceeded; the remote QP didn’t send any ACK/NACK, even after |
| 37 | + message retransmission |
| 38 | + |
| 39 | +IBV_WC_RNR_RETRY_EXC_ERR – Receiver Not Ready; a message that requires a Receive Request |
| 40 | + was sent, but isn’t any RR in the remote QP, even after message retransmission |
0 commit comments