summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
authorEtienne Champetier <e.champetier@ateme.com>2024-07-09 17:53:50 +0200
committerLuca Boccassi <luca.boccassi@gmail.com>2024-07-21 19:36:37 +0200
commit0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb (patch)
tree484f913e22cd46261d549c486dbe0f81c8f944db /src/shared
parenttest: override blocking localed policy in TEST-73-LOCALE (diff)
downloadsystemd-0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb.tar.xz
systemd-0a4ecc54cb9f2d3418b970c51bfadb69c34ae9eb.zip
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 ?).
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/netif-naming-scheme.c1
-rw-r--r--src/shared/netif-naming-scheme.h2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/shared/netif-naming-scheme.c b/src/shared/netif-naming-scheme.c
index 2955b6e8d5..5033566878 100644
--- a/src/shared/netif-naming-scheme.c
+++ b/src/shared/netif-naming-scheme.c
@@ -24,6 +24,7 @@ static const NamingScheme naming_schemes[] = {
{ "v253", NAMING_V253 },
{ "v254", NAMING_V254 },
{ "v255", NAMING_V255 },
+ { "v257", NAMING_V257 },
/* … add more schemes here, as the logic to name devices is updated … */
EXTRA_NET_NAMING_MAP
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index 27461f4ce9..45a5329185 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -43,6 +43,7 @@ typedef enum NamingSchemeFlags {
NAMING_DEVICETREE_ALIASES = 1 << 15, /* Generate names from devicetree aliases */
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 */
/* And now the masks that combine the features above */
NAMING_V238 = 0,
@@ -62,6 +63,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,
EXTRA_NET_NAMING_SCHEMES