pub struct Device<'a> { /* private fields */ }Expand description
A reference to an RDMA device.
This type represents a borrowed handle to an RDMA device.
It can be obtained from a DeviceList or a Context.
The reference is valid only as long as the source object (DeviceList or Context)
remains alive.
To perform operations on the device, you must first open it to obtain a Context.
Implementations§
Source§impl Device<'_>
impl Device<'_>
Source§impl<'a> Device<'a>
impl<'a> Device<'a>
Sourcepub fn bind_thread_to_numa(&self) -> Result<()>
pub fn bind_thread_to_numa(&self) -> Result<()>
Bind the calling task (OS thread) to the NUMA node local to this InfiniBand device.
This reads the device’s NUMA node from sysfs (/sys/class/infiniband/<dev>/device/numa_node)
and then applies the affinity using set_numa_node, which calls both numa_run_on_node()
and numa_set_localalloc().
§Errors
Returns an error if:
- The device name is not available (
self.name()isNone). - The sysfs file cannot be read (I/O error).
- The sysfs contents cannot be parsed as an
i32(reported asInvalidData). numa_run_on_node()fails (returns-1and setserrno; returned viaio::Error::last_os_error).
Sourcepub fn bind_thread_to_numa_strict(&self) -> Result<()>
pub fn bind_thread_to_numa_strict(&self) -> Result<()>
Like bind_thread_to_numa, but also sets a strict bind
policy — memory allocations will only be served from the local NUMA node, with no
fallback to other nodes.
§Errors
Same as bind_thread_to_numa.
Trait Implementations§
impl Send for Device<'_>
SAFETY: libibverbs components are thread safe.
impl Sync for Device<'_>
SAFETY: libibverbs components are thread safe.