This commit was manufactured by cvs2svn to create tag
[linux-2.6.git] / net / ipv4 / tcp_timer.c
index 58796c6..fc8e84f 100644 (file)
@@ -68,18 +68,13 @@ void tcp_clear_xmit_timers(struct sock *sk)
        struct tcp_opt *tp = tcp_sk(sk);
 
        tp->pending = 0;
-       if (timer_pending(&tp->retransmit_timer) &&
-           del_timer(&tp->retransmit_timer))
-               __sock_put(sk);
+       sk_stop_timer(sk, &tp->retransmit_timer);
 
        tp->ack.pending = 0;
        tp->ack.blocked = 0;
-       if (timer_pending(&tp->delack_timer) &&
-           del_timer(&tp->delack_timer))
-               __sock_put(sk);
+       sk_stop_timer(sk, &tp->delack_timer);
 
-       if (timer_pending(&sk->sk_timer) && del_timer(&sk->sk_timer))
-               __sock_put(sk);
+       sk_stop_timer(sk, &sk->sk_timer);
 }
 
 static void tcp_write_err(struct sock *sk)
@@ -218,19 +213,17 @@ static void tcp_delack_timer(unsigned long data)
                /* Try again later. */
                tp->ack.blocked = 1;
                NET_INC_STATS_BH(DelayedACKLocked);
-               if (!mod_timer(&tp->delack_timer, jiffies + TCP_DELACK_MIN))
-                       sock_hold(sk);
+               sk_reset_timer(sk, &tp->delack_timer, jiffies + TCP_DELACK_MIN);
                goto out_unlock;
        }
 
-       tcp_mem_reclaim(sk);
+       sk_stream_mem_reclaim(sk);
 
        if (sk->sk_state == TCP_CLOSE || !(tp->ack.pending & TCP_ACK_TIMER))
                goto out;
 
        if (time_after(tp->ack.timeout, jiffies)) {
-               if (!mod_timer(&tp->delack_timer, tp->ack.timeout))
-                       sock_hold(sk);
+               sk_reset_timer(sk, &tp->delack_timer, tp->ack.timeout);
                goto out;
        }
        tp->ack.pending &= ~TCP_ACK_TIMER;
@@ -265,7 +258,7 @@ static void tcp_delack_timer(unsigned long data)
 
 out:
        if (tcp_memory_pressure)
-               tcp_mem_reclaim(sk);
+               sk_stream_mem_reclaim(sk);
 out_unlock:
        bh_unlock_sock(sk);
        sock_put(sk);
@@ -276,7 +269,7 @@ static void tcp_probe_timer(struct sock *sk)
        struct tcp_opt *tp = tcp_sk(sk);
        int max_probes;
 
-       if (tp->packets_out || !tp->send_head) {
+       if (tp->packets_out || !sk->sk_send_head) {
                tp->probes_out = 0;
                return;
        }
@@ -429,8 +422,7 @@ static void tcp_write_timer(unsigned long data)
        bh_lock_sock(sk);
        if (sock_owned_by_user(sk)) {
                /* Try again later */
-               if (!mod_timer(&tp->retransmit_timer, jiffies + (HZ/20)))
-                       sock_hold(sk);
+               sk_reset_timer(sk, &tp->retransmit_timer, jiffies + (HZ / 20));
                goto out_unlock;
        }
 
@@ -438,8 +430,7 @@ static void tcp_write_timer(unsigned long data)
                goto out;
 
        if (time_after(tp->timeout, jiffies)) {
-               if (!mod_timer(&tp->retransmit_timer, tp->timeout))
-                       sock_hold(sk);
+               sk_reset_timer(sk, &tp->retransmit_timer, tp->timeout);
                goto out;
        }
 
@@ -457,7 +448,7 @@ static void tcp_write_timer(unsigned long data)
        TCP_CHECK_TIMER(sk);
 
 out:
-       tcp_mem_reclaim(sk);
+       sk_stream_mem_reclaim(sk);
 out_unlock:
        bh_unlock_sock(sk);
        sock_put(sk);
@@ -498,7 +489,16 @@ static void tcp_synack_timer(struct sock *sk)
         * ones are about to clog our table.
         */
        if (lopt->qlen>>(lopt->max_qlen_log-1)) {
+#ifdef CONFIG_ACCEPT_QUEUES
+               int young = 0;
+              
+               for(i=0; i < NUM_ACCEPT_QUEUES; i++) 
+                       young += lopt->qlen_young[i];
+               
+               young <<= 1;
+#else
                int young = (lopt->qlen_young<<1);
+#endif
 
                while (thresh > 2) {
                        if (lopt->qlen < young)
@@ -524,9 +524,12 @@ static void tcp_synack_timer(struct sock *sk)
                                        unsigned long timeo;
 
                                        if (req->retrans++ == 0)
-                                               lopt->qlen_young--;
-                                       timeo = min((TCP_TIMEOUT_INIT << req->retrans),
-                                                   TCP_RTO_MAX);
+#ifdef CONFIG_ACCEPT_QUEUES
+                                               lopt->qlen_young[req->acceptq_class]--;
+#else
+                                               lopt->qlen_young--;
+#endif
+                                       timeo = min((TCP_TIMEOUT_INIT << req->retrans), TCP_RTO_MAX);
                                        req->expires = now + timeo;
                                        reqp = &req->dl_next;
                                        continue;
@@ -538,7 +541,11 @@ static void tcp_synack_timer(struct sock *sk)
                                write_unlock(&tp->syn_wait_lock);
                                lopt->qlen--;
                                if (req->retrans == 0)
-                                       lopt->qlen_young--;
+#ifdef CONFIG_ACCEPT_QUEUES
+                                               lopt->qlen_young[req->acceptq_class]--;
+#else
+                                               lopt->qlen_young--;
+#endif
                                tcp_openreq_free(req);
                                continue;
                        }
@@ -557,14 +564,12 @@ static void tcp_synack_timer(struct sock *sk)
 
 void tcp_delete_keepalive_timer (struct sock *sk)
 {
-       if (timer_pending(&sk->sk_timer) && del_timer (&sk->sk_timer))
-               __sock_put(sk);
+       sk_stop_timer(sk, &sk->sk_timer);
 }
 
 void tcp_reset_keepalive_timer (struct sock *sk, unsigned long len)
 {
-       if (!mod_timer(&sk->sk_timer, jiffies + len))
-               sock_hold(sk);
+       sk_reset_timer(sk, &sk->sk_timer, jiffies + len);
 }
 
 void tcp_set_keepalive(struct sock *sk, int val)
@@ -617,7 +622,7 @@ static void tcp_keepalive_timer (unsigned long data)
        elapsed = keepalive_time_when(tp);
 
        /* It is alive without keepalive 8) */
-       if (tp->packets_out || tp->send_head)
+       if (tp->packets_out || sk->sk_send_head)
                goto resched;
 
        elapsed = tcp_time_stamp - tp->rcv_tstamp;
@@ -644,7 +649,7 @@ static void tcp_keepalive_timer (unsigned long data)
        }
 
        TCP_CHECK_TIMER(sk);
-       tcp_mem_reclaim(sk);
+       sk_stream_mem_reclaim(sk);
 
 resched:
        tcp_reset_keepalive_timer (sk, elapsed);