github ↗
docs menu

Module Rig_mlx5.Cq

A completion queue is a ring where the NIC reports the entries that completed.

#type nic := t
#type t

The type for completion queues.

#val make : nic -> int -> (t, string) Stdlib.result

make nic n is a completion queue of nic with room for n completions, n rounded up to a power of two no smaller than 2. Its queue pairs hold at most that many entries and receives together (Qp.make), so it never overflows.

It is Error msg if the rounded n is more than a completion queue of nic holds, as its kernel driver reports, or more than 224; msg then names the bound. It is also Error msg if the kernel refuses or the process cannot allocate the ring.

Raises Invalid_argument if n < 1.

#val poll : t -> Rig_mlx5_abi.Completion.t option

poll cq is the next completion of cq, which it consumes, or None if the NIC wrote none after those poll consumed.

#val arm : t -> unit

arm cq asks cq's NIC to raise one Completion event at the next completion of cq after those poll consumed.

#val destroy : t -> (unit, string) Stdlib.result

destroy cq destroys cq and frees its ring.

It is Error msg if the kernel refuses, as it does while it keeps a queue pair of cq that it refused to destroy. cq then counts as destroyed and its ring is freed all the same.

Raises Invalid_argument if a queue pair of cq is not destroyed.