From 83b94d10951d79445f7975bff835a88261c11a4e Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Sep 05 2017 07:19:27 +0000 Subject: import systemd-219-42.el7_4.1 --- diff --git a/SOURCES/0499-Revert-udev-net_id-add-support-for-phys_port_name-at.patch b/SOURCES/0499-Revert-udev-net_id-add-support-for-phys_port_name-at.patch new file mode 100644 index 0000000..8f0ab76 --- /dev/null +++ b/SOURCES/0499-Revert-udev-net_id-add-support-for-phys_port_name-at.patch @@ -0,0 +1,95 @@ +From 6cbd97527f6d33a140072131785547e898ee4c7a Mon Sep 17 00:00:00 2001 +From: Lukas Nykryn +Date: Tue, 15 Aug 2017 12:30:03 +0200 +Subject: [PATCH] Revert "udev: net_id: add support for phys_port_name + attribute (#4506)" + +This reverts commit 192545bc67fed763ac54761ca067b9c2f93ecdd1. + +This caused change of the names for sfc driver. + +Resolves: #1477285 +--- + src/udev/udev-builtin-net_id.c | 24 ++++++------------------ + 1 file changed, 6 insertions(+), 18 deletions(-) + +diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c +index 7c15435..19e1f26 100644 +--- a/src/udev/udev-builtin-net_id.c ++++ b/src/udev/udev-builtin-net_id.c +@@ -38,7 +38,7 @@ + * o[d] -- on-board device index number + * s[f][d] -- hotplug slot index number + * x -- MAC address +- * [P]ps[f][n|d/] ++ * [P]ps[f][d/] + * -- PCI geographical location + * [P]ps[f][u][..][c][i] + * -- USB port number chain +@@ -134,7 +134,7 @@ static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) { + unsigned dev_port = 0; + size_t l; + char *s; +- const char *attr, *port_name; ++ const char *attr; + int idx; + + /* ACPI _DSM -- device specific method for naming a PCI or PCI Express device */ +@@ -161,15 +161,10 @@ static int dev_pci_onboard(struct udev_device *dev, struct netnames *names) { + if (attr) + dev_port = strtol(attr, NULL, 10); + +- /* kernel provided front panel port name for multiple port PCI device */ +- port_name = udev_device_get_sysattr_value(dev, "phys_port_name"); +- + s = names->pci_onboard; + l = sizeof(names->pci_onboard); + l = strpcpyf(&s, l, "o%d", idx); +- if (port_name) +- l = strpcpyf(&s, l, "n%s", port_name); +- else if (dev_port > 0) ++ if (dev_port > 0) + l = strpcpyf(&s, l, "d%d", dev_port); + if (l == 0) + names->pci_onboard[0] = '\0'; +@@ -204,7 +199,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { + unsigned domain, bus, slot, func, dev_id = 0; + size_t l; + char *s; +- const char *attr, *port_name; ++ const char *attr; + struct udev_device *pci = NULL; + char slots[256], str[256]; + _cleanup_closedir_ DIR *dir = NULL; +@@ -225,9 +220,6 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { + } + } + +- /* kernel provided front panel port name for multiple port PCI device */ +- port_name = udev_device_get_sysattr_value(dev, "phys_port_name"); +- + /* compose a name based on the raw kernel's PCI bus, slot numbers */ + s = names->pci_path; + l = sizeof(names->pci_path); +@@ -236,9 +228,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { + l = strpcpyf(&s, l, "p%us%u", bus, slot); + if (func > 0 || is_pci_multifunction(names->pcidev)) + l = strpcpyf(&s, l, "f%d", func); +- if (port_name) +- l = strpcpyf(&s, l, "n%s", port_name); +- else if (dev_id > 0) ++ if (dev_id > 0) + l = strpcpyf(&s, l, "d%d", dev_id); + if (l == 0) + names->pci_path[0] = '\0'; +@@ -288,9 +278,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { + l = strpcpyf(&s, l, "s%d", hotplug_slot); + if (func > 0 || is_pci_multifunction(names->pcidev)) + l = strpcpyf(&s, l, "f%d", func); +- if (port_name) +- l = strpcpyf(&s, l, "n%s", port_name); +- else if (dev_id > 0) ++ if (dev_id > 0) + l = strpcpyf(&s, l, "d%d", dev_id); + if (l == 0) + names->pci_slot[0] = '\0'; diff --git a/SOURCES/76-phys-port-name.conf b/SOURCES/76-phys-port-name.conf new file mode 100644 index 0000000..fe456d0 --- /dev/null +++ b/SOURCES/76-phys-port-name.conf @@ -0,0 +1,2 @@ +install_items+=" /usr/lib/udev/phys-port-name-gen " +install_items+=" /usr/lib/udev/rules.d/76-phys-port-name.rules " diff --git a/SOURCES/76-phys-port-name.rules b/SOURCES/76-phys-port-name.rules new file mode 100644 index 0000000..92bb25a --- /dev/null +++ b/SOURCES/76-phys-port-name.rules @@ -0,0 +1,8 @@ +# do not edit this file, it will be overwritten on update +ACTION!="add", GOTO="phys_port_name_end" +SUBSYSTEM!="net", GOTO="phys_port_name_end" + +DRIVERS=="mlxsw*", ATTR{phys_port_name}=="?*", IMPORT{program}="/usr/lib/udev/phys-port-name-gen %k" +DRIVERS=="rocker", ATTR{phys_port_name}=="?*", IMPORT{program}="/usr/lib/udev/phys-port-name-gen %k" + +LABEL="phys_port_name_end" diff --git a/SOURCES/phys-port-name-gen b/SOURCES/phys-port-name-gen new file mode 100755 index 0000000..abf47cf --- /dev/null +++ b/SOURCES/phys-port-name-gen @@ -0,0 +1,37 @@ +#!/bin/bash + +SYSPATH="/sys/class/net/$1" +DEV_ID=$(<"${SYSPATH}/dev_id") +DEV_PORT=$(<"${SYSPATH}/dev_port") +PHYS_PORT_NAME=$(<"${SYSPATH}/phys_port_name") + +#if PHYS_PORT_NAME is empty we are safe +[ -z "${PHYS_PORT_NAME}" ] && exit 0 + +# On-board index based names +if [ -n "${ID_NET_NAME_ONBOARD}" ]; then + ID_NET_NAME_ONBOARD="${ID_NET_NAME_ONBOARD%d${DEV_PORT}}n${PHYS_PORT_NAME}" +fi + +if [ -n "${DEV_ID}" ]; then + DEV_ID=$(printf "%u" "${DEV_ID}") + if [ "${DEV_ID}" -eq "0" ] && [ -n "${DEV_PORT}" ]; then + # dev_port is decimal string, but we have a bug in net_id and we convert it to integer using base 16 + DEV_ID=$(printf "%u" "0x${DEV_PORT}") + fi +fi + +# PCI hot plug slot number based names +if [ -n "${ID_NET_NAME_SLOT}" ]; then + ID_NET_NAME_SLOT="${ID_NET_NAME_SLOT%d${DEV_ID}}n${PHYS_PORT_NAME}" +fi + +# PCI path based names +if [ -n "${ID_NET_NAME_PATH}" ]; then + ID_NET_NAME_PATH="${ID_NET_NAME_PATH%d${DEV_ID}}n${PHYS_PORT_NAME}" +fi + +[ -n "${ID_NET_NAME_ONBOARD}" ] && echo "ID_NET_NAME_ONBOARD=${ID_NET_NAME_ONBOARD}" +[ -n "${ID_NET_NAME_SLOT}" ] && echo "ID_NET_NAME_SLOT=${ID_NET_NAME_SLOT}" +[ -n "${ID_NET_NAME_PATH}" ] && echo "ID_NET_NAME_PATH=${ID_NET_NAME_PATH}" + diff --git a/SPECS/systemd.spec b/SPECS/systemd.spec index e279859..4dce0a3 100644 --- a/SPECS/systemd.spec +++ b/SPECS/systemd.spec @@ -7,7 +7,7 @@ Name: systemd Url: http://www.freedesktop.org/wiki/Software/systemd Version: 219 -Release: 42%{?dist} +Release: 42%{?dist}.1 # For a breakdown of the licensing, see README License: LGPLv2+ and MIT and GPLv2+ Summary: A System and Service Manager @@ -34,6 +34,9 @@ Source10: org.freedesktop.login1.policy Source11: org.freedesktop.machine1.policy Source12: org.freedesktop.systemd1.policy Source13: org.freedesktop.timedate1.policy +Source14: phys-port-name-gen +Source15: 76-phys-port-name.rules +Source16: 76-phys-port-name.conf # RHEL-specific Patch0001: 0001-kernel-install-add-fedora-specific-callouts-to-new-k.patch @@ -534,6 +537,7 @@ Patch0495: 0495-systemd-notify-Always-pass-a-valid-pid-to-sd_pid_not.patch Patch0496: 0496-sd_pid_notify_with_fds-fix-computing-msg_controllen.patch Patch0497: 0497-rules-move-cpu-hotplug-rule-to-separate-file.patch Patch0498: 0498-Revert-rules-move-cpu-hotplug-rule-to-separate-file.patch +Patch0499: 0499-Revert-udev-net_id-add-support-for-phys_port_name-at.patch %global num_patches %{lua: c=0; for i,p in ipairs(patches) do c=c+1; end; print(c);} @@ -872,6 +876,14 @@ install -m 0644 %{SOURCE6} %{buildroot}%{_sysconfdir}/rsyslog.d/ # Delete LICENSE files from _docdir (we'll get them in as %%license) rm -rf %{buildroot}%{_docdir}/LICENSE* +# Install script and udev rule for adding phys_port_name for mlxsw and rocker drivers +# And put them in dracut +mkdir -p %{buildroot}%{_prefix}/lib/udev/rules.d +install -m 0755 %{SOURCE14} %{buildroot}%{_prefix}/lib/udev/ +install -m 0644 %{SOURCE15} %{buildroot}%{_prefix}/lib/udev/rules.d/ +mkdir -p %{buildroot}%{_prefix}/lib/dracut/dracut.conf.d +install -m 0644 %{SOURCE16} %{buildroot}%{_prefix}/lib/dracut/dracut.conf.d/ + %find_lang %{name} # To avoid making life hard for Rawhide-using developers, don't package the @@ -1385,6 +1397,7 @@ fi %config(noreplace) %{_sysconfdir}/rc.d/rc.local %{_sysconfdir}/rc.local %{_datadir}/systemd/language-fallback-map +%{_prefix}/lib/dracut/dracut.conf.d/76-phys-port-name.conf # Make sure we don't remove runlevel targets from F14 alpha installs, # but make sure we don't create then anew. @@ -1493,6 +1506,10 @@ fi %{_mandir}/man8/systemd-resolved.* %changelog +* Tue Aug 15 2017 Lukas Nykryn - 219-42.1 +- Revert "udev: net_id: add support for phys_port_name attribute (#4506)" (#1477285) +- reintroduce naming based on phys_port_name for mlxsw and rocker via udev rule + * Tue Jun 27 2017 Lukas Nykryn - 219-42 - Revert "rules: move cpu hotplug rule to separate file" (#1465108)