From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: jasowang@redhat.com, mst@redhat.com, berrange@redhat.com
Subject: [PATCH 3/3] ebpf: Make ebpf_rss_load() return value consistent with @errp
Date: Tue, 18 Nov 2025 16:47:18 +0100 [thread overview]
Message-ID: <20251118154718.3969982-4-armbru@redhat.com> (raw)
In-Reply-To: <20251118154718.3969982-1-armbru@redhat.com>
ebpf_rss_load() returns false for failure without setting an Error
when its @ctx argument already has an eBPF program loaded. This is
wrong. Fortunately, it is only called @ctx has a program. Replace
the incorrect error check by an assertion.
The return value is now obviously reliable. Change the caller to use
it, because it's more concise.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
| 4 +---
hw/net/virtio-net.c | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
--git a/ebpf/ebpf_rss.c b/ebpf/ebpf_rss.c
index b64e9da3e3..926392b3c5 100644
--- a/ebpf/ebpf_rss.c
+++ b/ebpf/ebpf_rss.c
@@ -106,9 +106,7 @@ bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp)
{
struct rss_bpf *rss_bpf_ctx;
- if (ebpf_rss_is_loaded(ctx)) {
- return false;
- }
+ g_assert(!ebpf_rss_is_loaded(ctx));
rss_bpf_ctx = rss_bpf__open();
if (rss_bpf_ctx == NULL) {
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3b85560f6f..f5d93eb400 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1363,9 +1363,7 @@ static bool virtio_net_load_ebpf(VirtIONet *n, Error **errp)
return virtio_net_load_ebpf_fds(n, errp);
}
- ebpf_rss_load(&n->ebpf_rss, &err);
- /* Beware, ebpf_rss_load() can return false with @err unset */
- if (err) {
+ if (!ebpf_rss_load(&n->ebpf_rss, &err)) {
warn_report_err(err);
}
return true;
--
2.49.0
next prev parent reply other threads:[~2025-11-18 15:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-18 15:47 [PATCH 0/3] ebpf: Error fixes and cleanups Markus Armbruster
2025-11-18 15:47 ` [PATCH 1/3] ebpf: Fix stubs to set an error when they return failure Markus Armbruster
2025-11-18 16:01 ` Daniel P. Berrangé
2025-11-18 15:47 ` [PATCH 2/3] ebpf: Clean up useless error check in ebpf_rss_set_all() Markus Armbruster
2025-11-18 16:01 ` Daniel P. Berrangé
2025-11-18 15:47 ` Markus Armbruster [this message]
2025-11-18 16:03 ` [PATCH 3/3] ebpf: Make ebpf_rss_load() return value consistent with @errp Daniel P. Berrangé
2025-11-18 18:31 ` [PATCH 0/3] ebpf: Error fixes and cleanups Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251118154718.3969982-4-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=berrange@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.