From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=JRmrQilP; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 7D2E45A0262 for ; Mon, 09 Mar 2026 10:48:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1773049689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dAR6uHk7hHUku4SiaryN3Y9Ajx99NT1QPn7DCaT4BM4=; b=JRmrQilP66cgYYbn36lVHqEhGZrh1Ddi2kh2EStePaLQJyrQz8Z7qxsgSW6a7v0x6dQGIq qSjEvqfqJCdtEx62qwynp6dMRv9Q7ee+V8NVz5AAvWBDaXaAgvtBzCZ8Ss6LYzuMeFGIwd L+fzXnLTdSTEUotmBVFsvsvFQ/H2r8A= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-696-j1timzxMP1u8GmYiXaddiA-1; Mon, 09 Mar 2026 05:48:08 -0400 X-MC-Unique: j1timzxMP1u8GmYiXaddiA-1 X-Mimecast-MFC-AGG-ID: j1timzxMP1u8GmYiXaddiA_1773049687 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 2E5351956060; Mon, 9 Mar 2026 09:48:07 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.45.226.4]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id DC20B1954102; Mon, 9 Mar 2026 09:48:05 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v2 12/13] vu_common: Prepare to use multibuffer with guest RX Date: Mon, 9 Mar 2026 10:47:43 +0100 Message-ID: <20260309094744.1907754-13-lvivier@redhat.com> In-Reply-To: <20260309094744.1907754-1-lvivier@redhat.com> References: <20260309094744.1907754-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: Me36Q3QKeNLjS1zwa2h8G3vcLa9jTSXRa1-TQgG1T3M_1773049687 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 722DMJ76TGRLYBII4KWE3VOW2XRLDEY7 X-Message-ID-Hash: 722DMJ76TGRLYBII4KWE3VOW2XRLDEY7 X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier , David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 1b95bd6fa114 ("vhost_user: fix multibuffer from linux") introduces multibuffer with TX (from the guest), but with iPXE we need to handle also multibuffer for RX (to the guest). This patch makes the parameter generic and global. No functional change. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson --- vu_common.c | 6 ++---- vu_common.h | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vu_common.c b/vu_common.c index 94bd8d789a91..3225aca53ea6 100644 --- a/vu_common.c +++ b/vu_common.c @@ -20,8 +20,6 @@ #include "migrate.h" #include "epoll_ctl.h" -#define VU_MAX_TX_BUFFER_NB 2 - /** * vu_packet_check_range() - Check if a given memory zone is contained in * a mapped guest memory region @@ -203,11 +201,11 @@ static void vu_handle_tx(struct vu_dev *vdev, int index, count = 0; out_sg_count = 0; while (count < ARRAY_SIZE(elem) && - out_sg_count + VU_MAX_TX_BUFFER_NB <= VIRTQUEUE_MAX_SIZE) { + out_sg_count + IOV_PER_ELEM <= VIRTQUEUE_MAX_SIZE) { int ret; struct iov_tail data; - elem[count].out_num = VU_MAX_TX_BUFFER_NB; + elem[count].out_num = IOV_PER_ELEM; elem[count].out_sg = &out_sg[out_sg_count]; elem[count].in_num = 0; elem[count].in_sg = NULL; diff --git a/vu_common.h b/vu_common.h index c47e06885e3f..47490d91a57d 100644 --- a/vu_common.h +++ b/vu_common.h @@ -15,6 +15,8 @@ #include "ip.h" #include "virtio.h" +#define IOV_PER_ELEM (2) + static inline void *vu_eth(void *base) { return ((char *)base + VNET_HLEN); -- 2.53.0