Page MenuHomeVyOS Platform

Embedded: Allow ethernet names lanX, wan, sfpX
Open, WishlistPublicFEATURE REQUEST

Description

During experimentations with a BananaPi_R3 as an embedded vyos system, i'm working with some interface names hardcoded into the hardware ARM DTB files that is not easy changeable.
On default board DTB config, the board have these interfaces:

eth0 - 2,5G CPU to DSA switch ic interconnect
eth1 - 2,5G CPU sfp interface

wan  - 1G DSA rj45 interface 1
lan1 - 1G DSA rj45 interface 2
lan2 - 1G DSA rj45 interface 3
lan3 - 1G DSA rj45 interface 4
lan4 - 1G DSA rj45 interface 5
sfp2 - 2,5G DSA sfp interface 6

Most of these ports are connected to a MediaTek MT7531 DSA switch IC that takes care of the port multiplexing on this board.
using wanX* and lanX* interfaces i find quite normal for these embedded systems, and they also do not always have a number after the prefix. eg. a device with just one interface of a given type can be called just lan or wan
using sfpX i've not seen before this system, but it makes sense as they are not normal RJ45 interfaces. there are also references to these interface names in eg. /sys/devices/platform/sfp-[12]/
The two ethX interfaces are normal kernel enumerated interfaces, and all other interface names are hardcoded into the kernel DTB file for this platform.
The eth1 interface should also be named sfp1, and this should be fixable with a udev rule on this system eg.
the same with eth0 as it could be named dsa or something like that (the interface should not be directly configured, but provides statistics for the internal switch to cpu interface
eg:

ACTION=="add", SUBSYSTEM=="net", DRIVERS=="mtk_soc_eth", ENV{OF_FULLNAME}=="/soc/ethernet@15100000/mac@0", NAME="dsa"
ACTION=="add", SUBSYSTEM=="net", DRIVERS=="mtk_soc_eth", ENV{OF_FULLNAME}=="/soc/ethernet@15100000/mac@1", NAME="sfp1"

But then to the issue:

With the default vyos configuration i'm unable to configure other interfaces than ethX and lanX. wan and sfp2 is not able to be configured and will result in an error:

vyos@vyos# set int eth sfp2 desc test
  Invalid Ethernet interface name
  Value validation failed
  Set failed

solving this part could be made by modify the syntax:expression regex in /opt/vyatta/share/vyatta-cfg/templates/interfaces/ethernet/node.def (i've done this in my temporary image)

But i still will not get the interfaces listed inside show int so there are also other places this needs to be updated to show the interfaces everywhere.
There are also references to nic names inside here: https://github.com/vyos/vyos-utils/blob/master/src/iface/list_interfaces.ml#L20-L43

Is it possible to make support for these types of interfaces names upstream in VyOS?
And get all references to these names visible everywhere in the cli?

Details

Difficulty level
Unknown (require assessment)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Unspecified (possibly destroys the router)
Issue type
Unspecified (please specify)

Event Timeline

Does all the interfaces at bananapi represent a hw-id which can be used to map to the ethX syntax of VyOS?

@Apachez no, they are not mapped by hw-id, all mapping of DSA ports are done by the DTB file (Hardware Device Tree) loaded into the kernel. also the enumeration order of cpu ethX interfaces are specified by the DTB file

ahh.. looking at it now it looks like the new upstream DTB uses lanX for all "lan" switchports..

I am against this change, why not use eth0 everywhere? If it's a WAN or LAN port should be user decidable. Please use udev rules to rename those interfaces to eth0...ethXX

Also SFP ports are simple ethernet ports that hold a transceiver (which we already do for any other SFP, SFP+, SFP28 or QSFP card.

I agree, even if its "odd" at first sight I like that all interfaces are named ethX within VyOS and then its a matter to map each to physical interface by hw-id (which is done automagically during first install but can be remapped if wanted).

The problem is if the sfpX, wanX etc wont present a usable hw-id to attach to a specific ethX - how to resolve that?

Viacheslav triaged this task as Wishlist priority.Jan 20 2024, 2:10 AM