summaryrefslogtreecommitdiffstats
path: root/libnetdata/ebpf/ebpf.h
diff options
context:
space:
mode:
Diffstat (limited to 'libnetdata/ebpf/ebpf.h')
-rw-r--r--libnetdata/ebpf/ebpf.h45
1 files changed, 42 insertions, 3 deletions
diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h
index 125299672..f701e1d4d 100644
--- a/libnetdata/ebpf/ebpf.h
+++ b/libnetdata/ebpf/ebpf.h
@@ -5,6 +5,10 @@
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
+#ifdef LIBBPF_DEPRECATED
+#include <bpf/btf.h>
+#include <linux/btf.h>
+#endif
#include <stdlib.h> // Necessary for stdtoul
#define NETDATA_DEBUGFS "/sys/kernel/debug/tracing/"
@@ -17,11 +21,25 @@
#define EBPF_CFG_LOAD_MODE_RETURN "return"
#define EBPF_MAX_MODE_LENGTH 6
+#define EBPF_CFG_TYPE_FORMAT "ebpf type format"
+#define EBPF_CFG_DEFAULT_PROGRAM "auto"
+#define EBPF_CFG_CORE_PROGRAM "CO-RE"
+#define EBPF_CFG_LEGACY_PROGRAM "legacy"
+
+#define EBPF_CFG_CORE_ATTACH "ebpf co-re tracing"
+#define EBPF_CFG_ATTACH_TRAMPOLINE "trampoline"
+#define EBPF_CFG_ATTACH_TRACEPOINT "tracepoint"
+#define EBPF_CFG_ATTACH_PROBE "probe"
+
+#define EBPF_CFG_PROGRAM_PATH "btf path"
+
#define EBPF_CFG_UPDATE_EVERY "update every"
#define EBPF_CFG_PID_SIZE "pid table size"
#define EBPF_CFG_APPLICATION "apps"
#define EBPF_CFG_CGROUP "cgroups"
+#define EBPF_COMMON_FNCT_CLEAN_UP "release_task"
+
/**
* The RedHat magic number was got doing:
*
@@ -57,7 +75,8 @@ enum netdata_ebpf_kernel_versions {
NETDATA_EBPF_KERNEL_5_0 = 327680, // 327680 = 5 * 65536 + 0 * 256
NETDATA_EBPF_KERNEL_5_10 = 330240, // 330240 = 5 * 65536 + 10 * 256
NETDATA_EBPF_KERNEL_5_11 = 330496, // 330240 = 5 * 65536 + 11 * 256
- NETDATA_EBPF_KERNEL_5_15 = 331520 // 331520 = 5 * 65536 + 15 * 256
+ NETDATA_EBPF_KERNEL_5_15 = 331520, // 331520 = 5 * 65536 + 15 * 256
+ NETDATA_EBPF_KERNEL_5_16 = 331776 // 331776 = 5 * 65536 + 16 * 256
};
enum netdata_kernel_flag {
@@ -68,7 +87,8 @@ enum netdata_kernel_flag {
NETDATA_V5_4 = 1 << 4,
NETDATA_V5_10 = 1 << 5,
NETDATA_V5_11 = 1 << 6,
- NETDATA_V5_15 = 1 << 7
+ NETDATA_V5_15 = 1 << 7,
+ NETDATA_V5_16 = 1 << 8
};
enum netdata_kernel_idx {
@@ -79,7 +99,8 @@ enum netdata_kernel_idx {
NETDATA_IDX_V5_4 ,
NETDATA_IDX_V5_10,
NETDATA_IDX_V5_11,
- NETDATA_IDX_V5_15
+ NETDATA_IDX_V5_15,
+ NETDATA_IDX_V5_16
};
#define NETDATA_IDX_STR_V3_10 "3.10"
@@ -90,6 +111,7 @@ enum netdata_kernel_idx {
#define NETDATA_IDX_STR_V5_10 "5.10"
#define NETDATA_IDX_STR_V5_11 "5.11"
#define NETDATA_IDX_STR_V5_15 "5.15"
+#define NETDATA_IDX_STR_V5_16 "5.16"
/**
* Minimum value has relationship with libbpf support.
@@ -229,6 +251,8 @@ extern void ebpf_load_addresses(ebpf_addresses_t *fa, int fd);
extern void ebpf_fill_algorithms(int *algorithms, size_t length, int algorithm);
extern char **ebpf_fill_histogram_dimension(size_t maximum);
extern void ebpf_update_stats(ebpf_plugin_stats_t *report, ebpf_module_t *em);
+extern void ebpf_update_controller(int fd, ebpf_module_t *em);
+extern void ebpf_update_map_size(struct bpf_map *map, ebpf_local_maps_t *lmap, ebpf_module_t *em, const char *map_name);
// Histogram
#define NETDATA_EBPF_HIST_MAX_BINS 24UL
@@ -250,4 +274,19 @@ extern int ebpf_is_tracepoint_enabled(char *subsys, char *eventname);
extern int ebpf_enable_tracing_values(char *subsys, char *eventname);
extern int ebpf_disable_tracing_values(char *subsys, char *eventname);
+// BTF Section
+#define EBPF_DEFAULT_BTF_FILE "/sys/kernel/btf"
+#define EBPF_DEFAULT_ERROR_MSG "Cannot open or load BPF file for thread"
+
+// BTF helpers
+#define NETDATA_EBPF_MAX_SYSCALL_LENGTH 255
+
+extern netdata_ebpf_load_mode_t epbf_convert_string_to_load_mode(char *str);
+extern netdata_ebpf_program_loaded_t ebpf_convert_core_type(char *str, netdata_run_mode_t lmode);
+extern void ebpf_select_host_prefix(char *output, size_t length, char *syscall, int kver);
+#ifdef LIBBPF_MAJOR_VERSION
+extern void ebpf_adjust_thread_load(ebpf_module_t *mod, struct btf *file);
+extern struct btf *ebpf_parse_btf_file(const char *filename);
+#endif
+
#endif /* NETDATA_EBPF_H */