This commit introduces Broadcom's bnxt_en and bnxt_re out-of-tree
drivers, version 220.0.13.0, to StarlingX, and disables the in-tree
bnxt_en driver. (For clarity, the main driver package file name is
"bcm_220.0.83.0.tar.gz".)
There is a need to build Broadcom's driver against the version of the
Infiniband/RDMA code base bundled with Mellanox OFED (OpenFabrics
Enterprise Distribution), because the in-tree kernel Infiniband/RDMA
modules are disabled, and Mellanox OFED's out-of-tree Infiniband/RDMA
modules replace the in-tree versions.
A custom spec file was used, despite the fact that the Broadcom device
driver package includes a source RPM file. This was necessary due to two
reasons:
- The source RPM file has whitespace between its field labels (such as
Name, Version, Release, and so on) and the values of these fields.
(Example: "Name : bnxt_en") This unfortunately breaks "build-pkgs
--edit", which cannot handle the whitespace during the extraction of
the source RPM.
- More importantly, the spec file included by Broadcom has the following
lines in its %prep section, which does not use the %setup macro:
%prep
#%setup
mkdir -p source
tar -xzvf %{SOURCE0} -C source/
mv -f source/netxtreme-%name-%{version}-220.0.13.0/* source/
rm -rf source/netxtreme-%name-%{version}-220.0.13.0/
cp ./source/%{bnxt_re_driver}/README.TXT
./source/%{bnxt_re_driver}/%{bnxt_re_driver}_README.TXT
cp ./source/%{bnxt_en_driver}/README.TXT
./source/%{bnxt_en_driver}/%{bnxt_en_driver}_README.TXT
mkdir -p obj
This is problematic, because the "build-pkgs --edit" procedure
extracts the source RPM multiple times into the same directory to
ensure that the extraction is stable. However, the %prep section
quoted above does not remove the 'source' directory before attempting
to populate it. (Unfortunately, this issue is not patchable using a
meta-patch, because the extraction occurs even before the application
of meta-patches.) This in turn triggers the following errors:
+ mv -f source/netxtreme-bnxt_en-1.10.2-220.0.13.0/Makefile \
source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_en \
source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_en-1.10.2-220.0.13.0 \
source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_re \
source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_re-220.0.12.0 \
source/
mv: cannot move 'source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_en-1.10.2-220.0.13.0' \
to 'source/bnxt_en-1.10.2-220.0.13.0': Directory not empty
mv: cannot move 'source/netxtreme-bnxt_en-1.10.2-220.0.13.0/bnxt_re-220.0.12.0' \
to 'source/bnxt_re-220.0.12.0': Directory not empty
error: Bad exit status from .../std/srpm_work/bnxt_en/var/tmp/rpm-tmp.cDTpOP (%prep)
Bad exit status from .../std/srpm_work/bnxt_en/var/tmp/rpm-tmp.cDTpOP (%prep)
The changes made to the spec file are as follows:
- Reliance on Red Hat's kernel module packaging RPM spec macros (such as
%kernel_module_package) is removed, because the aforementioned macros
make use of the kmodtool helper program, which automatically generates
an RPM post-installation and post-uninstallation sections making use
of the weak-modules utility, which StarlingX does not use/support. It
is not possible to disable this behaviour of the kmodtool script
("/usr/lib/rpm/redhat/kmodtool") with a command line option or an
environment variable.
- The spec file is reorganized to build the kernel module against only a
single kernel "flavour", as StarlingX does not use the kernel flavour
concept.
- The %build process is modified so that instead of using the top-level
makefile (which does not take certain variables as arguments), the
bnxt_en- and bnxt_re-specific makefiles are called with make
separately. This allows passing KDIR, KVER and OFED_VERSION make
variables as command line arguments to make.
- The use of the devtoolset-8 software collection was added to align to
the kernel's build toolchain.
- The spec file is modified to detect the OFED version and pass the
version to the bnxt_re makefile as the OFED_VERSION environment
variable. This is necessary to automatically adapt to the version of
OFED installed in the build environment.
- The %post and %postun scriptlets are modified to make them similar to
the ones used by i40e, which passes the target kernel's version to
depmod. The original %post only had 'depmod -a', which can be
problematic when installing the package for a kernel that is not
currently running.
- Kernel module signing was added to %install. This shell snippet was
adapted from i40e.
- Finally, retpolines were enabled by default, given that StarlingX
enables retpolines in its kernel packages as well.
In terms of source code modifications, the following changes were made
to bnxt_en and bnxt_re:
- The bnxt_en and bnxt_re kernel modules are patched to make use of the
irq_update_affinity_hint function instead of the irq_set_affinity_hint
function, so that the irqaffinity= kernel command line option takes
effect for the affinities of the IRQs managed by the two drivers.
However, it should be noted the changes in bnxt_en are not truly
necessary, because pre-existing conditional compilation directives
leave out the modified code when targeting kernels >= v4.15 or kernels
that have the "IRQ matrix allocator" feature. The changes are kept for
completeness, nevertheless.
For further details, please see the patch description.
- A compilation failure caused by the definition of a placeholder macro
aimed to stand in for the bpf_warn_invalid_xdp_action function in the
kernel tree is resolved by removing the macro definition.
Testing:
- An ISO image was successfully built with a monolithic incremental
build procedure.
- Using a virtual machine in All-in-One simplex configuration, the
bnxt_en and bnxt_re kernel modules were confirmed to be successfully
loaded manually using, for example, "modprobe -v -a bnxt_en bnxt_re".
Runtime tests for these drivers were unfortunately very limited,
because the necessary hardware has not yet been acquired. We intend to
resolve integration issues when hardware is acquired.
Story: 2009915
Task: 44762
Depends-On: https://review.opendev.org/c/starlingx/kernel/+/833463
Depends-On: https://review.opendev.org/c/starlingx/tools/+/833462
Change-Id: Ieb4147335410160a781382b0b6b01e2015468a3b
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>