From nobody Thu Feb 10 16:35:05 2022 X-Original-To: dev-commits-src-all@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 C378A19AA22F; Thu, 10 Feb 2022 16:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Jvj5j4Bk2z4mXT; Thu, 10 Feb 2022 16:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644510905; 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; bh=kQ+aiygFxd2pDe2cdwzPeYQN7GObPY8GnziRVHasR1s=; b=kDYP8auYZTa5GK97MkgXSrPwkAqhuviV+pkNG5TgySV35+9S8qKk4dvmzThyzaXQib/0kV L91X6B3DbfcQ1v6iv7G4nmQX8UJftwtaSREfk5oh44sPimNtVmjXIx7Uhk8pkhzDQvRSPM qN2BICIOOxRy+BMwpE5POuhbaTzl2sIGvuzSzoEHFrpqVx4qRDtk9rp3MHEygb7Ow7BLH0 pyDxQxPr+7jqg3pkVscfiSkVem4aTCsDSW9OFrWFOUU0vz6c/5F+cmAkAnRRrzy7kQFGqO qvsmhTM9FnRupZVErzvgGxesWj2ArnNirRjbeZmIDk0+3t1VNPUfmhkFIWGUEQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3152A23E42; Thu, 10 Feb 2022 16:35:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 21AGZ5wD079233; Thu, 10 Feb 2022 16:35:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 21AGZ5s0079232; Thu, 10 Feb 2022 16:35:05 GMT (envelope-from git) Date: Thu, 10 Feb 2022 16:35:05 GMT Message-Id: <202202101635.21AGZ5s0079232@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Richard Scheffenegger Subject: git: 3f169c54ab8e - main - tcp: Add/update AccECN related statistics and numbers List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rscheff X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3f169c54ab8eb6742e0be119dc25c4bcaf222330 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644510905; 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; bh=kQ+aiygFxd2pDe2cdwzPeYQN7GObPY8GnziRVHasR1s=; b=wOnwbiRSAncZo5IL59PKq29uFl0IRbQ7aG5vD4ZXUikalFaWJilnGJ0Rs9mKhETlermLyD sC04wYMGFSoph8sAjNoazXE0LqzNUQ5cISincaYqUrOYmo6UNxR0GyzDi1W9hKZT2tM3Gw JZI1c7XgeNlhhvSMZcwgFrCtI94aOXewtF+WKqbWyNjh9szN8qcVX4g1rXS71ZujHLdnlk gs9sKCsDpXUxz28SZ4YwfzYSM+7XqWwI4Yrwh1dCkLrdgOW87Ye0TY2yfE6wLzsOs6e9l2 GJ08SjBiGNUqxw0/Q4f7+bn3S4iAChWGDcwrIcICRS8jWYacfLOjru1Dgb+7Uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644510905; a=rsa-sha256; cv=none; b=IXRkhw9U2UuALamIyASr6cJF/6ZAepkALPQkcMAVIZ/hELyCAman/bA4k5Nh1V8RsYWT4s UHbVRdKuHnRtqIf1oTZybatmKvoxo0BzuifXE0d1/oR/3TXA7TGlQSdAB32mjxjyOuoY4z dQPu6S+x1OHs4tpC+TXRId+r2gSB9c4Ho2c/mR32CpjIwR+Qrn2knKYwTUUW1nuaRnL4TG tEikN89a/4RDfHJCDQJ3QkIg3f3zZrSjJBPkv36Y91FOWM3uhsHDOwTtUYQRTFkWGNiVk4 fpHBPi/EtbV6PJaRm+cZL7GHbDFQJz5zobDfnYAedBxD6b6fvZ+h7y/nKbdNkg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rscheff: URL: https://cgit.FreeBSD.org/src/commit/?id=3f169c54ab8eb6742e0be119dc25c4bcaf222330 commit 3f169c54ab8eb6742e0be119dc25c4bcaf222330 Author: Richard Scheffenegger AuthorDate: 2022-02-09 23:19:55 +0000 Commit: Richard Scheffenegger CommitDate: 2022-02-09 23:21:31 +0000 tcp: Add/update AccECN related statistics and numbers Reserve couters in the tcps struct in preparation for AccECN, extend the debugging output for TF2 flags, optimize the syncache flags from individual bits to a codepoint for the specifc ECN handshake. This is in preparation of AccECN. No functional chance except for extended debug output capabilities. Reviewed By: #transport, rrs Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D34161 --- sys/netinet/tcp_ecn.c | 8 ++++---- sys/netinet/tcp_syncache.h | 11 ++++++----- sys/netinet/tcp_usrreq.c | 46 +++++++++++++++++++++++++++++++++++++++++++++- sys/netinet/tcp_var.h | 12 ++++++++++-- usr.bin/netstat/inet.c | 9 +++++++++ 5 files changed, 74 insertions(+), 12 deletions(-) diff --git a/sys/netinet/tcp_ecn.c b/sys/netinet/tcp_ecn.c index 43870b0801c3..17b3c90a46fb 100644 --- a/sys/netinet/tcp_ecn.c +++ b/sys/netinet/tcp_ecn.c @@ -239,8 +239,8 @@ tcp_ecn_output_established(struct tcpcb *tp, uint16_t *thflags, int len) void tcp_ecn_syncache_socket(struct tcpcb *tp, struct syncache *sc) { - if (sc->sc_flags & SCF_ECN) { - switch (sc->sc_flags & SCF_ECN) { + if (sc->sc_flags & SCF_ECN_MASK) { + switch (sc->sc_flags & SCF_ECN_MASK) { case SCF_ECN: tp->t_flags2 |= TF2_ECN_PERMIT; break; @@ -282,8 +282,8 @@ uint16_t tcp_ecn_syncache_respond(uint16_t thflags, struct syncache *sc) { if ((thflags & TH_SYN) && - (sc->sc_flags & SCF_ECN)) { - switch (sc->sc_flags & SCF_ECN) { + (sc->sc_flags & SCF_ECN_MASK)) { + switch (sc->sc_flags & SCF_ECN_MASK) { case SCF_ECN: thflags |= (0 | TH_ECE); TCPSTAT_INC(tcps_ecn_shs); diff --git a/sys/netinet/tcp_syncache.h b/sys/netinet/tcp_syncache.h index a16a80c483d5..1b2d5dd5d220 100644 --- a/sys/netinet/tcp_syncache.h +++ b/sys/netinet/tcp_syncache.h @@ -91,11 +91,12 @@ struct syncache { #define SCF_UNREACH 0x10 /* icmp unreachable received */ #define SCF_SIGNATURE 0x20 /* send MD5 digests */ #define SCF_SACK 0x80 /* send SACK option */ -#define SCF_ECN 0x100 /* send ECN setup packet */ -#define SCF_ACE_N 0x200 /* send ACE non-ECT setup */ -#define SCF_ACE_0 0x400 /* send ACE ECT0 setup */ -#define SCF_ACE_1 0x800 /* send ACE ECT1 setup */ -#define SCF_ACE_CE 0x1000 /* send ACE CE setup */ +#define SCF_ECN_MASK 0x700 /* ECN codepoint mask */ +#define SCF_ECN 0x100 /* send ECN setup packet */ +#define SCF_ACE_N 0x400 /* send ACE non-ECT setup */ +#define SCF_ACE_0 0x500 /* send ACE ECT0 setup */ +#define SCF_ACE_1 0x600 /* send ACE ECT1 setup */ +#define SCF_ACE_CE 0x700 /* send ACE CE setup */ struct syncache_head { struct mtx sch_mtx; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index c88ab5219152..ac9e79aed917 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1664,7 +1664,7 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) ti->tcpi_snd_wscale = tp->snd_scale; ti->tcpi_rcv_wscale = tp->rcv_scale; } - if (tp->t_flags2 & TF2_ECN_PERMIT) + if (tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT)) ti->tcpi_options |= TCPI_OPT_ECN; ti->tcpi_rto = tp->t_rxtcur * tick; @@ -2972,6 +2972,10 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_NOPUSH", comma ? ", " : ""); comma = 1; } + if (t_flags & TF_PREVVALID) { + db_printf("%sTF_PREVVALID", comma ? ", " : ""); + comma = 1; + } if (t_flags & TF_MORETOCOME) { db_printf("%sTF_MORETOCOME", comma ? ", " : ""); comma = 1; @@ -3000,6 +3004,10 @@ db_print_tflags(u_int t_flags) db_printf("%sTF_WASFRECOVERY", comma ? ", " : ""); comma = 1; } + if (t_flags & TF_WASCRECOVERY) { + db_printf("%sTF_WASCRECOVERY", comma ? ", " : ""); + comma = 1; + } if (t_flags & TF_SIGNATURE) { db_printf("%sTF_SIGNATURE", comma ? ", " : ""); comma = 1; @@ -3024,10 +3032,46 @@ db_print_tflags2(u_int t_flags2) int comma; comma = 0; + if (t_flags2 & TF2_PLPMTU_BLACKHOLE) { + db_printf("%sTF2_PLPMTU_BLACKHOLE", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_PLPMTU_PMTUD) { + db_printf("%sTF2_PLPMTU_PMTUD", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_PLPMTU_MAXSEGSNT) { + db_printf("%sTF2_PLPMTU_MAXSEGSNT", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_LOG_AUTO) { + db_printf("%sTF2_LOG_AUTO", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_DROP_AF_DATA) { + db_printf("%sTF2_DROP_AF_DATA", comma ? ", " : ""); + comma = 1; + } if (t_flags2 & TF2_ECN_PERMIT) { db_printf("%sTF2_ECN_PERMIT", comma ? ", " : ""); comma = 1; } + if (t_flags2 & TF2_ECN_SND_CWR) { + db_printf("%sTF2_ECN_SND_CWR", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_ECN_SND_ECE) { + db_printf("%sTF2_ECN_SND_ECE", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_ACE_PERMIT) { + db_printf("%sTF2_ACE_PERMIT", comma ? ", " : ""); + comma = 1; + } + if (t_flags2 & TF2_FBYTES_COMPLETE) { + db_printf("%sTF2_FBYTES_COMPLETE", comma ? ", " : ""); + comma = 1; + } } static void diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 7fff6984f672..68e78ee8892d 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -249,6 +249,8 @@ struct tcpcb { int t_dupacks; /* consecutive dup acks recd */ int t_lognum; /* Number of log entries */ int t_loglimit; /* Maximum number of log entries */ + uint32_t r_cep; /* Number of received CE marked packets */ + uint32_t s_cep; /* Synced number of delivered CE packets */ int64_t t_pacing_rate; /* bytes / sec, -1 => unlimited */ struct tcp_log_stailq t_logs; /* Log buffer */ struct tcp_log_id_node *t_lin; @@ -562,7 +564,7 @@ tcp_unlock_or_drop(struct tcpcb *tp, int tcp_output_retval) #define TF2_PLPMTU_PMTUD 0x00000002 /* Allowed to attempt PLPMTUD. */ #define TF2_PLPMTU_MAXSEGSNT 0x00000004 /* Last seg sent was full seg. */ #define TF2_LOG_AUTO 0x00000008 /* Session is auto-logging. */ -#define TF2_DROP_AF_DATA 0x00000010 /* Drop after all data ack'd */ +#define TF2_DROP_AF_DATA 0x00000010 /* Drop after all data ack'd */ #define TF2_ECN_PERMIT 0x00000020 /* connection ECN-ready */ #define TF2_ECN_SND_CWR 0x00000040 /* ECN CWR in queue */ #define TF2_ECN_SND_ECE 0x00000080 /* ECN ECE in queue */ @@ -818,7 +820,13 @@ struct tcpstat { uint64_t tcps_tw_resets; /* Times time-wait sent a reset. */ uint64_t tcps_tw_responds; /* Times time-wait sent a valid ack. */ - uint64_t _pad[6]; /* 3 UTO, 3 TBD */ + /* Accurate ECN Handshake stats */ + uint64_t tcps_ace_nect; /* ACE SYN packet with Non-ECT */ + uint64_t tcps_ace_ect1; /* ACE SYN packet with ECT1 */ + uint64_t tcps_ace_ect0; /* ACE SYN packet with ECT0 */ + uint64_t tcps_ace_ce; /* ACE SYN packet with CE */ + + uint64_t _pad[2]; /* 2 TBD */ }; #define tcps_rcvmemdrop tcps_rcvreassfull /* compat */ diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c index b77447575911..7cfffc9fa06c 100644 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -834,6 +834,15 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused) p(tcps_ecn_rcwnd, "\t{:congestion-reductions/%ju} " "{N:/time%s ECN reduced the congestion window}\n"); + p(tcps_ace_nect, "\t{:ace-nonect-syn/%ju} " + "{N:/ACE SYN packet%s with Non-ECT}\n"); + p(tcps_ace_ect0, "\t{:ace-ect0-syn/%ju} " + "{N:/ACE SYN packet%s with ECT0}\n"); + p(tcps_ace_ect1, "\t{:ace-ect1-syn/%ju} " + "{N:/ACE SYN packet%s with ECT1}\n"); + p(tcps_ace_ce, "\t{:ace-ce-syn/%ju} " + "{N:/ACE SYN packet%s with CE}\n"); + xo_close_container("ecn"); xo_open_container("tcp-signature"); p(tcps_sig_rcvgoodsig, "\t{:received-good-signature/%ju} "