pub struct XdpConfig {
pub enabled: bool,
pub bpf_object_path: PathBuf,
pub interface: String,
pub port: u16,
pub attach_mode: XdpAttachMode,
pub cpu_queue_size: u32,
pub collect_stats: bool,
pub fallback_on_error: bool,
}Expand description
Configuration for XDP network optimization.
Fields§
§enabled: boolEnable XDP (requires root or CAP_NET_ADMIN).
bpf_object_path: PathBufPath to compiled BPF object file.
interface: StringNetwork interface to attach to (e.g., “eth0”).
port: u16UDP port for filtering.
attach_mode: XdpAttachModeXDP attach mode.
cpu_queue_size: u32Queue size per CPU for XDP redirect.
collect_stats: boolEnable XDP statistics collection.
fallback_on_error: boolFallback gracefully if XDP unavailable.
Implementations§
Source§impl XdpConfig
impl XdpConfig
Sourcepub fn auto() -> Self
pub fn auto() -> Self
Create configuration with automatic detection.
Detects system capabilities and generates an optimal configuration:
- Enables XDP only on Linux 4.8+ with the xdp feature
- Prefers native mode on Linux 5.3+, falls back to generic mode
- Sizes CPU queues based on available memory
§Note
XDP requires additional setup (BPF object file, CAP_NET_ADMIN capability)
that cannot be auto-detected. This method sets enabled: false by default;
call .enabled(true) on the builder to enable XDP after ensuring
prerequisites are met.
§Example
use laminar_core::xdp::XdpConfig;
let config = XdpConfig::auto();
println!("XDP available: {}", config.xdp_available());Sourcepub fn xdp_available() -> bool
pub fn xdp_available() -> bool
Check if XDP is available on this system.
Returns true if the kernel supports XDP and the feature is enabled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XdpConfig
impl RefUnwindSafe for XdpConfig
impl Send for XdpConfig
impl Sync for XdpConfig
impl Unpin for XdpConfig
impl UnwindSafe for XdpConfig
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.