From: Akihiko Odaki <akihiko.od...@daynix.com> 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.od...@daynix.com> Message-Id: <20250108-buffers-v1-1-a0c85ff31...@daynix.com> Reviewed-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Michael S. Tsirkin <m...@redhat.com> Tested-by: Lei Yang <leiy...@redhat.com> Reviewed-by: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Michael S. Tsirkin <m...@redhat.com> (cherry picked from commit c17ad4b11bd268a35506cd976884562df6ca69d7) (Mjt: adjust for 7.2.x) Signed-off-by: Michael Tokarev <m...@tls.msk.ru> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 204a80ec71..0ba1db5b14 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1914,6 +1914,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf, sg, elem->in_num, offsetof(typeof(mhdr), num_buffers), sizeof(mhdr.num_buffers)); + } else { + mhdr.num_buffers = cpu_to_le16(1); } receive_header(n, sg, elem->in_num, buf, size); -- 2.39.5