Skip to content

Commit

Permalink
Implement configurable device port MTU.
Browse files Browse the repository at this point in the history
User is now able to set the MTU inside the Network object assigned to
device network port (aka SystemAdapter).
By default (if not set), EVE will set the default MTU size, which
depends on the network adapter type. Ethernet and WiFi adapters
default to 1500 bytes, while cellular modems typically receive
their MTU value from the network provider, which EVE will use
unless the user overrides the MTU value.

For Ethernet and WiFi ports, MTU is applied by NIM microservice.
For cellular modems, MTU is managed by the wwan microservice.

As part of this commit, few changes in the area of config items
of DPC Reconciler were done. For example, PhysIf and IOHandle
were refactored into:
- NetIO: represents existence of a NIC (previously the purpose of PhysIf)
- PhysIf: replacing IOHandle and additionally managing the network
  interface created for the NIC by the kernel (currently only the MTU
  attribute is managed)

Please note that this commit does not include MTU support for network
instances and applications. That part of the MTU support was split and
will be delivered as a separate commit.

Signed-off-by: Milan Lenco <milan@zededa.com>
  • Loading branch information
milan-zededa authored and eriknordmark committed Jun 21, 2024
1 parent 141f6d5 commit 1f5fa9c
Show file tree
Hide file tree
Showing 15 changed files with 730 additions and 365 deletions.
18 changes: 18 additions & 0 deletions docs/DEVICE-CONNECTIVITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,24 @@ SystemAdapter determines the usage of the network port, which is one of:

Network port directly assigned to an application is without SystemAdapter.

### Network Adapter MTU

The user can adjust the Maximum Transmission Unit (MTU) size of a network adapter.
MTU determines the largest IP packet that the underlying link can and is allowed to carry.
A smaller MTU value is often used to avoid packet fragmentation when some form of packet
encapsulation is being applied, while a larger MTU reduces the overhead associated with
packet headers, improves network efficiency, and increases throughput by allowing more
data to be transmitted in each packet (known as a jumbo frame).

EVE uses the L3 MTU, meaning the value does not include the L2 header size (e.g., Ethernet
header or VLAN tag size). The value is a 16-bit unsigned integer, representing the MTU size
in bytes. The minimum accepted value for the MTU is 1280, which is the minimum link MTU
needed to carry an IPv6 packet (see RFC 8200, "IPv6 minimum link MTU"). If the MTU for
a network adapter is not defined (zero value), EVE will set the default MTU size,
which depends on the network adapter type. Ethernet and WiFi adapters default to 1500 bytes,
while cellular modems typically receive their MTU value from the network provider,
which EVE will use unless the user overrides the MTU value.

## Load spreading and failover

Load spreading means that there are two or more similar uplink networks, for instance
Expand Down
127 changes: 0 additions & 127 deletions pkg/pillar/dpcreconciler/genericitems/iohandle.go

This file was deleted.

70 changes: 70 additions & 0 deletions pkg/pillar/dpcreconciler/genericitems/netio.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright (c) 2022 Zededa, Inc.
// SPDX-License-Identifier: Apache-2.0

package genericitems

import (
"fmt"

"github.com/lf-edge/eve-libs/depgraph"
)

// IOUsage : how is network IO being used.
type IOUsage uint8

const (
// IOUsageUnspecified : not specified how the network IO is being used.
IOUsageUnspecified IOUsage = iota
// IOUsageL3Adapter : network IO is used as L3 adapter.
IOUsageL3Adapter
// IOUsageVlanParent : network IO is used as VLAN parent interface.
IOUsageVlanParent
// IOUsageBondAggrIf : network IO is aggregated by Bond interface.
IOUsageBondAggrIf
)

// NetIO : network IO device.
// External item used to represent a presence of a NIC (or lack of it).
type NetIO struct {
// LogicalLabel : interface name used by the controller.
LogicalLabel string
// IfName : Interface name assigned by the OS.
IfName string
}

// Name returns the interface name.
func (n NetIO) Name() string {
return n.IfName
}

// Label returns the logical label.
func (n NetIO) Label() string {
return n.LogicalLabel + " (IO)"
}

// Type of the item.
func (n NetIO) Type() string {
return NetIOTypename
}

// Equal is a comparison method for two equally-named NetIO instances.
// It is NOOP, no attributes to compare.
func (n NetIO) Equal(depgraph.Item) bool {
return true
}

// External returns true because we learn about a presence of a network IO device
// through the NetworkMonitor.
func (n NetIO) External() bool {
return true
}

// String describes the network IO device.
func (n NetIO) String() string {
return fmt.Sprintf("Network IO device: %#+v", n)
}

// Dependencies returns nothing (external item).
func (n NetIO) Dependencies() (deps []depgraph.Dependency) {
return nil
}
56 changes: 0 additions & 56 deletions pkg/pillar/dpcreconciler/genericitems/physif.go

This file was deleted.

1 change: 0 additions & 1 deletion pkg/pillar/dpcreconciler/genericitems/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ func RegisterItems(log *base.LogObject, registry *reconciler.DefaultRegistry,
t string
}
configurators := []configurator{
{c: &IOHandleConfigurator{Log: log}, t: IOHandleTypename},
{c: &DhcpcdConfigurator{Log: log}, t: DhcpcdTypename},
{c: &ResolvConfConfigurator{Log: log}, t: ResolvConfTypename},
{c: &SSHAuthKeysConfigurator{Log: log}, t: SSHAuthKeysTypename},
Expand Down
9 changes: 5 additions & 4 deletions pkg/pillar/dpcreconciler/genericitems/typenames.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
package genericitems

const (
// IOHandleTypename : typename for network interface handle.
IOHandleTypename = "IO-Handle"
// NetIOTypename : typename for network IO device.
NetIOTypename = "Network-IO"
// PhysIfTypename : typename for physical network interfaces.
// Not implemented in genericitems (implementation specific to network stack).
PhysIfTypename = "Physical-Interface"
// AdapterTypename : typename for network adapters
// Not implemented in genericitems (implementation specific to network stack).
AdapterTypename = "Adapter"
Expand All @@ -19,8 +22,6 @@ const (
BondTypename = "Bond"
// DhcpcdTypename : typename for dhcpcd program (a DHCP and DHCPv6 client).
DhcpcdTypename = "DHCP-Client"
// PhysIfTypename : typename for physical network interfaces.
PhysIfTypename = "Physical-Interface"
// ResolvConfTypename : typename for singleton item representing resolv.conf.
ResolvConfTypename = "Resolv-Conf"
// IPv4RouteTypename : typename for IPv4 route.
Expand Down
Loading

0 comments on commit 1f5fa9c

Please sign in to comment.