diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 07:10:00 +0000 |
commit | 4ba2b326284765e942044db13a7f0dae702bec93 (patch) | |
tree | cbdfaec33eed4f3a970c54cd10e8ddfe3003b3b1 /lib/testing/test_long_func_name.c | |
parent | Initial commit. (diff) | |
download | xdp-tools-4ba2b326284765e942044db13a7f0dae702bec93.tar.xz xdp-tools-4ba2b326284765e942044db13a7f0dae702bec93.zip |
Adding upstream version 1.3.1.upstream/1.3.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/testing/test_long_func_name.c')
-rw-r--r-- | lib/testing/test_long_func_name.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/testing/test_long_func_name.c b/lib/testing/test_long_func_name.c new file mode 100644 index 0000000..867cd0b --- /dev/null +++ b/lib/testing/test_long_func_name.c @@ -0,0 +1,31 @@ +#include <linux/bpf.h> +#include <bpf/bpf_helpers.h> +#include <xdp/xdp_helpers.h> + +#define bpf_debug(fmt, ...) \ + { \ + char __fmt[] = fmt; \ + bpf_trace_printk(__fmt, sizeof(__fmt), \ + ##__VA_ARGS__); \ + } + +SEC("xdp") +int xdp_test_prog_with_a_long_name(struct xdp_md *ctx) +{ + bpf_debug("PASS[1]: prog %u\n", ctx->ingress_ifindex); + return XDP_PASS; +} + +SEC("xdp") +int xdp_test_prog_with_a_long_name_too(struct xdp_md *ctx) +{ + bpf_debug("PASS[2]: prog %u\n", ctx->ingress_ifindex); + return XDP_PASS; +} + +struct { + __uint(priority, 5); + __uint(XDP_PASS, 1); +} XDP_RUN_CONFIG(xdp_test_prog_with_a_long_name); + +char _license[] SEC("license") = "GPL"; |