Skip to content

Commit

Permalink
Merge pull request #1149 from nmorey/dev/master/modprobe
Browse files Browse the repository at this point in the history
suse tweaks
  • Loading branch information
rleon committed Mar 10, 2022
2 parents f8d7f42 + c18c918 commit 49f5693
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 16 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ set(IBDIAG_NODENAME_MAP_PATH "${CMAKE_INSTALL_FULL_SYSCONFDIR}/rdma/ib-node-name

set(CMAKE_INSTALL_INITDDIR "${CMAKE_INSTALL_SYSCONFDIR}/init.d"
CACHE PATH "Location for init.d files")
set(CMAKE_INSTALL_MODPROBEDIR "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/"
CACHE PATH "Location for modprobe.d files")
set(CMAKE_INSTALL_SYSTEMD_SERVICEDIR "${CMAKE_INSTALL_PREFIX}/lib/systemd/system"
CACHE PATH "Location for systemd service files")
set(CMAKE_INSTALL_SYSTEMD_BINDIR "/lib/systemd"
Expand Down
5 changes: 4 additions & 1 deletion buildlib/cbuild
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,10 @@ class leap(ZypperEnvironment):

class tumbleweed(ZypperEnvironment):
docker_parent = "opensuse/tumbleweed:latest";
pkgs = (leap.pkgs ^ {"valgrind-devel"}) | {"valgrind-client-headers"};
pkgs = (leap.pkgs ^ {"valgrind-devel"}) | {
"valgrind-client-headers",
"perl"
};
name = "tumbleweed";
specfile = "suse/rdma-core.spec";
rpmbuild_options = [ "--without=curlmini" ];
Expand Down
2 changes: 1 addition & 1 deletion providers/ipathverbs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ rdma_provider(ipathverbs
)

rdma_subst_install(FILES "truescale.conf.in"
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/"
DESTINATION "${CMAKE_INSTALL_MODPROBEDIR}/"
RENAME "truescale.conf")
install(FILES truescale-serdes.cmds
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}"
Expand Down
2 changes: 1 addition & 1 deletion providers/mlx4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ publish_headers(infiniband
mlx4dv.h
)

install(FILES "mlx4.conf" DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/modprobe.d/")
install(FILES "mlx4.conf" DESTINATION "${CMAKE_INSTALL_MODPROBEDIR}/")

rdma_pkg_config("mlx4" "libibverbs" "${CMAKE_THREAD_LIBS_INIT}")
51 changes: 38 additions & 13 deletions suse/rdma-core.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# spec file for package rdma-core
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
Expand All @@ -21,12 +21,17 @@
%define with_static %{?_with_static: 1} %{?!_with_static: 0}
%define with_pyverbs %{?_with_pyverbs: 1} %{?!_with_pyverbs: 0}

%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150300
# systemd-rpm-macros is wrong in 15.3 and below
%define _modprobedir /lib/modprobe.d
%endif

%define git_ver %{nil}
Name: rdma-core
Version: 40.0
Release: 0
Summary: RDMA core userspace libraries and daemons
License: GPL-2.0-only OR BSD-2-Clause
License: BSD-2-Clause OR GPL-2.0-only
Group: Productivity/Networking/Other

%define efa_so_major 1
Expand All @@ -45,21 +50,27 @@ Group: Productivity/Networking/Other
%define mlx4_lname libmlx4-%{mlx4_so_major}
%define mlx5_lname libmlx5-%{mlx5_so_major}

%ifnarch s390 %arm
%ifnarch s390 %arm riscv64
%define dma_coherent 1
%endif

%global modprobe_d_files 50-libmlx4.conf truescale.conf %{?dma_coherent:mlx4.conf}

# Almost everything is licensed under the OFA dual GPLv2, 2 Clause BSD license
# providers/ipathverbs/ Dual licensed using a BSD license with an extra patent clause
# providers/rxe/ Incorporates code from ipathverbs and contains the patent clause
# providers/hfi1verbs Uses the 3 Clause BSD license
Url: https://github.com/linux-rdma/rdma-core
URL: https://github.com/linux-rdma/rdma-core
Source: rdma-core-%{version}%{git_ver}.tar.gz
Source1: baselibs.conf
BuildRequires: binutils
BuildRequires: cmake >= 2.8.11
BuildRequires: gcc
BuildRequires: pandoc
# perl is needed for the proper rpm macros
%if %{?suse_version} > 1550
BuildRequires: perl
%endif
BuildRequires: pkgconfig
BuildRequires: python3-base
BuildRequires: python3-docutils
Expand Down Expand Up @@ -414,6 +425,7 @@ easy, object-oriented access to IB verbs.
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include \
-DCMAKE_INSTALL_INFODIR:PATH=%{_infodir} \
-DCMAKE_INSTALL_MANDIR:PATH=%{_mandir} \
-DCMAKE_INSTALL_MODPROBEDIR:PATH=%{_modprobedir} \
-DCMAKE_INSTALL_SYSCONFDIR:PATH=%{_sysconfdir} \
-DCMAKE_INSTALL_SYSTEMD_SERVICEDIR:PATH=%{_unitdir} \
-DCMAKE_INSTALL_SYSTEMD_BINDIR:PATH=%{_prefix}/lib/systemd \
Expand Down Expand Up @@ -444,24 +456,23 @@ cd ..
mkdir -p %{buildroot}/%{_sysconfdir}/rdma

%global dracutlibdir %%{_prefix}/lib/dracut/
%global sysmodprobedir %%{_sysconfdir}/modprobe.d

mkdir -p %{buildroot}%{_udevrulesdir}
mkdir -p %{buildroot}%{dracutlibdir}/modules.d/05rdma
mkdir -p %{buildroot}%{sysmodprobedir}
mkdir -p %{buildroot}%{_modprobedir}
mkdir -p %{buildroot}%{_unitdir}

# Port type setup for mlx4 dual port cards
install -D -m0644 redhat/rdma.mlx4.sys.modprobe %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
install -D -m0644 redhat/rdma.mlx4.sys.modprobe %{buildroot}%{_modprobedir}/50-libmlx4.conf
install -D -m0644 redhat/rdma.mlx4.conf %{buildroot}/%{_sysconfdir}/rdma/mlx4.conf
chmod 0644 %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
chmod 0644 %{buildroot}%{_modprobedir}/mlx4.conf
install -D -m0755 redhat/rdma.mlx4-setup.sh %{buildroot}%{_libexecdir}/mlx4-setup.sh

# Dracut file for IB support during boot
install -D -m0644 suse/module-setup.sh %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh

%if "%{_libexecdir}" != "/usr/libexec"
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{sysmodprobedir}/50-libmlx4.conf
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{_modprobedir}/50-libmlx4.conf
sed 's-/usr/libexec-%{_libexecdir}-g' -i %{buildroot}%{dracutlibdir}/modules.d/05rdma/module-setup.sh
%endif

Expand Down Expand Up @@ -500,11 +511,25 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%post -n libibmad%{mad_major} -p /sbin/ldconfig
%postun -n libibmad%{mad_major} -p /sbin/ldconfig

%pre
# Avoid restoring outdated stuff in posttrans
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -f "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}.rpmsave.old" || :
done

%post
# we ship udev rules, so trigger an update.
%{_bindir}/udevadm trigger --subsystem-match=infiniband --action=change || true
%{_bindir}/udevadm trigger --subsystem-match=infiniband_mad --action=change || true

%posttrans
# Migration of modprobe.conf files to _modprobedir
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -fv "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}" || :
done

#
# ibacm
#
Expand Down Expand Up @@ -577,7 +602,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%dir %{_udevrulesdir}
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%dir %{_sysconfdir}/modprobe.d
%dir %{_modprobedir}
%doc %{_docdir}/%{name}-%{version}/README.md
%doc %{_docdir}/%{name}-%{version}/udev.md
%config(noreplace) %{_sysconfdir}/rdma/mlx4.conf
Expand All @@ -587,9 +612,9 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%config(noreplace) %{_sysconfdir}/rdma/modules/rdma.conf
%config(noreplace) %{_sysconfdir}/rdma/modules/roce.conf
%if 0%{?dma_coherent}
%config(noreplace) %{_sysconfdir}/modprobe.d/mlx4.conf
%{_modprobedir}/mlx4.conf
%endif
%config(noreplace) %{_sysconfdir}/modprobe.d/truescale.conf
%{_modprobedir}/truescale.conf
%config(noreplace) %{_sysconfdir}/udev/rules.d/70-persistent-ipoib.rules
%{_unitdir}/rdma-hw.target
%{_unitdir}/rdma-load-modules@.service
Expand All @@ -603,7 +628,7 @@ rm -rf %{buildroot}/%{_sbindir}/srp_daemon.sh
%{_udevrulesdir}/90-rdma-hw-modules.rules
%{_udevrulesdir}/90-rdma-ulp-modules.rules
%{_udevrulesdir}/90-rdma-umad.rules
%{sysmodprobedir}/50-libmlx4.conf
%{_modprobedir}/50-libmlx4.conf
%{_libexecdir}/mlx4-setup.sh
%{_libexecdir}/truescale-serdes.cmds
%license COPYING.*
Expand Down

0 comments on commit 49f5693

Please sign in to comment.