gizhw:rdma
RDMA devices through libibverbs (libibverbs.so.1, loaded at run time): each device's name, firmware, node GUID and ids, and each port's state, MTU, LID, link width and speed, and link layer. The struct layouts are those of rdma-core's verbs.h (ibv_device_attr 232 bytes, ibv_port_attr 52 bytes), read by offset; the library's own functions do all the work.
import * as Rdma from "gizhw:rdma";Types
Port
type Port = { number: i64; state: i64; mtu: i64; lid: i64; width: i64; speed: i64; linkLayer: i64; }One port: its number, state (IBV_PORT_* 1 down, 2 init, 3 armed, 4 active), active MTU (IBV_MTU_: 1 to 5 for 256 to 4096 bytes), LID, active width and speed (the IBV_WIDTH_ and IBV_SPEED_* codes), and link layer (IBV_LINK_LAYER_*: 1 InfiniBand, 2 Ethernet).
number:i64state:i64mtu:i64lid:i64width:i64speed:i64linkLayer:i64
RdmaDevice
type RdmaDevice = { name: string; firmware: string; guid: u64; vendor: i64; part: i64; hardware: i64; ports: Vec<Port>; }One RDMA device: its name, firmware version, node GUID, vendor and part ids, hardware revision, and its ports.
name:stringfirmware:stringguid:u64vendor:i64part:i64hardware:i64ports:Vec<M15.Port>
Functions
parseDevice
function parseDevice(data: bytes, name: string, ports: Vec<Port>): RdmaDeviceThe device from its ibv_device_attr reply, its name and its ports (the name is not in the struct).
Effects: fail.
portCount
function portCount(data: bytes): i64The number of physical ports in an ibv_device_attr reply.
Effects: fail.
parsePort
function parsePort(data: bytes, number: i64): PortThe port from its ibv_port_attr reply, numbered number.
Effects: fail.
devices
function devices(sys: System): Vec<RdmaDevice> throws stringThe RDMA devices the verbs library lists, with their ports. A device that cannot be opened is left out.
Effects: fail, io.