diff --git a/sys/netinet/tcp_ecn.c b/sys/netinet/tcp_ecn.c --- a/sys/netinet/tcp_ecn.c +++ b/sys/netinet/tcp_ecn.c @@ -239,8 +239,8 @@ 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 @@ 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 --- a/sys/netinet/tcp_syncache.h +++ b/sys/netinet/tcp_syncache.h @@ -91,11 +91,12 @@ #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 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1664,7 +1664,7 @@ 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_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_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 @@ 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 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -249,6 +249,8 @@ 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 @@ #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 @@ 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 --- a/usr.bin/netstat/inet.c +++ b/usr.bin/netstat/inet.c @@ -834,6 +834,15 @@ 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} "