Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F156856339
D21117.id71132.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D21117.id71132.diff
View Options
Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -3408,7 +3408,8 @@
INP_WLOCK_ASSERT(tp->t_inpcb);
TCPSTAT_INC(tcps_rttupdated);
- tp->t_rttupdated++;
+ if (tp->t_rttupdated < UTYPE_MAX(tp->t_rttupdated))
+ (tp->t_rttupdated)++;
#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT,
imax(0, rtt * 1000 / hz));
Index: sys/netinet/tcp_stacks/bbr.c
===================================================================
--- sys/netinet/tcp_stacks/bbr.c
+++ sys/netinet/tcp_stacks/bbr.c
@@ -6516,7 +6516,8 @@
tp->t_rttbest = tp->t_srtt + tp->t_rttvar;
}
KMOD_TCPSTAT_INC(tcps_rttupdated);
- tp->t_rttupdated++;
+ if (tp->t_rttupdated < UTYPE_MAX(tp->t_rttupdated))
+ (tp->t_rttupdated)++;
#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT, imax(0, rtt_ticks));
#endif
Index: sys/netinet/tcp_stacks/rack.c
===================================================================
--- sys/netinet/tcp_stacks/rack.c
+++ sys/netinet/tcp_stacks/rack.c
@@ -3906,7 +3906,8 @@
}
KMOD_TCPSTAT_INC(tcps_rttupdated);
rack_log_rtt_upd(tp, rack, rtt, o_srtt, o_var);
- tp->t_rttupdated++;
+ if (tp->t_rttupdated < UTYPE_MAX(tp->t_rttupdated))
+ (tp->t_rttupdated)++;
#ifdef STATS
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_RTT, imax(0, rtt));
#endif
Index: sys/netinet/tcp_usrreq.c
===================================================================
--- sys/netinet/tcp_usrreq.c
+++ sys/netinet/tcp_usrreq.c
@@ -2776,7 +2776,7 @@
tp->t_rttbest);
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);
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -217,7 +217,6 @@
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;
@@ -253,6 +252,7 @@
tcp_seq gput_seq; /* Outbound measurement seq */
tcp_seq gput_ack; /* Inbound measurement ack */
int32_t t_stats_gput_prev; /* XXXLAS: Prev gput measurement */
+ uint8_t t_rttupdated; /* number of times rtt sampled */
uint8_t t_tfo_client_cookie_len; /* TCP Fast Open client cookie length */
uint32_t t_end_info_status; /* Status flag of end info */
unsigned int *t_tfo_pending; /* TCP Fast Open server pending counter */
@@ -551,6 +551,13 @@
max((tp)->t_rttmin, (((tp)->t_srtt >> (TCP_RTT_SHIFT - TCP_DELTA_SHIFT)) \
+ (tp)->t_rttvar) >> TCP_DELTA_SHIFT)
+/*
+ * Programmatically determine the maximum value of
+ * an unsigned type, without integer overflow.
+ */
+#define UTYPE_MAX(x) \
+ ((((1ULL << (sizeof((x)) * 8 - 1)) - 1) * 2) + 1)
+
/*
* TCP statistics.
* Many of these should be kept per connection,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, May 17, 10:40 PM (7 h, 45 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33214644
Default Alt Text
D21117.id71132.diff (3 KB)
Attached To
Mode
D21117: Reduce size of t_rttupdated in tcpcb
Attached
Detach File
Event Timeline
Log In to Comment