Re: [PATCH v2 3/3] tun: Set num_buffers for virtio 1.0

Akihiko Odaki
2025-01-10T10:04:14Z

On 2025/01/10 12:27, Jason Wang wrote:
> On Thu, Jan 9, 2025 at 2:59 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.
>
> Have we agreed on how to fix the spec or not?
>
> As I replied in the spec patch, if we just remove this "MUST", it
> looks like we are all fine?

My understanding is that we should fix the kernel and QEMU instead.
There may be some driver implementations that assumes num_buffers is 1
so the kernel and QEMU should be fixed to be compatible with such
potential implementations.

It is also possible to make future drivers with existing kernels and
QEMU by ensuring they will not read num_buffers when
VIRTIO_NET_F_MRG_RXBUF has not negotiated, and that's what "[PATCH v3]
virtio-net: Ignore num_buffers when unused" does.
https://lore.kernel.org/r/20250110-reserved-v3-1-2ade0a5d2090@daynix.com

Regards,
Akihiko Odaki