Notes about RDMA cmdq
文章目录
本文将mark下RDMA中cmdq(command queue)相关notes。
Host Channel Adapter(HCA) device, HCA device, NIC, NIC device and adapter device are used interchangeably.
Introduction
The HCA command interface is used for:
- configuring the HCA
- the handshake between hardware and system software
- handling (querying, configuring, modifying) HCA objects
The HCA is configured using the command queues. Each function has its own command queues to get commands from its HCA driver.
The command queue is the transport that is used to pass commands to the HCA.
cmdq其实属于一种sq(Send Queue),可以类比于NVMe的admin sq(submission queue)。
对于不同类型的RDMA设备,cmdq的具体实现是存在差异的。
mellanox mlx4 example
mellanox mlx4 cmdq的细节,可以参考spec中的7.14 Command Interface一节。
eRDMA example
Cmdq is the main control plane channel between erdma driver and hardware. After erdma device is initialized, the cmdq channel will be active in the whole lifecycle of this driver.
cmdq命令
eRDMA支持如下命令:
1 | enum CMDQ_RDMA_OPCODE { |
erdma_device_ops
1 | static const struct ib_device_ops erdma_device_ops = { |
struct ib_device_ops - InfiniBand device operations, 其实是内核与cmdq的交互接口。以alloc_mr为例,用户态下发创建Memory Region的请求到内核,此时erdma_ib_alloc_mr就会被调用。
1 | erdma_ib_alloc_mr |
最终,eRDMA driver会往cmdq中下发CMDQ_OPCODE_REG_MR命令来创建Memory Region。
erdma_post_cmd_wait
1 | erdma_post_cmd_wait |
cmdq初始化
1 | erdma_probe |
cmdq中断通知
Q: cmdq已经有cq了,为什么还需要eq(CEQ0)?
A: 如果只有cq,就只能用轮询模式了,加上ceq之后,cmdq与eq配合就能完成中断通知。
1 | static irqreturn_t erdma_comm_irq_handler(int irq, void *data) |
1 | erdma_cmdq_completion_handler |
cmdq相关寄存器
1 | ... |
参考资料: