The existing error trace event is renamed to have a name prefix matching its source file & to remove the redundant first arg that adds no useful information.
Signed-off-by: Daniel P. Berrangé <berra...@redhat.com> --- ebpf/ebpf_rss.c | 29 ++++++++++++++++++++++++----- ebpf/trace-events | 6 +++++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c index 59854c8b51..8c42953475 100644 --- a/ebpf/ebpf_rss.c +++ b/ebpf/ebpf_rss.c @@ -53,7 +53,7 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx, Error **errp) PROT_READ | PROT_WRITE, MAP_SHARED, ctx->map_configuration, 0); if (ctx->mmap_configuration == MAP_FAILED) { - trace_ebpf_error("eBPF RSS", "can not mmap eBPF configuration array"); + trace_ebpf_rss_error(ctx, "can not mmap eBPF configuration array"); error_setg(errp, "Unable to map eBPF configuration array"); return false; } @@ -61,7 +61,7 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx, Error **errp) PROT_READ | PROT_WRITE, MAP_SHARED, ctx->map_toeplitz_key, 0); if (ctx->mmap_toeplitz_key == MAP_FAILED) { - trace_ebpf_error("eBPF RSS", "can not mmap eBPF toeplitz key"); + trace_ebpf_rss_error(ctx, "can not mmap eBPF toeplitz key"); error_setg(errp, "Unable to map eBPF toeplitz array"); goto toeplitz_fail; } @@ -69,11 +69,15 @@ static bool ebpf_rss_mmap(struct EBPFRSSContext *ctx, Error **errp) PROT_READ | PROT_WRITE, MAP_SHARED, ctx->map_indirections_table, 0); if (ctx->mmap_indirections_table == MAP_FAILED) { - trace_ebpf_error("eBPF RSS", "can not mmap eBPF indirection table"); + trace_ebpf_rss_error(ctx, "can not mmap eBPF indirection table"); error_setg(errp, "Unable to map eBPF indirection array"); goto indirection_fail; } + trace_ebpf_rss_mmap(ctx, + ctx->mmap_configuration, + ctx->mmap_toeplitz_key, + ctx->mmap_indirections_table); return true; indirection_fail: @@ -108,7 +112,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp) rss_bpf_ctx = rss_bpf__open(); if (rss_bpf_ctx == NULL) { - trace_ebpf_error("eBPF RSS", "can not open eBPF RSS object"); + trace_ebpf_rss_error(ctx, "can not open eBPF RSS object"); error_setg(errp, "Unable to open eBPF RSS object"); goto error; } @@ -116,7 +120,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp) bpf_program__set_type(rss_bpf_ctx->progs.tun_rss_steering_prog, BPF_PROG_TYPE_SOCKET_FILTER); if (rss_bpf__load(rss_bpf_ctx)) { - trace_ebpf_error("eBPF RSS", "can not load RSS program"); + trace_ebpf_rss_error(ctx, "can not load RSS program"); error_setg(errp, "Unable to load eBPF program"); goto error; } @@ -131,6 +135,11 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp) ctx->map_toeplitz_key = bpf_map__fd( rss_bpf_ctx->maps.tap_rss_map_toeplitz_key); + trace_ebpf_rss_load(ctx, + ctx->program_fd, + ctx->map_configuration, + ctx->map_indirections_table, + ctx->map_toeplitz_key); if (!ebpf_rss_mmap(ctx, errp)) { goto error; } @@ -178,6 +187,12 @@ bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd, ctx->map_toeplitz_key = toeplitz_fd; ctx->map_indirections_table = table_fd; + trace_ebpf_rss_load(ctx, + ctx->program_fd, + ctx->map_configuration, + ctx->map_indirections_table, + ctx->map_toeplitz_key); + if (!ebpf_rss_mmap(ctx, errp)) { ctx->program_fd = -1; ctx->map_configuration = -1; @@ -259,6 +274,8 @@ bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config, ebpf_rss_set_toepliz_key(ctx, toeplitz_key); + trace_ebpf_rss_set_data(ctx, config, indirections_table, toeplitz_key); + return true; } @@ -268,6 +285,8 @@ void ebpf_rss_unload(struct EBPFRSSContext *ctx) return; } + trace_ebpf_rss_unload(ctx); + ebpf_rss_munmap(ctx); if (ctx->obj) { diff --git a/ebpf/trace-events b/ebpf/trace-events index b3ad1a35f2..0202abd905 100644 --- a/ebpf/trace-events +++ b/ebpf/trace-events @@ -1,4 +1,8 @@ # See docs/devel/tracing.rst for syntax documentation. # ebpf-rss.c -ebpf_error(const char *s1, const char *s2) "error in %s: %s" +ebpf_rss_error(void *ctx, const char *s) "ctx=%p error=%s" +ebpf_rss_load(void *ctx, int progfd, int cfgfd, int toepfd, int indirfd) "ctx=%p program-fd=%d config-fd=%d toeplitz-fd=%d indirection-fd=%d" +ebpf_rss_mmap(void *ctx, void *cfgptr, void *toepptr, void *indirptr) "ctx=%p config-ptr=%p toeplitz-ptr=%p indirection-ptr=%p" +ebpf_rss_unload(void *ctx) "rss unload ctx=%p" +ebpf_rss_set_data(void *ctx, void *cfgptr, void *toepptr, void *indirptr) "ctx=%p config-ptr=%p toeplitz-ptr=%p indirection-ptr=%p" -- 2.45.2