Skip to content

Commit c17ad4b

Browse files
akihikodakimstsirkin
authored andcommitted
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: df91055 ("virtio-net: enable virtio 1.0") Signed-off-by: Akihiko Odaki <[email protected]> Message-Id: <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Tested-by: Lei Yang <[email protected]> Reviewed-by: Michael S. Tsirkin <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent b876e72 commit c17ad4b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

hw/net/virtio-net.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,8 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,
19991999
offsetof(typeof(hdr),
20002000
virtio_net.hdr.num_buffers),
20012001
sizeof(hdr.virtio_net.hdr.num_buffers));
2002+
} else {
2003+
hdr.virtio_net.hdr.num_buffers = cpu_to_le16(1);
20022004
}
20032005

20042006
guest_offset = n->has_vnet_hdr ?

0 commit comments

Comments
 (0)