[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 3/3] vhost_vdpa: move VIRTIO_NET_F_STATUS handling to vhost_ne
From: |
Eugenio Pérez |
Subject: |
[PATCH v2 3/3] vhost_vdpa: move VIRTIO_NET_F_STATUS handling to vhost_net |
Date: |
Fri, 28 Oct 2022 17:19:17 +0200 |
Since it is emulated on all vhost backends it makes sense to move it.
Although this feature can be emulated by qemu it benefits from
information from the device. Ack it as long as the guest ack it.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
hw/net/vhost_net.c | 13 +++++++++++++
net/vhost-vdpa.c | 1 -
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c
index d28f8b974b..b533744211 100644
--- a/hw/net/vhost_net.c
+++ b/hw/net/vhost_net.c
@@ -127,8 +127,21 @@ int vhost_net_set_config(struct vhost_net *net, const
uint8_t *data,
void vhost_net_ack_features(struct vhost_net *net, uint64_t features)
{
+ static const int status_feature_bit[] = {
+ VIRTIO_NET_F_STATUS,
+ VHOST_INVALID_FEATURE_BIT,
+ };
+
net->dev.acked_features = net->dev.backend_features;
vhost_ack_features(&net->dev, vhost_net_get_feature_bits(net), features);
+ if (net->dev.features & BIT_ULL(VIRTIO_NET_F_STATUS)) {
+ /*
+ * If device support _F_STATUS qemu should ack it so it reports link
+ * status changes. If not supported qemu emulates it reporting an
+ * always up link.
+ */
+ vhost_ack_features(&net->dev, status_feature_bit, features);
+ }
}
uint64_t vhost_net_get_max_queues(VHostNetState *net)
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index 6d64000202..854b27186c 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -72,7 +72,6 @@ const int vdpa_feature_bits[] = {
VIRTIO_NET_F_RSS,
VIRTIO_NET_F_HASH_REPORT,
VIRTIO_NET_F_GUEST_ANNOUNCE,
- VIRTIO_NET_F_STATUS,
VHOST_INVALID_FEATURE_BIT
};
--
2.31.1