summaryrefslogtreecommitdiffstats
path: root/src/shared/netif-naming-scheme.h
diff options
context:
space:
mode:
authorViktor Mihajlovski <mihajlov@linux.ibm.com>2021-03-18 11:03:34 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-04-02 18:08:23 +0200
commita496a238e8ee66ce25ad13a3f46549b2e2e979fc (patch)
treeddbe9e00775b5ed4ec3bf76f6fda7a6c7b82009c /src/shared/netif-naming-scheme.h
parentMerge pull request #18717 from yuwata/sd-device-monitor-introduce-more-filters (diff)
downloadsystemd-a496a238e8ee66ce25ad13a3f46549b2e2e979fc.tar.xz
systemd-a496a238e8ee66ce25ad13a3f46549b2e2e979fc.zip
udev: fix slot based network names on s390
The s390 PCI driver assigns the hotplug slot name from the function_id attribute of the PCI device using a 8 char hexadecimal format to match the underlying firmware/hypervisor notation. Further, there's always a one-to-one mapping between a PCI function and a hotplug slot, as individual functions can hot plugged even for multi-function devices. As the generic matching code will always try to parse the slot name in /sys/bus/pci/slots as a positive decimal number, either a wrong value might be produced for ID_NET_NAME_SLOT if the slot name consists of decimal numbers only, or none at all if a character in the range from 'a' to 'f' is encountered. Additionally, the generic code assumes that two interfaces share a hotplug slot, if they differ only in the function part of the PCI address. E.g., for an interface with the PCI address dddd:bb:aa.f, it will match the device to the first slot with an address dddd:bb:aa. As more than one slot may have this address for the s390 PCI driver, the wrong slot may be selected. To resolve this we're adding a new naming schema version with the flag NAMING_SLOT_FUNCTION_ID, which enables the correct matching of hotplug slots if the device has an attribute named function_id. The ID_NET_NAME_SLOT property will only be produced if there's a file /sys/bus/pci/slots/<slotname> where <slotname> matches the value of /sys/bus/pci/devices/.../function_id in 8 char hex notation. Fixes #19016 See also #19078
Diffstat (limited to 'src/shared/netif-naming-scheme.h')
-rw-r--r--src/shared/netif-naming-scheme.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index 28cd4e41f2..f719744d56 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -32,6 +32,7 @@ typedef enum NamingSchemeFlags {
NAMING_LABEL_NOPREFIX = 1 << 7, /* Don't prepend ID_NET_LABEL_ONBOARD with interface type prefix */
NAMING_NSPAWN_LONG_HASH = 1 << 8, /* Shorten nspawn interfaces by including 24bit hash, instead of simple truncation */
NAMING_BRIDGE_NO_SLOT = 1 << 9, /* Don't use PCI hotplug slot information if the corresponding device is a PCI bridge */
+ NAMING_SLOT_FUNCTION_ID = 1 << 10, /* Use function_id if present to identify PCI hotplug slots */
/* And now the masks that combine the features above */
NAMING_V238 = 0,
@@ -41,6 +42,7 @@ typedef enum NamingSchemeFlags {
NAMING_V243 = NAMING_V241 | NAMING_NETDEVSIM | NAMING_LABEL_NOPREFIX,
NAMING_V245 = NAMING_V243 | NAMING_NSPAWN_LONG_HASH,
NAMING_V247 = NAMING_V245 | NAMING_BRIDGE_NO_SLOT,
+ NAMING_V249 = NAMING_V247 | NAMING_SLOT_FUNCTION_ID,
_NAMING_SCHEME_FLAGS_INVALID = -EINVAL,
} NamingSchemeFlags;