Module Rig_mlx5_abi.Completion
A completion is what the NIC writes once a work entry completes or fails.
The completion ring holds m entries of Completion.size bytes, m a power of two. Its consumer count c is how many completions the process read. The next is at byte 64 * (c mod m), and the NIC wrote it once Completion.owned says so.
val size : intsize is 64, the bytes of a completion.
type error = - #
| Local_length(*A local length is wrong.
*) - #
| Local_qp_operation(*The entry is malformed for its queue pair.
*) - #
| Local_protection(*Local memory is outside its region or its keys.
*) - #
| Flushed(*The queue pair failed before the entry ran.
*) - #
| Bad_response(*The peer sent an unexpected response.
*) - #
| Local_access(*The peer's request violated local access rights.
*) - #
| Remote_invalid_request(*The peer refused the request as malformed for its queue pair.
*) - #
| Remote_access(*The peer refused the request's memory or key.
*) - #
| Remote_operation(*The peer could not complete the request.
*) - #
| Retry_exceeded(*The peer acknowledged nothing within the queue pair's retries.
*) - #
| Remote_aborted(*The peer aborted the operation.
*) - #
| Other_error of int(*Another syndrome, by its number.
*)
The type for the reasons an entry failed.
type status = - #
| Done(*An entry of the send ring completed.
*) - #
| Received of int(*A receive took a message of that many bytes, which have landed in its memory.
*) - #
| Failed of {}(*An entry of
*)ringfailed, andvendoris the NIC's own syndrome. - #
| Unexpected of int(*The completion is of a kind that the entries here never make, such as a receive's of a message with immediate data, by its opcode.
*)
The type for the outcomes of entries.
type t = {- #
qp : int;(*The number of the entry's queue pair.
*) - #
index : int;(*The low 16 bits of the entry's number, for an entry of the send ring.
*) - #
status : status;
}The type for completions. The receives of a queue pair complete in the order they were posted.
owned b at ~count ~entries is true iff the completion at byte at of b is the one the NIC wrote for consumer count count of a ring of entries entries: its opcode is valid and its owner bit is bit log2 entries of count. A process must read the completion only after owned returns true, with loads ordered after the one that read the owner bit.
Raises Invalid_argument if the bytes are not in b, count is negative or entries is not a power of two.
read b at is the completion at byte at of b.
Raises Invalid_argument if the bytes are not in b.
invalidate b at marks the completion at byte at of b as one the NIC has not written, so that owned is false for it at every count until the NIC writes it. A new ring's completions are all marked so.
Raises Invalid_argument if the bytes are not in b.