From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com 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 DB67C5A026E for ; Fri, 04 Dec 2026 07:56:06 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796367365; 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=JFVoWkjHEozKLwRCe56YLO1kX3kach9NkNiVVrcGJXw=; b=fV71VhUD21uwpGRRqPTTHe7saaGr9NKlQyn7AzCmFA7B66kVTxDR9GVxSeUS3HAb/LDUeP 2RF2GOWmCAtT9ePHmJCvTp2ReInYlO7/Ybkeu6MEDSs4dUt/QmzC+mE6rLVyZoxLkg6anY CoRiqnO3ufs8F7gIHDDPvElYOew2JS8= X-MC-Rep: binary re single Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-UXO2NLSYOfmluSPNuZLvdw-1; Fri, 4 Dec 2026 06:56:04 +0000 X-MC-Unique: UXO2NLSYOfmluSPNuZLvdw-1 X-Mimecast-MFC-AGG-ID: UXO2NLSYOfmluSPNuZLvdw_1796367363 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4bb67b2c00cso10331615e9.1 for ; Thu, 03 Dec 2026 22:56:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796367363; x=1796972163; h=date:content-transfer-encoding:content-type: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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RU X-Received: by 2002:a05:600c:628f:b0:4bb:ab2c:67f7 with SMTP id 5b1f17b1804b1-4bbeb88b99dmr17826855e9.8.1796367362693; Thu, 03 Dec 2026 22:56:02 -0800 (PST) X-Received: by 2002:a05:600c:628f:b0:4bb:ab2c:67f7 with SMTP id 5b1f17b1804b1-4bbeb88b99dmr17826485e9.8.1796367362236; Thu, 03 Dec 2026 22:56:02 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbeb700675sm17284165e9.5.2026.12.03.22.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 22:56:01 -0800 (PST) From: Stefano Brivio To: Jon Maloy , Stuart McLaren Subject: Re: [PATCH] treewide: no L2 buffer in splice-only mode Message-ID: <20261204075600.16ee65d9@elisabeth> In-Reply-To: <2c83c89d-ed79-4097-a326-86d0008c70d9@redhat.com> References: <20261203175624.3078368-1-stuart.mclaren@hpe.com> <2c83c89d-ed79-4097-a326-86d0008c70d9@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: Fri, 04 Dec 2026 07:56:01 +0100 (CET) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: vFgG0pQMVFC9hu2tX_80UjjG1TgpyILXfGdHvETYtjo_1796367363 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: YVYFUWDJ5PUFUQ2J55OMYR4D6HTL3TVB X-Message-ID-Hash: YVYFUWDJ5PUFUQ2J55OMYR4D6HTL3TVB 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, 3 Dec 2026 19:26:36 -0500 Jon Maloy wrote: > On 2026-12-03 12:56, Stuart McLaren wrote: > > Save memory by not initializing L2 memory buffers when > > running in --splice-only mode. > > Nice. Definitely, thanks Stuart for the patch! > This looks correct to me: in --splice-only mode we never create > a tap interface, and fwd_nat_from_host() doesn't let us create flows > towards it, so none of those buffers is reachable, and keeping the > receive iovecs in udp_iov_init_one() covers the socket-to-socket path. This last sentence made me think: could we save some memory there as well? In pasta mode, udp_sock_to_sock() transfers one frame at a time, not UDP_MAX_FRAMES, so we could *probably* initialise a single one in udp_iov_init(), using some kind of macro expression that yields 1 for mode == MODE_PASTA and 32 otherwise, for the loop termination. Note that I haven't tested this though. > But I see a corner case: on master, nothing prevents --splice-only together > with --fd (documented as passt-only) I think this is a small pre-existing bug, because in theory one could also use it for pasta's tap device (but not for --splice-only), and... > and in that case we actually forward > traffic from the given file descriptor as usual. I checked this with a pipe > as fake tap device, and a UDP datagram from it was forwarded to the > host. With this patch, that traffic is silently dropped instead, as > the packet pools aren't initialised. ...this one as well. We should simply make --splice-only mutually exclusive with --fd, I think. If the tap device isn't usable, there's no point in passing one using a file descriptor. > In my view, the new behaviour matches better what --splice-only means, > and I doubt anybody uses this combination. If we want to keep the > previous behaviour anyway, the alternative would be to still initialise > the L2 buffers if --fd is given. Something like this: > > !c->splice_only || c->fd_tap != -1 > > instead of just !c->splice_only, in all the places this patch touches: > not just for the packet pools, but also for the TCP and UDP frames, as > we would need those to send replies back. > > I leave the decision about that to Stefano. I agree, I would rather merge this patch as it is, and propose / accept another patch or two fixing the --splice-only / --fd combination and documentation of --fd. -- Stefano