nfsd: minor write_pool_threads exit cleanup
[safe/jmp/linux-2.6] / net / ipv4 / tcp_cong.c
index bfb1996..e92beb9 100644 (file)
@@ -115,7 +115,7 @@ int tcp_set_default_congestion_control(const char *name)
 
        spin_lock(&tcp_cong_list_lock);
        ca = tcp_ca_find(name);
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
        if (!ca && capable(CAP_SYS_MODULE)) {
                spin_unlock(&tcp_cong_list_lock);
 
@@ -244,7 +244,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name)
        if (ca == icsk->icsk_ca_ops)
                goto out;
 
-#ifdef CONFIG_KMOD
+#ifdef CONFIG_MODULES
        /* not found attempt to autoload module */
        if (!ca && capable(CAP_SYS_MODULE)) {
                rcu_read_unlock();
@@ -287,7 +287,8 @@ int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight)
 
        left = tp->snd_cwnd - in_flight;
        if (sk_can_gso(sk) &&
-           left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd)
+           left * sysctl_tcp_tso_win_divisor < tp->snd_cwnd &&
+           left * tp->mss_cache < sk->sk_gso_max_size)
                return 1;
        return left <= tcp_max_burst(tp);
 }
@@ -335,6 +336,19 @@ void tcp_slow_start(struct tcp_sock *tp)
 }
 EXPORT_SYMBOL_GPL(tcp_slow_start);
 
+/* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */
+void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w)
+{
+       if (tp->snd_cwnd_cnt >= w) {
+               if (tp->snd_cwnd < tp->snd_cwnd_clamp)
+                       tp->snd_cwnd++;
+               tp->snd_cwnd_cnt = 0;
+       } else {
+               tp->snd_cwnd_cnt++;
+       }
+}
+EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai);
+
 /*
  * TCP Reno congestion control
  * This is special case used for fallback as well.
@@ -364,13 +378,7 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 in_flight)
                                tp->snd_cwnd++;
                }
        } else {
-               /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd */
-               if (tp->snd_cwnd_cnt >= tp->snd_cwnd) {
-                       if (tp->snd_cwnd < tp->snd_cwnd_clamp)
-                               tp->snd_cwnd++;
-                       tp->snd_cwnd_cnt = 0;
-               } else
-                       tp->snd_cwnd_cnt++;
+               tcp_cong_avoid_ai(tp, tp->snd_cwnd);
        }
 }
 EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid);