Subject: [PATCH 6/6] tcp_cubic: enable high resolution ack time if needed

From: Stephen Hemminger <[email-masked]>
Date: Thu, 10 Mar 2011 08:51:28 -0800

This is a refined version of an earlier patch by Lucas Nussbaum.
Cubic needs RTT values in milliseconds. If HZ < 1000 then
the values will be too coarse.

Signed-off-by: Stephen Hemminger <[email-masked]>

--- a/net/ipv4/tcp_cubic.c	2011-03-10 08:35:59.968882888 -0800
+++ b/net/ipv4/tcp_cubic.c	2011-03-10 08:36:10.241016524 -0800
@@ -459,6 +459,10 @@ static int __init cubictcp_register(void
 	/* divide by bic_scale and by constant Srtt (100ms) */
 	do_div(cube_factor, bic_scale * 10);
 
+	/* hystart needs ms clock resolution */
+	if (hystart && HZ < 1000)
+		cubictcp.flags |= TCP_CONG_RTT_STAMP;
+
 	return tcp_register_congestion_control(&cubictcp);
 }