@@ -1352,18 +1352,25 @@ exit:
static bool virtio_net_load_ebpf(VirtIONet *n, Error **errp)
{
- bool ret = false;
-
- if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
- trace_virtio_net_rss_load(n, n->nr_ebpf_rss_fds, n->ebpf_rss_fds);
- if (n->ebpf_rss_fds) {
- ret = virtio_net_load_ebpf_fds(n, errp);
- } else {
- ret = ebpf_rss_load(&n->ebpf_rss, errp);
- }
+ if (!virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
+ return true;
}
- return ret;
+ trace_virtio_net_rss_load(n, n->nr_ebpf_rss_fds, n->ebpf_rss_fds);
+
+ /*
+ * If user explicitly gave QEMU RSS FDs to use, then
+ * failing to use them must be considered a fatal
+ * error. If no RSS FDs were provided, QEMU is trying
+ * eBPF on a "best effort" basis only, so report a
+ * warning and allow fallback to software RSS.
+ */
+ if (n->ebpf_rss_fds) {
+ return virtio_net_load_ebpf_fds(n, errp);
+ }
+
+ ebpf_rss_load(&n->ebpf_rss, &error_warn);
+ return true;
}
static void virtio_net_unload_ebpf(VirtIONet *n)
@@ -3913,23 +3920,7 @@ static void virtio_net_device_realize(DeviceState *dev, Error **errp)
net_rx_pkt_init(&n->rx_pkt);
if (virtio_has_feature(n->host_features, VIRTIO_NET_F_RSS)) {
- Error *err = NULL;
- if (!virtio_net_load_ebpf(n, &err)) {
- /*
- * If user explicitly gave QEMU RSS FDs to use, then
- * failing to use them must be considered a fatal
- * error. If no RSS FDs were provided, QEMU is trying
- * eBPF on a "best effort" basis only, so report a
- * warning and allow fallback to software RSS.
- */
- if (n->ebpf_rss_fds) {
- error_propagate(errp, err);
- } else {
- warn_report("unable to load eBPF RSS: %s",
- error_get_pretty(err));
- error_free(err);
- }
- }
+ virtio_net_load_ebpf(n, errp);
}
}