hw/net/virtio-net.c | 2 ++ 1 file changed, 2 insertions(+)
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>
---
hw/net/virtio-net.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 06f096abf678..b241cd4bb48a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -1992,6 +1992,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 ?
---
base-commit: 38d0939b86e2eef6f6a622c6f1f7befda0146595
change-id: 20241227-buffers-6bd3493c287e
Best regards,
--
Akihiko Odaki <akihiko.odaki@daynix.com>
I tested this patch with virtio-net regression tests and tests
"mrg_rxbuf" on/off status with netperf tests, everything works fine.
Tested-by: Lei Yang <leiyang@redhat.com>
On Wed, Jan 8, 2025 at 8:23 PM Akihiko Odaki <akihiko.odaki@daynix.com> wrote:
>
> 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>
> ---
> hw/net/virtio-net.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 06f096abf678..b241cd4bb48a 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1992,6 +1992,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 ?
>
> ---
> base-commit: 38d0939b86e2eef6f6a622c6f1f7befda0146595
> change-id: 20241227-buffers-6bd3493c287e
>
> Best regards,
> --
> Akihiko Odaki <akihiko.odaki@daynix.com>
>
>
© 2016 - 2026 Red Hat, Inc.