ebpf: add formal error reporting to all APIs

The eBPF code is currently reporting error messages through trace
events. Trace events are fine for debugging, but they are not to be
considered the primary error reporting mechanism, as their output
is inaccessible to callers.

This adds an "Error **errp" parameter to all methods which have
important error scenarios to report to the caller.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-10-23 09:51:00 +01:00 committed by Jason Wang
parent 31efce1e31
commit 00b69f1d86
4 changed files with 64 additions and 20 deletions

View file

@ -1265,7 +1265,8 @@ static bool virtio_net_attach_ebpf_rss(VirtIONet *n)
rss_data_to_rss_config(&n->rss_data, &config);
if (!ebpf_rss_set_all(&n->ebpf_rss, &config,
n->rss_data.indirections_table, n->rss_data.key)) {
n->rss_data.indirections_table, n->rss_data.key,
NULL)) {
return false;
}
@ -1336,7 +1337,7 @@ static bool virtio_net_load_ebpf_fds(VirtIONet *n)
}
}
ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3]);
ret = ebpf_rss_load_fds(&n->ebpf_rss, fds[0], fds[1], fds[2], fds[3], NULL);
exit:
if (!ret) {
@ -1354,7 +1355,7 @@ static bool virtio_net_load_ebpf(VirtIONet *n)
if (virtio_net_attach_ebpf_to_backend(n->nic, -1)) {
if (!(n->ebpf_rss_fds && virtio_net_load_ebpf_fds(n))) {
ret = ebpf_rss_load(&n->ebpf_rss);
ret = ebpf_rss_load(&n->ebpf_rss, NULL);
}
}