On 3/12/26 10:47, David Gibson wrote:
On Thu, Mar 12, 2026 at 09:08:33AM +0100, Laurent Vivier wrote:
On 3/12/26 05:39, David Gibson wrote:
On Mon, Mar 09, 2026 at 10:47:44AM +0100, Laurent Vivier wrote:
iPXE places the vnet header in one virtqueue descriptor and the payload in another. When passt maps these descriptors, it needs two iovecs per virtqueue element to handle this layout.
Without this, passt crashes with:
ASSERTION FAILED in virtqueue_map_desc (virtio.c:403): num_sg < max_num_sg
Signed-off-by: Laurent Vivier
--- udp_vu.c | 8 ++++---- vu_common.c | 15 +++++++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/udp_vu.c b/udp_vu.c index cb5274aa1d81..47659b0402fd 100644 --- a/udp_vu.c +++ b/udp_vu.c @@ -34,7 +34,7 @@ #include "vu_common.h" static struct iovec iov_vu [VIRTQUEUE_MAX_SIZE]; -static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE]; +static struct vu_virtq_element elem [VIRTQUEUE_MAX_SIZE / IOV_PER_ELEM];
The two level structure of the queues (array of elems, each pointing to an array of iovs) confuses me a bit. I would have thought that VIRTQUEUE_MAX_SIZE represented the maximum number of elements, even if those elements had multiple iovs. Can you enlighten me?
In all the code until now I supposed the number of iovec is equal to the number of element because we had only one iovec per element.
At virtio level, VIRTQUEUE_MAX_SIZE is the number of vring_desc in a virtqueue, and a vring_desc is translated to an iovec in virtqueue_map_desc() that are collected to an element in vu_queue_map_desc(). So in passt, the maximum number of collected iovec will be VIRTQUEUE_MAX_SIZE and the maximum of element is VIRTQUEUE_MAX_SIZE if we have only one iovec per element.
Ok... sorry, I'm still unclear. Is the "element" a concept that's part of the "hardware" interface? Or just part of the structure on the software side?
It's a structure on the software side to reflect that a virtqueue entry can be split in several descriptors (addr, size) on the hardware side. A hardware side entry is mapped to a software side element, a hardware side descriptor is mapped to a software side iovec. Thanks, Laurent