[PATCH] TCP Westwood+

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dave,
this is the 2.4 version of Stephen's patch which removes
bw_sample. I did even few small changes to comments which
were simply too old and didn't reflect in any way the 
current implementation. It applies against 2.4.26-pre3.

Regards.

--

Angelo Dell'Aera 'buffer' 
Antifork Research, Inc.	  	http://buffer.antifork.org



diff -Naur linux-2.4.26-pre3-old/include/net/sock.h linux-2.4.26-pre3/include/net/sock.h
--- linux-2.4.26-pre3-old/include/net/sock.h	2004-03-15 16:23:02.000000000 +0100
+++ linux-2.4.26-pre3/include/net/sock.h	2004-03-15 16:26:30.000000000 +0100
@@ -435,7 +435,6 @@
 
 /* TCP Westwood structure */
         struct {
-                __u32    bw_sample;        /* bandwidth sample */
                 __u32    bw_ns_est;        /* first bandwidth estimation..not too smoothed 8) */
                 __u32    bw_est;           /* bandwidth estimate */
                 __u32    rtt_win_sx;       /* here starts a new evaluation... */
diff -Naur linux-2.4.26-pre3-old/include/net/tcp.h linux-2.4.26-pre3/include/net/tcp.h
--- linux-2.4.26-pre3-old/include/net/tcp.h	2004-03-15 16:23:02.000000000 +0100
+++ linux-2.4.26-pre3/include/net/tcp.h	2004-03-15 16:32:28.000000000 +0100
@@ -1880,16 +1880,18 @@
 void __tcp_westwood_slow_bw(struct sock *, struct sk_buff *);
 
 /*
- * This function initializes fields used in TCP Westwood.
- * We can't get no information about RTT at this time so
- * we are forced to set it to 0.
+ * This function initializes fields used in TCP Westwood+. We can't
+ * get no information about RTTmin at this time so we simply set it to
+ * TCP_WESTWOOD_INIT_RTT. This value was chosen to be too conservative
+ * since in this way we're sure it will be updated in a consistent
+ * way as soon as possible. It will reasonably happen within the first
+ * RTT period of the connection lifetime.
  */
 
 static inline void __tcp_init_westwood(struct sock *sk)
 {
 	struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
 
-	tp->westwood.bw_sample = 0;
 	tp->westwood.bw_ns_est = 0;
 	tp->westwood.bw_est = 0;
 	tp->westwood.accounted = 0;
diff -Naur linux-2.4.26-pre3-old/net/ipv4/tcp_input.c linux-2.4.26-pre3/net/ipv4/tcp_input.c
--- linux-2.4.26-pre3-old/net/ipv4/tcp_input.c	2004-03-15 16:23:05.000000000 +0100
+++ linux-2.4.26-pre3/net/ipv4/tcp_input.c	2004-03-15 16:30:28.000000000 +0100
@@ -2038,8 +2038,7 @@
 }
 
 /*
- * TCP Westwood
- * Functions needed for estimating bandwidth.
+ * TCP Westwood+
  */
 
 /*
@@ -2055,14 +2054,13 @@
 static void westwood_filter(struct sock *sk, __u32 delta)
 {
 	struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
-	__u32 sample = (tp->westwood.bk) / delta;
 
 	tp->westwood.bw_ns_est =
-		westwood_do_filter(tp->westwood.bw_ns_est, sample);
+		westwood_do_filter(tp->westwood.bw_ns_est, 
+				   tp->westwood.bk / delta);
 	tp->westwood.bw_est =
 		westwood_do_filter(tp->westwood.bw_est,
 				   tp->westwood.bw_ns_est);
-	tp->westwood.bw_sample = sample;
 }
 
 /* @westwood_update_rttmin
@@ -2086,8 +2084,7 @@
 
 /*
  * @westwood_acked
- * Evaluate increases for dk. It requires no lock since when it is
- * called lock should already be held. Be careful about it!
+ * Evaluate increases for dk. 
  */
 
 static __u32 westwood_acked(struct sock *sk)
@@ -2134,10 +2131,7 @@
 /*
  * @westwood_update_window
  * It updates RTT evaluation window if it is the right moment to do
- * it. If so it calls filter for evaluating bandwidth. Be careful
- * about __westwood_update_window() since it is called without
- * any form of lock. It should be used only for internal purposes.
- * Call westwood_update_window() instead.
+ * it. If so it calls filter for evaluating bandwidth. 
  */
  
 static void __westwood_update_window(struct sock *sk, __u32 now)
@@ -2162,7 +2156,7 @@
 }
 
 /*
- * @__westwood_fast_bw
+ * @__tcp_westwood_fast_bw
  * It is called when we are in fast path. In particular it is called when
  * header prediction is successfull. In such case infact update is
  * straight forward and doesn't need any particular care.
@@ -2253,7 +2247,7 @@
 }
 
 /*
- * @__westwood_slow_bw
+ * @__tcp_westwood_slow_bw
  * It is called when something is going wrong..even if there could
  * be no problems! Infact a simple delayed packet may trigger a
  * dupack. But we need to be careful in such case.
@@ -2269,7 +2263,7 @@
 	tp->westwood.rtt_min = westwood_update_rttmin(sk);
 }
 
-/* TCP Westwood routines end here */
+/* TCP Westwood+ routines end here */
 
 /* This routine deals with incoming acks, but not outgoing ones. */
 static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)






-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux