Skip to content

Commit

Permalink
tcp: add AccECN CE packet counters to tcpinfo
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rscheff committed Nov 6, 2022
1 parent d56c7ac commit 22c81cc
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sys/netinet/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion sys/netinet/tcp_ecn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
13 changes: 13 additions & 0 deletions sys/netinet/tcp_usrreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down

0 comments on commit 22c81cc

Please sign in to comment.