From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none 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=XUgexZWz; 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 ESMTP id EB3665A0271 for ; Thu, 05 Dec 2024 08:37:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1733384242; 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; bh=7tGoHPq/hAplW4r8nAjahrN/4Weabbiw7V5RIHVGUic=; b=XUgexZWzLEH1b8Q2W6t4DUtNVmVFoVU8fNAO0HO6KOVazziA2LLS++H8iFTYk08f/eUrg0 T99w/HrkvcA/ZPtA5LupJjux8n86Pif8bWHoR2PO+R+yeU9b2w8UtGt8P75BXkKpY5XprN ohzdUvIxnQhTKAFQaPT71cUuvyLsWBo= 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-639-aYuiVEvBPpiQjl_c1NVVMw-1; Thu, 05 Dec 2024 02:37:21 -0500 X-MC-Unique: aYuiVEvBPpiQjl_c1NVVMw-1 X-Mimecast-MFC-AGG-ID: aYuiVEvBPpiQjl_c1NVVMw 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-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6C85B1955F40 for ; Thu, 5 Dec 2024 07:37:20 +0000 (UTC) Received: from lenovo-t14s.redhat.com (unknown [10.39.192.151]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 74EE61956052; Thu, 5 Dec 2024 07:37:19 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH v2] udp_vu: update segment size Date: Thu, 5 Dec 2024 08:37:18 +0100 Message-ID: <20241205073718.6914-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: H6lpNDo25p6oWqY7rZdR6aSbuaWRcCflTP_KzNOdjYY_1733384240 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: KHONPGSF3SES2W7JWWTTA6DLHHGHPIXN X-Message-ID-Hash: KHONPGSF3SES2W7JWWTTA6DLHHGHPIXN 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: In udp_vu_sock_recv(), collect a segment with a size defined to IP_MAX_MTU + ETH_HLEN + sizeof(struct virtio_net_hdr_mrg_rxbuf) The original version double counted the IP header: IP_MAX_MTU includes the IP header, and so did hdrlen. Signed-off-by: Laurent Vivier --- udp_vu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/udp_vu.c b/udp_vu.c index 9c697f3be247..41235101b69e 100644 --- a/udp_vu.c +++ b/udp_vu.c @@ -104,7 +104,8 @@ static int udp_vu_sock_recv(const struct ctx *c, int s, uint32_t events, vu_init_elem(elem, iov_vu, VIRTQUEUE_MAX_SIZE); iov_cnt = vu_collect(vdev, vq, elem, VIRTQUEUE_MAX_SIZE, - IP_MAX_MTU - sizeof(struct udphdr) + hdrlen, + IP_MAX_MTU + ETH_HLEN + + sizeof(struct virtio_net_hdr_mrg_rxbuf), NULL); if (iov_cnt == 0) return 0; -- 2.47.1