⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

SriovDevice

Struct SriovDevice 

Source
pub struct SriovDevice {
    pub pf_address: PciAddress,
    pub capability: SriovCapability,
    pub vfs: Vec<VirtualFunction>,
    pub vfs_enabled: bool,
}
Expand description

An SR-IOV physical function with its virtual functions

Fields§

§pf_address: PciAddress

PCI address of the physical function

§capability: SriovCapability

Parsed SR-IOV capability

§vfs: Vec<VirtualFunction>

Virtual functions

§vfs_enabled: bool

Whether VFs are currently enabled

Implementations§

Source§

impl SriovDevice

Source

pub fn new(pf_address: PciAddress, capability: SriovCapability) -> Self

Create a new SR-IOV device from a PF and capability

Source

pub fn parse_capability( pf_address: PciAddress, data: &[u8], offset: u16, ) -> Result<Self, VmError>

Parse capability from config space data

Source

pub fn enable_vfs(&mut self, num_vfs: u16) -> Result<(), VmError>

Enable VFs (creates VF entries)

Source

pub fn disable_vfs(&mut self)

Disable all VFs

Source

pub fn assign_vf(&mut self, vf_index: u16, vm_id: u32) -> Result<(), VmError>

Assign a VF to a VM

Source

pub fn unassign_vf(&mut self, vf_index: u16) -> Result<(), VmError>

Unassign a VF from its VM

Source

pub fn vf(&self, vf_index: u16) -> Option<&VirtualFunction>

Get a VF by index

Source

pub fn num_enabled_vfs(&self) -> usize

Get number of enabled VFs

Source

pub fn num_assigned_vfs(&self) -> usize

Get number of assigned VFs

Source

pub fn available_vfs(&self) -> Vec<u16>

List available (unassigned) VFs

Auto Trait Implementations§

§

impl Freeze for SriovDevice

§

impl RefUnwindSafe for SriovDevice

§

impl Send for SriovDevice

§

impl Sync for SriovDevice

§

impl Unpin for SriovDevice

§

impl UnwindSafe for SriovDevice

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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.
§

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

Performs the conversion.