tcp: reduce the size of t_rttupdated in tcpcb

During tcp session start, various mechanisms need to
track a few initial RTTs before becoming active.
Prevent overflows of the corresponding tracking counter
and reduce the size of tcpcb simultaneously.

Reviewed By:		#transport, tuexen, guest-ccui
Sponsored by:		NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D21117
This commit is contained in:
Richard Scheffenegger 2023-01-26 18:07:11 +01:00
parent 7a78ae8865
commit 18b83b626a
5 changed files with 8 additions and 5 deletions

View File

@ -3537,7 +3537,8 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt)
INP_WLOCK_ASSERT(tptoinpcb(tp));
TCPSTAT_INC(tcps_rttupdated);
tp->t_rttupdated++;
if (tp->t_rttupdated < UCHAR_MAX)
tp->t_rttupdated++;
#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT,
imax(0, rtt * 1000 / hz));

View File

@ -6366,7 +6366,8 @@ tcp_bbr_xmit_timer_commit(struct tcp_bbr *bbr, struct tcpcb *tp, uint32_t cts)
tp->t_rttvar = rtt_ticks << (TCP_RTTVAR_SHIFT - 1);
}
KMOD_TCPSTAT_INC(tcps_rttupdated);
tp->t_rttupdated++;
if (tp->t_rttupdated < UCHAR_MAX)
tp->t_rttupdated++;
#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT, imax(0, rtt_ticks));
#endif

View File

@ -7646,7 +7646,8 @@ tcp_rack_xmit_timer_commit(struct tcp_rack *rack, struct tcpcb *tp)
}
rack->rc_srtt_measure_made = 1;
KMOD_TCPSTAT_INC(tcps_rttupdated);
tp->t_rttupdated++;
if (tp->t_rttupdated < UCHAR_MAX)
tp->t_rttupdated++;
#ifdef STATS
if (rack_stats_gets_ms_rtt == 0) {
/* Send in the microsecond rtt used for rxt timeout purposes */

View File

@ -3068,7 +3068,7 @@ db_print_tcpcb(struct tcpcb *tp, const char *name, int indent)
tp->t_rttvar, tp->t_rxtshift, tp->t_rttmin);
db_print_indent(indent);
db_printf("t_rttupdated: %lu max_sndwnd: %u t_softerror: %d\n",
db_printf("t_rttupdated: %u max_sndwnd: %u t_softerror: %d\n",
tp->t_rttupdated, tp->max_sndwnd, tp->t_softerror);
db_print_indent(indent);

View File

@ -230,7 +230,6 @@ struct tcpcb {
uint32_t snd_ssthresh_prev; /* ssthresh prior to retransmit */
tcp_seq snd_recover_prev; /* snd_recover prior to retransmit */
int t_sndzerowin; /* zero-window updates sent */
u_long t_rttupdated; /* number of times rtt sampled */
int snd_numholes; /* number of holes seen by sender */
u_int t_badrxtwin; /* window for retransmit recovery */
TAILQ_HEAD(sackhole_head, sackhole) snd_holes;
@ -276,6 +275,7 @@ struct tcpcb {
uint32_t t_dsack_bytes; /* dsack bytes received */
uint32_t t_dsack_tlp_bytes; /* dsack bytes received for TLPs sent */
uint32_t t_dsack_pack; /* dsack packets we have eceived */
uint8_t t_rttupdated; /* number of times rtt sampled */
/* TCP Fast Open */
uint8_t t_tfo_client_cookie_len; /* TFO client cookie length */
uint32_t t_end_info_status; /* Status flag of end info */