public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: Stefano Brivio <sbrivio@redhat.com>
To: Jon Maloy <jmaloy@redhat.com>, Stuart McLaren <stuart.mclaren@hpe.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] treewide: no L2 buffer in splice-only mode
Date: Fri, 04 Dec 2026 07:56:01 +0100 (CET)	[thread overview]
Message-ID: <20261204075600.16ee65d9@elisabeth> (raw)
In-Reply-To: <2c83c89d-ed79-4097-a326-86d0008c70d9@redhat.com>

On Thu, 3 Dec 2026 19:26:36 -0500
Jon Maloy <jmaloy@redhat.com> 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

  reply	other threads:[~2026-12-04  6:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03 17:56 Stuart McLaren
2026-12-04  0:26 ` Jon Maloy
2026-12-04  6:56   ` Stefano Brivio [this message]
2026-12-04 22:31 ` Stefano Brivio

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204075600.16ee65d9@elisabeth \
    --to=sbrivio@redhat.com \
    --cc=jmaloy@redhat.com \
    --cc=passt-dev@passt.top \
    --cc=stuart.mclaren@hpe.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).