diff --git a/libbpf_android/BpfUtils.cpp b/libbpf_android/BpfUtils.cpp index f640cde..5fed9c2 100644 --- a/libbpf_android/BpfUtils.cpp +++ b/libbpf_android/BpfUtils.cpp @@ -112,23 +112,6 @@ unsigned kernelVersion() { return KVER(kver_major, kver_minor, kver_sub); } -std::string BpfLevelToString(BpfLevel bpfLevel) { - switch (bpfLevel) { - case BpfLevel::NONE: - return "None [pre-4.9 or pre-P]"; - case BpfLevel::BASIC_4_9: - return "Basic [4.9 P+]"; - case BpfLevel::EXTENDED_4_14: - return "Extended [4.14]"; - case BpfLevel::EXTENDED_4_19: - return "Extended [4.19]"; - case BpfLevel::EXTENDED_5_4: - return "Extended [5.4+]"; - // No default statement. We want to see errors of the form: - // "enumeration value 'BPF_LEVEL_xxx' not handled in switch [-Werror,-Wswitch]". - } -} - static BpfLevel getUncachedBpfSupportLevel() { unsigned kver = kernelVersion(); diff --git a/libbpf_android/include/bpf/BpfUtils.h b/libbpf_android/include/bpf/BpfUtils.h index 0177955..0843339 100644 --- a/libbpf_android/include/bpf/BpfUtils.h +++ b/libbpf_android/include/bpf/BpfUtils.h @@ -31,9 +31,6 @@ namespace android { namespace bpf { enum class BpfLevel { - // Devices shipped before P or kernel version is lower than 4.9 do not - // have eBPF enabled. - NONE, // Devices shipped in P with android 4.9 kernel only have the basic eBPF // functionalities such as xt_bpf and cgroup skb filter. BASIC_4_9, @@ -54,11 +51,10 @@ uint64_t getSocketCookie(int sockFd); int synchronizeKernelRCU(); int setrlimitForTest(); unsigned kernelVersion(); -std::string BpfLevelToString(BpfLevel BpfLevel); BpfLevel getBpfSupportLevel(); inline bool isBpfSupported() { - return getBpfSupportLevel() != BpfLevel::NONE; + return true; } #define SKIP_IF_EXTENDED_BPF_NOT_SUPPORTED \