ibv_轮询_请求确认

轮询完成队列 (CQ)。

语法

#include <rdma/verbs.h>
int ibv_poll_cq(struct ibv_cq *cq, int num_entries, struct ibv_wc *wc)

描述

ibv_poll_cq () 函数将轮询变更队列 (CQ) 以获取工作完成情况,并返回 世界 数组中具有完成情况 (或者如果 CQ 包含小于此数目的所有可用完成情况) 的第一个 num_entries 参数。 wc 自变量是指向 <rdma/verbs.h> 文件中定义的 ibv_wc 结构数组的指针。
struct ibv_wc {
uint64_t                wr_id;          /* ID of the completed Work Request (WR) */
enum ibv_wc_status      status;         /* Status of the operation */
enum ibv_wc_opcode      opcode;         /* Operation type specified in the completed WR */
uint32_t                vendor_err;     /* Vendor error syndrome */
uint32_t                byte_len;       /* Number of bytes transferred */
uint32_t                imm_data;       /* Immediate data (in network byte order) */
uint32_t                qp_num;         /* Local QP number of completed WR */
uint32_t                src_qp;         /* Source QP number (remote QP number) of completed 
                                           WR (valid only for UD QPs) */
int                     wc_flags;       /* Flags of the completed WR */
uint16_t                pkey_index;     /* P_Key index (valid only for GSI QPs) */
uint16_t                slid;           /* Source LID */
uint8_t                 sl;             /* Service Level */
uint8_t                 dlid_path_bits; /* DLID path bits (not applicable for multicast 
                                           messages) */
};
wc_flags 属性描述了工作完成的特性。 该标志是 0 其中一个或多个标志的 0 或按位 OR:
IBV_WC_GRH
GRH 存在。
IBV_WC_带免疫功能
即时数据值有效。
并非所有 世界 属性都始终有效。 如果完成状态不是 IBV_WC_SUCCESS ,那么只有 Wr_id状态qp_num供应商错误 属性是有效的。
注: 每个轮询的完成都会从 CQ 中除去,并且无法返回到 CQ。 您必须以防止出现 CQ 过速的速度来使用工作完成。 在 CQ 过速中,将触发异步 IBV_EVENT_CQ_ERR 事件,并且无法使用该 CQ。

输入参数

描述信息
cq 指定 ibv_create_cq 函数中的 ibv_cq 结构。
条目数 指定要返回的最大完成队列条目数 (CQE)。

输出参数

描述信息
wc 指定 CQE 数组。

返回值

成功时, ibv_poll_cq () 函数将返回一个非负值,该值等于找到的完成数。 发生故障时,将返回负值。