netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: chia-yu.chang@nokia-bell-labs.com
Cc: dsahern@kernel.org, kuniyu@amazon.com, bpf@vger.kernel.org,
	netdev@vger.kernel.org, dave.taht@gmail.com, pabeni@redhat.com,
	jhs@mojatatu.com, kuba@kernel.org, stephen@networkplumber.org,
	xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net,
	edumazet@google.com, andrew+netdev@lunn.ch,
	donald.hunter@gmail.com, ast@fiberby.net, liuhangbin@gmail.com,
	shuah@kernel.org, linux-kselftest@vger.kernel.org, ij@kernel.org,
	ncardwell@google.com, koen.de_schepper@nokia-bell-labs.com,
	g.white@cablelabs.com, ingemar.s.johansson@ericsson.com,
	mirja.kuehlewind@ericsson.com, cheshire@apple.com,
	rs.ietf@gmx.at, Jason_Livingood@comcast.com,
	vidhi_goel@apple.com
Subject: Re: [PATCH v4 net-next 10/15] tcp: accecn: AccECN option send control
Date: Fri, 18 Apr 2025 19:24:58 +0100	[thread overview]
Message-ID: <20250418182458.GD2676982@horms.kernel.org> (raw)
In-Reply-To: <20250418173407.GC2676982@horms.kernel.org>

On Fri, Apr 18, 2025 at 06:34:07PM +0100, Simon Horman wrote:
> On Fri, Apr 18, 2025 at 01:00:24AM +0200, chia-yu.chang@nokia-bell-labs.com wrote:
> > From: Ilpo Järvinen <ij@kernel.org>
> > 
> > Instead of sending the option in every ACK, limit sending to
> > those ACKs where the option is necessary:
> > - Handshake
> > - "Change-triggered ACK" + the ACK following it. The
> >   2nd ACK is necessary to unambiguously indicate which
> >   of the ECN byte counters in increasing. The first
> >   ACK has two counters increasing due to the ecnfield
> >   edge.
> > - ACKs with CE to allow CEP delta validations to take
> >   advantage of the option.
> > - Force option to be sent every at least once per 2^22
> >   bytes. The check is done using the bit edges of the
> >   byte counters (avoids need for extra variables).
> > - AccECN option beacon to send a few times per RTT even if
> >   nothing in the ECN state requires that. The default is 3
> >   times per RTT, and its period can be set via
> >   sysctl_tcp_ecn_option_beacon.
> > 
> > Signed-off-by: Ilpo Järvinen <ij@kernel.org>
> > Co-developed-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> > Signed-off-by: Chia-Yu Chang <chia-yu.chang@nokia-bell-labs.com>
> > ---
> >  include/linux/tcp.h        |  3 +++
> >  include/net/netns/ipv4.h   |  1 +
> >  include/net/tcp.h          |  1 +
> >  net/ipv4/sysctl_net_ipv4.c |  9 ++++++++
> >  net/ipv4/tcp.c             |  5 ++++-
> >  net/ipv4/tcp_input.c       | 36 +++++++++++++++++++++++++++++++-
> >  net/ipv4/tcp_ipv4.c        |  1 +
> >  net/ipv4/tcp_minisocks.c   |  2 ++
> >  net/ipv4/tcp_output.c      | 42 ++++++++++++++++++++++++++++++--------
> >  9 files changed, 90 insertions(+), 10 deletions(-)
> > 
> > diff --git a/include/linux/tcp.h b/include/linux/tcp.h
> > index 0e032d9631ac..9619524d8901 100644
> > --- a/include/linux/tcp.h
> > +++ b/include/linux/tcp.h
> > @@ -309,7 +309,10 @@ struct tcp_sock {
> >  	u8	received_ce_pending:4, /* Not yet transmit cnt of received_ce */
> >  		unused2:4;
> >  	u8	accecn_minlen:2,/* Minimum length of AccECN option sent */
> > +		prev_ecnfield:2,/* ECN bits from the previous segment */
> > +		accecn_opt_demand:2,/* Demand AccECN option for n next ACKs */
> >  		est_ecnfield:2;/* ECN field for AccECN delivered estimates */
> > +	u64	accecn_opt_tstamp;	/* Last AccECN option sent timestamp */
> >  	u32	app_limited;	/* limited until "delivered" reaches this val */
> >  	u32	rcv_wnd;	/* Current receiver window		*/
> >  /*
> 
> ...
> 
> > @@ -5113,7 +5116,7 @@ static void __init tcp_struct_check(void)
> >  	/* 32bit arches with 8byte alignment on u64 fields might need padding
> >  	 * before tcp_clock_cache.
> >  	 */
> > -	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 122 + 6);
> > +	CACHELINE_ASSERT_GROUP_SIZE(struct tcp_sock, tcp_sock_write_txrx, 130 + 6);
> 
> Hi,
> 
> While this seems find on x86_64, x86_32 and arm64, it does not seem correct
> on ARM (32-bit).
> 
> This is because the existing two byte hole after est_ecnfield grows
> to 6 bytes. I assume this is because of alignment requirements.
> But in any case, the result is that the overall group size increases
> by 12 bytes rather than 8.
> 
> I believe that you can avoid the hole growing, and thus limit the overall
> increase in size of the group to 12 bytes, by placing accecn_opt_tstamp
> elsewhere, e.g. after app_limited rather than before it.
> 
> You can exercise this by cross compiling for ARM and examining
> the structure layout using pahole.
> 
> Cross compilers available from [1] should be able to do that something
> like this:
> 
> PATH=".../gcc-14.2.0-nolibc/arm-linux-gnueabi/bin:$PATH"
> export ARCH=arm
> export CROSS_COMPILE=arm-linux-gnueabi-
> 
> make allmodconfig
> echo "CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y" >> .config
> yes "" | make oldconfig
> 
> make net/ipv4/tcp.o

Sorry, I omitted the invocation of pahole.

pahole net/ipv4/tcp.o

> [1] https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/14.2.0/

-- 
pw-bot: changes-requested

  reply	other threads:[~2025-04-18 18:25 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-17 23:00 [PATCH v4 net-next 00/15] AccECN protocol patch series chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 01/15] tcp: reorganize SYN ECN code chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 02/15] tcp: fast path functions later chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 03/15] tcp: AccECN core chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 04/15] tcp: accecn: AccECN negotiation chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 05/15] tcp: accecn: add AccECN rx byte counters chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 06/15] tcp: accecn: AccECN needs to know delivered bytes chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 07/15] tcp: allow embedding leftover into option padding chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 08/15] tcp: sack option handling improvements chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 09/15] tcp: accecn: AccECN option chia-yu.chang
2025-04-18 18:31   ` Simon Horman
2025-04-18 19:35     ` Ilpo Järvinen
2025-04-22 16:23       ` Simon Horman
2025-04-17 23:00 ` [PATCH v4 net-next 10/15] tcp: accecn: AccECN option send control chia-yu.chang
2025-04-18 17:34   ` Simon Horman
2025-04-18 18:24     ` Simon Horman [this message]
2025-04-22 15:48       ` Chia-Yu Chang (Nokia)
2025-04-17 23:00 ` [PATCH v4 net-next 11/15] tcp: accecn: AccECN option failure handling chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 12/15] tcp: accecn: AccECN option ceb/cep heuristic chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 13/15] tcp: accecn: AccECN ACE field multi-wrap heuristic chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 14/15] tcp: accecn: try to fit AccECN option with SACK chia-yu.chang
2025-04-17 23:00 ` [PATCH v4 net-next 15/15] tcp: try to avoid safer when ACKs are thinned chia-yu.chang

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=20250418182458.GD2676982@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=Jason_Livingood@comcast.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=ast@fiberby.net \
    --cc=bpf@vger.kernel.org \
    --cc=cheshire@apple.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=dave.taht@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=g.white@cablelabs.com \
    --cc=ij@kernel.org \
    --cc=ingemar.s.johansson@ericsson.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=koen.de_schepper@nokia-bell-labs.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuhangbin@gmail.com \
    --cc=mirja.kuehlewind@ericsson.com \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rs.ietf@gmx.at \
    --cc=shuah@kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vidhi_goel@apple.com \
    --cc=xiyou.wangcong@gmail.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.
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 NNTP newsgroup(s).