Network Drop Monitor: Adding kfree_skb_clean for non-drops and modifying end-of-line...
[safe/jmp/linux-2.6] / net / ipv4 / tcp_htcp.c
index af99776..26d5c7f 100644 (file)
@@ -69,9 +69,12 @@ static u32 htcp_cwnd_undo(struct sock *sk)
        const struct tcp_sock *tp = tcp_sk(sk);
        struct htcp *ca = inet_csk_ca(sk);
 
-       ca->last_cong = ca->undo_last_cong;
-       ca->maxRTT = ca->undo_maxRTT;
-       ca->old_maxB = ca->undo_old_maxB;
+       if (ca->undo_last_cong) {
+               ca->last_cong = ca->undo_last_cong;
+               ca->maxRTT = ca->undo_maxRTT;
+               ca->old_maxB = ca->undo_old_maxB;
+               ca->undo_last_cong = 0;
+       }
 
        return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta);
 }
@@ -112,8 +115,7 @@ static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt
                return;
 
        /* achieved throughput calculations */
-       if (icsk->icsk_ca_state != TCP_CA_Open &&
-           icsk->icsk_ca_state != TCP_CA_Disorder) {
+       if (!((1 << icsk->icsk_ca_state) & (TCPF_CA_Open | TCPF_CA_Disorder))) {
                ca->packetcount = 0;
                ca->lasttime = now;
                return;
@@ -268,7 +270,10 @@ static void htcp_state(struct sock *sk, u8 new_state)
        case TCP_CA_Open:
                {
                        struct htcp *ca = inet_csk_ca(sk);
-                       ca->last_cong = jiffies;
+                       if (ca->undo_last_cong) {
+                               ca->last_cong = jiffies;
+                               ca->undo_last_cong = 0;
+                       }
                }
                break;
        case TCP_CA_CWR: