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=ACOhw72B; 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 BD9F55A0282 for ; Fri, 05 Sep 2025 17:49:45 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1757087384; 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=9w/Yv+TNI6CjsuHcE1QQ5bOc8vfJDL9vopLEqF5fA/U=; b=ACOhw72BQ1od2wAoNKAiIocCMwFeEV0yl48rZLwQxSxoM3IrE2Y2UKXtDJah4KX6HNCj5G s/nJxIF6VLTzjWaTNZ/GL7y6k+KJnSAv2qz0EM/JOJxM8BWPxFjCGtxpdr20CNlOwQQSB2 BEg68RiWWM0IbJKL3qWH5XZL9EIsAHM= Received: from mx-prod-mc-01.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-372-pnEsHhrQNe6rBTKHPAjzmQ-1; Fri, 05 Sep 2025 11:49:42 -0400 X-MC-Unique: pnEsHhrQNe6rBTKHPAjzmQ-1 X-Mimecast-MFC-AGG-ID: pnEsHhrQNe6rBTKHPAjzmQ_1757087382 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F24F91956096 for ; Fri, 5 Sep 2025 15:49:41 +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 094E31800577; Fri, 5 Sep 2025 15:49:40 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH 3/3] tcp_vu: Pass virtqueue pointer to tcp_vu_sock_recv() Date: Fri, 5 Sep 2025 17:49:35 +0200 Message-ID: <20250905154935.389634-4-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: bR_8oPOzpSqBuBWxxAb2axny_Ugwvzpuz07Uv-baPlI_1757087382 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: PM4TPHDMP3U35KWZJ4WR7WJB2GUBRB3Z X-Message-ID-Hash: PM4TPHDMP3U35KWZJ4WR7WJB2GUBRB3Z 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 tcp_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 --- tcp_vu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tcp_vu.c b/tcp_vu.c index cb39bc20355b..c6b5b91ec266 100644 --- a/tcp_vu.c +++ b/tcp_vu.c @@ -171,6 +171,7 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags) /** tcp_vu_sock_recv() - Receive datastream from socket into vhost-user buffers * @c: Execution context + * @vq: virtqueue to use to receive data * @conn: Connection pointer * @v6: Set for IPv6 connections * @already_sent: Number of bytes already sent @@ -181,13 +182,12 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags) * Return: number of bytes received from the socket, or a negative error code * on failure. */ -static ssize_t tcp_vu_sock_recv(const struct ctx *c, +static ssize_t tcp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq, const struct tcp_tap_conn *conn, bool v6, uint32_t already_sent, size_t fillsize, int *iov_cnt, int *head_cnt) { - struct vu_dev *vdev = c->vdev; - struct vu_virtq *vq = &vdev->vq[VHOST_USER_RX_QUEUE]; + const struct vu_dev *vdev = c->vdev; struct msghdr mh_sock = { 0 }; uint16_t mss = MSS_GET(conn); int s = conn->sock; @@ -398,7 +398,7 @@ int tcp_vu_data_from_sock(const struct ctx *c, struct tcp_tap_conn *conn) /* collect the buffers from vhost-user and fill them with the * data from the socket */ - len = tcp_vu_sock_recv(c, conn, v6, already_sent, fillsize, + len = tcp_vu_sock_recv(c, vq, conn, v6, already_sent, fillsize, &iov_cnt, &head_cnt); if (len < 0) { if (len != -EAGAIN && len != -EWOULDBLOCK) { -- 2.50.1