Enable mlx5 onboard device udev naming

This commit introduces a patch which prioritizes the udev
(re)naming rules for mlx5 controlled devices to take the
onboard device name (if it exists) over the slot/path name.

This is consistent with the naming order used by the StarlingX
installer to create the 70-persistent-net.rules file.

It is also consistent with the naming order in the 99-default.link
file.

Without this patch, there could be an inconsistency with the
70-persistent-net.rules first re-naming the device to its
slot/path name, and then being overridden by the Mellanox specific
82-net-setup-link.rules.

Testing:

- Ensure if a system has mlx onboard devices, that the interfaces
  are named according to the onboard name. (CentOS)
- Note: Since I have depended on a third party with access to a
  (CentOS) system with onboard MLX devices, the Debian portion of
  this patch has been confirmed to build successfully, but not
  functionally tested.

Closes-Bug: 1981831

Signed-off-by: Steven Webster <steven.webster@windriver.com>
Change-Id: I79f308b39debd8e5ffd131bc90262a7ab6345e41
This commit is contained in:
Steven Webster
2022-07-15 11:11:21 -04:00
parent e0bb6f65d7
commit b4f21b2de1
5 changed files with 149 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
From 0eb52f4a2a5d4d041afae205516515c4393fac2f Mon Sep 17 00:00:00 2001
From: Steven Webster <steven.webster@windriver.com>
Date: Mon, 11 Jul 2022 16:16:13 -0400
Subject: [PATCH] Enable mlx5 onboard udev name
Signed-off-by: Steven Webster <steven.webster@windriver.com>
---
SPECS/mlnx-ofa_kernel.spec | 2 ++
1 file changed, 2 insertions(+)
diff --git a/SPECS/mlnx-ofa_kernel.spec b/SPECS/mlnx-ofa_kernel.spec
index 2a1b956..d83da56 100644
--- a/SPECS/mlnx-ofa_kernel.spec
+++ b/SPECS/mlnx-ofa_kernel.spec
@@ -91,6 +91,7 @@ Group: System Environment/Base
Source: %{_basename}-%{_version}.tgz
Source100: modules-load.conf
Patch01: 0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch
+Patch02: 0002-Enable-mlx5-onboard-udev-name.patch
BuildRoot: %{?build_root:%{build_root}}%{!?build_root:/var/tmp/OFED}
Vendor: Mellanox Technologies
Obsoletes: kernel-ib
@@ -267,6 +268,7 @@ mv "$@" source/
mkdir obj
%patch01 -p1
+%patch02 -p1
%build
%if 0%{?rhel} == 7
--
2.29.2

View File

@@ -1,3 +1,4 @@
Support-STX-system-and-introduce-devtoolset-8.patch
mlx5-pci_irq-Use-irq_update_affinity_hint.patch
Ensure-that-modules-are-signed.patch
Enable-mlx5-onboard-udev-name.patch

View File

@@ -0,0 +1,57 @@
From 74ecb6be9dd81ff6a3c28d2d8f9e557cb76009c3 Mon Sep 17 00:00:00 2001
From: Steven Webster <steven.webster@windriver.com>
Date: Thu, 11 Aug 2022 12:32:48 -0400
Subject: [PATCH] Enable mlx5 onboard udev name
This patch prioritizes the udev renaming rule for mlx5 controlled
devices to take the onboard name over the slot/path name.
This is consistent with the 70-persistent-net.rules file written
by the StarlingX installer.
It is also consistent with the naming order in the 99-default.link
file.
Without this patch, there could be an inconsistency with the
70-persistent-net.rules first re-naming the device to its
slot/path name, and then being overridden by the Mellanox specific
82-net-setup-link.rules.
Signed-off-by: Steven Webster <steven.webster@windriver.com>
---
source/ofed_scripts/vf-net-link-name.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/source/ofed_scripts/vf-net-link-name.sh b/source/ofed_scripts/vf-net-link-name.sh
index 65d8a7b..3bf87cc 100755
--- a/source/ofed_scripts/vf-net-link-name.sh
+++ b/source/ofed_scripts/vf-net-link-name.sh
@@ -68,7 +68,9 @@ if [ "$ID_NET_DRIVER" == "mlx5e_rep" ]; then
fi
if [ "$skip" == "0" ]; then
- if [ -n "$ID_NET_NAME_SLOT" ]; then
+ if [ -n "$ID_NET_NAME_ONBOARD" ]; then
+ NAME="${ID_NET_NAME_ONBOARD%%np[[:digit:]]}"
+ elif [ -n "$ID_NET_NAME_SLOT" ]; then
NAME="${ID_NET_NAME_SLOT%%np[[:digit:]]}"
elif [ -n "$ID_NET_NAME_PATH" ]; then
NAME="${ID_NET_NAME_PATH%%np[[:digit:]]}"
@@ -176,9 +178,12 @@ for cnt in {1..2}; do
continue
fi
- parent_path=`get_pci_name $pci ID_NET_NAME_SLOT`
+ parent_path=`get_pci_name $pci ID_NET_NAME_ONBOARD`
if [ -z "$parent_path" ]; then
- parent_path=`get_pci_name $pci ID_NET_NAME_PATH`
+ parent_path=`get_pci_name $pci ID_NET_NAME_SLOT`
+ if [ -z "$parent_path" ]; then
+ parent_path=`get_pci_name $pci ID_NET_NAME_PATH`
+ fi
fi
echo "NAME=${parent_path}_$PORT"
exit
--
2.29.2

View File

@@ -0,0 +1,57 @@
From 74ecb6be9dd81ff6a3c28d2d8f9e557cb76009c3 Mon Sep 17 00:00:00 2001
From: Steven Webster <steven.webster@windriver.com>
Date: Thu, 11 Aug 2022 12:32:48 -0400
Subject: [PATCH] Enable mlx5 onboard udev name
This patch prioritizes the udev renaming rule for mlx5 controlled
devices to take the onboard name over the slot/path name.
This is consistent with the 70-persistent-net.rules file written
by the StarlingX installer.
It is also consistent with the naming order in the 99-default.link
file.
Without this patch, there could be an inconsistency with the
70-persistent-net.rules first re-naming the device to its
slot/path name, and then being overridden by the Mellanox specific
82-net-setup-link.rules.
Signed-off-by: Steven Webster <steven.webster@windriver.com>
---
source/ofed_scripts/vf-net-link-name.sh | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/ofed_scripts/vf-net-link-name.sh b/ofed_scripts/vf-net-link-name.sh
index 65d8a7b..3bf87cc 100755
--- a/ofed_scripts/vf-net-link-name.sh
+++ b/ofed_scripts/vf-net-link-name.sh
@@ -68,7 +68,9 @@ if [ "$ID_NET_DRIVER" == "mlx5e_rep" ]; then
fi
if [ "$skip" == "0" ]; then
- if [ -n "$ID_NET_NAME_SLOT" ]; then
+ if [ -n "$ID_NET_NAME_ONBOARD" ]; then
+ NAME="${ID_NET_NAME_ONBOARD%%np[[:digit:]]}"
+ elif [ -n "$ID_NET_NAME_SLOT" ]; then
NAME="${ID_NET_NAME_SLOT%%np[[:digit:]]}"
elif [ -n "$ID_NET_NAME_PATH" ]; then
NAME="${ID_NET_NAME_PATH%%np[[:digit:]]}"
@@ -176,9 +178,12 @@ for cnt in {1..2}; do
continue
fi
- parent_path=`get_pci_name $pci ID_NET_NAME_SLOT`
+ parent_path=`get_pci_name $pci ID_NET_NAME_ONBOARD`
if [ -z "$parent_path" ]; then
- parent_path=`get_pci_name $pci ID_NET_NAME_PATH`
+ parent_path=`get_pci_name $pci ID_NET_NAME_SLOT`
+ if [ -z "$parent_path" ]; then
+ parent_path=`get_pci_name $pci ID_NET_NAME_PATH`
+ fi
fi
echo "NAME=${parent_path}_$PORT"
exit
--
2.29.2

View File

@@ -1 +1,2 @@
0001-mlx5-pci_irq-Use-irq_update_affinity_hint.patch
0002-Enable-mlx5-onboard-udev-name.patch