diff --git a/sys/netinet/tcp.h b/sys/netinet/tcp.h index 7bb2efe5fae0..aa7f73f8be3c 100644 --- a/sys/netinet/tcp.h +++ b/sys/netinet/tcp.h @@ -390,7 +390,8 @@ struct tcp_info { u_int32_t tcpi_snd_zerowin; /* Zero-sized windows sent */ /* Accurate ECN counters. */ - u_int32_t __tcpi_received_ce; /* # of CE marks received */ + u_int32_t tcpi_delivered_ce; + u_int32_t tcpi_received_ce; /* # of CE marks received */ u_int32_t __tcpi_delivered_e1_bytes; u_int32_t __tcpi_delivered_e0_bytes; u_int32_t __tcpi_delivered_ce_bytes; diff --git a/sys/netinet/tcp_ecn.c b/sys/netinet/tcp_ecn.c index c74f4fa7c514..1d693944ac40 100644 --- a/sys/netinet/tcp_ecn.c +++ b/sys/netinet/tcp_ecn.c @@ -325,8 +325,10 @@ tcp_ecn_input_segment(struct tcpcb *tp, uint16_t thflags, int iptos) } } else { /* RFC3168 ECN handling */ - if ((thflags & (TH_SYN | TH_ECE)) == TH_ECE) + if ((thflags & (TH_SYN | TH_ECE)) == TH_ECE) { delta_ace = 1; + tp->t_scep++; + } if (thflags & TH_CWR) { tp->t_flags2 &= ~TF2_ECN_SND_ECE; tp->t_flags |= TF_ACKNOW; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index d069c804bcc4..cc85c852ab6a 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1640,6 +1640,19 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) tcp_offload_tcp_info(tp, ti); } #endif + /* + * AccECN related counters. + */ + if ((tp->t_flags2 & (TF2_ECN_PERMIT | TF2_ACE_PERMIT)) == + (TF2_ECN_PERMIT | TF2_ACE_PERMIT)) + /* + * Internal counter starts at 5 for AccECN + * but 0 for RFC3168 ECN. + */ + ti->tcpi_delivered_ce = tp->t_scep - 5; + else + ti->tcpi_delivered_ce = tp->t_scep; + ti->tcpi_received_ce = tp->t_rcep; } /*