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=E9CViaa0; 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 AF3415A0265 for ; Sun, 15 Feb 2026 11:56:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1771152975; 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=Bqu4mPuXB7R/oeThYeDid8J56sJK3JBhXhk32kKQK6E=; b=E9CViaa01UYfIXZLleiiCqS1Ei0S8u2IVwvoFmg1u82YaX94GIGJOhb7kYGLtTxtSBIFKm aRGj52gC8QyJ74wli9k3cNuT1AboLmi923qD48JQ+7TmoQiGaxmb2xxr++a4/+USduFBO4 /FLXve9q3F7XYzgnowARxGew0cNoqbA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-652-pbtZ7pfBMvGL6YQWAx1Idg-1; Sun, 15 Feb 2026 05:56:14 -0500 X-MC-Unique: pbtZ7pfBMvGL6YQWAx1Idg-1 X-Mimecast-MFC-AGG-ID: pbtZ7pfBMvGL6YQWAx1Idg_1771152973 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-48079ae1001so19125415e9.0 for ; Sun, 15 Feb 2026 02:56:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771152972; x=1771757772; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Bqu4mPuXB7R/oeThYeDid8J56sJK3JBhXhk32kKQK6E=; b=qa/+ob8hMUQoqJrfCLZR2S2u4OFvOpMaU/wb3g8OI4JveyoE1qvzFEA0NNi/9GJvj4 BVehGqtNfo5zm5Fp+mjdqzwi5SYkyWcl01GV84PMpQQy3gR5V4Mbm/jFJg3JALyWJa13 VWWjP8N88OmQ1ZhElrXEYatgTrXcIHtAMasaS3X5KOgbw1pmEQOe6HHW/04BucZrN1Uj ar4W8HSXRb++4uc8jytKtrDOK4j3efKV7Q0pKdnCqQ8bvtZyC7eu/O6fkCdqqzRKkalf nbuW0OJttocoxsk8njNnDVblaedWWYmS+V70gI4Qe3pzDxurU11QWFBSa06gZNiXeiZj Vpxw== X-Gm-Message-State: AOJu0Yyh8G+MSgTKAPzNPeZFdI5BZp3ZH4e+yIvYnYy5swtNVLsRwosh pEwyMU1yjApqWZUNMsacIlFIfwCNfFWihP0bTQxAsP+bKh4iSxtDTbsqrsxRO+BWQ4tAZz09BOv j77RcOJHgd6YA9nwvuvfDgMXHDQTK3gKVkBlIz9tJWakVL9bl/0e645RZNzbztJPFMGnkCDDGx9 Bdk64DPGfx2gb1bQo7Kr/Gqor9mYMfidl4GaJz X-Gm-Gg: AZuq6aKRs6wpBwB/pCgmCuUMGuVk0R5fWIYMrI/HSXPswnk3tLxwzSrFTo9CvineiE1 j87oBnhpxKPmalX47Xw93msC9707SELGTW6yY7uDJcm0zqxJBmW2fGc5o0ddaM88PofVvT/31N+ hHvlzNSaM/l+QSe+xoUjdkx6rug4Vh0UAl5KRQTfiNZ+Loo+LenLTiyONZ5ZmZTYoUgkKKFF+AC VdyxNwh89mZkXuJL9tlOU1ubX0W7HHy5llqDIx1LBFVTLLYPIEmlcl8PbT8q2UVyO5iGVlLch4B bLB2UP1mvLo0DoW7/jU31L/aclbCPTGgpSIcPSZzYKanLnRXAtUbJcYir8XO6hDcGxeQs2shCPU wlCMVOpJq0vzodeoU1z7A0WLWCrOL8LzvMKfCl8sQEHcsN0ViyA== X-Received: by 2002:a05:600c:4e93:b0:47a:814c:ee95 with SMTP id 5b1f17b1804b1-48379bbcbd0mr77459495e9.12.1771152972448; Sun, 15 Feb 2026 02:56:12 -0800 (PST) X-Received: by 2002:a05:600c:4e93:b0:47a:814c:ee95 with SMTP id 5b1f17b1804b1-48379bbcbd0mr77459135e9.12.1771152971854; Sun, 15 Feb 2026 02:56:11 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4835dd0e327sm344457615e9.14.2026.02.15.02.56.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Feb 2026 02:56:11 -0800 (PST) From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH 2/2] tcp_vu, udp_vu: Account for virtio net header in minimum frame size Message-ID: <20260215115609.32cb69b0@elisabeth> In-Reply-To: <20260212113932.1047788-3-lvivier@redhat.com> References: <20260212113932.1047788-1-lvivier@redhat.com> <20260212113932.1047788-3-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Sun, 15 Feb 2026 11:56:10 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 1ufOWdJOUQY_OfOhpTuoafcQOfUUUvMsWzeh6DIYtPg_1771152973 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 6674MY73QZETYWKMWIIMKQZ2JHCL3JMK X-Message-ID-Hash: 6674MY73QZETYWKMWIIMKQZ2JHCL3JMK X-MailFrom: sbrivio@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: passt-dev@passt.top 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: On Thu, 12 Feb 2026 12:39:32 +0100 Laurent Vivier wrote: > In the vhost-user paths, the buffers provided by the virtio queue > include the virtio net header (VNET_HLEN) prepended to the Ethernet > frame. The minimum size checks using ETH_ZLEN must therefore account > for this additional header length, otherwise we underestimate the > minimum buffer size needed. > > Use ETH_ZLEN + VNET_HLEN instead of bare ETH_ZLEN in vu_collect() > calls and the corresponding ASSERT() checks. > > Fixes: 0cb8f9003654 ("tcp, udp: Pad batched frames for vhost-user modes to 60 bytes (802.3 minimum)") > Signed-off-by: Laurent Vivier > --- > tcp_vu.c | 8 ++++---- > udp_vu.c | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/tcp_vu.c b/tcp_vu.c > index f7bda4943e43..2d593d534d68 100644 > --- a/tcp_vu.c > +++ b/tcp_vu.c > @@ -90,12 +90,12 @@ int tcp_vu_send_flag(const struct ctx *c, struct tcp_tap_conn *conn, int flags) > vu_set_element(&flags_elem[0], NULL, &flags_iov[0]); > > elem_cnt = vu_collect(vdev, vq, &flags_elem[0], 1, > - MAX(hdrlen + sizeof(*opts), ETH_ZLEN), NULL); > + MAX(hdrlen + sizeof(*opts), ETH_ZLEN + VNET_HLEN), NULL); > if (elem_cnt != 1) > return -1; > > ASSERT(flags_elem[0].in_sg[0].iov_len >= > - MAX(hdrlen + sizeof(*opts), ETH_ZLEN)); > + MAX(hdrlen + sizeof(*opts), ETH_ZLEN + VNET_HLEN)); > > vu_set_vnethdr(vdev, flags_elem[0].in_sg[0].iov_base, 1); > > @@ -208,7 +208,7 @@ static ssize_t tcp_vu_sock_recv(const struct ctx *c, struct vu_virtq *vq, > > cnt = vu_collect(vdev, vq, &elem[elem_cnt], > VIRTQUEUE_MAX_SIZE - elem_cnt, > - MAX(MIN(mss, fillsize) + hdrlen, ETH_ZLEN), > + MAX(MIN(mss, fillsize) + hdrlen, ETH_ZLEN + VNET_HLEN), > &frame_size); > if (cnt == 0) > break; > @@ -302,7 +302,7 @@ static void tcp_vu_prepare(const struct ctx *c, struct tcp_tap_conn *conn, > /* we guess the first iovec provided by the guest can embed > * all the headers needed by L2 frame, including any padding > */ > - ASSERT(iov[0].iov_len >= MAX(hdrlen, ETH_ZLEN)); > + ASSERT(iov[0].iov_len >= MAX(hdrlen, ETH_ZLEN + VNET_HLEN)); This triggers in the passt_vu_in_ns/tcp, "TCP/IPv4: host to guest: big transfer" test case, that is, the first time we connect to the guest (probably on the initial SYN segment). I didn't check why. I applied 1/2, but not this one. -- Stefano