Re: [PATCH 4/4] TCP YEAH: use vegas dont copy it

2007-04-23 Thread David Miller
From: Stephen Hemminger <[EMAIL PROTECTED]>
Date: Mon, 23 Apr 2007 20:31:21 -0700

> Rather than using a copy of vegas code, the YEAH code should just
> have it exported so there is common code.
> 
> Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>

Excellent cleanup.

Applied, thanks Stephen.
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/4] TCP YEAH: use vegas dont copy it

2007-04-23 Thread Stephen Hemminger
Rather than using a copy of vegas code, the YEAH code should just
have it exported so there is common code.

Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>


---
 net/ipv4/tcp_vegas.c |   31 +---
 net/ipv4/tcp_vegas.h |   24 +
 net/ipv4/tcp_yeah.c  |   53 +---
 net/ipv4/tcp_yeah.h  |  131 ---
 4 files changed, 61 insertions(+), 178 deletions(-)

--- net-2.6.22.orig/net/ipv4/tcp_vegas.c
+++ net-2.6.22/net/ipv4/tcp_vegas.c
@@ -38,6 +38,8 @@
 
 #include 
 
+#include "tcp_vegas.h"
+
 /* Default values of the Vegas variables, in fixed-point representation
  * with V_PARAM_SHIFT bits to the right of the binary point.
  */
@@ -54,17 +56,6 @@ module_param(gamma, int, 0644);
 MODULE_PARM_DESC(gamma, "limit on increase (scale by 2)");
 
 
-/* Vegas variables */
-struct vegas {
-   u32 beg_snd_nxt;/* right edge during last RTT */
-   u32 beg_snd_una;/* left edge  during last RTT */
-   u32 beg_snd_cwnd;   /* saves the size of the cwnd */
-   u8  doing_vegas_now;/* if true, do vegas for this RTT */
-   u16 cntRTT; /* # of RTTs measured within last RTT */
-   u32 minRTT; /* min of RTTs measured within last RTT (in 
usec) */
-   u32 baseRTT;/* the min of all Vegas RTT measurements seen 
(in usec) */
-};
-
 /* There are several situations when we must "re-start" Vegas:
  *
  *  o when a connection is established
@@ -81,7 +72,7 @@ struct vegas {
  * Instead we must wait until the completion of an RTT during
  * which we actually receive ACKs.
  */
-static inline void vegas_enable(struct sock *sk)
+static void vegas_enable(struct sock *sk)
 {
const struct tcp_sock *tp = tcp_sk(sk);
struct vegas *vegas = inet_csk_ca(sk);
@@ -104,13 +95,14 @@ static inline void vegas_disable(struct 
vegas->doing_vegas_now = 0;
 }
 
-static void tcp_vegas_init(struct sock *sk)
+void tcp_vegas_init(struct sock *sk)
 {
struct vegas *vegas = inet_csk_ca(sk);
 
vegas->baseRTT = 0x7fff;
vegas_enable(sk);
 }
+EXPORT_SYMBOL_GPL(tcp_vegas_init);
 
 /* Do RTT sampling needed for Vegas.
  * Basically we:
@@ -120,7 +112,7 @@ static void tcp_vegas_init(struct sock *
  *   o min-filter RTT samples from a much longer window (forever for now)
  * to find the propagation delay (baseRTT)
  */
-static void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
+void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
 {
struct vegas *vegas = inet_csk_ca(sk);
u32 vrtt;
@@ -138,8 +130,9 @@ static void tcp_vegas_pkts_acked(struct 
vegas->minRTT = min(vegas->minRTT, vrtt);
vegas->cntRTT++;
 }
+EXPORT_SYMBOL_GPL(tcp_vegas_pkts_acked);
 
-static void tcp_vegas_state(struct sock *sk, u8 ca_state)
+void tcp_vegas_state(struct sock *sk, u8 ca_state)
 {
 
if (ca_state == TCP_CA_Open)
@@ -147,6 +140,7 @@ static void tcp_vegas_state(struct sock 
else
vegas_disable(sk);
 }
+EXPORT_SYMBOL_GPL(tcp_vegas_state);
 
 /*
  * If the connection is idle and we are restarting,
@@ -157,12 +151,13 @@ static void tcp_vegas_state(struct sock 
  * packets, _then_ we can make Vegas calculations
  * again.
  */
-static void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
+void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event)
 {
if (event == CA_EVENT_CWND_RESTART ||
event == CA_EVENT_TX_START)
tcp_vegas_init(sk);
 }
+EXPORT_SYMBOL_GPL(tcp_vegas_cwnd_event);
 
 static void tcp_vegas_cong_avoid(struct sock *sk, u32 ack,
 u32 seq_rtt, u32 in_flight, int flag)
@@ -339,8 +334,7 @@ static void tcp_vegas_cong_avoid(struct 
 }
 
 /* Extract info for Tcp socket info provided via netlink. */
-static void tcp_vegas_get_info(struct sock *sk, u32 ext,
-  struct sk_buff *skb)
+void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb)
 {
const struct vegas *ca = inet_csk_ca(sk);
if (ext & (1 << (INET_DIAG_VEGASINFO - 1))) {
@@ -354,6 +348,7 @@ static void tcp_vegas_get_info(struct so
nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
}
 }
+EXPORT_SYMBOL_GPL(tcp_vegas_get_info);
 
 static struct tcp_congestion_ops tcp_vegas = {
.flags  = TCP_CONG_RTT_STAMP,
--- /dev/null
+++ net-2.6.22/net/ipv4/tcp_vegas.h
@@ -0,0 +1,24 @@
+/*
+ * TCP Vegas congestion control interface
+ */
+#ifndef __TCP_VEGAS_H
+#define __TCP_VEGAS_H 1
+
+/* Vegas variables */
+struct vegas {
+   u32 beg_snd_nxt;/* right edge during last RTT */
+   u32 beg_snd_una;/* left edge  during last RTT */
+   u32 beg_snd_cwnd;   /* saves the size of the cwnd */
+   u8  doing_vegas_now;/* if true, do vegas for this RTT */
+   u16 cntRTT; /* # of RTTs measured within last RTT */
+   u32