udev-builtin-net_id: add NAMING_DEVICETREE_PORT_ALIASES to check of_node of netdevs before their parents

The net_id builtin only checked the of_node of a netdev's parent device,
not that of the netdev itself. While it is common that netdevs don't have
an OF node assigned themselves, as they are derived from some parent
device, this is not always the case. In particular when a single
controller provides multiple ports that can be referenced indiviually in
the Device Tree (both for aliases/MAC address assignment and phandle
references), the correct of_node will be that of the netdev itself, not
that of the parent, so it needs to be checked, too.

A new naming scheme flag NAMING_DEVICETREE_PORT_ALIASES is added to
allow selecting the new behavior.
This commit is contained in:
Matthias Schiffer
2024-08-15 18:20:49 +02:00
committed by Luca Boccassi
parent 98b86d294a
commit 24c2e04e9a
3 changed files with 23 additions and 10 deletions
+3 -2
View File
@@ -40,10 +40,11 @@ typedef enum NamingSchemeFlags {
NAMING_XEN_VIF = 1 << 13, /* Generate names for Xen netfront devices */
NAMING_BRIDGE_MULTIFUNCTION_SLOT = 1 << 14, /* Use PCI hotplug slot information associated with bridge, but only if PCI device is multifunction.
* This is disabled since v255, as it seems not to work at least for some setups. See issue #28929. */
NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases */
NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases of a netdev's parent's OF node */
NAMING_USB_HOST = 1 << 16, /* Generate names for usb host */
NAMING_SR_IOV_R = 1 << 17, /* Use "r" suffix for SR-IOV VF representors */
NAMING_FIRMWARE_NODE_SUN = 1 << 18, /* Use firmware_node/sun to get PCI slot number */
NAMING_DEVICETREE_PORT_ALIASES = 1 << 19, /* Include aliases of OF nodes of a netdev itself, not just its parent. See PR #33958. */
/* And now the masks that combine the features above */
NAMING_V238 = 0,
@@ -63,7 +64,7 @@ typedef enum NamingSchemeFlags {
* patch later. NAMING_SR_IOV_R is enabled by default in
* systemd version 255, naming scheme "v255". */
NAMING_V255 = NAMING_V254 & ~NAMING_BRIDGE_MULTIFUNCTION_SLOT,
NAMING_V257 = NAMING_V255 | NAMING_FIRMWARE_NODE_SUN,
NAMING_V257 = NAMING_V255 | NAMING_FIRMWARE_NODE_SUN | NAMING_DEVICETREE_PORT_ALIASES,
EXTRA_NET_NAMING_SCHEMES