pub struct ProtectionDomain<'ctx> { /* private fields */ }
Expand description

A protection domain for a device’s context.

Implementations§

source§

impl<'ctx> ProtectionDomain<'ctx>

source

pub fn create_qp<'pd, 'scq, 'rcq, 'res>( &'pd self, send: &'scq CompletionQueue<'_>, recv: &'rcq CompletionQueue<'_>, qp_type: Type ) -> QueuePairBuilder<'res>
where 'scq: 'res, 'rcq: 'res, 'pd: 'res,

Creates a queue pair builder associated with this protection domain.

send and recv are the device Context to associate with the send and receive queues respectively. send and recv may refer to the same Context.

qp_type indicates the requested Transport Service Type of this QP:

  • IBV_QPT_RC: Reliable Connection
  • IBV_QPT_UC: Unreliable Connection
  • IBV_QPT_UD: Unreliable Datagram

Note that both this protection domain, and both provided completion queues, must outlive the resulting QueuePair.

source

pub fn allocate<T: Sized + Copy + Default>( &self, n: usize ) -> Result<MemoryRegion<T>>

Allocates and registers a Memory Region (MR) associated with this ProtectionDomain.

This process allows the RDMA device to read and write data to the allocated memory. Only registered memory can be sent from and received to by QueuePairs. Performing this registration takes some time, so performing memory registration isn’t recommended in the data path, when fast response is required.

Every successful registration will result with a MR which has unique (within a specific RDMA device) lkey and rkey values. These keys must be communicated to the other end’s QueuePair for direct memory access.

The maximum size of the block that can be registered is limited to device_attr.max_mr_size. There isn’t any way to know what is the total size of memory that can be registered for a specific device.

allocate currently sets the following permissions for each new MemoryRegion:

  • IBV_ACCESS_LOCAL_WRITE: Enables Local Write Access
  • IBV_ACCESS_REMOTE_WRITE: Enables Remote Write Access
  • IBV_ACCESS_REMOTE_READ: Enables Remote Read Access
  • IBV_ACCESS_REMOTE_ATOMIC: Enables Remote Atomic Operation Access (if supported)

Local read access is always enabled for the MR.

§Panics

Panics if the size of the memory region zero bytes, which can occur either if n is 0, or if mem::size_of::<T>() is 0.

§Errors
  • EINVAL: Invalid access value.
  • ENOMEM: Not enough resources (either in operating system or in RDMA device) to complete this operation.

Trait Implementations§

source§

impl<'a> Drop for ProtectionDomain<'a>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<'a> Send for ProtectionDomain<'a>

source§

impl<'a> Sync for ProtectionDomain<'a>

Auto Trait Implementations§

§

impl<'ctx> RefUnwindSafe for ProtectionDomain<'ctx>

§

impl<'ctx> Unpin for ProtectionDomain<'ctx>

§

impl<'ctx> UnwindSafe for ProtectionDomain<'ctx>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.