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=h+wIiOHx; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id C24CB5A027B for ; Fri, 05 Sep 2025 17:49:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757087382; 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=j9Ldn5wK8XrmgUE/0lIX4PJULXaEeKsMxlJcZU5Kl5o=; b=h+wIiOHx5JfcT20RCvw1Ai2nlafyxfHNNoUwqzGdoHE5m7Z7ba7kZo8Y0dlT1NWOxyHsZF U509RIFPrr2KBSfS90ElSFbr1uKHZbLJkYFsY3UP2KJoukyr2YHbYPlWJ8GucHIBakopOV x5JxBarUiQRPdYiOB4fglkUYesjk6pQ= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-313-U1Wy5e9LOES3lvH9AmfBEQ-1; Fri, 05 Sep 2025 11:49:41 -0400 X-MC-Unique: U1Wy5e9LOES3lvH9AmfBEQ-1 X-Mimecast-MFC-AGG-ID: U1Wy5e9LOES3lvH9AmfBEQ_1757087380 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7864318002C2 for ; Fri, 5 Sep 2025 15:49:40 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.44.32.9]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 735FB1800576; Fri, 5 Sep 2025 15:49:39 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 2/3] udp_vu: Pass virtqueue pointer to udp_vu_sock_recv() Date: Fri, 5 Sep 2025 17:49:34 +0200 Message-ID: <20250905154935.389634-3-lvivier@redhat.com> In-Reply-To: <20250905154935.389634-1-lvivier@redhat.com> References: <20250905154935.389634-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: ORIgkg8MyCoaShggUFXLt__CZ2AwbZchHuVvAsiTiho_1757087380 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: 6XSZXDVD73OFYM2XU4TADCXHHWBVB4HO X-Message-ID-Hash: 6XSZXDVD73OFYM2XU4TADCXHHWBVB4HO 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 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: Pass the virtqueue pointer to udp_vu_sock_recv() to enable proper queue selection for multiqueue support. This ensures that received packets are processed on the same virtqueue as the caller. Signed-off-by: Laurent Vivier --- udp_vu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/udp_vu.c b/udp_vu.c index 2fb7b900ca31..099677f914e7 100644 --- a/udp_vu.c +++ b/udp_vu.c @@ -60,16 +60,17 @@ static size_t udp_vu_hdrlen(bool v6) /** * udp_vu_sock_recv() - Receive datagrams from socket into vhost-user buffers * @c: Execution context + * @vq: virtqueue to use to receive data * @s: Socket to receive from * @v6: Set for IPv6 connections * @dlen: Size of received data (output) * * Return: number of iov entries used to store the datagram */ -static int udp_vu_sock_recv(const struct ctx *c, int s, bool v6, ssize_t *dlen) +static int udp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq, int s, + bool v6, ssize_t *dlen) { - struct vu_dev *vdev = c->vdev; - struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE]; + const struct vu_dev *vdev = c->vdev; int iov_cnt, idx, iov_used; struct msghdr msg = { 0 }; size_t off, hdrlen; @@ -210,7 +211,7 @@ void udp_vu_sock_to_tap(const struct ctx *c, int s, int n, flow_sidx_t tosidx) ssize_t dlen; int iov_used; - iov_used = udp_vu_sock_recv(c, s, v6, &dlen); + iov_used = udp_vu_sock_recv(c, vq, s, v6, &dlen); if (iov_used <= 0) break; -- 2.50.1