[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RESEND v7 16/19] ebpf: Simplify error handling
|
From: |
Akihiko Odaki |
|
Subject: |
[PATCH RESEND v7 16/19] ebpf: Simplify error handling |
|
Date: |
Sat, 18 Nov 2023 18:25:56 +0900 |
The error handling procedures required when rss_bpf__open() and
rss_bpf__load(rss_bpf_ctx) are different so it's better to implement
them separately.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
ebpf/ebpf_rss.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index 3978333584..2de9e7851f 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -46,12 +46,13 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
rss_bpf_ctx = rss_bpf__open();
if (rss_bpf_ctx == NULL) {
trace_ebpf_error("eBPF RSS", "can not open eBPF RSS object");
- goto error;
+ return false;
}
if (rss_bpf__load(rss_bpf_ctx)) {
trace_ebpf_error("eBPF RSS", "can not load RSS program");
- goto error;
+ rss_bpf__destroy(rss_bpf_ctx);
+ return false;
}
ctx->obj = rss_bpf_ctx;
@@ -65,11 +66,6 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx)
rss_bpf_ctx->maps.tap_rss_map_toeplitz_key);
return true;
-error:
- rss_bpf__destroy(rss_bpf_ctx);
- ctx->obj = NULL;
-
- return false;
}
static bool ebpf_rss_set_config(struct EBPFRSSContext *ctx,
--
2.42.1
- [PATCH RESEND v7 05/19] tap: Call tap_receive_iov() from tap_receive(), (continued)
- [PATCH RESEND v7 05/19] tap: Call tap_receive_iov() from tap_receive(), Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 06/19] tap: Shrink zeroed virtio-net header, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 07/19] virtio-net: Copy header only when necessary, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 08/19] virtio-net: Disable RSS on reset, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 09/19] virtio-net: Unify the logic to update NIC state for RSS, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 10/19] virtio-net: Return an error when vhost cannot enable RSS, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 11/19] virtio-net: Report RSS warning at device realization, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 12/19] virtio-net: Always set populate_hash, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 13/19] virtio-net: Do not write hashes to peer buffer, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 14/19] ebpf: Fix RSS error handling, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 16/19] ebpf: Simplify error handling,
Akihiko Odaki <=
- [PATCH RESEND v7 15/19] ebpf: Use standard section name, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 18/19] ebpf: Refactor tun_rss_steering_prog(), Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 19/19] ebpf: Add a separate target for skeleton, Akihiko Odaki, 2023/11/18
- [PATCH RESEND v7 17/19] ebpf: Return 0 when configuration fails, Akihiko Odaki, 2023/11/18