TSG-23335 TFE适配AArch64架构

This commit is contained in:
luwenpeng
2024-11-13 15:08:03 +08:00
parent 595167dcf8
commit 2e69e0edd8
18 changed files with 191 additions and 93 deletions

View File

@@ -55,11 +55,42 @@ struct bpf_obj_ctx *bpf_obj_load(const char *obj_file, uint32_t queue_num, uint3
bpf_config_set_hash_mode(&ctx->config, hash_mode);
bpf_config_set_debug_log(&ctx->config, debug_log);
#if (LIBBPF_MAJOR_VERSION > 0 || (LIBBPF_MAJOR_VERSION == 0 && LIBBPF_MINOR_VERSION >= 7))
struct bpf_program *prog;
ctx->prog_obj = bpf_object__open_file(ctx->obj_file, NULL);
if (ctx->prog_obj == NULL)
{
printf("ERROR: Unable to open bpf object %s, %s.\n", ctx->obj_file, strerror(errno));
goto error;
}
prog = bpf_object__find_program_by_name(ctx->prog_obj, "bpf_tun_rss_steering");
if (!prog)
{
printf("ERROR: Unable to get bpf program from object %s, %s.\n", ctx->obj_file, strerror(errno));
goto error;
}
bpf_program__set_type(prog, BPF_PROG_TYPE_SOCKET_FILTER);
if (bpf_object__load(ctx->prog_obj))
{
printf("ERROR: Unable to load bpf object %s, %s.\n", ctx->obj_file, strerror(errno));
goto error;
}
ctx->prog_fd = bpf_program__fd(prog);
if (ctx->prog_fd < 0)
{
printf("ERROR: Unable to get bpf program fd from object %s, %s.\n", ctx->obj_file, strerror(errno));
goto error;
}
#else
if (bpf_prog_load(ctx->obj_file, BPF_PROG_TYPE_SOCKET_FILTER, &ctx->prog_obj, &ctx->prog_fd) < 0)
{
printf("ERROR: Unable to load bpf object %s, %s.\n", ctx->obj_file, strerror(errno));
goto error;
}
#endif
if (bpf_config_update_map(&ctx->config, ctx->prog_obj) == -1)
{