[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v8 11/19] virtio-net: Report RSS warning at device realization
From: |
Akihiko Odaki |
Subject: |
[PATCH v8 11/19] virtio-net: Report RSS warning at device realization |
Date: |
Sun, 10 Dec 2023 14:29:49 +0900 |
Warning about RSS fallback at device realization allows the user to
notice the configuration problem early.
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
hw/net/virtio-net.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index c2cbf39a5f..40beff2262 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1260,10 +1260,12 @@ static bool virtio_net_attach_epbf_rss(VirtIONet *n)
if (!ebpf_rss_set_all(&n->ebpf_rss, &config,
n->rss_data.indirections_table, n->rss_data.key)) {
+ error_report("Failed to configure eBPF RSS");
return false;
}
if (!virtio_net_attach_ebpf_to_backend(n->nic, n->ebpf_rss.program_fd)) {
+ error_report("Failed to attach eBPF to backend");
return false;
}
@@ -1278,16 +1280,10 @@ static void virtio_net_detach_epbf_rss(VirtIONet *n)
static void virtio_net_commit_rss_config(VirtIONet *n)
{
if (n->rss_data.enabled) {
- n->rss_data.enabled_software_rss = n->rss_data.populate_hash;
+ n->rss_data.enabled_software_rss = n->rss_data.populate_hash ||
+ !virtio_net_attach_epbf_rss(n);
if (n->rss_data.populate_hash) {
virtio_net_detach_epbf_rss(n);
- } else if (!virtio_net_attach_epbf_rss(n)) {
- if (get_vhost_net(qemu_get_queue(n->nic)->peer)) {
- warn_report("Can't load eBPF RSS for vhost");
- } else {
- warn_report("Can't load eBPF RSS - fallback to software RSS");
- n->rss_data.enabled_software_rss = true;
- }
}
trace_virtio_net_rss_enable(n->rss_data.hash_types,
@@ -3746,10 +3742,14 @@ 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) &&
- !virtio_net_load_ebpf(n) &&
- get_vhost_net(nc->peer)) {
- error_setg(errp, "Can't load eBPF RSS for vhost");
- virtio_net_device_unrealize(dev);
+ !virtio_net_load_ebpf(n)) {
+ if (get_vhost_net(nc->peer)) {
+ error_setg(errp, "Can't load eBPF RSS for vhost");
+ virtio_net_device_unrealize(dev);
+ return;
+ }
+
+ warn_report("Can't load eBPF RSS - fallback to software RSS");
}
}
--
2.43.0
- [PATCH v8 05/19] tap: Call tap_receive_iov() from tap_receive(), (continued)
- [PATCH v8 05/19] tap: Call tap_receive_iov() from tap_receive(), Akihiko Odaki, 2023/12/10
- [PATCH v8 04/19] net: Remove receive_raw(), Akihiko Odaki, 2023/12/10
- [PATCH v8 06/19] tap: Shrink zeroed virtio-net header, Akihiko Odaki, 2023/12/10
- [PATCH v8 07/19] virtio-net: Copy header only when necessary, Akihiko Odaki, 2023/12/10
- [PATCH v8 08/19] virtio-net: Disable RSS on reset, Akihiko Odaki, 2023/12/10
- [PATCH v8 09/19] virtio-net: Unify the logic to update NIC state for RSS, Akihiko Odaki, 2023/12/10
- [PATCH v8 10/19] virtio-net: Return an error when vhost cannot enable RSS, Akihiko Odaki, 2023/12/10
- [PATCH v8 12/19] virtio-net: Always set populate_hash, Akihiko Odaki, 2023/12/10
- [PATCH v8 13/19] virtio-net: Do not write hashes to peer buffer, Akihiko Odaki, 2023/12/10
- [PATCH v8 14/19] ebpf: Fix RSS error handling, Akihiko Odaki, 2023/12/10
- [PATCH v8 11/19] virtio-net: Report RSS warning at device realization,
Akihiko Odaki <=
- [PATCH v8 16/19] ebpf: Simplify error handling, Akihiko Odaki, 2023/12/10
- [PATCH v8 15/19] ebpf: Use standard section name, Akihiko Odaki, 2023/12/10
- [PATCH v8 18/19] ebpf: Refactor tun_rss_steering_prog(), Akihiko Odaki, 2023/12/10
- [PATCH v8 19/19] ebpf: Add a separate target for skeleton, Akihiko Odaki, 2023/12/10
- [PATCH v8 17/19] ebpf: Return 0 when configuration fails, Akihiko Odaki, 2023/12/10
- Re: [PATCH v8 00/19] virtio-net RSS/hash report fixes and improvements, Yuri Benditovich, 2023/12/11