tcp: add AccECN CE packet counters to tcpinfo

Provide diagnostics information around AccECN into
the tcpinfo struct.

Event:			IETF 115 Hackathon
Reviewed By:		tuexen, #transport
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D37280
This commit is contained in:
Richard Scheffenegger 2022-11-06 11:55:52 +01:00
parent d56c7ac87f
commit 22c81cc516
3 changed files with 18 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
/*