aboutgitcodebugslistschat
path: root/doc
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2026-03-03 16:17:34 +0100
committerStefano Brivio <sbrivio@redhat.com>2026-03-04 18:50:49 +0100
commit71a0d6cbbb0f0c936130e28dd33d48a16894491b (patch)
treeb201937cea48ced37ac8fcef9b854d7771c9d106 /doc
parent685864dea8c35a6abf3ab61de786167e73b18816 (diff)
downloadpasst-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar.gz
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar.bz2
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar.lz
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar.xz
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.tar.zst
passt-71a0d6cbbb0f0c936130e28dd33d48a16894491b.zip
vu_common: Always set num_buffers in virtio-net header
Legacy virtio used two different header formats: struct virtio_net_hdr (10 bytes) when VIRTIO_NET_F_MRG_RXBUF was not negotiated, and struct virtio_net_hdr_mrg_rxbuf (12 bytes) when it was. The num_buffers field only existed in the larger header. Modern virtio (VIRTIO_F_VERSION_1, i.e. virtio 1.0+) always uses the 12-byte struct virtio_net_hdr_mrg_rxbuf header regardless of whether VIRTIO_NET_F_MRG_RXBUF is negotiated, so num_buffers is always present in the header. passt only supports modern virtio and dies if VIRTIO_F_VERSION_1 is not negotiated (vhost_user.c), and VNET_HLEN is unconditionally defined as sizeof(struct virtio_net_hdr_mrg_rxbuf). The virtio specification (v1.1, section 5.1.6) requires that: "The device MUST set num_buffers to 1 if VIRTIO_NET_F_MRG_RXBUF has not been negotiated." vu_set_vnethdr() only set num_buffers when VIRTIO_NET_F_MRG_RXBUF was negotiated. When it was not, num_buffers was left uninitialised, violating the spec. Since vu_collect() already limits buffer collection to a single element when VIRTIO_NET_F_MRG_RXBUF is not negotiated, num_buffers passed by callers is guaranteed to be 1 in that case. We can therefore unconditionally set num_buffers, which makes the vdev parameter unnecessary. Drop the vdev parameter from vu_set_vnethdr() and update all callers. Signed-off-by: Laurent Vivier <lvivier@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Diffstat (limited to 'doc')
0 files changed, 0 insertions, 0 deletions