public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Max Chernoff <git@maxchernoff.ca>
Subject: Re: [PATCH 5/8] tcp: Don't limit window to less-than-MSS values, use zero instead
Date: Fri, 5 Dec 2025 13:53:06 +1100	[thread overview]
Message-ID: <aTJJEnQNGMzj0UKR@zatzit> (raw)
In-Reply-To: <20251205022016.4554e520@elisabeth>

[-- Attachment #1: Type: text/plain, Size: 3302 bytes --]

On Fri, Dec 05, 2025 at 02:20:16AM +0100, Stefano Brivio wrote:
> On Fri, 5 Dec 2025 11:35:22 +1100
> David Gibson <david@gibson.dropbear.id.au> wrote:
> 
> > On Thu, Dec 04, 2025 at 08:45:38AM +0100, Stefano Brivio wrote:
> > > If the sender uses data clumping (including Nagle's algorithm) for
> > > Silly Window Syndrome (SWS) avoidance, advertising less than a MSS
> > > means the sender might stop sending altogether, and window updates
> > > after a low window condition are just as important as they are in
> > > a zero-window condition.
> > > 
> > > For simplicity, approximate that limit to zero, as we have an
> > > implementation forcing window updates after zero-sized windows.
> > > 
> > > Signed-off-by: Stefano Brivio <sbrivio@redhat.com>  
> > 
> > The logic change looks good to me, so,
> > 
> > Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> > 
> > However, a couple of points about the description (both commit message
> > and comment).
> > 
> >  * Nagle's algorithm is certainly related, but it's not clear to me
> >    it's quite the same thing as the sender-side SWS avoidance
> >    algorithm - Nagle's exists for a different purpose, certainly.
> >    RFC 813 doesn't name Nagle's algorithm anywhere,    although that
> >    could because the name wasn't as established at the time.
> 
> Sure, Nagle's algorithm was published almost two years later (RFC 896).
> 
> >  * Since you're referencing RFC 813 anyway, it seems relevant that
> >    what you're doing here is pretty similar to the receiver-side SWS
> >    avoidance algorithm described in section 4.
> 
> The practical problem I observed comes from the "clumping" Linux does
> while sending (and that's implemented as part of Nagle's algorithm).

Ok.  I guess you could look at Nagle's algorithm as (amongst other
things) a refinement of the sender-side anti-SWS angorithm in RFC 813.

> But yes I actually ignored section 4 in all this, I'll mention it
> explicitly.
> 
> > > ---
> > >  tcp.c | 12 ++++++++++++
> > >  1 file changed, 12 insertions(+)
> > > 
> > > diff --git a/tcp.c b/tcp.c
> > > index fbf97a0..2220059 100644
> > > --- a/tcp.c
> > > +++ b/tcp.c
> > > @@ -1140,6 +1140,18 @@ int tcp_update_seqack_wnd(const struct ctx *c, struct tcp_tap_conn *conn,
> > >  		else
> > >  			limit = SNDBUF_GET(conn) - (int)sendq;
> > >  
> > > +		/* If the sender uses Nagle's algorithm to prevent Silly Window
> > > +		 * Syndrome (SWS, RFC 813 Section 3) it's critical that, should
> > > +		 * the window ever become less than the MSS, we advertise a new
> > > +		 * value once it increases again to be above it.
> > > +		 *
> > > +		 * To this end, for simplicity, approximate a window value below
> > > +		 * the MSS to zero, as we already have mechanisms in place to
> > > +		 * force updates after the window becomes zero.
> > > +		 */
> > > +		if (limit < MSS_GET(conn))
> > > +			limit = 0;
> > > +
> > >  		new_wnd_to_tap = MIN((int)tinfo->tcpi_snd_wnd, limit);
> > >  	}
> > >  
> > > -- 
> > > 2.43.0
> 
> -- 
> Stefano
> 

-- 
David Gibson (he or they)	| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you, not the other way
				| around.
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2025-12-05  2:53 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-04  7:45 [PATCH 0/8] tcp: Fix throughput issues with non-local peers Stefano Brivio
2025-12-04  7:45 ` [PATCH 1/8] tcp: Limit advertised window to available, not total sending buffer size Stefano Brivio
2025-12-04 23:10   ` David Gibson
2025-12-04  7:45 ` [PATCH 2/8] tcp: Adaptive interval based on RTT for socket-side acknowledgement checks Stefano Brivio
2025-12-04 23:48   ` David Gibson
2025-12-05  1:20     ` Stefano Brivio
2025-12-05  2:49       ` David Gibson
2025-12-04  7:45 ` [PATCH 3/8] tcp: Don't clear ACK_TO_TAP_DUE if we're advertising a zero-sized window Stefano Brivio
2025-12-04 23:50   ` David Gibson
2025-12-04  7:45 ` [PATCH 4/8] tcp: Acknowledge everything if sending buffer is less than SNDBUF_BIG Stefano Brivio
2025-12-05  0:08   ` David Gibson
2025-12-05  1:20     ` Stefano Brivio
2025-12-05  2:50       ` David Gibson
2025-12-08  0:19         ` Stefano Brivio
2025-12-04  7:45 ` [PATCH 5/8] tcp: Don't limit window to less-than-MSS values, use zero instead Stefano Brivio
2025-12-05  0:35   ` David Gibson
2025-12-05  1:20     ` Stefano Brivio
2025-12-05  2:53       ` David Gibson [this message]
2025-12-04  7:45 ` [PATCH 6/8] tcp: Allow exceeding the available sending buffer size in window advertisements Stefano Brivio
2025-12-05  2:34   ` David Gibson
2025-12-08  0:20     ` Stefano Brivio
2025-12-04  7:45 ` [PATCH 7/8] tcp: Send a duplicate ACK also on complete sendmsg() failure Stefano Brivio
2025-12-05  2:35   ` David Gibson
2025-12-04  7:45 ` [PATCH 8/8] tcp: Skip redundant ACK on partial " Stefano Brivio
2025-12-05  2:36   ` David Gibson

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=aTJJEnQNGMzj0UKR@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=git@maxchernoff.ca \
    --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).