Blob Blame History Raw
From 6a3afa1a7e302ae414fbfa64b3da281aa56d64ed Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Wed, 23 Mar 2022 17:34:12 +0100
Subject: [PATCH] udev/net_id: avoid slot based names only for single function
 devices

If we have two or more devices that share the same slot but they are
also multifunction then it is OK to use the slot information even if it
is the same for all of them. Name conflict will be avoided because we
will append function number and form names like, ens1f1, ens1f2...

(cherry picked from commit 66425daf2c68793adf24a48a26d58add8662e83f)

Related: #2138081
---
 man/systemd.net-naming-scheme.xml | 7 ++++++-
 src/shared/netif-naming-scheme.h  | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/man/systemd.net-naming-scheme.xml b/man/systemd.net-naming-scheme.xml
index 8c2017a0ce..e5268be38e 100644
--- a/man/systemd.net-naming-scheme.xml
+++ b/man/systemd.net-naming-scheme.xml
@@ -451,7 +451,12 @@
         <varlistentry>
           <term><constant>rhel-9.0</constant></term>
 
-          <listitem><para>Same as naming scheme <constant>v250</constant>.</para>
+          <listitem><para>Since version <constant>v247</constant> we no longer set
+          <varname>ID_NET_NAME_SLOT</varname> if we detect that a PCI device associated with a slot is a PCI
+          bridge as that would create naming conflict when there are more child devices on that bridge. Now,
+          this is relaxed and we will use slot information to generate the name based on it but only if
+          the PCI device has multiple functions. This is safe because distinct function number is a part of
+          the device name for multifunction devices.</para>
           </listitem>
         </varlistentry>
 
diff --git a/src/shared/netif-naming-scheme.h b/src/shared/netif-naming-scheme.h
index b5fa1f0ef0..fd3ae1b7f5 100644
--- a/src/shared/netif-naming-scheme.h
+++ b/src/shared/netif-naming-scheme.h
@@ -51,7 +51,7 @@ typedef enum NamingSchemeFlags {
         NAMING_V250 = NAMING_V249 | NAMING_XEN_VIF,
         NAMING_V251 = NAMING_V250 | NAMING_BRIDGE_MULTIFUNCTION_SLOT,
         NAMING_V252 = NAMING_V251 | NAMING_DEVICETREE_ALIASES,
-        NAMING_RHEL_9_0 = NAMING_V250,
+        NAMING_RHEL_9_0 = NAMING_V250 | NAMING_BRIDGE_MULTIFUNCTION_SLOT,
 
         EXTRA_NET_NAMING_SCHEMES