From nobody Sun Nov 06 20:19:18 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N55LM55rVz4h2KV; Sun, 6 Nov 2022 20:19:23 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N55LM4Xdmz45v8; Sun, 6 Nov 2022 20:19:23 +0000 (UTC) (envelope-from rpokala@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667765963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V0zPShas1usLMUApQQ+qnFHkPlT/JighX0lD0/sXkpY=; b=e8HQPF/yyKUYT0Dc6r9zFXYxe+iK5EkNwIKJnZp57S4SToKKF7K+8JyqJ12AmI4nA+n5M7 h7c0vqklRt+AGiu0yNg4i8i16IV8tGjNelr5Cj7ncjpYMheXN6DHAG3u3UthSeFrZfcmuc wVvsv+GuP023sE9hvun4T2LfZ0P2lhfEy2+JR2w0rWoGkRWdGFqBVGohaQzSQsn9j0i2yt hiRZMzCLvjxwyw+rBkiHWT9ORGJrl8SoCcdZG4CmosXMcRdx/GWOCyNZ9ZmoINhsfyzmRT Xn/p8cLBH9rA9EXFC60YFNQS9VeAJFxtwXHGTESktlytkMbKeHD58Cr2xKqObw== Received: from [192.168.1.10] (unknown [IPv6:2601:641:700:5284:45da:52:4af1:aec4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 4N55LL6tLWz1968; Sun, 6 Nov 2022 20:19:22 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.66.22102801 Date: Sun, 06 Nov 2022 12:19:18 -0800 Subject: Re: b1258b76435a - main - tcp: add conservative d.cep accounting algorithm From: Ravi Pokala To: Richard Scheffenegger , , , Message-ID: <5D60182C-42AF-428F-80A2-1E22438D8D1D@panasas.com> Thread-Topic: b1258b76435a - main - tcp: add conservative d.cep accounting algorithm References: <202211061110.2A6BAqJL010414@gitrepo.freebsd.org> In-Reply-To: <202211061110.2A6BAqJL010414@gitrepo.freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: quoted-printable ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1667765963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V0zPShas1usLMUApQQ+qnFHkPlT/JighX0lD0/sXkpY=; b=V9oTTvJI++PEB9pw4z5yo4Z77BRh3FGc3rYvbunPYGvv3rx+P3uUOZOUn5tzNJ6Qbvz8rK eFIwmXtoJ+OYn7ERwNYLFtKc9bQD2b7fzQo6Hs9r5pJz006sGE29yQ96ELWR/q30h5p+0o 0JKp1vlGgEPqbhYzo3FsyP4VO6wT9/xAfShOOgmrc+RvpC+Q+JfeUIQcHNqUy5C1jYEo9p SABBJ4fiuax7Bt3HXPVktvEz8T3Xvlcu9XtOJLWEE8R6ne2Rdir3EOLgC7eCwsTM3zXGvr j2xuSDVCfK3NqFiCS7yY1cS+EmBBu2jFeRSVC1v/EN8lrjWmHoIcGG6MGfCswg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1667765963; a=rsa-sha256; cv=none; b=Q4jN7a5kvSeMDBdG4wCMZ/K0sob6i+rHRdzDTr6XC4DJzWvCaWJVnFeuS/gQ2gMHHtfdnW iBKlFotUweuviMctl+AFSyWKpgwCjWaWLloLrJ6dHWQjspD46VccqOuowHeLbKEquAL4Cr t4RZ1qtbZuj5QrQEfmHZFOKG+/bLUrVCEOhFZC5V++SRKDGtn9RJgef0RNP0L8Guqme8Nl Nz42abJ6hyO83xsb6A0+brY3Yad7Hsn4bwgX7nvJsBnjNVqxXo+AkBlT2XY1MRqamcjQ0a v997J4EI07z9LcmtspKHJD0dc/KnGxC9YPYwGLxWB2H6rpQ1V+C+03ekHdzi/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N Hi Richard, This change adds 'int tlen' and 'int pkts' as an arguments to tcp_ecn_input= _segment(). However, while the function uses 'pkts', it does not use 'tlen'.= Is it supposed to? Was the argument added now for planned use in the future= ? If it is not currently being use, it should be marked '__unused', right? Thanks, Ravi (rpokala@) =EF=BB=BF-----Original Message----- From: on behalf of Richard Scheffenegger= Date: 2022-11-06, Sunday at 03:10 To: , , Subject: git: b1258b76435a - main - tcp: add conservative d.cep accounting = algorithm The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=3Db1258b76435ac370ddd0f814a3= 51779ddb267f6f commit b1258b76435ac370ddd0f814a351779ddb267f6f Author: Richard Scheffenegger AuthorDate: 2022-11-06 10:59:55 +0000 Commit: Richard Scheffenegger CommitDate: 2022-11-06 11:05:22 +0000 tcp: add conservative d.cep accounting algorithm Accurate ECN asks to conservatively estimate, when the ACE counter may have wrapped due to a single ACK covering a larger number of segments. This is described in Annex A.2 of the accurate-ecn draft. Event: IETF 115 Hackathon Reviewed By: tuexen, #transport Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D37281 --- sys/netinet/tcp_ecn.c | 17 ++++++++++------- sys/netinet/tcp_ecn.h | 2 +- sys/netinet/tcp_input.c | 4 +++- sys/netinet/tcp_stacks/rack.c | 10 +++++++--- sys/netinet/tcp_var.h | 6 ++++++ 5 files changed, 27 insertions(+), 12 deletions(-) diff --git a/sys/netinet/tcp_ecn.c b/sys/netinet/tcp_ecn.c index 1d693944ac40..40791172e55f 100644 --- a/sys/netinet/tcp_ecn.c +++ b/sys/netinet/tcp_ecn.c @@ -271,9 +271,9 @@ tcp_ecn_input_parallel_syn(struct tcpcb *tp, uint16= _t thflags, int iptos) * TCP ECN processing. */ int -tcp_ecn_input_segment(struct tcpcb *tp, uint16_t thflags, int iptos) +tcp_ecn_input_segment(struct tcpcb *tp, uint16_t thflags, int tlen, in= t pkts, int iptos) { - int delta_ace =3D 0; + int delta_cep =3D 0; if (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT)) { switch (iptos & IPTOS_ECN_MASK) { @@ -292,9 +292,12 @@ tcp_ecn_input_segment(struct tcpcb *tp, uint16_t t= hflags, int iptos) if ((iptos & IPTOS_ECN_MASK) =3D=3D IPTOS_ECN_CE) tp->t_rcep +=3D 1; if (tp->t_flags2 & TF2_ECN_PERMIT) { - delta_ace =3D (tcp_ecn_get_ace(thflags) + 8 - - (tp->t_scep & 0x07)) & 0x07; - tp->t_scep +=3D delta_ace; + delta_cep =3D (tcp_ecn_get_ace(thflags) + 8 - + (tp->t_scep & 7)) & 7; + if (delta_cep < pkts) + delta_cep =3D pkts - + ((pkts - delta_cep) & 7); + tp->t_scep +=3D delta_cep; } else { /* * process the final ACK of the 3WHS @@ -326,7 +329,7 @@ tcp_ecn_input_segment(struct tcpcb *tp, uint16_t th= flags, int iptos) } else { /* RFC3168 ECN handling */ if ((thflags & (TH_SYN | TH_ECE)) =3D=3D TH_ECE) { - delta_ace =3D 1; + delta_cep =3D 1; tp->t_scep++; } if (thflags & TH_CWR) { @@ -341,7 +344,7 @@ tcp_ecn_input_segment(struct tcpcb *tp, uint16_t th= flags, int iptos) cc_ecnpkt_handler_flags(tp, thflags, iptos); } - return delta_ace; + return delta_cep; } /* diff --git a/sys/netinet/tcp_ecn.h b/sys/netinet/tcp_ecn.h index deade12b75d1..3cc7715b9562 100644 --- a/sys/netinet/tcp_ecn.h +++ b/sys/netinet/tcp_ecn.h @@ -43,7 +43,7 @@ void tcp_ecn_input_syn_sent(struct tcpcb *, uint16_t, int); void tcp_ecn_input_parallel_syn(struct tcpcb *, uint16_t, int); -int tcp_ecn_input_segment(struct tcpcb *, uint16_t, int); +int tcp_ecn_input_segment(struct tcpcb *, uint16_t, int, int, int); uint16_t tcp_ecn_output_syn_sent(struct tcpcb *); int tcp_ecn_output_established(struct tcpcb *, uint16_t *, int, bool)= ; void tcp_ecn_syncache_socket(struct tcpcb *, struct syncache *); diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 84574aaa00ae..a1787a0f93db 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1627,7 +1627,9 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th,= struct socket *so, /* * TCP ECN processing. */ - if (tcp_ecn_input_segment(tp, thflags, iptos)) + if (tcp_ecn_input_segment(tp, thflags, tlen, + tcp_packets_this_ack(tp, th->th_ack), + iptos)) cc_cong_signal(tp, th, CC_ECN); /* diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rac= k.c index fdac23d0c5cc..e99f104bfa29 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -13528,8 +13528,10 @@ rack_do_compressed_ack_processing(struct tcpcb= *tp, struct socket *so, struct mb rack_cc_after_idle(rack, tp); } tp->t_rcvtime =3D ticks; - /* Now what about ECN? */ - if (tcp_ecn_input_segment(tp, ae->flags, ae->codepoint)) + /* Now what about ECN of a chain of pure ACKs? */ + if (tcp_ecn_input_segment(tp, ae->flags, 0, + tcp_packets_this_ack(tp, ae->ack), + ae->codepoint)) rack_cong_signal(tp, CC_ECN, ae->ack, __LINE__); #ifdef TCP_ACCOUNTING /* Count for the specific type of ack in */ @@ -14320,7 +14322,9 @@ rack_do_segment_nounlock(struct mbuf *m, struct= tcphdr *th, struct socket *so, * TCP ECN processing. XXXJTL: If we ever use ECN, we need to move * this to occur after we've validated the segment. */ - if (tcp_ecn_input_segment(tp, thflags, iptos)) + if (tcp_ecn_input_segment(tp, thflags, tlen, + tcp_packets_this_ack(tp, th->th_ack), + iptos)) rack_cong_signal(tp, CC_ECN, th->th_ack, __LINE__); /* diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index d115a18d66d5..01deeaad58cf 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -551,6 +551,12 @@ tcp_unlock_or_drop(struct tcpcb *tp, int tcp_outpu= t_retval) #endif #define BYTES_THIS_ACK(tp, th) (th->th_ack - tp->snd_una) +static int inline +tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) +{ + return ((ack - tp->snd_una) / tp->t_maxseg + + ((((ack - tp->snd_una) % tp->t_maxseg) !=3D 0) ? 1 : 0)); +} /* * Flags for the t_oobflags field.