CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2025/12/22 13:24:49
Modified files:
sys/dev/fdt : virtio_mmio.c
sys/dev/pci : virtio_pci.c
sys/dev/pv : if_vio.c
Log message:
virtio: Fix condition for buffer chaining, negotiate VIRTIO_F_ANY_LAYOUT
In 0.9-only time, the VIO_HAVE_MRG_RXBUF macro checked just for the
VIRTIO_NET_F_MRG_RXBUF feature. The meaning was later changed to
(version_1 || VIRTIO_NET_F_MRG_RXBUF), but the new meaning is only
correct for one use of the macro. The buffer chaining must check for the
MRG_RXBUF feature exclusively.
On the other hand, the check if we have to split the header from the
rest of the buffer in the rx queue is a workaround for old kvm versions.
The standard has since then gained the ANY_LAYOUT feature flag to turn
off this workaround. According to the virtio 1.x standard, we should
accept VIRTIO_F_ANY_LAYOUT if it is offered for transitional devices.
ANY_LAYOUT is implicit if VERSION_1 has been negotiated.
Since accepting ANY_LAYOUT only relaxes the requirements for us, we can
simply accept it globally for all virtio device types. vioblk(4) and
vioscsi(4) unconditionally use the strict buffer layout required for
legacy devices without ANY_LAYOUT, anyway.
Problem noticed by helg@
ok helg@