aboutsummaryrefslogtreecommitdiffstats
path: root/src/bpfswitch/usrc/libbpf_helpers.h
diff options
context:
space:
mode:
authorSridhar K. N. Rao <srao@linuxfoundation.org>2022-12-16 17:24:48 +0530
committerSridhar K. N. Rao <srao@linuxfoundation.org>2022-12-19 21:14:08 +0530
commit3409364da8fa46eae8ca22a579e219dc74958079 (patch)
tree83cb1cc72c3c59465d7d3be0f793a896c0ad7a21 /src/bpfswitch/usrc/libbpf_helpers.h
parent34147ac299351c44d4f7d135892457fba38a132b (diff)
ebpf: This patch adds ebpf-baremetal test support
Remove object files and binaries Suggestions in systems/Readme. Add license headers. Signed-off-by: Sridhar K. N. Rao <srao@linuxfoundation.org> Change-Id: I5fd481e3ed3eb51e6b8091cbf6d1ec8e3b00cbf0
Diffstat (limited to 'src/bpfswitch/usrc/libbpf_helpers.h')
-rw-r--r--src/bpfswitch/usrc/libbpf_helpers.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bpfswitch/usrc/libbpf_helpers.h b/src/bpfswitch/usrc/libbpf_helpers.h
new file mode 100644
index 00000000..9be0513c
--- /dev/null
+++ b/src/bpfswitch/usrc/libbpf_helpers.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __LIBBPF_HELPERS_H
+#define __LIBBPF_HELPERS_H
+
+#include <bpf/libbpf.h>
+
+int load_obj_file(struct bpf_prog_load_attr *attr,
+ struct bpf_object **obj,
+ const char *objfile, bool user_set);
+
+int bpf_map_get_fd_by_name(const char *name);
+int bpf_map_get_fd_by_path(const char *path);
+int bpf_map_get_fd(__u32 id, const char *path, const char *name,
+ const char *desc);
+
+int bpf_prog_get_fd_by_path(const char *path);
+int bpf_prog_get_fd(__u32 id, const char *path, const char *name,
+ const char *desc);
+
+int attach_to_dev_generic(int idx, int prog_fd, const char *dev);
+int detach_from_dev_generic(int idx, const char *dev);
+
+int attach_to_dev(int idx, int prog_fd, const char *dev);
+int detach_from_dev(int idx, const char *dev);
+
+int attach_to_dev_tx(int idx, int prog_fd, const char *dev);
+int detach_from_dev_tx(int idx, const char *dev);
+
+#endif