github ↗
docs menu

Module Rig_mlx5_abi.Uar

An access region (UAR) is a page of the NIC through which a process rings doorbells.

The kernel gives a process access regions as system pages it maps from the NIC's device file, and a system page holds per_page access regions of 4096 bytes. Each access region has 4 doorbell registers, numbered across the system pages a process maps, so register r is in access region r / 4.

#val per_region : int

per_region is 4, the doorbell registers of an access region.

#val mapping : page:int -> int -> int

mapping ~page i is the offset in the NIC's device file of system page i of the process's access regions, mapped uncached, on a host whose pages are page bytes.

Raises Invalid_argument if i is not in [0;255] or page is not a positive power of two.

#val register : per_page:int -> size:int -> int -> int * int

register ~per_page ~size r is the system page and the byte offset in it of doorbell register r, with per_page access regions per system page and registers of size bytes. A queue pair's doorbell is 8 bytes stored at that offset.

Raises Invalid_argument if r is negative, r mod 4 is 2 or 3 (registers a process never rings), per_page < 1 or size < 0.

#val cq_doorbell : int

cq_doorbell is the byte offset in an access region of the register a process stores Doorbell.arm in.