Debian: Add out-of-tree driver for Broadcom NICs

This commit introduces the bnxt_en and bnxt_re out-of-tree drivers for
Broadcom's NetXtreme network adapters, disables the in-tree versions and
handles the fall-out by forcibly enabling the kernel's CONFIG_PAGE_POOL
configuration option.

In comparison to commit ec7d0d4768 ("Prepare for Broadcom drivers")
and commit 0ae9f6bd53 ("Add Broadcom NetXtreme-E drivers") that
introduce the same drivers to CentOS-based StarlingX, the following
changes were made:

- The amount of changes in bnxt_re's makefiles was reduced by taking
  advantage of the fact that /lib/modules/<kver>/{build,source} symbolic
  links point to the header and kbuild directories.

- The bnxt_en driver's makefile was modified to enable parallelized
  builds.

- The shell commands to add the 'MODULE_INFO(retpoline, "Y")'
  pre-processor directive to the bnxt_en and bnxt_re modules were
  removed, as we discovered that this causes the module to have
  'retpoline: Y' in its metadata twice, as shown by the following shell
  interaction output on a Debian-based StarlingX installation:

  $ modinfo bnxt_en | grep retpoline:
  retpoline:      Y
  retpoline:      Y

The changes inherited from CentOS-based StarlingX but which are not
mentioned in the comparison section above are as follows:

- With patch "0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch",
  we fix a build failure caused by the definition of a macro intended as
  a placeholder for an in-tree API function. The v5.10 kernel already
  defines this function, so the macro is removed.

- With patch "0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch",
  we modify the bnxt_en and bnxt_re drivers so that the affinities of
  the IRQs serviced by these drivers are set up according to StarlingX's
  requirements, which is to make use of the CPU list specified by the
  irqaffinity= kernel command line argument. As was the case with
  CentOS-based StarlingX, the changes in bnxt_re take effect, but the
  changes in bnxt_en are included for completeness, as the latter code
  is compiled out with kernel versions >= 4.15. (Please see the patch
  description for further details on this.)

- The CONFIG_PAGE_POOL option is forcibly enabled, as removing bnxt_en
  from the in-tree kernel build removes the last user of
  CONFIG_PAGE_POOL, which is a dependency for the Mellanox OFED and
  bnxt_en drivers. This causes the kernel build system to automatically
  disable this option. Hence, this commit makes the CONFIG_PAGE_POOL
  option default to being enabled.

Finally, the version of the Debian package was made "1.10.2.220.0.13.0"
instead of the upstream "1.10.2-220.0.13.0", because Debian's versioning
policy only allows hyphen/dash ('-') characters in package versions when
there is no Debian revision appended to the version. Given that
StarlingX appends -1 as the Debian revision, we chose to use '.' instead
of '-' in the package version. (Another approach would have been to
relocate the '220.0.13.0' to the revision field.)

Verification notes:
- A Debian-based StarlingX ISO image is successfully built with the
  standard kernel, and the ISO image was installed onto a physical
  server with a quadport Broadcom network adapter, but with some
  workarounds. The bnxt_en and bnxt_re modules were observed to be
  automatically loaded on this server, as expected.

- One of the interfaces of the Broadcom network adapter in the
  aforementioned server was the management (OAM) interface, which was
  observed to work without obvious/apparent issues.

- The preempt-rt kernel was not tested, because an ISO image with the
  preempt-rt image could not be built due to reasons unrelated to this
  commit. That is, despite rebasing and running the following commands,
  the resulting ISO image did not start the installation process in a
  virtual machine, where a kickstart parse error was encountered:
    downloader -B rt,std -s -b && \
    build-pkgs -c -a -b rt,std && \
    build-image -t rt

Story: 2009915
Task: 45138

Change-Id: I012c8acaf18a2a2f18679ee2ddda67bf1e55d2c0
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
This commit is contained in:
M. Vefa Bicakci 2022-04-13 04:31:45 +00:00
parent 8b64cfaabe
commit e8cb7ff3ee
23 changed files with 687 additions and 0 deletions

View File

@ -1,4 +1,5 @@
kernel-std
kernel-modules/bnxt_en
kernel-modules/intel-i40e
kernel-modules/intel-iavf
kernel-modules/intel-ice

View File

@ -1,4 +1,5 @@
kernel-rt
kernel-modules/bnxt_en
kernel-modules/intel-i40e
kernel-modules/intel-iavf
kernel-modules/intel-ice

View File

@ -0,0 +1,7 @@
bnxt-en (1.10.2.220.0.13.0-1) unstable; urgency=medium
* Initial release of the out-of-tree bnxt_en driver for StarlingX. This
driver corresponds to "netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz" in
Broadcom's "bcm_220.0.83.0" release.
-- M. Vefa Bicakci <vefa.bicakci@windriver.com> Wed, 13 Apr 2022 03:06:20 +0000

View File

@ -0,0 +1,14 @@
Source: bnxt-en
Section: net
Priority: optional
Maintainer: StarlingX Developers <starlingx-discuss@lists.starlingx.io>
Build-Depends: debhelper-compat (= 13), linux@KERNEL_TYPE@-headers-5.10.0-6-amd64, linux@KERNEL_TYPE@-kbuild-5.10, mlnx-ofed-kernel-modules@KERNEL_TYPE@
Standards-Version: 4.5.1
Rules-Requires-Root: no
Package: bnxt-en@KERNEL_TYPE@
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: This package provides the bnxt_en and bnxt_re kernel modules.
This package provides the bnxt_en and bnxt_re kernel modules built
for the Linux kernel using the amd64 processors.

View File

@ -0,0 +1,34 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: bnxt_en
Upstream-Contact: Broadcom Inc.
Source: netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz
Comment:
Source archive is included as
bcm_220.0.83.0/Linux/Linux_Driver/netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz
in the compressed tar archive at the following address:
https://docs.broadcom.com/docs-and-downloads/ethernet-network-adapters/NXE/BRCM_220.0.83.0/bcm_220.0.83.0.tar.gz
Files: *
Copyright: Copyright 2015-2022 Broadcom Inc.
Comment:
Documentation in the source archive indicates copyright years 2015-2021.
However, the source code was released in 2022. Hence, the copyright year above
is indicated by this file as 2015-2022.
License: GPL-2
This program is free software; you can redistribute it and/or modify it under
the terms and conditions of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in the
file called "COPYING".
On Debian-based systems the full text of the GNU General Public License
version 2 license can be found in `/usr/share/common-licenses/GPL-2'.

View File

@ -0,0 +1 @@
softdep bnxt_en post: bnxt_re

View File

@ -0,0 +1,104 @@
From 8df4ad6c7e42a1d3e0753716d62efa35b7eb6891 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Fri, 4 Feb 2022 18:27:53 -0500
Subject: [PATCH] bnxt_re/Makefile: Adapt to mlnx-ofa_kernel for StarlingX
This patch adapts the bnxt_re kernel module's Makefile to
mlnx-ofa_kernel for Debian-based StarlingX.
Here is a summary of the changes:
- Unlike CentOS-based StarlingX, the KDIR variable is no longer needed
to be specified explicitly to make, because the symbolic links
/lib/modules/<kver>/{build,source} are sufficient to detect the
correct directories on Debian. However, this leaves the KDIR variable
undefined, which is problematic as this variable is used later in the
Makefile. Fix this by pointing KDIR to the "build" symbolic link
(i.e., "$(LINUX)").
- To target Mellanox's OFED distribution instead of compat-rdma, the
references to "/usr/src/compat-rdma" are replaced with
"/usr/src/ofa_kernel".
- Mellanox's OFED distribution has version numbers in the form 5.x, so
the Makefile version match patterns are adjusted.
- "AUTOCONF_H += -include $(LINUXSRC)/include/linux/kconfig.h" line is
added avoid the following kernel module build errors indicating that
IS_ENABLED is unintendedly undefined:
include/asm-generic/bitops/instrumented-non-atomic.h: In function \
'__instrument_read_write_bitop':
include/asm-generic/bitops/instrumented-non-atomic.h:63:6: error: \
implicit declaration of function 'IS_ENABLED' \
[-Werror=implicit-function-declaration]
if (IS_ENABLED(CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC)) {
^~~~~~~~~~
- The line that reads
"KBUILD_EXTRA_SYMBOLS := $(BNXT_PEER_MEM_INC)/Module.symvers"
is guarded to avoid the following build warning, which is encountered
as BNXT_PEER_MEM_INC is not defined by default:
WARNING: Symbol version dump "/Module.symvers" is missing.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
bnxt_re-220.0.12.0/Makefile | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/bnxt_re-220.0.12.0/Makefile b/bnxt_re-220.0.12.0/Makefile
index 532fb8025465..702d4a81c6f2 100644
--- a/bnxt_re-220.0.12.0/Makefile
+++ b/bnxt_re-220.0.12.0/Makefile
@@ -59,6 +59,8 @@ endif
ifneq ($(KDIR),)
LINUX=$(KDIR)
LINUXSRC=$(LINUX)
+else ifneq ($(LINUX),)
+ KDIR=$(LINUX)
endif
ifeq ($(shell ls $(LINUXSRC)/include/uapi > /dev/null 2>&1 && echo uapi),)
@@ -90,26 +92,32 @@ ifeq ($(OFED_VERSION), )
endif
#find OFED version and compat-includes
-ofed_major=$(filter OFED-3.% OFED-4.%, $(OFED_VERSION))
+ofed_major=$(filter OFED-3.% OFED-4.% 5.%, $(OFED_VERSION))
ifneq ($(ofed_major), )
-exists=$(shell if [ -e /usr/src/compat-rdma$(OFED_VERSION) ];\
+exists=$(shell if [ -e /usr/src/ofa_kernel-$(OFED_VERSION) ];\
then echo y; fi)
ifeq ($(exists), )
-$(shell ln -s /usr/src/compat-rdma\
- /usr/src/compat-rdma$(OFED_VERSION))
+$(shell ln -s /usr/src/ofa_kernel\
+ /usr/src/ofa_kernel-$(OFED_VERSION))
endif
-OFA_BUILD_PATH=/usr/src/compat-rdma$(OFED_VERSION)
-OFA_KERNEL_PATH=/usr/src/compat-rdma$(OFED_VERSION)
+OFA_BUILD_PATH=/usr/src/ofa_kernel/default
+OFA_KERNEL_PATH=/usr/src/ofa_kernel/default
EXTRA_CFLAGS += -DOFED_3_x
-ofed_4_17_x=$(filter OFED-4.17%, $(ofed_major))
+ofed_4_17_x=$(filter OFED-4.17% 5.%, $(ofed_major))
ifneq ($(ofed_4_17_x), )
EXTRA_CFLAGS += -D__OFED_BUILD__
endif
EXTRA_CFLAGS += -include $(OFA_KERNEL_PATH)/include/linux/compat-2.6.h
AUTOCONF_H = -include $(shell /bin/ls -1 $(LINUX)/include/*/autoconf.h 2> /dev/null | head -1)
+AUTOCONF_H += -include $(LINUXSRC)/include/linux/kconfig.h
endif #end non 3.x OFED
+
+ifneq ($(BNXT_PEER_MEM_INC),)
KBUILD_EXTRA_SYMBOLS := $(BNXT_PEER_MEM_INC)/Module.symvers
+else
+KBUILD_EXTRA_SYMBOLS :=
+endif
ifeq (OFED-NATIVE, $(findstring OFED-NATIVE, $(OFED_VERSION)))
ifeq ($(KERNELRELEASE),)
--
2.25.1

View File

@ -0,0 +1,45 @@
From 861bb6919cf76ca93c0f41fab8fbd2178aba08c3 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Fri, 4 Feb 2022 19:44:06 -0500
Subject: [PATCH] bnxt_en/bnxt_compat.h: Fix up a build failure
This commit resolves the following build failure:
In file included from ./include/net/sock.h:59,
from ./include/linux/tcp.h:19,
from ./include/linux/ipv6.h:87,
from ./include/net/dsfield.h:12,
from ./include/net/ip_tunnels.h:13,
from ./include/net/dst_metadata.h:6,
from /builddir/build/BUILD/netxtreme-bnxt_en-1.10.2-219.0.55.0/bnxt_en-1.10.2-219.0.55.0/bnxt.h:30,
from /builddir/build/BUILD/netxtreme-bnxt_en-1.10.2-219.0.55.0/bnxt_en-1.10.2-219.0.55.0/bnxt_hwrm.c:26:
./include/linux/filter.h:980:1: error: useless type name in empty declaration [-Werror]
void bpf_warn_invalid_xdp_action(u32 act);
^~~~
cc1: all warnings being treated as errors
The problem arises from the fact that the function
bpf_warn_invalid_xdp_action is already defined in the kernel. Having a
placeholder macro definition with the same name causes the compilation
warning (which turns into an error due to -Werror).
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h b/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h
index 63d27f2e8979..aeb15fc9ab2a 100644
--- a/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h
+++ b/bnxt_en-1.10.2-220.0.13.0/bnxt_compat.h
@@ -1596,7 +1596,6 @@ enum xdp_action {
#ifndef HAVE_BPF_TRACE
#define trace_xdp_exception(dev, xdp_prog, act)
-#define bpf_warn_invalid_xdp_action(act)
#endif
#ifdef HAVE_XDP_RXQ_INFO
--
2.25.1

View File

@ -0,0 +1,134 @@
From ad51050d13b3cae78140b1acc507d792646f8503 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Wed, 2 Mar 2022 14:14:12 -0500
Subject: [PATCH] bnxt_en, bnxt_re: Use irq_update_affinity_hint
This commit updates the bnxt_en and bnxt_re device drivers to use the
irq_update_affinity_hint function instead of the irq_set_affinity_hint
function, so that StarlingX's CPU affinity requirements for interrupts
are met. (Note that the StarlingX kernel has been patched to add the
irq_update_affinity_hint API function, which originally did not exist in
kernel version 5.10.)
irq_set_affinity_hint sets the IRQ affinity hint as well as the actual
IRQ affinity, which causes the IRQ affinity to not align with the value
of the irqaffinity= command line option.
StarlingX's user-space initialization scripts set the IRQ affinities
too, but if a network interface is initialized after the completion of
the initialization scripts, then the network adapter's preferred IRQ
affinity passed to irq_set_affinity_hint takes effect. The latter is
undesirable if the CPU affinity of an interrupt includes CPUs that are
in the set of isolated CPUs configured by StarlingX, as isolated CPUs
should not service unrelated interrupts.
To resolve the aforementioned issues, this patch updates the bnxt_en and
bnxt_re drivers to use irq_update_affinity_hint, which only sets the IRQ
affinity hint, and not the actual IRQ affinity. This allows interrupts
to be affined to the CPUs listed in the irqaffinity= command line
argument by default, and eliminates the need to set the IRQ affinities
after the initialization of network interfaces.
Finally, please note that the changes in bnxt_en were confirmed to not
be compiled with StarlingX's 5.10-based kernel, because of the following
conditional compilation pre-processor directives that are above the
irq_set_affinity_hint/irq_update_affinity_hint call site:
#if (!defined(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) || \
KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE) && \
(defined(HAVE_CPUMASK_LOCAL_FIRST) || \
defined(HAVE_CPUMASK_LOCAL_SPREAD))
/* ... */
cpumask_set_cpu(cpumask_local_spread(i, numa_node),
irq->cpu_mask);
/* ... */
rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
/* ... */
The IRQ matrix allocator is enabled in StarlingX's kernel, which also
has a version greater than 4.15. 4.15 happens to be the kernel version
with which the IRQ matrix allocator was introduced. In other words, the
call site in question is not compiled at all with the out-of-tree
bnxt_en driver. The in-tree version of bnxt_en does not have conditional
compilation directives around the same code (i.e., the code is always
compiled in).
Our imperfect understanding of the intent is that the out-of-tree
bnxt_en driver's authors decided to rely on the IRQ matrix allocator's
default IRQ vector distribution behaviour (which appears to occur at a
lower level) instead of setting the IRQ affinity hints explicitly.
Thankfully, the lack of a call irq_update_affinity_hint does not prevent
the irqaffinity= command line argument from taking effect for such
interrupts. This was confirmed with a virtual machine and the e1000e
driver, which also manages multiple MSI-X interrupts and which also does
not explicitly set the IRQ affinities nor affinity hints. In our
experiments, the IRQ affinities of the emulated Intel network adapter
correctly matched the CPU list set by the irqaffinity= command line
argument.
Despite what is discussed above, the code changes in bnxt_en are kept
for completeness.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
bnxt_en-1.10.2-220.0.13.0/bnxt.c | 6 +++---
bnxt_re-220.0.12.0/qplib_fp.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/bnxt_en-1.10.2-220.0.13.0/bnxt.c b/bnxt_en-1.10.2-220.0.13.0/bnxt.c
index b0b99338c425..a2f55dfcd0c3 100644
--- a/bnxt_en-1.10.2-220.0.13.0/bnxt.c
+++ b/bnxt_en-1.10.2-220.0.13.0/bnxt.c
@@ -10716,7 +10716,7 @@ static void bnxt_free_irq(struct bnxt *bp)
(defined(HAVE_CPUMASK_LOCAL_FIRST) || \
defined(HAVE_CPUMASK_LOCAL_SPREAD))
if (irq->have_cpumask) {
- irq_set_affinity_hint(irq->vector, NULL);
+ irq_update_affinity_hint(irq->vector, NULL);
free_cpumask_var(irq->cpu_mask);
irq->have_cpumask = 0;
}
@@ -10787,10 +10787,10 @@ static int bnxt_request_irq(struct bnxt *bp)
break;
}
#endif
- rc = irq_set_affinity_hint(irq->vector, irq->cpu_mask);
+ rc = irq_update_affinity_hint(irq->vector, irq->cpu_mask);
if (rc) {
netdev_warn(bp->dev,
- "Set affinity failed, IRQ = %d\n",
+ "Update affinity failed, IRQ = %d\n",
irq->vector);
break;
}
diff --git a/bnxt_re-220.0.12.0/qplib_fp.c b/bnxt_re-220.0.12.0/qplib_fp.c
index ef5f279fcb79..60d2eda3727d 100644
--- a/bnxt_re-220.0.12.0/qplib_fp.c
+++ b/bnxt_re-220.0.12.0/qplib_fp.c
@@ -492,7 +492,7 @@ void bnxt_qplib_nq_stop_irq(struct bnxt_qplib_nq *nq, bool kill)
bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, false);
/* Sync with last running IRQ handler */
synchronize_irq(nq->msix_vec);
- irq_set_affinity_hint(nq->msix_vec, NULL);
+ irq_update_affinity_hint(nq->msix_vec, NULL);
free_irq(nq->msix_vec, nq);
/* Cleanup Tasklet */
@@ -546,10 +546,10 @@ int bnxt_qplib_nq_start_irq(struct bnxt_qplib_nq *nq, int nq_indx,
cpumask_clear(&nq->mask);
cpumask_set_cpu(nq_indx, &nq->mask);
- rc = irq_set_affinity_hint(nq->msix_vec, &nq->mask);
+ rc = irq_update_affinity_hint(nq->msix_vec, &nq->mask);
if (rc)
dev_warn(&res->pdev->dev,
- "QPLIB: set affinity failed; vector: %d nq_idx: %d\n",
+ "QPLIB: update affinity failed; vector: %d nq_idx: %d\n",
nq->msix_vec, nq_indx);
nq->requested = true;
bnxt_qplib_ring_nq_db(&nq->nq_db.dbinfo, res->cctx, true);
--
2.25.1

View File

@ -0,0 +1,37 @@
From c7555e5087afb22752631dd19b357d9e25cd6760 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Fri, 15 Apr 2022 04:29:31 +0000
Subject: [PATCH] bnxt_en/Makefile: Allow parallelized build
This commit allows bnxt_en's build to be parallelized via the use of
"$(MAKE)" instead of "make". Without this change, make for bnxt_en
reports the following error and continues the build in a serialized
manner:
warning: jobserver unavailable: using -j1. \
Add '+' to parent make rule.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
bnxt_en-1.10.2-220.0.13.0/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/bnxt_en-1.10.2-220.0.13.0/Makefile b/bnxt_en-1.10.2-220.0.13.0/Makefile
index fe2c229d17b5..52a25eb11277 100644
--- a/bnxt_en-1.10.2-220.0.13.0/Makefile
+++ b/bnxt_en-1.10.2-220.0.13.0/Makefile
@@ -1083,9 +1083,9 @@ endef
default:
ifeq ($(CROSS_COMPILE),)
- make -C $(LINUX) M=$(shell pwd) $(call fwd_ver)modules
+ $(MAKE) -C $(LINUX) M=$(shell pwd) $(call fwd_ver)modules
else ifneq ($(CROSS_COMPILE),)
- make -C $(LINUXSRC) M=$(shell pwd) $(call fwd_ver)modules CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH)
+ $(MAKE) -C $(LINUXSRC) M=$(shell pwd) $(call fwd_ver)modules CROSS_COMPILE=$(CROSS_COMPILE) ARCH=$(ARCH)
endif
yocto_all:
--
2.25.1

View File

@ -0,0 +1,4 @@
0001-bnxt_re-Makefile-Adapt-to-mlnx-ofa_kernel-for-Starli.patch
0002-bnxt_en-bnxt_compat.h-Fix-up-a-build-failure.patch
0003-bnxt_en-bnxt_re-Use-irq_update_affinity_hint.patch
0004-bnxt_en-Makefile-Allow-parallelized-build.patch

View File

@ -0,0 +1,85 @@
#!/usr/bin/make -f
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
%:
dh $@
WITH_MOD_SIGN ?= 1
kheaders_name=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep common)
kbuild_name=$(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep amd64)
kversion=$(shell echo $(kbuild_name) | sed 's/linux@KERNEL_TYPE@-headers-//g')
# "dpkg --status mlnx-ofed-kernel-modules" prints a version line
# like the following:
# Version: 5.5-OFED.5.5.1.0.3.1.stx.5.kver.5.10.0-6-amd64
# Reduce this line to the version number substring "5.5" before
# the substring "-OFED".
ofed_version=$(shell dpkg --status mlnx-ofed-kernel-modules@KERNEL_TYPE@ | \
grep -e '^Version:' | sed -e 's@^Version: \([0-9]\+\.[0-9]\+\)-OFED.*@\1@')
ifeq ($(ofed_version),)
$(error "Error: Could not detect the OFED version")
endif
version=$(shell dpkg-parsechangelog | sed -n 's/^Version: *\([^-]\+\)-.\+/\1/p')
ifeq ($(WITH_MOD_SIGN),1)
pkg_name=bnxt-en@KERNEL_TYPE@
endif
_sysconfdir=/etc
ifeq ($(WITH_MOD_SIGN),1)
_keydir ?= /usr/src/kernels/$(kversion)/
privkey ?= $(_keydir)/signing_key.pem
pubkey ?= $(_keydir)/signing_key.x509
endif
override_dh_auto_install:
dh_install bnxt_en/bnxt_en.ko /lib/modules/$(kversion)/extra/bnxt_en/
dh_install bnxt_re/bnxt_re.ko /lib/modules/$(kversion)/extra/drivers/infiniband/hw/bnxt_re/
dh_install debian/extra/bnxt.conf $(_sysconfdir)/modprobe.d/
override_dh_strip:
dh_strip
find debian -name '*.ko' | xargs strip -g
ifeq ($(WITH_MOD_SIGN),1)
@echo "Sign the modules"
/usr/lib/linux@KERNEL_TYPE@-kbuild-*/scripts/sign-file sha256 $(privkey) $(pubkey) \
./debian/$(pkg_name)/lib/modules/$(kversion)/extra/bnxt_en/bnxt_en.ko
/usr/lib/linux@KERNEL_TYPE@-kbuild-*/scripts/sign-file sha256 $(privkey) $(pubkey) \
./debian/$(pkg_name)/lib/modules/$(kversion)/extra/drivers/infiniband/hw/bnxt_re/bnxt_re.ko
endif
override_dh_auto_clean:
dh_auto_build -D ./bnxt_en -- clean KVER=$(kversion) EXTRA_CFLAGS+="-DVERSION='$(version)'"
dh_auto_build -D ./bnxt_re -- clean KVER=$(kversion) OFED_VERSION="$(ofed_version)"
override_dh_auto_build:
# Regenerate manifest hash
if [ -e bnxt_en/MANIFEST ]; then \
cd bnxt_en && sha512sum $$(cat MANIFEST | cut -c 131-) > MANIFEST; \
fi
dh_auto_build -D ./bnxt_en -- KVER=$(kversion) EXTRA_CFLAGS+="-DVERSION='$(version)'"
dh_auto_build -D ./bnxt_re -- KVER=$(kversion) OFED_VERSION="$(ofed_version)"

View File

@ -0,0 +1 @@
3.0 (quilt)

View File

@ -0,0 +1,51 @@
#!/bin/bash
#
# Copyright (c) 2022 Wind River Systems, Inc.
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. The ASF licenses this
# file to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# The only parameter is the name of the new directory that will contain
# the extracted source code. Be aware that this new directory will be
# created in the same directory as where this script is located when
# building.
# Tools needed: mkdir, rm, tar
DL_TARBALL=bcm_220.0.83.0.tar.gz
SRC_TARBALL=Linux/Linux_Driver/netxtreme-bnxt_en-1.10.2-220.0.13.0.tar.gz
TMPDIR="bcm_tmp"
DESTDIR="${1}"
if test -z "${DESTDIR}"; then
echo "Missing destination directory on command line."
exit 1
fi
rm -rf "${TMPDIR}"
mkdir -p "${TMPDIR}"
if ! tar -C "${TMPDIR}" --strip-components=1 -xvf "${DL_TARBALL}"; then
echo "Could not extract into ${TMPDIR}: ${DL_TARBALL}"
exit 1
fi
mkdir -p "${DESTDIR}"
if ! tar -C "${DESTDIR}" --strip-components=1 -xvf "${TMPDIR}/${SRC_TARBALL}"; then
echo "Could not extract into ${DESTDIR}: ${TMPDIR}/${SRC_TARBALL}"
exit 1
fi
rm -rf "${TMPDIR}"

View File

@ -0,0 +1,14 @@
---
debver: 1.10.2.220.0.13.0
debname: bnxt-en
dl_hook: dl_hook
dl_files:
bcm_220.0.83.0.tar.gz:
topdir: null
url: "https://docs.broadcom.com/docs-and-downloads/\
ethernet-network-adapters/NXE/BRCM_220.0.83.0/\
bcm_220.0.83.0.tar.gz"
sha256sum: 85bdfc30b4bd3e184e3b57a48055c11085e3b97593f7b4a8347fa50a9d571336
revision:
dist: $STX_DIST
PKG_GITREVCOUNT: true

View File

@ -0,0 +1,39 @@
From 8f317b2da82820b4f8e4c40470cb1f4e5f6c1703 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Thu, 21 Apr 2022 02:06:11 +0000
Subject: [PATCH] Debian: Disable CONFIG_BNXT*
This commit disables the CONFIG_BNXT* options, because StarlingX ships
with an out-of-tree version of the bnxt_en kernel module. The
aforementioned configuration options enable the in-tree version of the
same module.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
debian/config/amd64/none/config | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
index bd5b621476ca..840ecee6120d 100644
--- a/debian/config/amd64/none/config
+++ b/debian/config/amd64/none/config
@@ -2442,11 +2442,11 @@ CONFIG_TIGON3_HWMON=y
CONFIG_BNX2X=m
CONFIG_BNX2X_SRIOV=y
# CONFIG_SYSTEMPORT is not set
-CONFIG_BNXT=m
-CONFIG_BNXT_SRIOV=y
-CONFIG_BNXT_FLOWER_OFFLOAD=y
-CONFIG_BNXT_DCB=y
-CONFIG_BNXT_HWMON=y
+# CONFIG_BNXT is not set
+# CONFIG_BNXT_SRIOV is not set
+# CONFIG_BNXT_FLOWER_OFFLOAD is not set
+# CONFIG_BNXT_DCB is not set
+# CONFIG_BNXT_HWMON is not set
CONFIG_NET_VENDOR_BROCADE=y
# CONFIG_BNA is not set
CONFIG_NET_VENDOR_CADENCE=y
--
2.25.1

View File

@ -7,3 +7,4 @@
0007-Debian-update-5.10-Kernel-to-5.10.99.patch
0008-config-set-configs-needed-for-secure-boot.patch
0009-Drop-Android-patches.patch
0010-Debian-Disable-CONFIG_BNXT.patch

View File

@ -0,0 +1,36 @@
From e469e34954dc8eb27b0f2fe521e18ac2e03dad61 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Thu, 3 Feb 2022 21:34:14 -0500
Subject: [PATCH] Enable CONFIG_PAGE_POOL by default
CONFIG_PAGE_POOL is a "hidden" configuration option, which causes it to
be enabled only when another kernel configuration option explicitly
selects it. Specifying CONFIG_PAGE_POOL=y in .config does not have any
effect.
Given that StarlingX disables all in-tree device drivers that explicitly
select CONFIG_PAGE_POOL, and given that at least one out-of-tree kernel
module (mlnx-ofa_kernel) requires the features made available by
CONFIG_PAGE_POOL, this commit enables the configuration option in
question by default.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
net/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/Kconfig b/net/Kconfig
index 05b0f041f039..62443980ba6b 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -437,6 +437,7 @@ config NET_DEVLINK
config PAGE_POOL
bool
+ default y
config FAILOVER
tristate "Generic failover module"
--
2.29.2

View File

@ -24,3 +24,4 @@
0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch
0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch
0028-driver-core-auxiliary-bus-Enable-by-default.patch
0029-Enable-CONFIG_PAGE_POOL-by-default.patch

View File

@ -0,0 +1,39 @@
From 90f87bfc5bbc26bc3bfeb5d89b89d5bd794b716b Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Thu, 21 Apr 2022 02:06:11 +0000
Subject: [PATCH] Debian: Disable CONFIG_BNXT*
This commit disables the CONFIG_BNXT* options, because StarlingX ships
with an out-of-tree version of the bnxt_en kernel module. The
aforementioned configuration options enable the in-tree version of the
same module.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
debian/config/amd64/none/config | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/debian/config/amd64/none/config b/debian/config/amd64/none/config
index a5dadc7b6b55..5088a2aec7a2 100644
--- a/debian/config/amd64/none/config
+++ b/debian/config/amd64/none/config
@@ -2451,11 +2451,11 @@ CONFIG_TIGON3_HWMON=y
CONFIG_BNX2X=m
CONFIG_BNX2X_SRIOV=y
# CONFIG_SYSTEMPORT is not set
-CONFIG_BNXT=m
-CONFIG_BNXT_SRIOV=y
-CONFIG_BNXT_FLOWER_OFFLOAD=y
-CONFIG_BNXT_DCB=y
-CONFIG_BNXT_HWMON=y
+# CONFIG_BNXT is not set
+# CONFIG_BNXT_SRIOV is not set
+# CONFIG_BNXT_FLOWER_OFFLOAD is not set
+# CONFIG_BNXT_DCB is not set
+# CONFIG_BNXT_HWMON is not set
CONFIG_NET_VENDOR_BROCADE=y
# CONFIG_BNA is not set
CONFIG_NET_VENDOR_CADENCE=y
--
2.25.1

View File

@ -7,3 +7,4 @@
0007-Debian-update-5.10-Kernel-to-5.10.99.patch
0008-config-set-configs-needed-for-secure-boot.patch
0009-Drop-Android-patches.patch
0010-Debian-Disable-CONFIG_BNXT.patch

View File

@ -0,0 +1,36 @@
From 3ba9b411491dfdca077f7810cf474e82026f63c8 Mon Sep 17 00:00:00 2001
From: "M. Vefa Bicakci" <vefa.bicakci@windriver.com>
Date: Thu, 3 Feb 2022 21:34:14 -0500
Subject: [PATCH] Enable CONFIG_PAGE_POOL by default
CONFIG_PAGE_POOL is a "hidden" configuration option, which causes it to
be enabled only when another kernel configuration option explicitly
selects it. Specifying CONFIG_PAGE_POOL=y in .config does not have any
effect.
Given that StarlingX disables all in-tree device drivers that explicitly
select CONFIG_PAGE_POOL, and given that at least one out-of-tree kernel
module (mlnx-ofa_kernel) requires the features made available by
CONFIG_PAGE_POOL, this commit enables the configuration option in
question by default.
Signed-off-by: M. Vefa Bicakci <vefa.bicakci@windriver.com>
---
net/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/Kconfig b/net/Kconfig
index d6567162c1cf..add29b03a664 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -437,6 +437,7 @@ config NET_DEVLINK
config PAGE_POOL
bool
+ default y
config FAILOVER
tristate "Generic failover module"
--
2.29.2

View File

@ -24,3 +24,4 @@
0026-driver-core-auxiliary-bus-Remove-unneeded-module-bit.patch
0027-driver-core-auxiliary-bus-Fix-memory-leak-when-drive.patch
0028-driver-core-auxiliary-bus-Enable-by-default.patch
0029-Enable-CONFIG_PAGE_POOL-by-default.patch