Files
kernel/kernel-modules/mlnx-ofa_kernel/debian/deb_patches/0001-mlnx-ofa_kernel-adapt-the-debian-folder-for-starling.patch
Jiping Ma bd9c042318 mlnx-ofa_kernel:Upgrade OFED driver version to 24.10
This upgrades the OFED driver package to the mlnx-ofa_kernel-24.10.tgz
located in https://linux.mellanox.com/public/repo/mlnx_ofed/
24.10-1.1.4.0/SRPMS/. As part of the plan to upgrade to the 6.12
kernel, we also want to update the Nvidia/Mellanox driver to the
latest supported version.

The new versions are:
    mlnx-ofa_kernel-24.10.tgz
    dma-core-2410mlnx54.tar.gz
    mlnx-tools-24.10.tar.gz

Verification:
- Build module success for kernel-std/kernel-rt.
- Build package success for rdma-core, mstflint and mlnx-tools.
- Install onto a StarlingX system with All-in-One lab with network
  adapters Mellanox's OFED. The network adapters of controllers
  are Mellanox Technologies MT27800 Family [ConnectX-5].
- Install onto a StarlingX system in labs with network
  adapters Mellanox's OFED. The network adapters of controllers
  are [ConnectX-6 DX],[ConnectX-6 LX].
- The physical function interfaces are up and pass packets for rt
  and std.
- create vfs, ensure that the interface can come up and pass packets.
- RDMA/Infiniband over Ethernet functionalities of the Mellanox adapters
  were successfully tested using the Linux RDMA community's perftest
  package.

Story: 2011384
Task: 51890

Depends-On: https://review.opendev.org/c/starlingx/kernel/+/945449
Change-Id: I1a9f7881e3ba6805354f684b2001bc931350f348
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
2025-04-09 08:12:32 +00:00

313 lines
11 KiB
Diff

From d70f7bf8a78251974580a84c24f5d34c3ca640ba Mon Sep 17 00:00:00 2001
From: Jiping Ma <jiping.ma2@windriver.com>
Date: Wed, 23 Mar 2022 22:59:40 -0700
Subject: [PATCH 1/2] mlnx-ofa_kernel: adapt the debian folder for starlingX
Adapt the upstream debian folder for starlingX:
- don't use dkms and build the kernel modules from source code;
- add mlnx-ofed-kernel-modules package;
- add the building configuration <--build-dummy-mods> and install
mlnx.conf to keep aligned with starlingX;
- adapt the kernelver to make the building work.
- add support for kernel-rt.
- add postinst, prerm files for rt build that are copied from the original
files postinst, prerm. For example, mlnx-ofed-kernel-modules-rt.prerm is
copied from mlnx-ofed-kernel-modules.prerm.
Signed-off-by: Li Zhou <li.zhou@windriver.com>
[jm: Adapted the patch for context change, and added postinst,
prerm files for rt build.]
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
Signed-off-by: Yue Tao <Yue.Tao@windriver.com>
[jm: Adapted the patch for context change]
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
[jm: Adapted the patch for context change of the 24.10 version.]
Signed-off-by: Jiping Ma <jiping.ma2@windriver.com>
---
debian/control | 22 +++-------
debian/extra/mlnx.conf | 20 +++++++++
debian/mlnx-ofed-kernel-modules-rt.postinst | 17 ++++++++
debian/mlnx-ofed-kernel-modules-rt.prerm | 10 +++++
debian/mlnx-ofed-kernel-utils-rt.postinst | 47 +++++++++++++++++++++
debian/mlnx-ofed-kernel-utils-rt.postrm | 14 ++++++
debian/mlnx-ofed-kernel-utils-rt.prerm | 23 ++++++++++
debian/rules | 24 ++++++++---
8 files changed, 156 insertions(+), 21 deletions(-)
create mode 100644 debian/extra/mlnx.conf
create mode 100755 debian/mlnx-ofed-kernel-modules-rt.postinst
create mode 100755 debian/mlnx-ofed-kernel-modules-rt.prerm
create mode 100755 debian/mlnx-ofed-kernel-utils-rt.postinst
create mode 100755 debian/mlnx-ofed-kernel-utils-rt.postrm
create mode 100755 debian/mlnx-ofed-kernel-utils-rt.prerm
diff --git a/debian/control b/debian/control
index bd3cf23..701a9c5 100644
--- a/debian/control
+++ b/debian/control
@@ -2,7 +2,7 @@ Source: mlnx-ofed-kernel
Section: net
Priority: optional
Maintainer: Vladimir Sokolovsky <vlad@mellanox.com>
-Build-Depends: debhelper (>= 8.0.0), autotools-dev, bzip2, dkms,
+Build-Depends: debhelper (>= 8.0.0), autotools-dev, bzip2, dkms, linux@KERNEL_TYPE@-headers-stx-amd64, linux@KERNEL_TYPE@-keys
Standards-Version: 4.2.0
Homepage: http://www.mellanox.com/page/products_dyn?product_family=26&mtag=linux_sw_drivers
@@ -13,18 +13,8 @@ Depends: ${misc:Depends}, coreutils, pciutils, grep, procps, module-init-tools |
Conflicts: mlnx-en-utils
Description: Userspace tools to restart and tune mlnx-ofed kernel modules
-Package: mlnx-ofed-kernel-dkms
-Section: kernel
-Architecture: all
-Depends: dkms, ${misc:Depends}, mlnx-ofed-kernel-utils, libc6-dev, gcc,
-Recommends: linux-headers-arm64 | linux-headers-powerpc | linux-headers-ppc64 | linux-headers-ppc64le | linux-headers-amd64 | linux-headers-generic | linux-headers
-Provides: mlnx-rdma-rxe-dkms
-Conflicts: mlnx-rdma-rxe-dkms
-Replaces: mlnx-rdma-rxe-dkms
-Description: DKMS support for mlnx-ofed kernel modules
- This package provides integration with the DKMS infrastructure for
- automatically building out of tree kernel modules.
- .
- This package provides the source code for the mlnx-ofed kernel modules.
- .
- This package contains the source to be built with dkms.
+Package: mlnx-ofed-kernel-modules@KERNEL_TYPE@
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, mlnx-ofed-kernel-utils
+Description: ofed kernel modules
+ This package provides the mlnx-ofed out of tree kernel modules.
diff --git a/debian/extra/mlnx.conf b/debian/extra/mlnx.conf
new file mode 100644
index 0000000..0cb2131
--- /dev/null
+++ b/debian/extra/mlnx.conf
@@ -0,0 +1,20 @@
+mlx_compat
+ib_cm
+ib_core
+ib_ucm
+ib_uverbs
+iw_cm
+rdma_cm
+rdma_ucm
+mlx5_ib
+rdma_rxe
+ib_iser
+ib_isert
+ib_srp
+mlx5_core
+nvme-rdma
+nvmet-rdma
+rpcrdma
+svcrdma
+xprtrdma
+
diff --git a/debian/mlnx-ofed-kernel-modules-rt.postinst b/debian/mlnx-ofed-kernel-modules-rt.postinst
new file mode 100755
index 0000000..a67c0c4
--- /dev/null
+++ b/debian/mlnx-ofed-kernel-modules-rt.postinst
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+symlink="/usr/src/ofa_kernel/default"
+if [ "$1" = "configure" ]; then
+ if [ -L "$symlink" ] && \
+ ! update-alternatives --list ofa_kernel_headers >/dev/null 2>&1;
+ then
+ rm -f "$symlink"
+ fi
+ mkdir -p /usr/src/ofa_kernel
+ update-alternatives --install "$symlink" ofa_kernel_headers \
+ /usr/src/ofa_kernel/@ARCH@/@KVER@ 30
+fi
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/mlnx-ofed-kernel-modules-rt.prerm b/debian/mlnx-ofed-kernel-modules-rt.prerm
new file mode 100755
index 0000000..6f1b1df
--- /dev/null
+++ b/debian/mlnx-ofed-kernel-modules-rt.prerm
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+set -e
+
+if [ "$1" = remove ]; then
+ update-alternatives --remove ofa_kernel_headers \
+ /usr/src/ofa_kernel/@ARCH@/@KVER@
+fi
+
+#DEBHELPER#
diff --git a/debian/mlnx-ofed-kernel-utils-rt.postinst b/debian/mlnx-ofed-kernel-utils-rt.postinst
new file mode 100755
index 0000000..279820d
--- /dev/null
+++ b/debian/mlnx-ofed-kernel-utils-rt.postinst
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+dist=`lsb_release -s -i | tr '[:upper:]' '[:lower:]'`
+dist_ver=`lsb_release -s -r`
+
+if [ "X$dist" != "Xubuntu" ]; then
+ /usr/sbin/update-rc.d openibd defaults > /dev/null 2>&1
+fi
+
+if (systemctl 2>/dev/null | grep -qw "\\-\.mount" 2>/dev/null); then
+ systemctl daemon-reload >/dev/null 2>&1 || true
+ systemctl enable openibd >/dev/null 2>&1 || true
+ cat /proc/sys/kernel/random/boot_id 2>/dev/null | sed -e 's/-//g' > /var/run/openibd.bootid || true
+ test -s /var/run/openibd.bootid || echo manual > /var/run/openibd.bootid || true
+fi
+
+# set specific module parameter for Ubuntu
+echo "options ib_ipoib send_queue_size=128 recv_queue_size=128" >> /etc/modprobe.d/ib_ipoib.conf
+
+# Update limits.conf (but not for Containers)
+if [ ! -e "/.dockerenv" ] && ! (grep -q docker /proc/self/cgroup 2>/dev/null); then
+ if [ -e /etc/security/limits.conf ]; then
+ LIMITS_UPDATED=0
+ if ! (grep -qE "soft.*memlock" /etc/security/limits.conf 2>/dev/null); then
+ echo "* soft memlock unlimited" >> /etc/security/limits.conf
+ LIMITS_UPDATED=1
+ fi
+ if ! (grep -qE "hard.*memlock" /etc/security/limits.conf 2>/dev/null); then
+ echo "* hard memlock unlimited" >> /etc/security/limits.conf
+ LIMITS_UPDATED=1
+ fi
+ if [ $LIMITS_UPDATED -eq 1 ]; then
+ echo "Configured /etc/security/limits.conf"
+ fi
+ fi
+fi
+
+for old_udev in \
+ /etc/udev/rules.d/82-net-setup-link.rules \
+ /etc/udev/rules.d/83-net-setup-link.rules \
+ /etc/udev/rules.d/90-ib \
+; do
+ dpkg-maintscript-helper rm_conffile $old_udev 5.4-OFED.5.4.0.4.9 -- "$@"
+done
+dpkg-maintscript-helper rm_conffile /etc/infiniband/vf-net-link-name.sh 5.6-OFED.5.6.0.5.6 -- "$@"
+
+exit 0
diff --git a/debian/mlnx-ofed-kernel-utils-rt.postrm b/debian/mlnx-ofed-kernel-utils-rt.postrm
new file mode 100755
index 0000000..8b8068f
--- /dev/null
+++ b/debian/mlnx-ofed-kernel-utils-rt.postrm
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+set -e
+
+for old_udev in \
+ /etc/udev/rules.d/82-net-setup-link.rules \
+ /etc/udev/rules.d/83-net-setup-link.rules \
+ /etc/udev/rules.d/90-ib \
+; do
+ dpkg-maintscript-helper rm_conffile $old_udev 5.4-OFED.5.4.0.4.9 -- "$@"
+done
+dpkg-maintscript-helper rm_conffile /etc/infiniband/vf-net-link-name.sh 5.6-OFED.5.6.0.5.6 -- "$@"
+
+#DEBHELPER#
diff --git a/debian/mlnx-ofed-kernel-utils-rt.prerm b/debian/mlnx-ofed-kernel-utils-rt.prerm
new file mode 100755
index 0000000..79e96b5
--- /dev/null
+++ b/debian/mlnx-ofed-kernel-utils-rt.prerm
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+dist=`lsb_release -s -i | tr '[:upper:]' '[:lower:]'`
+dist_ver=`lsb_release -s -r`
+
+if [ "X$dist" != "Xubuntu" ]; then
+ /usr/sbin/update-rc.d -f openibd remove > /dev/null 2>&1
+fi
+
+if (systemctl 2>/dev/null | grep -qw "\\-\.mount" 2>/dev/null); then
+ systemctl disable openibd >/dev/null 2>&1 || true
+fi
+
+for old_udev in \
+ /etc/udev/rules.d/82-net-setup-link.rules \
+ /etc/udev/rules.d/83-net-setup-link.rules \
+ /etc/udev/rules.d/90-ib \
+; do
+ dpkg-maintscript-helper rm_conffile $old_udev 5.4-OFED.5.4.0.4.9 -- "$@"
+done
+dpkg-maintscript-helper rm_conffile /etc/infiniband/vf-net-link-name.sh 5.6-OFED.5.6.0.5.6 -- "$@"
+
+exit 0
diff --git a/debian/rules b/debian/rules
index f3cfff4..94d1616 100755
--- a/debian/rules
+++ b/debian/rules
@@ -17,8 +17,20 @@
-include /usr/share/dpkg/architecture.mk
-WITH_DKMS ?= 1
-WITH_MOD_SIGN ?= 0
+WITH_DKMS ?= 0
+WITH_MOD_SIGN ?= 1
+
+#Here kernelver should be the one this package depends on,
+#while "uname -r" got the building machine's os release number.
+kheaders_name = $(shell ls /usr/src | grep linux@KERNEL_TYPE@-headers | grep amd64)
+kernelver = $(shell echo $(kheaders_name) | sed 's/linux@KERNEL_TYPE@-headers-//g')
+
+ifeq ($(WITH_MOD_SIGN),1)
+_keydir ?= /usr/src/kernels/$(kernelver)/
+export MODULE_SIGN_PRIV_KEY=$(_keydir)/signing_key.pem
+export MODULE_SIGN_PUB_KEY=$(_keydir)/signing_key.x509
+endif
+
MLXNUMC = $(shell grep ^processor /proc/cpuinfo | wc -l)
NJOBS ?= $(shell if [ $(MLXNUMC) -lt 16 ]; then echo $(MLXNUMC); else echo 16; fi)
ifeq ($(WITH_DKMS),1)
@@ -34,7 +46,7 @@ psource:=$(pname)-source
ifeq ($(WITH_DKMS),1)
pdkms:=$(pname)-dkms
else
-pdkms:=$(pname)-modules
+pdkms:=$(pname)-modules@KERNEL_TYPE@
endif
putils:=$(pname)-utils
@@ -47,7 +59,6 @@ export INSTALL_MOD_PATH:=$(CURDIR)/debian/$(pdkms)
DIST_NAME := $(shell lsb_release -si)
DIST_RELEASE := $(DIST_NAME)/$(shell lsb_release -sc)
-kernelver ?= $(shell uname -r)
kernelver1 = $(shell echo $(kernelver) | sed -e 's/_/-/g')
kernel_source_dir ?= "/lib/modules/$(kernelver)/build"
deb_arch = $(shell uname -m)
@@ -69,7 +80,7 @@ override_dh_auto_configure:
ifneq ($(WITH_DKMS),1)
@echo Building for $(kernelver)
find compat -type f -exec touch -t 200012201010 '{}' \; || true
- $(CURDIR)/configure --kernel-version=$(kernelver) --kernel-sources=$(kernel_source_dir) $(shell $(CURDIR)/ofed_scripts/dkms_ofed $(kernelver) $(kernel_source_dir) get-config) --with-njobs=$(NJOBS)
+ $(CURDIR)/configure --kernel-version=$(kernelver) --kernel-sources=$(kernel_source_dir) $(shell $(CURDIR)/ofed_scripts/dkms_ofed $(kernelver) $(kernel_source_dir) get-config) --with-njobs=$(NJOBS) --build-dummy-mods
endif
mod_dev_dir = /usr/src/ofa_kernel/$(deb_arch)/$(kernelver)
@@ -189,6 +200,9 @@ endif
install -m 0755 source/ofed_scripts/setup_mr_cache.sh debian/$(putils)/usr/sbin
install -m 0755 ofed_scripts/mlnx_bf_assign_ct_cores.sh debian/$(putils)/usr/share/mlnx_ofed
+ dh_installdirs -p$(putils) /etc/modules-load.d/
+ install -m 644 debian/extra/mlnx.conf debian/$(putils)/etc/modules-load.d/
+
override_dh_installinit:
--
2.47.1