RDMA:我如何知道轮询 CQ 后是否响应读取请求?

RDMA: how do I know if a Read request is responded after polling the CQ?

我有N个qps,我会在每个qp中通过send queue发送M个RDMA Read请求。 读取请求由 ibv_post_send() 发送,并使用 ibv_poll_cq().

迭代轮询 cq

问题是,如果我在调用ibv_poll_cq()后得到一些工作完成(WC),我怎么知道WC对应于哪个读取请求?我正在使用可靠连接模式。

当您通过 ibv_post_send() you are using ibv_send_wr 结构发送读取请求时,有 uint64_t wr_id; 您设置的字段

wr_id - A 64 bits value associated with this WR. If a Work Completion will be generated when this Work Request ends, it will contain this value.

然后当 you do ibv_poll_cq() 你传递 ibv_wc 将填充

的结构

wr_id - The 64 bits value that was associated with the corresponding Work Request.