Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a21f9f96cd035b0d9aec32d80ea0152672fbed42
Commit:     a21f9f96cd035b0d9aec32d80ea0152672fbed42
Parent:     1761f7d7fea32c2290710f5c0afa0c3d93220593
Author:     Gerrit Renker <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 20 15:12:10 2007 -0300
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:26:58 2007 -0700

    [CCID3]: Wrap computation of RFC3390-initial rate into separate function
    
    The CCID 3 and TFRC specs (RFC 4342, RFC 3448, draft-3448bis) make frequent
    reference to the computation of the RFC-3390 initial sending rate:
    
      1. Initial sending rate when RTT is known (RFC 4342, p. 6)
      2. Response to Idle/Application-Limited periods (RFC 4342, 5.1)
    
    This warrants putting the code into its own function, for later code reuse.
    
    Signed-off-by: Gerrit Renker <[EMAIL PROTECTED]>
    Signed-off-by: Ian McDonald <[EMAIL PROTECTED]>
    Signed-off-by: Arnaldo Carvalho de Melo <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/dccp/ccids/ccid3.c |   25 ++++++++++++++++++-------
 1 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index dc6e418..8d33a09 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -82,6 +82,21 @@ static void ccid3_hc_tx_set_state(struct sock *sk,
 }
 
 /*
+ * Compute the initial sending rate X_init according to RFC 3390:
+ *     w_init   =    min(4 * MSS, max(2 * MSS, 4380 bytes))
+ *     X_init   =    w_init / RTT
+ * For consistency with other parts of the code, X_init is scaled by 2^6.
+ */
+static inline u64 rfc3390_initial_rate(struct sock *sk)
+{
+       const struct dccp_sock *dp = dccp_sk(sk);
+       const __u32 w_init = min(4 * dp->dccps_mss_cache,
+                                max(2 * dp->dccps_mss_cache, 4380U));
+
+       return scaled_div(w_init << 6, ccid3_hc_tx_sk(sk)->ccid3hctx_rtt);
+}
+
+/*
  * Recalculate t_ipi and delta (should be called whenever X changes)
  */
 static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx)
@@ -469,20 +484,16 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, 
struct sk_buff *skb)
                        /*
                         * Larger Initial Windows [RFC 4342, sec. 5]
                         */
-                       __u32 w_init = min(4 * dp->dccps_mss_cache,
-                                          max(2 * dp->dccps_mss_cache, 4380U));
                        hctx->ccid3hctx_rtt  = r_sample;
-                       hctx->ccid3hctx_x    = scaled_div(w_init << 6, 
r_sample);
+                       hctx->ccid3hctx_x    = rfc3390_initial_rate(sk);
                        hctx->ccid3hctx_t_ld = now;
 
                        ccid3_update_send_interval(hctx);
 
-                       ccid3_pr_debug("%s(%p), s=%u, MSS=%u, w_init=%u, "
+                       ccid3_pr_debug("%s(%p), s=%u, MSS=%u, "
                                       "R_sample=%dus, X=%u\n", dccp_role(sk),
                                       sk, hctx->ccid3hctx_s,
-                                      dp->dccps_mss_cache,
-                                      w_init,
-                                      (int)r_sample,
+                                      dp->dccps_mss_cache, (int)r_sample,
                                       (unsigned)(hctx->ccid3hctx_x >> 6));
 
                        ccid3_hc_tx_set_state(sk, TFRC_SSTATE_FBACK);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to