Skip to main content

select_optimal_ibv_devices

Function select_optimal_ibv_devices 

Source
pub fn select_optimal_ibv_devices<I: IbvDeviceImpl>(
    location: MemoryLocation,
) -> Result<Vec<IbvDeviceInfo>>
Expand description

The NIC(s) of backend I with the best path to location, ranked by PciPath::is_better_than (most local, then highest port-capped bandwidth) and returning all that tie for best.

A NIC that cannot be ranked – no ACTIVE port, unresolvable PCI address – is logged and skipped, so a host with no usable NIC yields an empty list rather than an error. Errors are reserved for a memory location that cannot be resolved at all, which no NIC could have compensated for.

A NIC’s path bandwidth is the lesser of its PCIe-chain bottleneck and its RDMA port speed. Results are cached per (backend, location), empty ones included, since the PCI/NUMA topology is fixed for the process lifetime. A host whose links are all down at the first call therefore keeps an empty answer for the rest of the process.

The NICs come back in lexicographic order by name, per [compute_optimal_ibv_devices]; the cache hands back the same order. Callers rely on it to agree with their peers on which of several tied NICs to use without exchanging anything.