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
This commit is contained in:
Richard Scheffenegger 2022-02-10 00:19:55 +01:00
parent 6db44b0158
commit 3f169c54ab
5 changed files with 74 additions and 12 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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} "