From: Jon Maloy <jmaloy@redhat.com>
To: sbrivio@redhat.com, david@gibson.dropbear.id.au,
jmaloy@redhat.com, passt-dev@passt.top
Subject: [PATCH] tcp_buf: Don't fill the slot reserved for duplicate ACKs with data
Date: Wed, 25 Nov 2026 19:13:27 -0500 [thread overview]
Message-ID: <20261126001327.4136475-1-jmaloy@redhat.com> (raw)
Since commit db7fb06f710e ("tcp_buf: Always reserve slot for possible
duplicate ACK flag in the same batch"), tcp_data_to_tap() flushes the
batch when only one free slot is left. However, in passt mode,
tcp_buf_data_from_sock() can still receive into all TCP_FRAMES_MEM
buffers at once, meaning that if it gets more than TCP_FRAMES_MEM - 1
segments, tcp_data_to_tap() flushes after the second last one, and
then continues with building the last frame in slot 0. This has
the consequence that the last segment is forwarded to the guest
with the payload of the first segment, which we just sent, instead
of the one we received into the last slot.
We limit the number of buffers we receive into to TCP_FRAMES_MEM - 1,
so that a whole batch of data frames always fits before the reserved
slot.
This also fixes a clang-tidy 23 warning in tcp_buf_data_from_sock(),
as the check on available slots there can now be false.
Fixes: db7fb06f710e ("tcp_buf: Always reserve slot for possible duplicate ACK flag in the same batch")
Signed-off-by: Jon Maloy <jmaloy@redhat.com>
---
tcp_buf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tcp_buf.c b/tcp_buf.c
index 0780a327..c9d675e3 100644
--- a/tcp_buf.c
+++ b/tcp_buf.c
@@ -35,7 +35,7 @@
#define TCP_FRAMES_MEM 128
#define TCP_FRAMES \
- (c->mode == MODE_PASTA ? 1 : TCP_FRAMES_MEM)
+ (c->mode == MODE_PASTA ? 1 : TCP_FRAMES_MEM - 1)
/* Static buffers */
--
2.56.1
reply other threads:[~2026-11-26 0:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261126001327.4136475-1-jmaloy@redhat.com \
--to=jmaloy@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.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).