[DCCP]: Sample RTT from SYN exchange
authorGerrit Renker <gerrit@erg.abdn.ac.uk>
Tue, 20 Mar 2007 18:27:17 +0000 (15:27 -0300)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:27:02 +0000 (22:27 -0700)
Function:

include/linux/dccp.h
net/dccp/input.c
net/dccp/options.c

index fdd4217f10471670e114003546bd8182d09ad70d..e668cf531babce00ea8fac706387691af910c8fb 100644 (file)
@@ -481,10 +481,12 @@ struct dccp_ackvec;
  * @dccps_hc_rx_insert_options -
  * @dccps_hc_tx_insert_options -
  * @dccps_xmit_timer - timer for when CCID is not ready to send
+ * @dccps_syn_rtt - RTT sample from Request/Response exchange (in usecs)
  */
 struct dccp_sock {
        /* inet_connection_sock has to be the first member of dccp_sock */
        struct inet_connection_sock     dccps_inet_connection;
+#define dccps_syn_rtt                  dccps_inet_connection.icsk_ack.lrcvtime
        __u64                           dccps_swl;
        __u64                           dccps_swh;
        __u64                           dccps_awl;
index bd578c87b2e7aa7bcd866949f0eff69dcd4ed58a..da6ec185ed5b5826e6df5b6d58f7870e26330cb9 100644 (file)
@@ -300,6 +300,14 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
                if (dccp_parse_options(sk, skb))
                        goto out_invalid_packet;
 
+               /* Obtain RTT sample from SYN exchange (used by CCID 3) */
+               if (dp->dccps_options_received.dccpor_timestamp_echo) {
+                       struct timeval now;
+
+                       dccp_timestamp(sk, &now);
+                       dp->dccps_syn_rtt = dccp_sample_rtt(sk, &now, NULL);
+               }
+
                if (dccp_msk(sk)->dccpms_send_ack_vector &&
                    dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
                                    DCCP_SKB_CB(skb)->dccpd_seq,
index 9074ca7977b2f908280886bdd75286242b283cd6..14b6212273239439437cb399f4666480ecfe4473 100644 (file)
@@ -563,6 +563,14 @@ int dccp_insert_options(struct sock *sk, struct sk_buff *skb)
            dccp_insert_options_feat(sk, skb))
                return -1;
 
+       /*
+        * Obtain RTT sample from Request/Response exchange.
+        * This is currently used in CCID 3 initialisation.
+        */
+       if (DCCP_SKB_CB(skb)->dccpd_type == DCCP_PKT_REQUEST &&
+           dccp_insert_option_timestamp(sk, skb))
+               return -1;
+
        /* XXX: insert other options when appropriate */
 
        if (DCCP_SKB_CB(skb)->dccpd_opt_len != 0) {