Skip to main content

DpdkArgs

Struct DpdkArgs 

Source
pub struct DpdkArgs {
    pub eal_args: String,
    pub ports: Vec<u16>,
    pub ip: Option<Ipv4Addr>,
    pub prefix_len: u8,
    pub gateway: Option<Ipv4Addr>,
    pub peer_ip: Option<Ipv4Addr>,
    pub gateway_mac: Option<String>,
    pub peer_mac: Option<String>,
    pub mtu: usize,
    pub vlan: Option<u16>,
}
Expand description

The --dpdk-* flags’ type, from melin-dpdk; re-exported here because ServerConfig::dpdk is one, so that a caller building a config in code needs no dependency of its own on that crate. The DPDK flags, one per field of NicConfig, for a binary to flatten into its own command line (#[command(flatten)]).

The help here is kept short: what an operator has to know about a flag (why the peer MAC is not optional on a fabric that assigns MACs, why a client beside a node needs an EAL file prefix of its own) is written on the NicConfig field the flag maps onto, once.

nic_config and nic_config_or are the one mapping and the one validation: a binary that requires --dpdk-ip calls the first, one that defaults it the second. A binary that changes a flag’s default for its own command line does so with mut_arg on the arg’s id (the flag’s name, snake-cased: dpdk_eal_args), which is also the id to name in a conflicts_with or requires of its own. The flags’ argument group is DpdkArgs, the struct’s name, as clap names a group: a struct of the binary’s own that flattens this one must be named otherwise.

Default is what parsing an empty command line gives, so a program can build one in code with ..DpdkArgs::default().

Fields§

§eal_args: String

DPDK EAL arguments (space-separated). Example: –dpdk-eal-args=“-l 0-7 –huge-dir /dev/hugepages”. Passed directly to rte_eal_init. Only used when compiled with –features dpdk. The = is required: the value itself starts with a dash, and requiring the joined form keeps a forgotten value from silently swallowing the next flag as the EAL string.

§ports: Vec<u16>

DPDK port IDs (comma-separated). For LACP bonds, pass both VF ports (e.g., “0,1”) so traffic arriving on either bond member is received.

§ip: Option<Ipv4Addr>

IPv4 address for the DPDK interface (e.g., “10.0.0.1”).

§prefix_len: u8

IPv4 prefix length for the DPDK interface. Default: 24.

§gateway: Option<Ipv4Addr>

IPv4 gateway for the DPDK interface (optional, needed for cross-subnet traffic).

§peer_ip: Option<Ipv4Addr>

Peer IPv4 used for the bifurcated rte_flow steering rule. When set, the DPDK port opens in isolated mode and only IPv4 packets sourced from this address are delivered into DPDK queue 0 — everything else stays with the kernel netdev. Required for L3 setups that share the public NIC with the kernel (SSH, etc.).

§gateway_mac: Option<String>

Gateway MAC (aa:bb:cc:dd:ee:ff) seeded into smoltcp for the --dpdk-gateway IP. Required in L3 bifurcated mode because the gateway’s ARP reply would not match the steering rule and would be eaten by the kernel. Source from ip neigh on the host.

§peer_mac: Option<String>

MAC (aa:bb:cc:dd:ee:ff) of the peer this interface dials: the primary named by --replica-of on a replica, the node on a client. Required where the peer’s port keeps a hardware MAC (mlx5 bifurcated, AWS ENI), or the connect times out. Read it from /sys/class/net/<iface>/address on the peer.

§mtu: usize

MTU for the DPDK interface. Use 9000 for jumbo frames (6x fewer TCP segments). Requires switch and PF MTU to be set accordingly.

§vlan: Option<u16>

VLAN ID for hardware VLAN strip/insert. Required in dedicated NIC mode (dpdk-setup-dedicated.sh) where the kernel doesn’t handle VLAN tags. Not needed for SR-IOV mode (the PF handles VLAN tagging).

Implementations§

Source§

impl DpdkArgs

Source

pub fn nic_config(&self) -> Result<NicConfig, DpdkArgsError>

The flags as a NIC configuration, with --dpdk-ip required: what a client calls, which has no address to assume.

Source

pub fn nic_config_or( &self, default_ip: Ipv4Addr, ) -> Result<NicConfig, DpdkArgsError>

The flags as a NIC configuration, with default_ip where no --dpdk-ip was given: what a binary with an address of its own to assume calls (the node’s is NicConfig::default’s).

Source

pub fn first_given(&self) -> Option<&'static str>

The first flag set away from its default, if any, in the order the flags are declared: what a binary that ignores the flags on some run (a client on the kernel transport) refuses, since the operator meant something by it.

Compared against Default, which is the flags’ own defaults: a binary that changes a default with mut_arg cannot use this. A flag given at its default value cannot be told from one not given, and changes nothing; neither does an EAL string of whitespace alone.

Trait Implementations§

Source§

impl Args for DpdkArgs

Source§

fn group_id() -> Option<Id>

Report the ArgGroup::id for this set of arguments
Source§

fn augment_args<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_args_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

impl Clone for DpdkArgs

Source§

fn clone(&self) -> DpdkArgs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DpdkArgs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for DpdkArgs

Source§

fn default() -> DpdkArgs

The flags’ own defaults, which are NicConfig::default’s with no address (the tests hold the three together).

Source§

impl Eq for DpdkArgs

Source§

impl FromArgMatches for DpdkArgs

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<DpdkArgs, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<DpdkArgs, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl PartialEq for DpdkArgs

Source§

fn eq(&self, other: &DpdkArgs) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DpdkArgs

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> OptionalSend for T
where T: Send + ?Sized,

Source§

impl<T> OptionalSync for T
where T: Sync + ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more