Skip to content

Commit

Permalink
Allow user to specify order of network interfaces inside application
Browse files Browse the repository at this point in the history
Currently, when application has both virtual network interfaces
configured and some network devices directly assigned, EVE will first
attach virtual interfaces in the order that follows ACL IDs (a historical
workaround for missing interface order field), followed by directly assigned
network adapters, in the order of the AppInstanceConfig.adapters
list.
To allow the user to specify the order between all application
network interfaces (across both virtual and passthrough devices), we
introduce a new boolean flag enforce_network_interface_order inside the
application instance config and allow the controller to pass the order
requirements for all application network adapters.
For backward compatibility reasons, by default this will be disabled
and the original ordering method will remain in use.

Signed-off-by: Milan Lenco <[email protected]>
  • Loading branch information
milan-zededa committed Nov 20, 2024
1 parent 7ac0c2c commit 1bb9b47
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 0 deletions.
10 changes: 10 additions & 0 deletions proto/config/appconfig.proto
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,16 @@ message AppInstanceConfig {

// Custom resolution applies to VM that is running in FML mode only.
string vm_resolution = 27;

// Enables enforcement of user-defined ordering for network interfaces.
// This applies to both virtual interfaces (specified in the "interfaces" list)
// and directly assigned network adapters (specified in the "adapters" list as items
// of type "PhyIoNetEth", "PhyIoNetWLAN", "PhyIoNetWWAN", and "PhyIoNetEthVF").
// Note: Older versions of EVE may not support enforcing the user-defined order
// of application network interfaces. The controller can check
// ZInfoDevice.api_capability to verify if the configured device supports the
// API capability API_CAPABILITY_ENFORCED_NET_INTERFACE_ORDER.
bool enforce_network_interface_order = 28;
}

message PatchEnvelopeRef {
Expand Down
19 changes: 19 additions & 0 deletions proto/config/devcommon.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,25 @@ message Adapter {
org.lfedge.eve.common.PhyIoType type = 1;
string name = 2; // Short hand name such as "com" from bundle
EthVF eth_vf = 3; // Only relevant for PHY_IO_TYPE_PHY_IO_NET_ETH_VF

// Optionally defines the network interface order relative to other directly assigned
// network devices and virtual network adapters (see "interface_order" in
// NetworkAdapter, file "netconfig.proto").
// Only applies to (assignable) network adapters, i.e. types: "PhyIoNetEth", "PhyIoNetWLAN",
// "PhyIoNetWWAN" and "PhyIoNetEthVF".
// Interface with a lower order value will appear inside the application before
// interface with a higher order value.
// The implementation of this ordering may depend on the hypervisor. For example,
// the hypervisor might virtualize the PCI bus and assign lower PCI addresses to
// interfaces with lower order values.
// Two network interfaces (virtual or physical) assigned to the same application
// cannot share the same order value, except for the value `0`, which represents
// an undefined interface order.
// Since this field was introduced in later versions, older versions of EVE do not
// support user-defined interface ordering. For backward compatibility, the user-defined
// order is applied only if "enforce_network_interface_order" is enabled for the given
// application (see "AppInstanceConfig", file "appconfig.proto").
uint32 interface_order = 4;
}

// Information regarding Virtual Function (VF) customisation
Expand Down
17 changes: 17 additions & 0 deletions proto/config/netconfig.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,23 @@ message NetworkAdapter {
// allow AppInstance to discover other AppInstances
// attached to this network instance. Default is false
bool allow_to_discover = 42;

// Optionally defines the network interface order relative to other virtual
// network adapters and directly assigned network devices (see `interface_order`
// in Adapter, file `devcommon.proto`).
// Interface with a lower order value will appear inside the application before
// interface with a higher order value.
// The implementation of this ordering may depend on the hypervisor. For example,
// the hypervisor might virtualize the PCI bus and assign lower PCI addresses to
// interfaces with lower order values.
// Two network interfaces (virtual or physical) assigned to the same application
// cannot share the same order value, except for the value `0`, which represents
// an undefined interface order.
// Since this field was introduced in later versions, older versions of EVE do not
// support user-defined interface ordering. For backward compatibility, the user-defined
// order is applied only if "enforce_network_interface_order" is enabled for the given
// application (see "AppInstanceConfig", file "appconfig.proto").
uint32 interface_order = 50;
}

message WirelessConfig {
Expand Down
1 change: 1 addition & 0 deletions proto/info/info.proto
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ enum APICapability {
API_CAPABILITY_BOOT_MODE = 7; // Support different boot modes for Edge Applications (VMs)
API_CAPABILITY_MTU = 8; // Allows to set MTU for network adapters and network instances
API_CAPABILITY_ADAPTER_USER_LABELS = 9; // Supports user-defined shared network adapter labels
API_CAPABILITY_ENFORCED_NET_INTERFACE_ORDER = 10; // Is able to enforce the user-defined order of application network interfaces
// Add new values as new EdgeDevConfig API features are implemented
}

Expand Down

0 comments on commit 1bb9b47

Please sign in to comment.