ibv_req_notify_cq() - RDMAmojo RDMAmojo

描述

ibv_req_notify_cq() 在完成队列 (CQ) 上请求Completion Notification(完成通知)。
ibv_req_notify_cq() 请求(驱动): 当下一个请求的WC 被添加到CQ,生成一个(能被ibv_get_cq_event() 读取的)通知。(bv_req_notify_cq() requests a notification when the next Work Completion of a requested type is added to the CQ.)

在调用 ibv_req_notify_cq() 之前,存在于 CQ 中的任何WC(工作完成)都不会创建将要用ibv_get_cq_event() 读取的“完成通知”。

(个人理解:调用ibv_req_notify_cq()检查CQ上是否有WC,如果有就生成event(通知)。后面调用ibv_get_cq_event()就能读出event,就知道cq有WC,再调用ibv_poll_cq()从cq中获取WC)

可以请求两种类型的完成事件:
Solicited Completion Event (被动完成事件) - 当对面的send 或 带立即数且设置了Solicited Event 指示(即对端send_flags设置为IBV_SEND_SOLICITED ) 的RDMA write 到来产生一个 “接收成功” or “接收失败”的WC加入到CQ。

Unsolicited Completion Event  (主动完成事件) - 当任何WC(工作完成)添加到 CQ 时发生,无论它是发送还是接收WC(工作完成),以及它是成功还是不成功的工作完成。

(Unsolicited :不请自来的,主动的)

如果一个请求的Completion Notification(完成通知)处于pending(待处理):即调用了 ibv_req_notify_cq() 但没有Completion Notification发生,则继续调用 ibv_req_notify_cq() 对同一个 CQ 请求相同的Completion Notification类型将无效;只会生成一个Completion Notification(完成通知)。只有在“完成通知”发生后,调用 ibv_req_notify_cq() 才会生效。

next completion event的“请求完成通知”(Request Completion Notification)优先于同一 CQ 的 solicited event的“请求完成通知”。

如果对同一个 CQ 多次调用 ibv_req_notify_cq() 并且至少有一个请求将类型设置为下一个完成,则在将下一个“完成”添加到该 CQ 时(即不是为下一个Solicited Completion)生成一个“”完成通知”。

一旦一个“完成通知”发生,如果想要获得更多的“完成通知”,他必须再次调用ibv_req_notify_cq()。

原文:ibv_req_notify_cq() - RDMAmojo RDMAmojo

ibv_req_notify_cq() requests a Completion Notification on a Completion Queue (CQ).

ibv_req_notify_cq() requests a notification when the next Work Completion of a requested type is added to the CQ. Any Work Completions that existed in the CQ before calling ibv_req_notify_cq() will not result in creating a Completion Notification. The Completion Notification will be read using ibv_get_cq_event().

There are two types of Completion Events that can be requested:

  • Solicited Completion Event - Occurs when an incoming Send or RDMA Write with Immediate Data message with the Solicited Event indicator set (i.e. the remote side posted a Send Request with IBV_SEND_SOLICITED set in send_flags) causes a generation of a successful Receive Work Completion or any unsuccessful (either Send of Receive) Work Completion to be added to the CQ.
  • Unsolicited Completion Event - occurs when any Work Completion is added to the CQ, whether it is a Send or Receive Work Completion and whether is it successful or unsuccessful Work Completion.

If a Request Completion Notification is pending, i.e. ibv_req_notify_cq() was called and no Completion Notification occurred, subsequent calls to ibv_req_notify_cq() with the same CQ requesting the same Completion Event type will have no effect; only one Completion Notification will be generated. Calling ibv_req_notify_cq() will have an effect only after the Completion Notification will occur.

A Request Completion Notification for the next completion event takes precedence over a Request Completion Notification for a solicited event completion for the same CQ.

If multiple calls to ibv_req_notify_cq() have been made for the same CQ and at least one of the requests set the type to the next completion, a Completion Notification will be generated when the next Completion is added to that CQ (i.e. not for the next Solicited Completion).

Once a Completion Notification occurred, if one wishes to get more Completions Notification, he has to call ibv_req_notify_cq() again.

参数

Name Direction Description
cq in CQ that was returned from ibv_create_cq()
solicited_only in Type of the requested Completion Notification.

0 The next Completion whether it is Solicited or Unsolicited
otherwise the next Completion is Solicited only or for any unsuccessful Work Completion

 返回值

Value Description
0 On success
errno On failure.
EINVAL Invalid CQ handle

 例子

1) 请求下一次Completion的通知:

struct ibv_cq *cq;if (ibv_req_notify_cq(cq, 0)) {fprintf(stderr, "Error, ibv_req_notify_cq() failed when requested a ""notification for the next completion\n");return -1;
}

2) 请求下一次Solicited Completion的通知:

struct ibv_cq *cq;if (ibv_req_notify_cq(cq, 1)) {fprintf(stderr, "Error, ibv_req_notify_cq() failed when requested a ""notification for the next solicited completion\n");return -1;
}

常见问题

我可以使用 ibv_poll_cq() 读取WC(工作完成),为什么我要使用 ibv_req_notify_cq()?

使用events 处理WC将减少应用程序的 CPU 消耗;您的线程将休眠,直到新的WC将添加到 CQ。

我可以对每个 CQ 调用 ibv_req_notify_cq() 吗?

是的。尽管请记住,请求Solicited Completions的通知 仅对与接收队列相关联的 CQ 有意义。

当 CQ 中有WC(是我已经ask过的type)时,我调用了 ibv_req_notify_cq() 我会收到完成通知吗?
不,你不会。A Completion Notification will be generated for the *next* Completion of the type that you've asked (Solicited or next) that will be added to the CQ *after* you called

我在收到完成通知之前调用了 ibv_req_notify_cq() 几次,这是什么效果?

If all calls to ibv_req_notify_cq() were done when requesting the same Completion type, you will get only one Completion Notification, according to the quested type. If at least one of them requested a Completion Notification for the next Completion, you will get a notification for the next Completion.

我可以要求在将 N 个“完成”添加到 CQ 后收到通知吗
不,这不受支持。

可以让每个添加到 CQ 的“完成”自动获取通知(而不是每次再次调用 ibv_req_notify_cq())?

不,这不受支持。收到通知后,如果想再收到通知,需要再次调用 ibv_req_notify_cq() 。

【verbs】ibv_req_notify_cq()相关推荐

  1. 【verbs】ibv_get_cq_event|ibv_ack_cq_events()

    目录 ibv_get_cq_event 概要 描述 返回值 提示 ibv_ack_cq_events 描述 参数 返回值 例子 常见问题 ibv_get_cq_event ibv_get_cq_eve ...

  2. 【verbs】ibv_get_async_event()

    原文:ibv_get_async_event() - RDMAmojo RDMAmojo 描述 ibv_get_async_event() 读取 RDMA 设备上下文context的下一个异步事件. ...

  3. 【verbs】ibv_create_comp_channel()

    原文:ibv_create_comp_channel() - RDMAmojo RDMAmojo 描述 ibv_create_comp_channel() 为 RDMA 设备上下文创建完成事件通道. ...

  4. 【vbers】ibv_req_notify_cq()

    ibv_req_notify_cq() - RDMAmojo RDMAmojo 描述 ibv_req_notify_cq() 在完成队列 (CQ) 上请求完成通知. 当一个请求的下一个WC添加到 CQ ...

  5. 【RDMA】12. RDMA之Verbs|OFED

    目录 verbs源码 相关名词解释 Verbs API是什么 设计Verbs API的原因 Verbs API所包含的内容 使用Verbs API编写RDMA应用程序 官方示例程序 参考文献 [RDM ...

  6. 【RDMA】RDMA编程 和相关资料

    目录 RDMA的学习环境搭建 RDMA与socket的类比 RDMA编程流程 RDMA编程2 RDMA学习路线总结 简介--什么是rdma 编程环境 推荐编程库 编程参考手册 相关资料和代码参考 rd ...

  7. 【RDMA】RDMA 编程实例(rdma_cm API)

    目录 RDMA编程基础 说明 1. RDMA的学习环境搭建 2. RDMA与socket的类比 3. RDMA服务器的代码流程 main() { } 实例 用法 Makefile 服务端server. ...

  8. 【RDMA】优化 RDMA 代码的提示和技巧

    目录 RDMA性能优化理论依据 二.基础概念背后的硬件执行方式和原理 Memory Region RDMA Verbs Queue Pair 三.RDMA性能优化 3.1 关注地址翻译的性能开销 3. ...

  9. 【推荐】LSI(latent semantic indexing) 完美教程

    [推荐]LSI(latent semantic indexing) 完美教程 "instead of lecturing about SVD I want to show you how t ...

最新文章

  1. $each $position $sort $slice
  2. opencv图像边界的填充
  3. mysql跨服务器查询语句_MySQL 跨服务器访问之-FEDERATED引擎
  4. php读取txt插入数据库,PHP读取TXT文件插入数据库
  5. iReport中序号自增的实现
  6. win7怎么运行linux,win7系统运行linux shell脚本的操作方法
  7. c 语言中浮点数舍入,浮点数在C中舍入,我不明白为什么
  8. 一文带你认识30个重要的数据结构和算法
  9. qt 获取用户缩放_Qt-如何创建随窗口缩放并保持纵横比的图像?
  10. matlab ofdm qpsk,Matlab关于ofdm系统qpsk调制、awgn信道下的仿真
  11. sqli-labs(32-37)
  12. StataIC——线性回归计算个股的β值
  13. 普歌-Vue 封装防刷新考试倒计时组
  14. MySQL远程连接的设置
  15. MySQL基础篇 | 连接查询、子查询(嵌套)
  16. C#中隐藏的15大功能
  17. qt助手服务器超时,hfs网络文件服务器
  18. python 选手比赛模拟
  19. synchronized的偏斜锁,轻量级锁,重量级锁
  20. 机器学习 —— 决策树

热门文章

  1. 三菱plc232数据线驱动下载_西门子PLC与三菱PLC专业横评,选型不再纠结
  2. C3P0数据库连接池的配置
  3. 深度学习框架(如:Pytorch、Tensorflow、Caffe...)
  4. 国产数据库“向未来”
  5. VBA 自定义函数语法
  6. 移动app——“免费”才是王道
  7. 03-Matplotlib数据可视化
  8. 咱中国人必须知道的国学常识
  9. Multiview RGB-D Dataset for Object Instance Detection*(译文)
  10. 后端-数据字典模块开发