!52 adapt map define for libbpf-1.2.2

From: @kwb0523 
Reviewed-by: @nlgwcy 
Signed-off-by: @nlgwcy
This commit is contained in:
openeuler-ci-bot 2024-04-24 06:19:49 +00:00 committed by Gitee
commit d62764f0a7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 76 additions and 2 deletions

View File

@ -0,0 +1,70 @@
From bc1ac8f89714535f3cdcae4aa970d4a82d5bcf5c Mon Sep 17 00:00:00 2001
From: kwb0523 <kwb0523@163.com>
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

View File

@ -1,6 +1,6 @@
Name: oncn-bwm Name: oncn-bwm
Version: 1.1 Version: 1.1
Release: 7 Release: 8
Summary: Pod bandwidth management in mixed deployment scenarios of online and offline services Summary: Pod bandwidth management in mixed deployment scenarios of online and offline services
License: GPL-2.0 License: GPL-2.0
URL: https://gitee.com/src-openeuler/oncn-bwm 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 Patch9005: 0005-fix-some-review-issues.patch
Patch9006: 0006-fix-input-options-unused-warning.patch Patch9006: 0006-fix-input-options-unused-warning.patch
Patch9007: 0007-fix-net_qos_stats-warning-when-qos-not-enable.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 %description
Pod bandwidth management in mixed deployment scenarios of online and offline services Pod bandwidth management in mixed deployment scenarios of online and offline services
@ -104,7 +105,7 @@ depmod -a
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%attr(0500,root,root) %{_bindir}/bwmcli %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_prio_kern.o
%attr(0500,root,root) /usr/share/bwmcli/bwm_tc.o %attr(0500,root,root) /usr/share/bwmcli/bwm_tc.o
%attr(0550,root,root) %dir /lib/modules/bwm %attr(0550,root,root) %dir /lib/modules/bwm
@ -115,6 +116,9 @@ depmod -a
%changelog %changelog
* Wed Apr 24 2024 JofDiamonds <kwb0523@163.com> - 1.1-8
- adapt map define for libbpf-1.2.2
* Wed Oct 18 2023 JofDiamonds <kwb0523@163.com> - 1.1-7 * Wed Oct 18 2023 JofDiamonds <kwb0523@163.com> - 1.1-7
- fix net_qos_stats warning when qos not enable - fix net_qos_stats warning when qos not enable