]> git.ipfire.org Git - thirdparty/systemd.git/commit
udev-builtin-net_id: use firmware_node/sun for ID_NET_NAME_SLOT
authorEtienne Champetier <e.champetier@ateme.com>
Tue, 9 Jul 2024 15:53:50 +0000 (11:53 -0400)
committerLuca Boccassi <luca.boccassi@gmail.com>
Sun, 21 Jul 2024 17:36:37 +0000 (18:36 +0100)
commit0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb
tree484f913e22cd46261d549c486dbe0f81c8f944db
parent7b5c38a91def6cf236605010a0a93a1cd4c137e9
udev-builtin-net_id: use firmware_node/sun for ID_NET_NAME_SLOT

pci_get_hotplug_slot() has the following limitations:
- if slots are not hotpluggable, they are not in /sys/bus/pci/slots.
- the address at /sys/bus/pci/slots/X/addr doesn't contains the function part,
  so on some system, 2 different slots with different _SUN end up with the same
  hotplug_slot, leading to naming conflicts.
- it tries all parent devices until it finds a slot number, which is incorrect,
  and what led to NAMING_BRIDGE_MULTIFUNCTION_SLOT being disabled.

The use of PCI hotplug to find the slot (ACPI _SUN) was introduced in
https://github.com/systemd/systemd/commit/0035597a30d120f70df2dd7da3d6128fb8ba6051
"udev: net_id - export PCI hotplug slot names" on 2012/11/26.
At the same time on the kernel side we got
https://github.com/torvalds/linux/commit/bb74ac23b10820d8722c3e1f4add9ef59e703f63
"ACPI: create _SUN sysfs file" on 2012/11/16.

Using PCI hotplug was the only way at the time, but now 12 years later we can use
firmware_node/sun sysfs file.
Looking at a small selection of server HW, for HPE (Gen10 DL325), the _SUN is attached
to the NIC device, whereas for Dell (R640/R6515/R6615) and Cisco (UCSC-C220-M5SX),
the _SUN is on the first parent pcieport.

We still fallback to pci_get_hotplug_slot() to handle the s390 case and
maybe some other coner cases (_SUN on grand parent device that is not a
bridge ?).
man/systemd.net-naming-scheme.xml
src/shared/netif-naming-scheme.c
src/shared/netif-naming-scheme.h
src/udev/udev-builtin-net_id.c