From dfcc0ff5d2bf6eb7c6ad7621c61c896e69ff8103 Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 18 Jan 2023 20:44:56 +0100 Subject: [PATCH] bpf-headers: fix use of netlink.h header netlink.h header have NL_SET_ERR_MSG_MOD that is tied to kmods. We don't need kmods on bpf tools and this cause compilation error if the header is included. Fix it by dropping NL_SET_ERR_MSG_MOD. Link: https://github.com/openwrt/openwrt/pull/11825 Signed-off-by: Christian Marangi --- ...op-NL_SET_ERR_MSG-for-kernel-modules.patch | 30 +++++++++++++ ...-use-NL_SET_ERR_MSG-instead-of-NL_SE.patch | 44 +++++++++++++++++++ 2 files changed, 74 insertions(+) create mode 100644 package/kernel/bpf-headers/patches/101-linux-netlink-drop-NL_SET_ERR_MSG-for-kernel-modules.patch create mode 100644 package/kernel/bpf-headers/patches/102-net-flow_offload-use-NL_SET_ERR_MSG-instead-of-NL_SE.patch diff --git a/package/kernel/bpf-headers/patches/101-linux-netlink-drop-NL_SET_ERR_MSG-for-kernel-modules.patch b/package/kernel/bpf-headers/patches/101-linux-netlink-drop-NL_SET_ERR_MSG-for-kernel-modules.patch new file mode 100644 index 0000000000..5771b32954 --- /dev/null +++ b/package/kernel/bpf-headers/patches/101-linux-netlink-drop-NL_SET_ERR_MSG-for-kernel-modules.patch @@ -0,0 +1,30 @@ +From 7ed95633bff19950069c348b94c9c13164a57a2a Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Wed, 18 Jan 2023 20:20:39 +0100 +Subject: [PATCH] linux/netlink: drop NL_SET_ERR_MSG for kernel modules + +We don't need NL_SET_ERR_MSG_MOD for bpf modules and we can drop it to +solve missing KBUILD_MODNAME define. + +Signed-off-by: Christian Marangi +--- + include/linux/netlink.h | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/include/linux/netlink.h b/include/linux/netlink.h +index 61b1c7f..93561fb 100644 +--- a/include/linux/netlink.h ++++ b/include/linux/netlink.h +@@ -98,9 +98,6 @@ struct netlink_ext_ack { + __extack->_msg = __msg; \ + } while (0) + +-#define NL_SET_ERR_MSG_MOD(extack, msg) \ +- NL_SET_ERR_MSG((extack), KBUILD_MODNAME ": " msg) +- + #define NL_SET_BAD_ATTR_POLICY(extack, attr, pol) do { \ + if ((extack)) { \ + (extack)->bad_attr = (attr); \ +-- +2.38.1 + diff --git a/package/kernel/bpf-headers/patches/102-net-flow_offload-use-NL_SET_ERR_MSG-instead-of-NL_SE.patch b/package/kernel/bpf-headers/patches/102-net-flow_offload-use-NL_SET_ERR_MSG-instead-of-NL_SE.patch new file mode 100644 index 0000000000..4dec16874e --- /dev/null +++ b/package/kernel/bpf-headers/patches/102-net-flow_offload-use-NL_SET_ERR_MSG-instead-of-NL_SE.patch @@ -0,0 +1,44 @@ +From 6e7cd9c0abffea55e39a4160949bc6fba972d161 Mon Sep 17 00:00:00 2001 +From: Christian Marangi +Date: Thu, 19 Jan 2023 13:37:46 +0100 +Subject: [PATCH] net/flow_offload: use NL_SET_ERR_MSG instead of + NL_SET_ERR_MSG_MOD + +Use NL_SET_ERR_MSG instead of NL_SET_ERR_MSG_MOD for bpf modules as +kernel modules are not supported. + +Signed-off-by: Christian Marangi +--- + include/net/flow_offload.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h +index 7a2b022..f17c485 100644 +--- a/include/net/flow_offload.h ++++ b/include/net/flow_offload.h +@@ -321,7 +321,7 @@ flow_action_mixed_hw_stats_check(const struct flow_action *action, + + flow_action_for_each(i, action_entry, action) { + if (i && action_entry->hw_stats != last_hw_stats) { +- NL_SET_ERR_MSG_MOD(extack, "Mixing HW stats types for actions is not supported"); ++ NL_SET_ERR_MSG(extack, "Mixing HW stats types for actions is not supported"); + return false; + } + last_hw_stats = action_entry->hw_stats; +@@ -356,11 +356,11 @@ __flow_action_hw_stats_check(const struct flow_action *action, + + if (!check_allow_bit && + ~action_entry->hw_stats & FLOW_ACTION_HW_STATS_ANY) { +- NL_SET_ERR_MSG_MOD(extack, "Driver supports only default HW stats type \"any\""); ++ NL_SET_ERR_MSG(extack, "Driver supports only default HW stats type \"any\""); + return false; + } else if (check_allow_bit && + !(action_entry->hw_stats & BIT(allow_bit))) { +- NL_SET_ERR_MSG_MOD(extack, "Driver does not support selected HW stats type"); ++ NL_SET_ERR_MSG(extack, "Driver does not support selected HW stats type"); + return false; + } + return true; +-- +2.38.1 + -- 2.30.2