diff options
Diffstat (limited to 'scripts/package-build/linux-kernel/patches')
4 files changed, 286 insertions, 0 deletions
diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch new file mode 100644 index 00000000..aaff6df5 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0001-mlx5-build-on-kernels-with-ndo_default_qcfg-but-no-n.patch @@ -0,0 +1,85 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 8 Nov 2026 09:15:04 +0000 +Subject: [PATCH] mlx5: build on kernels with ndo_default_qcfg but no + ndo_validate_qcfg + +OFED assumes ndo_default_qcfg and ndo_validate_qcfg arrived together +(Linux 7.0) and guards both with HAVE_NDO_DEFAULT_QCFG. Linux 6.18.y +stable backported the queue config struct and ndo_default_qcfg without +ndo_validate_qcfg, so the mlx5 driver fails to compile. + +Add a separate HAVE_NDO_VALIDATE_QCFG feature test and a backport patch +which only wires up the validate callback if the kernel provides it. +--- + .../0379-BACKPORT-ndo_validate_qcfg.patch | 28 +++++++++++++++++++ + compat/config/rdma.m4 | 18 ++++++++++++ + 2 files changed, 46 insertions(+) + create mode 100644 backports/0379-BACKPORT-ndo_validate_qcfg.patch + +diff --git a/backports/0379-BACKPORT-ndo_validate_qcfg.patch b/backports/0379-BACKPORT-ndo_validate_qcfg.patch +new file mode 100644 +index 0000000..f0baf3c +--- /dev/null ++++ b/backports/0379-BACKPORT-ndo_validate_qcfg.patch +@@ -0,0 +1,28 @@ ++--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c +++++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c ++@@ -6879,6 +6879,7 @@ static void mlx5e_queue_default_qcfg(str ++ qcfg->rx_page_size = PAGE_SIZE; ++ } ++ +++#ifdef HAVE_NDO_VALIDATE_QCFG ++ static int mlx5e_queue_validate_qcfg(struct net_device *dev, ++ struct netdev_queue_config *qcfg, ++ struct netlink_ext_ack *extack) ++@@ -6903,6 +6904,7 @@ static int mlx5e_queue_validate_qcfg(str ++ ++ return 0; ++ } +++#endif /* HAVE_NDO_VALIDATE_QCFG */ ++ ++ static bool mlx5e_queue_validate_page_size(struct net_device *dev, ++ struct netdev_queue_config *qcfg, ++@@ -7067,7 +7069,9 @@ static const struct netdev_queue_mgmt_op ++ #ifdef HAVE_NDO_DEFAULT_QCFG ++ /* Newer kernels (7.0+): qcfg sub-feature on netdev_queue_mgmt_ops */ ++ .ndo_default_qcfg = mlx5e_queue_default_qcfg, +++#ifdef HAVE_NDO_VALIDATE_QCFG ++ .ndo_validate_qcfg = mlx5e_queue_validate_qcfg, +++#endif ++ .supported_params = QCFG_RX_PAGE_SIZE, ++ #endif ++ }; +diff --git a/compat/config/rdma.m4 b/compat/config/rdma.m4 +index 02aeb4d..f9a185a 100644 +--- a/compat/config/rdma.m4 ++++ b/compat/config/rdma.m4 +@@ -4703,6 +4703,24 @@ MLNX_RDMA_TEST_CASE(HAVE_DEVL_RATE_NODES_DESTROY_UNSETS_PARENT, [devl_rate_nodes + return 0; + ]) + ++ MLNX_RDMA_TEST_CASE(HAVE_NDO_VALIDATE_QCFG, [struct netdev_queue_mgmt_ops has ndo_validate_qcfg], [ ++ #include <net/netdev_queues.h> ++ ++ static int test_validate(struct net_device *dev, struct netdev_queue_config *qcfg, ++ struct netlink_ext_ack *extack); ++ static int test_validate(struct net_device *dev, struct netdev_queue_config *qcfg, ++ struct netlink_ext_ack *extack) ++ { ++ return 0; ++ } ++ ],[ ++ struct netdev_queue_mgmt_ops ops = { ++ .ndo_validate_qcfg = test_validate, ++ }; ++ ++ return 0; ++ ]) ++ + MLNX_RDMA_TEST_CASE(HAVE_IRQ_UPDATE_AFFINITY_HINT, [irq_set_affinity_and_hint is defined], [ + #include <linux/interrupt.h> + ],[ +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch new file mode 100644 index 00000000..0ce617fa --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0002-mlx5-build-on-kernels-where-xsk_buff_get_metadata-ta.patch @@ -0,0 +1,62 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 8 Nov 2026 09:26:17 +0000 +Subject: [PATCH] mlx5: build on kernels where xsk_buff_get_metadata takes + options + +Linux 6.18.y stable backported upstream commit a6e4b9a6deb9 ("xsk: honor +XDP_TX_METADATA in zero-copy path"), which adds the descriptor options +to xsk_buff_get_metadata(). OFED still calls it with two arguments and +the mlx5 XSK TX path fails to compile. + +Add a HAVE_XSK_BUFF_GET_METADATA_OPTIONS feature test and a backport +patch passing the descriptor options, matching the in-tree driver. +--- + ...0-BACKPORT-xsk_buff_get_metadata-options.patch | 15 +++++++++++++++ + compat/config/rdma.m4 | 8 ++++++++ + 2 files changed, 23 insertions(+) + create mode 100644 backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch + +diff --git a/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch b/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch +new file mode 100644 +index 0000000..3c83cde +--- /dev/null ++++ b/backports/0380-BACKPORT-xsk_buff_get_metadata-options.patch +@@ -0,0 +1,15 @@ ++--- a/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c +++++ b/drivers/net/ethernet/mellanox/mlx5/core/en/xsk/tx.c ++@@ -119,8 +119,12 @@ bool mlx5e_xsk_tx(struct mlx5e_xdpsq *sq ++ #endif ++ xdptxd.len = desc.len; ++ #ifdef HAVE_XSK_TX_METADATA_OPS +++#ifdef HAVE_XSK_BUFF_GET_METADATA_OPTIONS +++ meta = xsk_buff_get_metadata(pool, desc.addr, desc.options); +++#else ++ meta = xsk_buff_get_metadata(pool, desc.addr); ++ #endif +++#endif ++ ++ #ifdef HAVE_XSK_BUFF_ALLOC ++ xsk_buff_raw_dma_sync_for_device(pool, xdptxd.dma_addr, xdptxd.len); +diff --git a/compat/config/rdma.m4 b/compat/config/rdma.m4 +index f9a185a..070595c 100644 +--- a/compat/config/rdma.m4 ++++ b/compat/config/rdma.m4 +@@ -4721,6 +4721,14 @@ MLNX_RDMA_TEST_CASE(HAVE_DEVL_RATE_NODES_DESTROY_UNSETS_PARENT, [devl_rate_nodes + return 0; + ]) + ++ MLNX_RDMA_TEST_CASE(HAVE_XSK_BUFF_GET_METADATA_OPTIONS, [xsk_buff_get_metadata has options parameter], [ ++ #include <net/xdp_sock_drv.h> ++ ],[ ++ xsk_buff_get_metadata(NULL, 0, 0); ++ ++ return 0; ++ ]) ++ + MLNX_RDMA_TEST_CASE(HAVE_IRQ_UPDATE_AFFINITY_HINT, [irq_set_affinity_and_hint is defined], [ + #include <linux/interrupt.h> + ],[ +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch new file mode 100644 index 00000000..aaf339ae --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0003-debian-drop-mlnx-ofed-kernel-dkms-install-file.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 8 Nov 2026 09:32:47 +0000 +Subject: [PATCH] debian: drop mlnx-ofed-kernel-dkms install file + +The dkms package is excluded by the "modules" build profile, but +dh_install still evaluates the install files of all packages to support +dh_missing. This file is a dh-exec script and dh-exec is only a build +dependency outside of the "modules" profile, so building with -Pmodules +fails unless dh-exec happens to be installed. + +The dkms package is never built, drop its install file. +--- + debian/mlnx-ofed-kernel-dkms.install | 11 ----------- + 1 file changed, 11 deletions(-) + delete mode 100755 debian/mlnx-ofed-kernel-dkms.install + +diff --git a/debian/mlnx-ofed-kernel-dkms.install b/debian/mlnx-ofed-kernel-dkms.install +deleted file mode 100755 +index d116b98..0000000 +--- a/debian/mlnx-ofed-kernel-dkms.install ++++ /dev/null +@@ -1,11 +0,0 @@ +-#!/usr/bin/dh-exec +-source/compat* usr/src/${pname}-${dkms_version} +-source/include usr/src/${pname}-${dkms_version} +-source/drivers usr/src/${pname}-${dkms_version} +-source/fs usr/src/${pname}-${dkms_version} +-source/net usr/src/${pname}-${dkms_version} +-source/backports usr/src/${pname}-${dkms_version} +-source/backports_applied usr/src/${pname}-${dkms_version} +-source/ofed_scripts usr/src/${pname}-${dkms_version} +-source/COPYING usr/src/${pname}-${dkms_version} +-source/debian/changelog usr/src/${pname}-${dkms_version}/debian +-- +2.39.5 + diff --git a/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch new file mode 100644 index 00000000..ccdbc4a1 --- /dev/null +++ b/scripts/package-build/linux-kernel/patches/mlnx-ofed-kernel/0004-debian-do-not-ship-build-sources-in-the-modules-pack.patch @@ -0,0 +1,102 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Christian Breunig <christian@breunig.cc> +Date: Sun, 8 Nov 2026 13:21:54 +0000 +Subject: [PATCH] debian: do not ship build sources in the modules package + +Without DKMS the modules package still installs headers, compat sources +and Module.symvers to /usr/src/ofa_kernel, and registers them as an +alternative, so further modules can be compiled on the target system. + +VyOS ships precompiled modules only and never builds kernel code on the +target. Drop the source tree and the maintainer scripts which only +managed its alternative. +--- + debian/mlnx-ofed-kernel-modules.postinst | 17 ----------------- + debian/mlnx-ofed-kernel-modules.prerm | 10 ---------- + debian/rules | 22 ---------------------- + 3 files changed, 49 deletions(-) + delete mode 100755 debian/mlnx-ofed-kernel-modules.postinst + delete mode 100755 debian/mlnx-ofed-kernel-modules.prerm + +diff --git a/debian/mlnx-ofed-kernel-modules.postinst b/debian/mlnx-ofed-kernel-modules.postinst +deleted file mode 100755 +index a67c0c4..0000000 +--- a/debian/mlnx-ofed-kernel-modules.postinst ++++ /dev/null +@@ -1,17 +0,0 @@ +-#!/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.prerm b/debian/mlnx-ofed-kernel-modules.prerm +deleted file mode 100755 +index 6f1b1df..0000000 +--- a/debian/mlnx-ofed-kernel-modules.prerm ++++ /dev/null +@@ -1,10 +0,0 @@ +-#!/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/rules b/debian/rules +index 775cadd..2570424 100755 +--- a/debian/rules ++++ b/debian/rules +@@ -112,22 +112,6 @@ endif + endif + + +- # +- # Sources for building stuff over MLNX_OFED +- # +- # With DKMS, copy the below files and folders during post_build since the +- # new DKMS versions started to remove the whole build directory. +- # however, some old versions of DKMS are buggy and ignores POST_BUILD +-ifeq ($(WITH_DKMS),1) +-else +- dh_installdirs -p$(pdkms) $(mod_dev_dir) +- cp -a include/ debian/$(pdkms)$(mod_dev_dir) +- cp -a config* debian/$(pdkms)$(mod_dev_dir) +- cp -a compat* debian/$(pdkms)$(mod_dev_dir) +- cp -a ofed_scripts debian/$(pdkms)$(mod_dev_dir) +- cp -a Module*.symvers debian/$(pdkms)$(mod_dev_dir) +-endif +- + # Force DKMS to install our modules. + # This is mostly needed for modules that do not have a version number info, as DKMS + # will compare their srcversion field, which does not really say which module is newer. +@@ -178,12 +162,6 @@ ifeq ($(DKMS3),1) + # versions: + echo "activate-await update-initramfs" >debian/$(pdkms)/DEBIAN/triggers + endif +-else +- sed -i \ +- -e 's/@KVER@/$(kernelver)/' \ +- -e 's/@ARCH@/$(deb_arch)/' \ +- debian/$(pdkms)/DEBIAN/postinst \ +- debian/$(pdkms)/DEBIAN/prerm + endif + + ifneq ($(MLNX_KO_NO_STRIP),1) +-- +2.39.5 + |
