Page MenuHomeFreeBSD

D40146.diff
No OneTemporary

D40146.diff

diff --git a/sys/netinet/cc/cc_cubic.c b/sys/netinet/cc/cc_cubic.c
--- a/sys/netinet/cc/cc_cubic.c
+++ b/sys/netinet/cc/cc_cubic.c
@@ -570,8 +570,8 @@
/* Ignore srtt until a min number of samples have been taken. */
if (CCV(ccv, t_rttupdated) >= CUBIC_MIN_RTT_SAMPLES) {
cubic_data = ccv->cc_data;
- t_srtt_ticks = CCV(ccv, t_srtt) / TCP_RTT_SCALE;
-
+ t_srtt_ticks = tcp_get_srtt(ccv->ccvc.tcp,
+ TCP_TMR_GRANULARITY_TICKS);
/*
* Record the current SRTT as our minrtt if it's the smallest
* we've seen or minrtt is currently equal to its initialised
diff --git a/sys/netinet/cc/cc_htcp.c b/sys/netinet/cc/cc_htcp.c
--- a/sys/netinet/cc/cc_htcp.c
+++ b/sys/netinet/cc/cc_htcp.c
@@ -444,7 +444,7 @@
*/
if (V_htcp_rtt_scaling)
alpha = max(1, (min(max(HTCP_MINROWE,
- (CCV(ccv, t_srtt) << HTCP_SHIFT) /
+ (tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) << HTCP_SHIFT) /
htcp_rtt_ref), HTCP_MAXROWE) * alpha)
>> HTCP_SHIFT);
@@ -495,18 +495,18 @@
* or minrtt is currently equal to its initialised value. Ignore SRTT
* until a min number of samples have been taken.
*/
- if ((CCV(ccv, t_srtt) < htcp_data->minrtt ||
+ if ((tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) < htcp_data->minrtt ||
htcp_data->minrtt == TCPTV_SRTTBASE) &&
(CCV(ccv, t_rttupdated) >= HTCP_MIN_RTT_SAMPLES))
- htcp_data->minrtt = CCV(ccv, t_srtt);
+ htcp_data->minrtt = tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS);
/*
* Record the current SRTT as our maxrtt if it's the largest we've
* seen. Ignore SRTT until a min number of samples have been taken.
*/
- if (CCV(ccv, t_srtt) > htcp_data->maxrtt
+ if (tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS) > htcp_data->maxrtt
&& CCV(ccv, t_rttupdated) >= HTCP_MIN_RTT_SAMPLES)
- htcp_data->maxrtt = CCV(ccv, t_srtt);
+ htcp_data->maxrtt = tcp_get_srtt(ccv->ccvc.tcp, TCP_TMR_GRANULARITY_TICKS);
}
/*
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -4316,7 +4316,7 @@
memset(&log.u_bbr, 0, sizeof(log.u_bbr));
#ifdef TCPHPTS
- log.u_bbr.inhpts = tcp_in_hpts(tptoinpcb(tp));
+ log.u_bbr.inhpts = tcp_in_hpts(tp);
#endif
log.u_bbr.flex8 = val;
log.u_bbr.rttProp = http->timestamp;
@@ -4641,3 +4641,31 @@
}
}
}
+
+uint32_t
+tcp_get_srtt(struct tcpcb *tp, int granularity)
+{
+ uint32_t srtt;
+
+ if (tp->t_tmr_granularity == TCP_TMR_GRANULARITY_USEC)
+ srtt = tp->t_srtt;
+ else if (tp->t_tmr_granularity == TCP_TMR_GRANULARITY_TICKS)
+ srtt = tp->t_srtt >> TCP_RTT_SHIFT;
+ if (tp->t_tmr_granularity == granularity)
+ return (srtt);
+ /* If we reach here they are oppsite what the caller wants */
+ if (granularity == TCP_TMR_GRANULARITY_USEC) {
+ /*
+ * The user wants useconds and internally
+ * its kept in ticks, convert to useconds.
+ */
+ srtt = TICKS_2_USEC(srtt);
+ } else if (granularity == TCP_TMR_GRANULARITY_TICKS) {
+ /*
+ * The user wants ticks and internally its
+ * kept in useconds, convert to ticks.
+ */
+ srtt = USEC_2_TICKS(srtt);
+ }
+ return (srtt);
+}
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1400,6 +1400,7 @@
bool force);
struct tcp_function_block *find_and_ref_tcp_functions(struct tcp_function_set *fs);
int find_tcp_function_alias(struct tcp_function_block *blk, struct tcp_function_set *fs);
+uint32_t tcp_get_srtt(struct tcpcb *tp, int granularity);
void tcp_switch_back_to_default(struct tcpcb *tp);
struct tcp_function_block *
find_and_ref_tcp_fb(struct tcp_function_block *fs);

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 27, 8:16 AM (10 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17815281
Default Alt Text
D40146.diff (3 KB)

Event Timeline