GizStack
View .mdOpen in ChatGPTOpen in Claude

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.

gizlang
import * as Rdma from "gizhw:rdma";

Types

Port

gizlang
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: i64
  • state: i64
  • mtu: i64
  • lid: i64
  • width: i64
  • speed: i64
  • linkLayer: i64

RdmaDevice

gizlang
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: string
  • firmware: string
  • guid: u64
  • vendor: i64
  • part: i64
  • hardware: i64
  • ports: Vec<M15.Port>

Functions

parseDevice

gizlang
function parseDevice(data: bytes, name: string, ports: Vec<Port>): RdmaDevice

The device from its ibv_device_attr reply, its name and its ports (the name is not in the struct).

Effects: fail.

portCount

gizlang
function portCount(data: bytes): i64

The number of physical ports in an ibv_device_attr reply.

Effects: fail.

parsePort

gizlang
function parsePort(data: bytes, number: i64): Port

The port from its ibv_port_attr reply, numbered number.

Effects: fail.

devices

gizlang
function devices(sys: System): Vec<RdmaDevice> throws string

The RDMA devices the verbs library lists, with their ports. A device that cannot be opened is left out.

Effects: fail, io.