summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2021-01-20 15:23:40 -0800
committerMaciej Żenczykowski <maze@google.com>2021-01-20 16:24:02 -0800
commita36bed395f014aa69f08ae6dadb6f9684e448275 (patch)
treef4c7a19ce1284bb01a50c4d3ca7379f224819b8d
parent916d2395cc28144261cf6b2a9c528680659f18fd (diff)
downloadplatform_system_bpf-a36bed395f014aa69f08ae6dadb6f9684e448275.tar.gz
platform_system_bpf-a36bed395f014aa69f08ae6dadb6f9684e448275.tar.bz2
platform_system_bpf-a36bed395f014aa69f08ae6dadb6f9684e448275.zip
add SKIP_IF_XDP_NOT_SUPPORTED macro
Test: builds, atest, TreeHugger Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: Ia954983565250faff547e81a53ec0df5fc26827e
-rw-r--r--libbpf_android/include/bpf/BpfUtils.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/libbpf_android/include/bpf/BpfUtils.h b/libbpf_android/include/bpf/BpfUtils.h
index bb097bf..e67f664 100644
--- a/libbpf_android/include/bpf/BpfUtils.h
+++ b/libbpf_android/include/bpf/BpfUtils.h
@@ -57,6 +57,15 @@ static inline bool isAtLeastKernelVersion(unsigned major, unsigned minor, unsign
} \
} while (0)
+#define SKIP_IF_XDP_NOT_SUPPORTED \
+ do { \
+ if (!android::bpf::isAtLeastKernelVersion(5, 9, 0)) { \
+ GTEST_LOG_(INFO) << "This test is skipped since xdp" \
+ << "not supported\n"; \
+ return; \
+ } \
+ } while (0)
+
} // namespace bpf
} // namespace android