summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@daynix.com>2025-01-08 21:13:29 +0900
committerMichael S. Tsirkin <mst@redhat.com>2025-04-02 12:44:47 -0400
commitc17ad4b11bd268a35506cd976884562df6ca69d7 (patch)
treec2b7f182922a6b9e47fa506c62b634eb2cd76e68
parentb876e721f1c939f3e83ac85bd3c1c2821e12b3fa (diff)
downloadfocaccia-qemu-c17ad4b11bd268a35506cd976884562df6ca69d7.tar.gz
focaccia-qemu-c17ad4b11bd268a35506cd976884562df6ca69d7.zip
virtio-net: Fix num_buffers for version 1
The specification says the device MUST set num_buffers to 1 if
VIRTIO_NET_F_MRG_RXBUF has not been negotiated.

Fixes: df91055db5c9 ("virtio-net: enable virtio 1.0")
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Message-Id: <20250108-buffers-v1-1-a0c85ff31aeb@daynix.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r--hw/net/virtio-net.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index de87cfadff..340c6b6422 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1999,6 +1999,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
                                     offsetof(typeof(hdr),
                                              virtio_net.hdr.num_buffers),
                                     sizeof(hdr.virtio_net.hdr.num_buffers));
+            } else {
+                hdr.virtio_net.hdr.num_buffers = cpu_to_le16(1);
             }
 
             guest_offset = n->has_vnet_hdr ?