tcptw: count how many times a tcptw was actually useful
This will allow a sysadmin to lower net.inet.tcp.msl and see how long tcptw are actually useful.
This commit is contained in:
parent
cb3772639f
commit
71d2d5adfe
@ -462,6 +462,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
|
||||
INP_TRY_UPGRADE(inp) == 0)
|
||||
goto drop;
|
||||
tcp_twclose(tw, 0);
|
||||
TCPSTAT_INC(tcps_tw_recycles);
|
||||
return (1);
|
||||
}
|
||||
|
||||
@ -481,6 +482,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
|
||||
th->th_seq+tlen, (tcp_seq)0, TH_RST|TH_ACK);
|
||||
}
|
||||
INP_UNLOCK(inp);
|
||||
TCPSTAT_INC(tcps_tw_resets);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -519,6 +521,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th,
|
||||
th->th_seq != tw->rcv_nxt || th->th_ack != tw->snd_nxt) {
|
||||
TCP_PROBE5(receive, NULL, NULL, m, NULL, th);
|
||||
tcp_twrespond(tw, TH_ACK);
|
||||
TCPSTAT_INC(tcps_tw_responds);
|
||||
goto dropnoprobe;
|
||||
}
|
||||
drop:
|
||||
|
@ -706,6 +706,11 @@ struct tcpstat {
|
||||
uint64_t tcps_dsack_bytes; /* Number of bytes DSACK'ed no TLP */
|
||||
uint64_t tcps_dsack_tlp_bytes; /* Number of bytes DSACK'ed due to TLPs */
|
||||
|
||||
/* TCPS_TIME_WAIT usage stats */
|
||||
uint64_t tcps_tw_recycles; /* Times time-wait was recycled. */
|
||||
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 */
|
||||
};
|
||||
|
||||
|
@ -857,13 +857,23 @@ tcp_stats(u_long off, const char *name, int af1 __unused, int proto __unused)
|
||||
"{N:/Path MTU discovery black hole detection min MSS activation%s}\n");
|
||||
p(tcps_pmtud_blackhole_failed, "\t{:pmtud-failed/%ju} "
|
||||
"{N:/Path MTU discovery black hole detection failure%s}\n");
|
||||
|
||||
xo_close_container("pmtud");
|
||||
xo_open_container("tw");
|
||||
|
||||
p(tcps_tw_responds, "\t{:tw_responds/%ju} "
|
||||
"{N:/time%s connection in TIME-WAIT responded with ACK}\n");
|
||||
p(tcps_tw_recycles, "\t{:tw_recycles/%ju} "
|
||||
"{N:/time%s connection in TIME-WAIT was actively recycled}\n");
|
||||
p(tcps_tw_resets, "\t{:tw_resets/%ju} "
|
||||
"{N:/time%s connection in TIME-WAIT responded with RST}\n");
|
||||
|
||||
xo_close_container("tw");
|
||||
#undef p
|
||||
#undef p1a
|
||||
#undef p2
|
||||
#undef p2a
|
||||
#undef p3
|
||||
xo_close_container("pmtud");
|
||||
|
||||
|
||||
xo_open_container("TCP connection count by state");
|
||||
xo_emit("{T:/TCP connection count by state}:\n");
|
||||
|
Loading…
Reference in New Issue
Block a user