github ↗
docs menu

Module Rig_mlx5_abi.Entry

A work entry is one operation of a queue pair's send ring.

Every entry here takes one basic block of Entry.size bytes, so that no entry wraps around the ring's end. Entry i of a ring of n entries is at byte 64 * (i mod n).

#val size : int

size is 64, the bytes of a basic block.

#type local = {
  1. #address : int;
    (*

    The address the NIC knows the first byte by.

    *)
  2. #bytes : int;
    (*

    The length, in bytes.

    *)
  3. #key : int;
    (*

    The local key of the region that holds it.

    *)
}

The type for memory this process registered with its NIC.

#type remote = {
  1. #address : int;
    (*

    The address the peer's NIC knows the first byte by.

    *)
  2. #key : int;
    (*

    The remote key of the peer's region that holds it.

    *)
}

The type for memory a peer registered with its NIC.

#type op =
  1. #| Write of {
    1. #src : local;
    2. #dst : remote;
    }
    (*

    Write {src; dst} copies src.bytes bytes from src to dst.

    *)
  2. #| Write_inline of {
    1. #data : string;
    2. #dst : remote;
    }
    (*

    Write_inline {data; dst} copies data, which the entry holds, to dst. The NIC reads no memory of this process for it.

    *)
  3. #| Read of {
    1. #src : remote;
    2. #dst : local;
    }
    (*

    Read {src; dst} copies dst.bytes bytes from src to dst. It reads what the writes posted before it on its queue pair wrote.

    *)
  4. #| Send of {
    1. #src : local;
    }
    (*

    Send {src} sends the src.bytes bytes of src to the peer, whose NIC lands them in the oldest receive the peer posted.

    *)

The type for operations.

#type t = {
  1. #op : op;
  2. #signal : bool;
    (*

    The NIC writes a completion once the entry completes. It writes one for a failed entry whatever signal says.

    *)
}

The type for work entries.

#val max_inline : int

max_inline is 28, the most bytes a Write_inline carries in one basic block.

#val write : buffer -> int -> qp:int -> index:int -> t -> unit

write b at ~qp ~index e writes e in the size bytes of b at byte at, as entry number index of queue pair number qp. index is the ring's producer count before the entry, and the NIC reads its low 16 bits.

Raises Invalid_argument if:

  • the bytes are not in b, or at is not a multiple of size;
  • qp is not in [0;2{^24}-1], or index is negative;
  • a length is not in [0;2{^31}-1], a key is not in [0;2{^32}-1], or an address is negative;
  • a Write_inline carries more than max_inline bytes.