summaryrefslogtreecommitdiff
path: root/src/xdp/common/common_user_bpf_xdp.h
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-12-18 17:13:13 +0100
committerChristian Poessinger <christian@poessinger.com>2020-12-19 21:56:19 +0100
commitb5c80d310527223b93e4133ac2f4c8c063c70a98 (patch)
tree48ae9e2752b4b94c07f767a019c99a8c2460c014 /src/xdp/common/common_user_bpf_xdp.h
parent22308b05dfbcd8da0230bbd8ba3bbc2a55da7786 (diff)
downloadvyos-1x-b5c80d310527223b93e4133ac2f4c8c063c70a98.tar.gz
vyos-1x-b5c80d310527223b93e4133ac2f4c8c063c70a98.zip
xdp: T2666: switch to example code provided by xdp-tutorial
Diffstat (limited to 'src/xdp/common/common_user_bpf_xdp.h')
-rw-r--r--src/xdp/common/common_user_bpf_xdp.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xdp/common/common_user_bpf_xdp.h b/src/xdp/common/common_user_bpf_xdp.h
new file mode 100644
index 000000000..4f8aa51d4
--- /dev/null
+++ b/src/xdp/common/common_user_bpf_xdp.h
@@ -0,0 +1,20 @@
+/* Common BPF/XDP functions used by userspace side programs */
+#ifndef __COMMON_USER_BPF_XDP_H
+#define __COMMON_USER_BPF_XDP_H
+
+int xdp_link_attach(int ifindex, __u32 xdp_flags, int prog_fd);
+int xdp_link_detach(int ifindex, __u32 xdp_flags, __u32 expected_prog_id);
+
+struct bpf_object *load_bpf_object_file(const char *filename, int ifindex);
+struct bpf_object *load_bpf_and_xdp_attach(struct config *cfg);
+
+const char *action2str(__u32 action);
+
+int check_map_fd_info(const struct bpf_map_info *info,
+ const struct bpf_map_info *exp);
+
+int open_bpf_map_file(const char *pin_dir,
+ const char *mapname,
+ struct bpf_map_info *info);
+
+#endif /* __COMMON_USER_BPF_XDP_H */