本文将mark下RDMA中的Event Queue机制。 Host Channel Adapter(HCA) device, HCA device, NIC, NIC device and adapter device are used interchangeably.
Introduction
HCA has multiple sources that can generate events (completion events, asynchronous events/ errors). Once an event is generated internally, it can be reported to the host software via the Event Queue mechanism. The EQ is a memory-resident circular buffer used by hardware to write event cause information for consumption by the host software. Once event reporting is enabled, event cause information is written by hardware to the EQ when the event occurs. If EQ is armed, HW will subsequently generate an interrupt on the device interface (send MSI-X message or assert the pin) as configured in the EQ.
Q3: CQ与EQ是如何绑定的? A3: While creating a CQ, software configures the EQ number to which this CQ will report completion events.
eRDMA example
Event queue (EQ) is the main notification way from erdma hardware to its driver. Each erdma device contains 2 kinds EQs: asynchronous EQ (AEQ) and completion EQ (CEQ). Per device has 1 AEQ, which used for RDMA async event report, and max to 32 CEQs (numbered for CEQ0 to CEQ31). CEQ0 is used for cmdq completion event report, and the rest CEQs are used for RDMA completion event report.
staticintmlx4_eq_int(struct mlx4_dev *dev, struct mlx4_eq *eq) { structmlx4_priv *priv = mlx4_priv(dev); structmlx4_eqe *eqe; int cqn; int eqes_found = 0; int set_ci = 0; int port; int slave = 0; int ret; int flr_slave; u8 update_slave_state; int i; enum slave_port_gen_event gen_event; unsignedlong flags; structmlx4_vport_state *s_info; int eqe_size = dev->caps.eqe_size;
while ((eqe = next_eqe_sw(eq, dev->caps.eqe_factor, eqe_size))) { /* * Make sure we read EQ entry contents after we've * checked the ownership bit. */ dma_rmb();