networkd: bridge is configured before interfaces are enslaved

Jordi Auge jordi.auge at technica-engineering.de
Thu Dec 21 11:07:57 UTC 2023


Hello,

I'm using systemd 244 on an embedded device, and I'm having a problem when trying to configure the onboard switch via networkd.

The CPU is a TI J7200 SOC, which has a hardware switch. It is configured from linux like a regular bridge, with switchdev.
Basically, you create a br0 interface, bind the device's physical interfaces to it. A driver will pick up that you're actually bridging interfaces belonging to the bridge, and enable the hardware offloading.
The driver will then pick up any configuration done to the software bridge, and forward it to the hardware, so all vlans, QoS rules and such get registered on the hardware.

The problem I'm having is that networkd is registering the vlans on br0 before the physical interfaces are enslaved.

So:
* br0 is created. At this point it's a regular software bridge.
* The physical interfaces are added as links, pending udev initialization
* bridge configuration begins, some vlans are created, and enslaved on the bridge
* udev reports the physical interfaces as initialized
* networkd switches them from pending to initialized
* networkd then enslaves physical interfaces to br0. At this point the driver starts picking up configurations on br0.
* bridge configuration continues

The problem I have here is that in the hardware switch's driver will only pick up any configuration done after the physical interfaces are bound. Everything done before is unknown to the hardware.

So, what would be the correct behaviour here?
The easiest idea that comes to mind is to delay bridge configuration until the physical interfaces are bound. I can configure the network via shell scripts by doing things in this order. Should I patch networkd to add this dependency, or is there a cleaner way?

I know 244 is an old version, and it is a possibility to move to a newer version if that will indeed fix the problem, but I'd like to know if that is the case before committing the resources needed for this update.

__________________________________________________________________
Jordi Augé
Embedded Linux Engineer
Technica Electronics Barcelona
 


More information about the systemd-devel mailing list