aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2007-09-26 01:39:16 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:34 -0400
commitaa97efd97acefb7d3dcd864adb878c7ce34061b3 (patch)
tree1cad4e0193364c6b601c1ebc2ec8bc4aa8f600ae /net/dccp
parente0eb68596232788bc352368f2fbc3cb088e42e41 (diff)
[DCCP]: Reuse ktime_get_real() calls again
This patch reduces the number of timestamps taken in the receive path for each packet. The ccid3_hc_tx_update_x() routine is called in * the receive path for each CCID3-controlled packet * for the nofeedback timer (if no feedback arrives during 4 RTT) Currently, when there is no loss, each packet gets timestamped twice. The patch resolves this by recycling the first timestamp taken on packet reception for RTT sampling. When the no_feedback_timer() is called, then the timestamp argument is simply set to NULL - so that ccid3_hc_tx_update_x() takes care of the logic. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk> Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ccids/ccid3.c39
1 files changed, 16 insertions, 23 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index e75efe72da2b..e16f9bb9eaaf 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -113,27 +113,24 @@ static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
113 hctx->ccid3hctx_s, (unsigned)(hctx->ccid3hctx_x >> 6)); 113 hctx->ccid3hctx_s, (unsigned)(hctx->ccid3hctx_x >> 6));
114 114
115} 115}
116/* 116
117 * Update X by 117/**
118 * If (p > 0) 118 * ccid3_hc_tx_update_x - Update allowed sending rate X
119 * X_calc = calcX(s, R, p); 119 * @stamp: most recent time if available - can be left NULL.
120 * X = max(min(X_calc, 2 * X_recv), s / t_mbi); 120 * This function tracks draft rfc3448bis, check there for latest details.
121 * Else
122 * If (now - tld >= R)
123 * X = max(min(2 * X, 2 * X_recv), s / R);
124 * tld = now;
125 * 121 *
126 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support 122 * Note: X and X_recv are both stored in units of 64 * bytes/second, to support
127 * fine-grained resolution of sending rates. This requires scaling by 2^6 123 * fine-grained resolution of sending rates. This requires scaling by 2^6
128 * throughout the code. Only X_calc is unscaled (in bytes/second). 124 * throughout the code. Only X_calc is unscaled (in bytes/second).
129 * 125 *
130 */ 126 */
131static void ccid3_hc_tx_update_x(struct sock *sk) 127static void ccid3_hc_tx_update_x(struct sock *sk, ktime_t *stamp)
132 128
133{ 129{
134 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 130 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
135 __u64 min_rate = 2 * hctx->ccid3hctx_x_recv; 131 __u64 min_rate = 2 * hctx->ccid3hctx_x_recv;
136 const __u64 old_x = hctx->ccid3hctx_x; 132 const __u64 old_x = hctx->ccid3hctx_x;
133 ktime_t now = stamp? *stamp : ktime_get_real();
137 134
138 /* 135 /*
139 * Handle IDLE periods: do not reduce below RFC3390 initial sending rate 136 * Handle IDLE periods: do not reduce below RFC3390 initial sending rate
@@ -153,18 +150,14 @@ static void ccid3_hc_tx_update_x(struct sock *sk)
153 (((__u64)hctx->ccid3hctx_s) << 6) / 150 (((__u64)hctx->ccid3hctx_s) << 6) /
154 TFRC_T_MBI); 151 TFRC_T_MBI);
155 152
156 } else { 153 } else if (ktime_us_delta(now, hctx->ccid3hctx_t_ld)
157 const ktime_t now = ktime_get_real(); 154 - (s64)hctx->ccid3hctx_rtt >= 0) {
158
159 if ((ktime_us_delta(now, hctx->ccid3hctx_t_ld) -
160 (s64)hctx->ccid3hctx_rtt) >= 0) {
161 155
162 hctx->ccid3hctx_x = 156 hctx->ccid3hctx_x =
163 max(min(2 * hctx->ccid3hctx_x, min_rate), 157 max(min(2 * hctx->ccid3hctx_x, min_rate),
164 scaled_div(((__u64)hctx->ccid3hctx_s) << 6, 158 scaled_div(((__u64)hctx->ccid3hctx_s) << 6,
165 hctx->ccid3hctx_rtt)); 159 hctx->ccid3hctx_rtt));
166 hctx->ccid3hctx_t_ld = now; 160 hctx->ccid3hctx_t_ld = now;
167 }
168 } 161 }
169 162
170 if (hctx->ccid3hctx_x != old_x) { 163 if (hctx->ccid3hctx_x != old_x) {
@@ -273,7 +266,7 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
273 hctx->ccid3hctx_x_recv <<= 4; 266 hctx->ccid3hctx_x_recv <<= 4;
274 } 267 }
275 /* Now recalculate X [RFC 3448, 4.3, step (4)] */ 268 /* Now recalculate X [RFC 3448, 4.3, step (4)] */
276 ccid3_hc_tx_update_x(sk); 269 ccid3_hc_tx_update_x(sk, NULL);
277 /* 270 /*
278 * Schedule no feedback timer to expire in 271 * Schedule no feedback timer to expire in
279 * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) 272 * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi)
@@ -493,7 +486,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
493 tfrc_calc_x(hctx->ccid3hctx_s, 486 tfrc_calc_x(hctx->ccid3hctx_s,
494 hctx->ccid3hctx_rtt, 487 hctx->ccid3hctx_rtt,
495 hctx->ccid3hctx_p); 488 hctx->ccid3hctx_p);
496 ccid3_hc_tx_update_x(sk); 489 ccid3_hc_tx_update_x(sk, &now);
497 490
498 ccid3_pr_debug("%s(%p), RTT=%uus (sample=%uus), s=%u, " 491 ccid3_pr_debug("%s(%p), RTT=%uus (sample=%uus), s=%u, "
499 "p=%u, X_calc=%u, X_recv=%u, X=%u\n", 492 "p=%u, X_calc=%u, X_recv=%u, X=%u\n",