Module Rig_bnxt.Region
A region is memory the NIC writes and reads. It is local to its NIC: a peer's sends write it only through a receive this process posted, and only queue pairs connected to queue pairs of its own NIC read it (Qp.read).
The NIC writes a region in the order of the entries that write it, and the bytes of a receive or a read land in system memory before its completion: they are there once Qp.poll or Qp.wait has taken it. This holds because open_ turns the NIC's relaxed ordering off.
type tThe type for regions.
host nic n is a region over new, zeroed system memory of nic's machine, of n bytes rounded up to the machine's page (Rig_pci.Machine.page), which the process reads and writes with read and write.
Error msg if the machine has no memory for it, as Rig_pci.Function.alloc_dma states, or the firmware refuses it.
Raises Invalid_argument if n <= 0.
pages nic a n is a region over the n bytes at address a of the process, which start on a page of nic's machine (Rig_pci.Machine.page), pinned for nic as Rig_pci.Function.pin pins them until the region is deregistered or nic closes. The NIC reaches the pages that held the bytes when pages ran, whatever the process maps there later.
Error msg if the machine has no room to pin them for nic, the system refuses to pin them, or the firmware refuses the region. A NIC that is not behind an IOMMU takes only memory Rig_pci.Function.alloc_dma gave, and pages of any other memory of the process is Error msg: those pages go back to the system when the process dies, while the NIC may still write them (Rig_pci.Function.pin).
Raises Invalid_argument if n <= 0 or a is not on a page.
device nic runs is a region over another device's memory at runs, (bus address, bytes) pairs in order, such as a GPU's memory behind its BAR. The memory must stay where it is until the region is deregistered.
Error msg if nic is behind an IOMMU, which maps no other device's memory for it, or the firmware refuses it.
Raises Invalid_argument if runs is empty, a run's address is negative, a run's size is not positive, or either is not a multiple of 4096.
read r at n is a copy of the n bytes at offset at of r. The bytes a receive wrote are there once its completion has been taken.
Raises Invalid_argument if the bytes do not lie in r, or r is not of host or is deregistered.
write r at s writes s at offset at of r. A send posted after write returns sends them.
Raises Invalid_argument as read does.
deregister r deregisters r and frees the memory the library allocated for it, the memory host made included, and unpins the memory pages pinned. The NIC reads and writes r no more once deregister returns Ok ().
It is Error msg if the firmware refuses, and so is every call after one that an exception ended. The NIC may then still read and write r's memory, which stays allocated and pinned until close.