From afb28eccd1288fbc952fa9d08705f83bd4f2043b Mon Sep 17 00:00:00 2001 From: kwb0523 Date: Wed, 24 Apr 2024 11:04:13 +0800 Subject: [PATCH] adapt map define for libbpf-1.2.2 (cherry picked from commit 40468d9e2bd3d87540a1f4876ac9639135f5a8c4) --- 0008-adapt-map-define-for-libbpf-1.2.2.patch | 70 ++++++++++++++++++++ oncn-bwm.spec | 8 ++- 2 files changed, 76 insertions(+), 2 deletions(-) create mode 100644 0008-adapt-map-define-for-libbpf-1.2.2.patch diff --git a/0008-adapt-map-define-for-libbpf-1.2.2.patch b/0008-adapt-map-define-for-libbpf-1.2.2.patch new file mode 100644 index 0000000..3fcafe8 --- /dev/null +++ b/0008-adapt-map-define-for-libbpf-1.2.2.patch @@ -0,0 +1,70 @@ +From bc1ac8f89714535f3cdcae4aa970d4a82d5bcf5c Mon Sep 17 00:00:00 2001 +From: kwb0523 +Date: Wed, 24 Apr 2024 10:53:19 +0800 +Subject: [PATCH] adapt map define for libbpf-1.2.2 + +--- + bpf/bwm_tc.c | 47 +++++++++++++++++------------------------------ + 1 file changed, 17 insertions(+), 30 deletions(-) + +diff --git a/bpf/bwm_tc.c b/bpf/bwm_tc.c +index d04d454..72bb944 100644 +--- a/bpf/bwm_tc.c ++++ b/bpf/bwm_tc.c +@@ -22,36 +22,23 @@ + #define PIN_GLOBAL_NS 2 + #define OFFLINE_PRIO ((unsigned int)-1) + +-struct bpf_elf_map_t { +- __u32 type; +- __u32 key_size; +- __u32 value_size; +- __u32 max_elem; +- __u32 flags; +- __u32 id; +- __u32 pinning; +-}; +- +- +-struct bpf_elf_map_t SEC("maps") throttle_cfg = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(unsigned int), +- .value_size = sizeof(struct edt_throttle_cfg), +- .pinning = PIN_GLOBAL_NS, +- .max_elem = 1, +- .flags = 0, +- .id = 0, +-}; +- +-struct bpf_elf_map_t SEC("maps") throttle_map = { +- .type = BPF_MAP_TYPE_ARRAY, +- .key_size = sizeof(unsigned int), +- .value_size = sizeof(struct edt_throttle), +- .pinning = PIN_GLOBAL_NS, +- .max_elem = 1, +- .flags = 0, +- .id = 0, +-}; ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __uint(key_size, sizeof(unsigned int)); ++ __uint(value_size, sizeof(struct edt_throttle_cfg)); ++ __uint(max_entries, 1); ++ __uint(map_flags, 0); ++ __uint(pinning, LIBBPF_PIN_BY_NAME); ++} throttle_cfg SEC(".maps"); ++ ++struct { ++ __uint(type, BPF_MAP_TYPE_ARRAY); ++ __uint(key_size, sizeof(unsigned int)); ++ __uint(value_size, sizeof(struct edt_throttle)); ++ __uint(max_entries, 1); ++ __uint(map_flags, 0); ++ __uint(pinning, LIBBPF_PIN_BY_NAME); ++} throttle_map SEC(".maps"); + + static void throttle_init(const struct edt_throttle_cfg *cfg, struct edt_throttle *throttle) + { +-- +2.33.0 + diff --git a/oncn-bwm.spec b/oncn-bwm.spec index d7e1a21..01f8240 100644 --- a/oncn-bwm.spec +++ b/oncn-bwm.spec @@ -1,6 +1,6 @@ Name: oncn-bwm Version: 1.1 -Release: 7 +Release: 8 Summary: Pod bandwidth management in mixed deployment scenarios of online and offline services License: GPL-2.0 URL: https://gitee.com/src-openeuler/oncn-bwm @@ -21,6 +21,7 @@ Patch9004: 0004-fix-offline-packets-block.patch Patch9005: 0005-fix-some-review-issues.patch Patch9006: 0006-fix-input-options-unused-warning.patch Patch9007: 0007-fix-net_qos_stats-warning-when-qos-not-enable.patch +Patch9008: 0008-adapt-map-define-for-libbpf-1.2.2.patch %description Pod bandwidth management in mixed deployment scenarios of online and offline services @@ -104,7 +105,7 @@ depmod -a %files %defattr(-,root,root) %attr(0500,root,root) %{_bindir}/bwmcli -%attr(0500,root,root) /usr/share/bwmcli +%attr(0500,root,root) %dir /usr/share/bwmcli %attr(0500,root,root) /usr/share/bwmcli/bwm_prio_kern.o %attr(0500,root,root) /usr/share/bwmcli/bwm_tc.o %attr(0550,root,root) %dir /lib/modules/bwm @@ -115,6 +116,9 @@ depmod -a %changelog +* Wed Apr 24 2024 JofDiamonds - 1.1-8 +- adapt map define for libbpf-1.2.2 + * Wed Oct 18 2023 JofDiamonds - 1.1-7 - fix net_qos_stats warning when qos not enable -- Gitee