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=MTqSyUJx; 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 490EF5A0276 for ; Fri, 05 Dec 2025 12:27:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764934076; 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=TNzJbVyWsp3gNw02193X0zMtCHA1SXisx8lird8OYUw=; b=MTqSyUJx/mShTSBUKvnHIMB640nC0zodZVnDMCdJC7BF+RLrK6dB4lC+AL608pTR2UjY1z MwvAiHHeWzuvitbfrYCOr9xQNPVcS8Ai+7bTy4yY5ofKHnJv8PjkVICSai83QDkUXHQktn jrZWYT4iIqZJva1Wnc4D54LAQe6o6lc= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-j7rA231cMc6915NF0ATFGg-1; Fri, 05 Dec 2025 06:27:53 -0500 X-MC-Unique: j7rA231cMc6915NF0ATFGg-1 X-Mimecast-MFC-AGG-ID: j7rA231cMc6915NF0ATFGg_1764934072 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-42e2e3c3e1aso997508f8f.1 for ; Fri, 05 Dec 2025 03:27:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764934071; x=1765538871; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=TNzJbVyWsp3gNw02193X0zMtCHA1SXisx8lird8OYUw=; b=S/rJf3BbkCFxh0XAU72Re92qdzzl2DScQoPqQ8nfWZi+YiVAXsIMDBWNGEORefuUeM iVy8gvu20w0Zlnjn8ffv4WaejJ8ALmjRKm8I8wIyYE5r/zOrKOHvloOwO+64IdE/GHf0 163MN2hly8y1Pij9+UOn7RgdnOMIKH0lknuCxilf/rwRA/eBt7KGFTBrLN+GSullQniU zaCHXrdHuw3zXAY0zP8GNdtBGsWwso6DOFE97ylVWB+7te7NjyHhsBf6qgs9dMx2XkKT WcnKHpSMVz4DJ7q6YSISvceBNojq9wHh7gjEao6J7epz0aVpPTpnxIfwg0RM7wbadIRM dvDQ== X-Gm-Message-State: AOJu0Yyfb8IEcnOrb9INVhyHK/a2XykkPBwd0mFyFHXSEsce4c0Tlojd r4uM/mLz3iV2ebws6at3lqleP5VgMcqVUZOixxXT2Q/C8t8hCSbOMBy051AuHIY2f/VOXkKn7E1 q9EhMs7AhhdxRCAHEaew3XGMcso1g+1EOFVTW0j58hITG2Mfyx4vNXHlh9VQ5rA== X-Gm-Gg: ASbGncsGy0MOhZLebVwYFWoz1CSOJSFJx3rDiCMo/s1fPoXrtanFhHeWnogStPvA99N bXnrwomSi4iP+ULx1yYIEzsSGBWoyAF7DzNpw9uw8TFN88C8c93ujHMZ+3x/EhTmwbq1vDFA/S0 yaFbbVkukJBplewjBw2sCSvk+EDcBdl4CmSoHmRMDUGNT2mj2IPnfKfptWt3Oi16CK/UdpeKFUQ EWbJyBGpM1C+QwzCYvKwbK4zXUwMvyrtAQQ285vIrW7s8UU5nKEQjLql34XAy7JCP50YnR6jfrJ Tqp0DNsvQLlLQAzRN1y0zUfHJKPfArQq4Pzm7PM3A7LRE9If9z3GyilKPoWWoIBfQYNIreNUYzk UICCfO0KXY3HcEPHEBMrXK1bTd9SWTKtSApfh1w== X-Received: by 2002:a05:6000:310e:b0:429:b751:7935 with SMTP id ffacd0b85a97d-42f731cc86amr10271822f8f.56.1764934071610; Fri, 05 Dec 2025 03:27:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEE1T2VQz8NyaZbncNoeER0/yQokvjSURlnGH4UEwSAaLGQvrLh3l/vJFM+JvGtpiYKRw4CNA== X-Received: by 2002:a05:6000:310e:b0:429:b751:7935 with SMTP id ffacd0b85a97d-42f731cc86amr10271785f8f.56.1764934071204; Fri, 05 Dec 2025 03:27:51 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f7d2226e7sm8562980f8f.27.2025.12.05.03.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 03:27:50 -0800 (PST) Date: Fri, 5 Dec 2025 12:27:49 +0100 From: Stefano Brivio To: passt-dev@passt.top Subject: Re: [PATCH v2 4/5] tcp, udp: Pad batched frames to 60 bytes (802.3 minimum) in non-vhost-user modes Message-ID: <20251205122749.53b101ea@elisabeth> In-Reply-To: <20251205064842.42abd0d5@elisabeth> References: <20251205005157.2577523-1-sbrivio@redhat.com> <20251205005157.2577523-5-sbrivio@redhat.com> <20251205064842.42abd0d5@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: iVfbDi57QGwxBtICi4kEuC5Xw2HDMLr2hlZsct4fAaI_1764934072 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: V65UWVCALCB2C3I6HF4SEM7X7SZQBVPP X-Message-ID-Hash: V65UWVCALCB2C3I6HF4SEM7X7SZQBVPP 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: David Gibson , 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: On Fri, 5 Dec 2025 06:48:42 +0100 Stefano Brivio wrote: > On Fri, 5 Dec 2025 01:51:56 +0100 > Stefano Brivio wrote: > > > Add a further iovec frame part, TCP_IOV_ETH_PAD for TCP and > > UDP_IOV_ETH_PAD for UDP, after the payload, make that point to a > > zero-filled buffer, and send out a part of it if needed to reach > > the minimum frame length given by 802.3, that is, 60 bytes altogether. > > > > The frames we might need to pad are IPv4 only (the IPv6 header is > > larger), and are typically TCP ACK segments but can also be small > > data segments or datagrams. > > > > Link: https://bugs.passt.top/show_bug.cgi?id=166 > > Signed-off-by: Stefano Brivio > > Reviewed-by: David Gibson > > Reviewed-by: Laurent Vivier > > ...for some reason, in combination with the previous series with TCP > throughput fixes, this patch now seems to break basic transfers ("large > transfer", IPv4, guest to host), with passt only. Whoa, it turns out I didn't test this one at all, sorry for that, I don't know how it happened. This "clearly" needs: --- diff --git a/tcp.c b/tcp.c index c5486bc..7140b22 100644 --- a/tcp.c +++ b/tcp.c @@ -1037,7 +1037,7 @@ void tcp_fill_headers(const struct ctx *c, struct tcp_tap_conn *conn, else tcp_update_csum(psum, th, payload); - tap_hdr_update(taph, l3len + sizeof(struct ethhdr)); + tap_hdr_update(taph, MAX(l3len + sizeof(struct ethhdr), ETH_ZLEN)); } /** diff --git a/udp.c b/udp.c index f32f553..08bec50 100644 --- a/udp.c +++ b/udp.c @@ -381,19 +381,25 @@ static void udp_tap_prepare(const struct mmsghdr *mmh, struct ethhdr *eh = (*tap_iov)[UDP_IOV_ETH].iov_base; struct udp_payload_t *bp = &udp_payload[idx]; struct udp_meta_t *bm = &udp_meta[idx]; - size_t l4len; + size_t l4len, l2len; eth_update_mac(eh, NULL, tap_omac); if (!inany_v4(&toside->eaddr) || !inany_v4(&toside->oaddr)) { l4len = udp_update_hdr6(&bm->ip6h, bp, toside, mmh[idx].msg_len, no_udp_csum); - tap_hdr_update(&bm->taph, l4len + sizeof(bm->ip6h) + ETH_HLEN); + + l2len = MAX(l4len + sizeof(bm->ip6h) + ETH_HLEN, ETH_ZLEN); + tap_hdr_update(&bm->taph, l2len); + eh->h_proto = htons_constant(ETH_P_IPV6); (*tap_iov)[UDP_IOV_IP] = IOV_OF_LVALUE(bm->ip6h); } else { l4len = udp_update_hdr4(&bm->ip4h, bp, toside, mmh[idx].msg_len, no_udp_csum); - tap_hdr_update(&bm->taph, l4len + sizeof(bm->ip4h) + ETH_HLEN); + + l2len = MAX(l4len + sizeof(bm->ip4h) + ETH_HLEN, ETH_ZLEN); + tap_hdr_update(&bm->taph, l2len); + eh->h_proto = htons_constant(ETH_P_IP); (*tap_iov)[UDP_IOV_IP] = IOV_OF_LVALUE(bm->ip4h); } --- on top. I'll respin the whole series in a bit (once I addressed David's comments to 5/5 as well). -- Stefano