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: StringDPDK 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: u8IPv4 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: usizeMTU 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
impl DpdkArgs
Sourcepub fn nic_config(&self) -> Result<NicConfig, DpdkArgsError>
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.
Sourcepub fn nic_config_or(
&self,
default_ip: Ipv4Addr,
) -> Result<NicConfig, DpdkArgsError>
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).
Sourcepub fn first_given(&self) -> Option<&'static str>
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
impl Args for DpdkArgs
Source§fn augment_args<'b>(__clap_app: Command) -> Command
fn augment_args<'b>(__clap_app: Command) -> Command
Source§fn augment_args_for_update<'b>(__clap_app: Command) -> Command
fn augment_args_for_update<'b>(__clap_app: Command) -> Command
Command so it can instantiate self via
FromArgMatches::update_from_arg_matches_mut Read moreSource§impl Default for DpdkArgs
impl Default for DpdkArgs
Source§fn default() -> DpdkArgs
fn default() -> DpdkArgs
The flags’ own defaults, which are NicConfig::default’s with no
address (the tests hold the three together).
impl Eq for DpdkArgs
Source§impl FromArgMatches for DpdkArgs
impl FromArgMatches for DpdkArgs
Source§fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<DpdkArgs, Error>
fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<DpdkArgs, Error>
Source§fn from_arg_matches_mut(
__clap_arg_matches: &mut ArgMatches,
) -> Result<DpdkArgs, Error>
fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<DpdkArgs, Error>
Source§fn update_from_arg_matches(
&mut self,
__clap_arg_matches: &ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>
ArgMatches to self.Source§fn update_from_arg_matches_mut(
&mut self,
__clap_arg_matches: &mut ArgMatches,
) -> Result<(), Error>
fn update_from_arg_matches_mut( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>
ArgMatches to self.