* [Qemu-devel] [PATCH] virtio-net: correctly advertise host features
@ 2014-11-13 5:55 Jason Wang
2014-11-13 11:30 ` Stefan Hajnoczi
0 siblings, 1 reply; 2+ messages in thread
From: Jason Wang @ 2014-11-13 5:55 UTC (permalink / raw)
To: aliguori, mst, qemu-devel; +Cc: Jason Wang
We should not advertise the feature that depends on ctrl vq is it was not
enabled. And not advertise the VIRTIO_NET_F_CTRL_RX_EXTRA is
VIRTIO_NET_F_CTRL_RX is not enabled.
Otherwise, this may confuse guest driver and lead unexpected bugs.
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
hw/net/virtio-net.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9b88775..553f5a4 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -465,6 +465,21 @@ static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features)
features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO);
}
+ if (!(features & (0x1 << VIRTIO_NET_F_CTRL_VQ))) {
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_GUEST_OFFLOADS);
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_RX);
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_VLAN);
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_RX_EXTRA);
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_MAC_ADDR);
+ features &= ~(0x1 << VIRTIO_NET_F_GUEST_ANNOUNCE);
+ features &= ~(0x1 << VIRTIO_NET_F_MQ);
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_MAC_ADDR);
+ }
+
+ if (!(features & (0x1 << VIRTIO_NET_F_CTRL_RX))) {
+ features &= ~(0x1 << VIRTIO_NET_F_CTRL_RX_EXTRA);
+ }
+
if (!get_vhost_net(nc->peer)) {
return features;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-13 11:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13 5:55 [Qemu-devel] [PATCH] virtio-net: correctly advertise host features Jason Wang
2014-11-13 11:30 ` Stefan Hajnoczi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).