DCCP protocol discussions
 help / color / mirror / Atom feed
* [PATCH 5/5]: Fix Request/Response RTT sampling
@ 2007-09-12 14:35 Gerrit Renker
  2007-09-13  0:28 ` Ian McDonald
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Gerrit Renker @ 2007-09-12 14:35 UTC (permalink / raw)
  To: dccp

[DCCP]: Fix Request/Response RTT sampling

This fixes a problem with the Request/Response RTT sampling:

The current timestamp is taken after the options are processed, which is
too late if there is anything in the option processing code which takes
more than a trivial amount of time.

One instance is feature negotiation - I found that a full run through all
the option negotiation can take up to 38 ms. (Whether this says something
about feature negotiation or its implementation is a separate issue.)

The real problem (and it was caused by me) is that one does not know
how much time is spent in processing the options - and since DCCP has
space for up to 1020 bytes of options, the situation can be even much worse.

Therefore and since the Linux implementation always sends the required Elapsed
Time option, the timestamp is taken when the function is called, not later.

Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>    
---
 net/dccp/input.c |   12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -329,6 +329,7 @@ static int dccp_rcv_request_sent_state_p
 	if (dh->dccph_type = DCCP_PKT_RESPONSE) {
 		const struct inet_connection_sock *icsk = inet_csk(sk);
 		struct dccp_sock *dp = dccp_sk(sk);
+		long tstamp = dccp_timestamp();
 
 		/* Stop the REQUEST timer */
 		inet_csk_clear_xmit_timer(sk, ICSK_TIME_RETRANS);
@@ -349,13 +350,10 @@ static int dccp_rcv_request_sent_state_p
 		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) {
-			long d = dccp_timestamp();
-
-			d -= dp->dccps_options_received.dccpor_timestamp_echo;
-			dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * d);
-		}
+		/* Obtain usec RTT sample from SYN exchange (used by CCID 3) */
+		if (likely(dp->dccps_options_received.dccpor_timestamp_echo))
+			dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * (tstamp -
+			    dp->dccps_options_received.dccpor_timestamp_echo));
 
 		if (dccp_msk(sk)->dccpms_send_ack_vector &&
 		    dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-09-18  7:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-12 14:35 [PATCH 5/5]: Fix Request/Response RTT sampling Gerrit Renker
2007-09-13  0:28 ` Ian McDonald
2007-09-13  8:07 ` Gerrit Renker
2007-09-18  7:47 ` Ian McDonald

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox