From 3dc5327a8485aa7379c78fd882d6ce1a8e515093 Mon Sep 17 00:00:00 2001 From: "M. Vefa Bicakci" Date: Wed, 30 Mar 2022 13:25:20 -0400 Subject: [PATCH] bnxt_en: Automatically load bnxt_re This commit ensures that the bnxt_re module is automatically loaded whenever bnxt_en is loaded by StarlingX's boot-up process or manually by the user. The bnxt_re module is not automatically loaded, and this requires manually loading the module before being able to use RDMA. In contrast, bnxt_en has aliases that allows it to be automatically loaded on systems with compatible Broadcom network adapters. This commit adds a 'softdep' modprobe hook for bnxt_en, so that the bnxt_re module is automatically loaded after the bnxt_en module is loaded. In terms of alternatives, the following options were considered: - Always load bnxt_en and bnxt_re, like Mellanox OFED's drivers. This option's main drawback is that the modules will always consume resources such as kernel memory, even when a compatible network adapter is not available. - Use install and remove hooks. This option is functionally similar to having a softdep hook, but allows the use of arbitrary shell commands. We did not opt for this option, because the modprobe.conf manual page mentions that the install/remove hooks will eventually be deprecated. Verification - An ISO image was built successfully using a monolithic incremental build procedure. - The built ISO image was installed onto a virtual machine in All-in-One simplex mode, low-latency profile. - The bnxt_en module was loaded using "sudo modprobe bnxt_en". "lsmod" showed that both bnxt_en and bnxt_re were loaded. - The bnxt_en module was removed using "sudo modprobe -v -r bnxt_en", which indicated that bnxt_re and bnxt_en were removed, in that order. The end result was confirmed with "lsmod". Story: 2009915 Task: 44917 Change-Id: I6f58ed7b1cd07d856ae9fba5f27820adf8f649d0 Signed-off-by: M. Vefa Bicakci --- kernel-modules/bnxt_en/centos/bnxt_en.spec | 5 +++++ kernel-modules/bnxt_en/centos/build_srpm.data | 1 + kernel-modules/bnxt_en/files/modprobe.conf | 1 + 3 files changed, 7 insertions(+) create mode 100644 kernel-modules/bnxt_en/files/modprobe.conf diff --git a/kernel-modules/bnxt_en/centos/bnxt_en.spec b/kernel-modules/bnxt_en/centos/bnxt_en.spec index 258df20e..036dc08b 100644 --- a/kernel-modules/bnxt_en/centos/bnxt_en.spec +++ b/kernel-modules/bnxt_en/centos/bnxt_en.spec @@ -38,6 +38,7 @@ Requires(post): /usr/sbin/depmod Requires(postun): /usr/sbin/depmod Source0: netxtreme-%{kmod_name}-%{version}-%{upstream_release}.tar.gz +Source1: modprobe.conf Patch0001: 0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch Patch0002: 0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch @@ -104,6 +105,9 @@ mkdir -p ${dest_dir_bnxt_re} install -m 744 ${src_dir_bnxt_en} ${dest_dir_bnxt_en} install -m 744 ${src_dir_bnxt_re} ${dest_dir_bnxt_re} +install -d %{buildroot}%{_sysconfdir}/modprobe.d +install -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/modprobe.d/bnxt.conf + ### Adapted from i40e # Strip the modules(s). find %{buildroot} -type f -name \*.ko -exec %{__strip} --strip-debug \{\} \; @@ -120,6 +124,7 @@ done %files %defattr(644,root,root,755) /lib/modules/%{kversion}/extra/%{kmod_name}/ +%{_sysconfdir}/modprobe.d/bnxt.conf %post if [ -e "/boot/System.map-%{kversion}" ]; then diff --git a/kernel-modules/bnxt_en/centos/build_srpm.data b/kernel-modules/bnxt_en/centos/build_srpm.data index 1409dbf9..548c604a 100644 --- a/kernel-modules/bnxt_en/centos/build_srpm.data +++ b/kernel-modules/bnxt_en/centos/build_srpm.data @@ -1,5 +1,6 @@ COPY_LIST=" \ $PATCHES_BASE/* \ + $PKG_BASE/files/modprobe.conf \ $STX_BASE/downloads/netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz \ " diff --git a/kernel-modules/bnxt_en/files/modprobe.conf b/kernel-modules/bnxt_en/files/modprobe.conf new file mode 100644 index 00000000..2b6dd552 --- /dev/null +++ b/kernel-modules/bnxt_en/files/modprobe.conf @@ -0,0 +1 @@ +softdep bnxt_en post: bnxt_re