aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/ccids/ccid3.c
diff options
context:
space:
mode:
authorGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:30:19 -0400
committerGerrit Renker <gerrit@erg.abdn.ac.uk>2008-09-04 01:45:34 -0400
commit63b3a73bb85daf441f964aaf9b3fc89be4209c23 (patch)
tree6ac875b3971ff8299106ca6b878fc56d5cd77e84 /net/dccp/ccids/ccid3.c
parentde6f2b59e5cd15a8772adb732a1d80e141a77115 (diff)
dccp ccid-3: Remove ugly RTT-sampling history lookup
This removes the RTT-sampling function tfrc_tx_hist_rtt(), since 1. it suffered from complex passing of return values (the return value both indicated successful lookup while the value doubled as RTT sample); 2. when for some odd reason the sample value equalled 0, this triggered a bug warning about "bogus Ack", due to the ambiguity of the return value; 3. on a passive host which has not sent anything the TX history is empty and thus will lead to unwanted "bogus Ack" warnings such as ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-28197148 ccid3_hc_tx_packet_recv: server(e7b7d518): DATAACK with bogus ACK-26641606. The fix is to replace the implicit encoding by performing the steps manually. Furthermore, the "bogus Ack" warning has been removed, since it can actually be triggered due to several reasons (network reordering, old packet, (3) above), hence it is not very useful. Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp/ccids/ccid3.c')
-rw-r--r--net/dccp/ccids/ccid3.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index eb1bda08eeb2..f74e58d9793f 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -371,6 +371,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
371{ 371{
372 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); 372 struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
373 struct ccid3_options_received *opt_recv = &hctx->options_received; 373 struct ccid3_options_received *opt_recv = &hctx->options_received;
374 struct tfrc_tx_hist_entry *acked;
374 ktime_t now; 375 ktime_t now;
375 unsigned long t_nfb; 376 unsigned long t_nfb;
376 u32 pinv, r_sample; 377 u32 pinv, r_sample;
@@ -384,17 +385,24 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
384 hctx->state != TFRC_SSTATE_NO_FBACK) 385 hctx->state != TFRC_SSTATE_NO_FBACK)
385 return; 386 return;
386 387
387 now = ktime_get_real(); 388 /*
388 389 * Locate the acknowledged packet in the TX history.
389 /* Estimate RTT from history if ACK number is valid */ 390 *
390 r_sample = tfrc_tx_hist_rtt(hctx->hist, 391 * Returning "entry not found" here can for instance happen when
391 DCCP_SKB_CB(skb)->dccpd_ack_seq, now); 392 * - the host has not sent out anything (e.g. a passive server),
392 if (r_sample == 0) { 393 * - the Ack is outdated (packet with higher Ack number was received),
393 DCCP_WARN("%s(%p): %s with bogus ACK-%llu\n", dccp_role(sk), sk, 394 * - it is a bogus Ack (for a packet not sent on this connection).
394 dccp_packet_name(DCCP_SKB_CB(skb)->dccpd_type), 395 */
395 (unsigned long long)DCCP_SKB_CB(skb)->dccpd_ack_seq); 396 acked = tfrc_tx_hist_find_entry(hctx->hist, dccp_hdr_ack_seq(skb));
397 if (acked == NULL)
396 return; 398 return;
397 } 399 /* For the sake of RTT sampling, ignore/remove all older entries */
400 tfrc_tx_hist_purge(&acked->next);
401
402 /* Update the moving average for the RTT estimate (RFC 3448, 4.3) */
403 now = ktime_get_real();
404 r_sample = dccp_sample_rtt(sk, ktime_us_delta(now, acked->stamp));
405 hctx->rtt = tfrc_ewma(hctx->rtt, r_sample, 9);
398 406
399 /* Update receive rate in units of 64 * bytes/second */ 407 /* Update receive rate in units of 64 * bytes/second */
400 hctx->x_recv = opt_recv->ccid3or_receive_rate; 408 hctx->x_recv = opt_recv->ccid3or_receive_rate;
@@ -406,11 +414,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb)
406 hctx->p = 0; 414 hctx->p = 0;
407 else /* can not exceed 100% */ 415 else /* can not exceed 100% */
408 hctx->p = scaled_div(1, pinv); 416 hctx->p = scaled_div(1, pinv);
409 /* 417
410 * Validate new RTT sample and update moving average
411 */
412 r_sample = dccp_sample_rtt(sk, r_sample);
413 hctx->rtt = tfrc_ewma(hctx->rtt, r_sample, 9);
414 /* 418 /*
415 * Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3 419 * Update allowed sending rate X as per draft rfc3448bis-00, 4.2/3
416 */ 420 */