pub struct NetPort {
pub host_fd: i32,
pub last_avail_tx: Atomic<u16>,
}Expand description
Host-side plumbing for a VirtioNet instance running under the custom VMM.
Holds the raw socket fd used to exchange L2 frames with the datapath (primary NIC) or the vmnet relay (bridge NIC), plus the TX cursor.
A NetPort is bound once via VirtioNet::bind_port after the host
fd is known (which is after device registration, when the socketpair
has been created). It is kept in an OnceLock on the device so hot-path
methods can read both fields without mutex overhead.
Fields§
§host_fd: i32Raw fd of the host-side socketpair peer. Reads pull inbound frames from the datapath; writes push guest TX frames to the datapath.
last_avail_tx: Atomic<u16>Cursor into the TX avail ring — the last avail index the device has already drained. Wrapping u16 matches the VirtIO spec.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NetPort
impl RefUnwindSafe for NetPort
impl Send for NetPort
impl Sync for NetPort
impl Unpin for NetPort
impl UnsafeUnpin for NetPort
impl UnwindSafe for NetPort
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more