add SKIP_IF_XDP_NOT_SUPPORTED macro am: a36bed395f am: 7d7af8b3d8

Original change: https://android-review.googlesource.com/c/platform/system/bpf/+/1555041

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ic07142251645ff8fb6b37c7a6df25e30938b48a0
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 @@
         }                                                                         \
     } 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