Compare commits

...

No commits in common. "c8" and "84944470b20046776c4f63250245ce43ae664ef3" have entirely different histories.

11 changed files with 87 additions and 323 deletions

View File

@ -1 +1 @@
a31985f5cc19bd0a2bed7a32567d06f5ec72c0af SOURCES/biosdevname-0.7.3.tar.gz
a31985f5cc19bd0a2bed7a32567d06f5ec72c0af biosdevname-0.7.3.tar.gz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/biosdevname-0.7.3.tar.gz
/biosdevname-*.tar.gz

View File

@ -0,0 +1,33 @@
From db1371e4d22465c27b5ed8d851cea6e72f0176f7 Mon Sep 17 00:00:00 2001
From: rpm-build <rpm-build>
Date: Wed, 21 Mar 2018 18:10:08 +0100
Subject: [PATCH 1/2] Disable biosdevname by default
---
biosdevname.rules.in | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/biosdevname.rules.in b/biosdevname.rules.in
index 0a32aa5..1dcca74 100644
--- a/biosdevname.rules.in
+++ b/biosdevname.rules.in
@@ -12,13 +12,13 @@ ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}"
ENV{UDEV_BIOSDEVNAME}=="0", GOTO="netdevicename_end"
ENV{UDEV_BIOSDEVNAME}=="1", GOTO="netdevicename_start"
-# uncomment the next line for biosdevname to be off by default
-# GOTO="netdevicename_end"
+# off by default
+GOTO="netdevicename_end"
LABEL="netdevicename_start"
# using NAME= instead of setting INTERFACE_NAME, so that persistent
# names aren't generated for these devices, they are "named" on each boot.
-SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace"
+SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --smbios 2.6 --nopirq --policy physical -i %k", NAME="%c" OPTIONS+="string_escape=replace"
LABEL="netdevicename_end"
--
2.14.3

View File

@ -1,14 +1,15 @@
From 6e29eb19cfec3b657eb6ed8121898e80c1c39e6b Mon Sep 17 00:00:00 2001
From 14a0cef248d2996cde90e64ae56d7bdb569b3995 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= <vpavlin@redhat.com>
Date: Mon, 23 Sep 2013 14:05:59 +0200
Subject: [PATCH] Place udev rules to /usr/lib
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
biosdevname.rules.in | 2 +-
configure.ac | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 177f54a..474c064 100644
diff --git a/biosdevname.rules.in b/biosdevname.rules.in
index e26ba98..8c12cb8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,7 +68,7 @@ AC_CHECK_FUNCS([dup2 gettimeofday memset munmap select socket strcasecmp strchr
@ -21,5 +22,5 @@ index 177f54a..474c064 100644
if [[ -e /etc/udev/rules.d/60-net.rules ]]; then
# RHEL 5 / Fedora
--
2.14.3
1.8.3.1

View File

@ -1,27 +0,0 @@
From 4257dbad671fd1080231483c1891f46ed9ea7107 Mon Sep 17 00:00:00 2001
From: Ka-Shu Wong <31426385+kashuwong@users.noreply.github.com>
Date: Fri, 1 Sep 2017 15:33:56 +1000
Subject: [PATCH] Add support for ExaNIC network cards (#5)
ExaNIC cards have multiple physical ports on the same PCI function and
need to be numbered using the dev_port attribute.
---
src/bios_device.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/bios_device.c b/src/bios_device.c
index e9d5177..3cc528b 100644
--- a/src/bios_device.c
+++ b/src/bios_device.c
@@ -221,6 +221,8 @@ int ismultiport(const char *driver)
return 1;
if (!strncmp(driver, "cxgb", 4))
return 1;
+ if (!strncmp(driver, "exanic", 6))
+ return 1;
return 0;
}
--
2.14.3

View File

@ -1,29 +0,0 @@
From d6fa84f8a80d5e1c526fe675c345f709a700e33e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Josef=20M=C3=B6llers?= <josef.moellers@suse.com>
Date: Fri, 20 Jul 2018 08:56:48 +0200
Subject: [PATCH] Prevent infinite recursion in dmidecode.c::smbios_setslot by
(#7)
Checking that subordinate bus has a number greater than the
current bus.
Fixes SUSE bug#1093625
---
src/dmidecode/dmidecode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c
index 1d805bb..a01a6ce 100644
--- a/src/dmidecode/dmidecode.c
+++ b/src/dmidecode/dmidecode.c
@@ -153,7 +153,7 @@ void smbios_setslot(const struct libbiosdevname_state *state,
}
/* Found a PDEV, now is it a bridge? */
- if (pdev->sbus != -1) {
+ if (pdev->sbus != -1 && pdev->sbus > bus) {
smbios_setslot(state, domain, pdev->sbus, -1, -1, type, slot, index, label);
}
}
--
2.17.2

View File

@ -1,187 +0,0 @@
From 8f2d9991d50e09ba9af842fb592b37d0c2021a06 Mon Sep 17 00:00:00 2001
From: dirkjacobus <dirkjacobus@gmail.com>
Date: Sun, 11 Nov 2018 23:29:24 -0800
Subject: [PATCH] Netronome biosdevname support (#8)
* Add support for Netronome netdevices
Netronome netdevices also provide multiple ports through the same
function.
* Set devID with phys_port_name index for nfp devices
Netronome netdevices should rather use the index from the phys_port_name
attribute instead of the dev_port/dev_id
attributes.
* Exclude naming Netronome logical devices
Some drivers, like the Netronome nfp driver, expose logical devices such
as representors and switchdev uplink devices.
There isn't currently a naming scheme for such devices, so exclude them
from the biosdevname naming policy.
Split ports also don't have a naming scheme defined for biosdevname, so
its better to exclude them from naming.
Identification of such devices will always be driver dependent.
At the moment, only 'nfp' driver devices are considered for exclusion.
---
src/bios_device.c | 6 ++++-
src/eths.c | 65 ++++++++++++++++++++++++++++++++++++++++-------
src/eths.h | 6 +++++
3 files changed, 67 insertions(+), 10 deletions(-)
diff --git a/src/bios_device.c b/src/bios_device.c
index 3cc528b..4882513 100644
--- a/src/bios_device.c
+++ b/src/bios_device.c
@@ -214,7 +214,7 @@ static void sort_device_list(struct libbiosdevname_state *state)
list_splice(&sorted_devices, &state->bios_devices);
}
-/* Check for Mellanox/Chelsio drivers */
+/* Check for multiport drivers */
int ismultiport(const char *driver)
{
if (!strncmp(driver, "mlx4", 4))
@@ -223,6 +223,8 @@ int ismultiport(const char *driver)
return 1;
if (!strncmp(driver, "exanic", 6))
return 1;
+ if (!strncmp(driver, "nfp", 3))
+ return 1;
return 0;
}
@@ -248,6 +250,8 @@ static void match_pci_and_eth_devs(struct libbiosdevname_state *state)
/* Ignore if devtype is fcoe */
if (netdev_devtype_is_fcoe(n))
continue;
+ if (!netdev_is_eligible(n))
+ continue;
b = malloc(sizeof(*b));
if (!b)
continue;
diff --git a/src/eths.c b/src/eths.c
index d2c4d36..688c3af 100644
--- a/src/eths.c
+++ b/src/eths.c
@@ -35,21 +35,67 @@ char *pr_ether(char *buf, const int size, const unsigned char *s)
return (buf);
}
-static void eths_get_devid(const char *devname, int *devid)
+static int eths_get_phys_port_name_id(const char *devname)
+{
+ char *portstr = NULL;
+ char path[PATH_MAX];
+ int index = -1;
+
+ /* Only devices that have a phys_port_name of 'pX' are considered here,
+ * with the index 'X' extracted.
+ */
+ snprintf(path, sizeof(path), "/sys/class/net/%s/phys_port_name", devname);
+ if (sysfs_read_file(path, &portstr) == 0) {
+ char *res = NULL;
+
+ if (portstr[0] == 'p') {
+ index = strtol(&portstr[1], &res, 10);
+ /* Reset to invalid if the format is unexpected. */
+ if (*res)
+ index = -1;
+ }
+
+ free(portstr);
+ }
+
+ return index;
+}
+
+static void eths_get_dev_eligible(struct network_device *dev)
+{
+ /* By default, all network devices are eligible for naming. Some may
+ * opt-out explicitly below.
+ */
+ dev->is_eligible = 1;
+
+ if (dev->drvinfo_valid && strcmp(dev->drvinfo.driver, "nfp") == 0) {
+ dev->is_eligible = (eths_get_phys_port_name_id(dev->kernel_name) >= 0 ? 1 : 0);
+ }
+}
+
+static void eths_get_devid(struct network_device *dev)
{
char path[PATH_MAX];
char *devidstr = NULL;
- *devid = -1;
- snprintf(path, sizeof(path), "/sys/class/net/%s/dev_port", devname);
- if (sysfs_read_file(path, &devidstr) == 0) {
- sscanf(devidstr, "%i", devid);
- free(devidstr);
+ dev->devid = -1;
+
+ /* For some drivers, the phys_port_name index, e.g. pX, is the correct
+ * dev ID to use instead of the dev_port attribute.
+ */
+ if (dev->drvinfo_valid && strcmp(dev->drvinfo.driver, "nfp") == 0) {
+ dev->devid = eths_get_phys_port_name_id(dev->kernel_name);
} else {
- snprintf(path, sizeof(path), "/sys/class/net/%s/dev_id", devname);
+ snprintf(path, sizeof(path), "/sys/class/net/%s/dev_port", dev->kernel_name);
if (sysfs_read_file(path, &devidstr) == 0) {
- sscanf(devidstr, "%i", devid);
+ sscanf(devidstr, "%i", &dev->devid);
free(devidstr);
+ } else {
+ snprintf(path, sizeof(path), "/sys/class/net/%s/dev_id", dev->kernel_name);
+ if (sysfs_read_file(path, &devidstr) == 0) {
+ sscanf(devidstr, "%i", &dev->devid);
+ free(devidstr);
+ }
}
}
}
@@ -224,13 +270,14 @@ static void fill_eth_dev(struct network_device *dev)
eths_get_ifindex(dev->kernel_name, &dev->ifindex);
eths_get_hwaddr(dev->kernel_name, dev->dev_addr, sizeof(dev->dev_addr), &dev->arphrd_type);
eths_get_permaddr(dev->kernel_name, dev->perm_addr, sizeof(dev->perm_addr));
- eths_get_devid(dev->kernel_name, &dev->devid);
devtype = eths_get_devtype(dev);
if (devtype > 0)
dev->devtype_is_fcoe = 1;
rc = eths_get_info(dev->kernel_name, &dev->drvinfo);
if (rc == 0)
dev->drvinfo_valid = 1;
+ eths_get_devid(dev);
+ eths_get_dev_eligible(dev);
}
void free_eths(struct libbiosdevname_state *state)
diff --git a/src/eths.h b/src/eths.h
index b695d3d..49e399d 100644
--- a/src/eths.h
+++ b/src/eths.h
@@ -30,6 +30,7 @@ struct network_device {
int devid;
int devtype_is_fcoe;
char *devtype;
+ int is_eligible:1; /* not eligible for naming when 0 */
};
extern void get_eths(struct libbiosdevname_state *state);
@@ -68,4 +69,9 @@ static inline int netdev_arphrd_type_is_eth(const struct network_device *dev)
return (dev->arphrd_type == ARPHRD_ETHER);
}
+static inline int netdev_is_eligible(const struct network_device *dev)
+{
+ return (!!dev->is_eligible);
+}
+
#endif /* __ETHS_H_INCLUDED */
--
2.17.2

View File

@ -1,25 +0,0 @@
From e63b3589e0ded7078b2f02546fc0b0a2a10223be Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Mon, 17 Dec 2018 10:52:51 +0100
Subject: [PATCH] rules: disable pirq and force minimal smbios version
Related: #1623621
---
biosdevname.rules.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/biosdevname.rules.in b/biosdevname.rules.in
index 0a32aa5..105ef5a 100644
--- a/biosdevname.rules.in
+++ b/biosdevname.rules.in
@@ -19,6 +19,6 @@ LABEL="netdevicename_start"
# using NAME= instead of setting INTERFACE_NAME, so that persistent
# names aren't generated for these devices, they are "named" on each boot.
-SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace"
+SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --smbios 2.6 --nopirq --policy physical -i %k", NAME="%c" OPTIONS+="string_escape=replace"
LABEL="netdevicename_end"
--
2.17.2

View File

@ -1,27 +0,0 @@
From c4771922d64cb1540968ab4b5a9bfbe1148cb211 Mon Sep 17 00:00:00 2001
From: Michal Sekletar <msekleta@redhat.com>
Date: Tue, 18 Dec 2018 11:34:56 +0100
Subject: [PATCH] rules: disable biosdevname by default
---
biosdevname.rules.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/biosdevname.rules.in b/biosdevname.rules.in
index 31b003c..1dcca74 100644
--- a/biosdevname.rules.in
+++ b/biosdevname.rules.in
@@ -12,8 +12,8 @@ ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}"
ENV{UDEV_BIOSDEVNAME}=="0", GOTO="netdevicename_end"
ENV{UDEV_BIOSDEVNAME}=="1", GOTO="netdevicename_start"
-# uncomment the next line for biosdevname to be off by default
-# GOTO="netdevicename_end"
+# off by default
+GOTO="netdevicename_end"
LABEL="netdevicename_start"
--
2.17.2

View File

@ -1,9 +1,7 @@
Name: biosdevname
Version: 0.7.3
Release: 2%{?dist}
Release: 9%{?dist}
Summary: Udev helper for naming devices per BIOS names
Group: System Environment/Base
License: GPLv2
URL: http://linux.dell.com/files/%{name}
# SMBIOS only exists on these arches. It's also likely that other
@ -14,16 +12,13 @@ Source0: http://linux.dell.com/files/%{name}/%{name}-%{version}/%{name}-%{versio
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gcc
BuildRequires: pciutils-devel
BuildRequires: zlib-devel
BuildRequires: make
Patch0001: 0001-Add-support-for-ExaNIC-network-cards-5.patch
Patch0002: 0002-Prevent-infinite-recursion-in-dmidecode.c-smbios_set.patch
Patch0003: 0003-Netronome-biosdevname-support-8.patch
Patch0999: 0999-Place-udev-rules-to-usr-lib.patch
Patch1000: 1000-rules-disable-pirq-and-force-minimal-smbios-version.patch
Patch1001: 1001-rules-disable-biosdevname-by-default.patch
Patch1: 0001-Disable-biosdevname-by-default.patch
Patch2: 0002-Place-udev-rules-to-usr-lib.patch
%description
biosdevname in its simplest form takes a kernel device name as an
@ -34,10 +29,10 @@ name (e.g. eth0).
%prep
%setup -q
%autopatch -p1
%autopatch
%build
autoreconf -fiv
autoreconf -fvi
%configure --prefix=%{_prefix}
make %{?_smp_mflags}
@ -45,20 +40,45 @@ make %{?_smp_mflags}
make install install-data DESTDIR=%{buildroot}
%files
%defattr(-,root,root,-)
%doc COPYING README
%{_sbindir}/%{name}
%{_prefix}/lib/udev/rules.d/*.rules
%{_mandir}/man1/%{name}.1*
%changelog
* Mon Dec 17 2018 Michal Sekletár <msekleta@redhat.com> - 0.7.3-2
- make biosdevname optional even on Dell servers (#1623621)
- prevent infinite recursion in smbios_setslot() (#1499458)
- Netronome biosdevname support (#1649036)
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 0.7.3-9
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Fri Mar 23 2018 Michal Sekletar <msekleta@redhat.com> - 0.7.3-1
- rebase to biosdevname 0.7.3
* Thu Apr 15 2021 Mohan Boddu <mboddu@redhat.com> - 0.7.3-8
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Mar 22 2018 Michal Sekletar <msekleta@redhat.com> - 0.7.3-1
- rebase to biosdevname-0.7.3
* Wed Mar 21 2018 Michal Sekletar <msekleta@redhat.com> - 0.7.2-1
- rebase to biosdevname-0.7.2
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
@ -151,6 +171,10 @@ make install install-data DESTDIR=%{buildroot}
- Don't display _vf suffix on NPAR devices with single function
- Fix PCIe/PIRQ slot mapping
<<<<<<< HEAD
=======
>>>>>>> f16
* Thu Apr 21 2011 Praveen K Paladugu <praveen_paladugu@dell.com> - 0.3.8-1
- Add changes to parse VPD structure for device mapping on NPAR devices
- Fix pathname
@ -224,7 +248,7 @@ make install install-data DESTDIR=%{buildroot}
* Fri Sep 21 2007 Matt Domsch <Matt_Domsch@dell.com> 0.2.4-3
- fix manpage entry in files
* Fri Sep 21 2007 Matt Domsch <Matt_Domsch@dell.com> 0.2.4-2
- rebuild with Requires: udev > 115-3.20070920git

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (biosdevname-0.7.3.tar.gz) = 9cd2b7d115d6ee487f4aafa21b00025a3917d3c89489fe70ab3de8aa979158477a1d0b5287101b7cec7200fef0d2f6894a0e6389a174d6f8670dcd7530dc445d