return tp->ack.pending&TCP_ACK_SCHED;
 }
 
-static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp)
+static __inline__ void tcp_dec_quickack_mode(struct tcp_sock *tp, unsigned int pkts)
 {
-       if (tp->ack.quick && --tp->ack.quick == 0) {
-               /* Leaving quickack mode we deflate ATO. */
-               tp->ack.ato = TCP_ATO_MIN;
+       if (tp->ack.quick) {
+               if (pkts >= tp->ack.quick) {
+                       tp->ack.quick = 0;
+
+                       /* Leaving quickack mode we deflate ATO. */
+                       tp->ack.ato = TCP_ATO_MIN;
+               } else
+                       tp->ack.quick -= pkts;
        }
 }
 
 
                tp->ack.pingpong = 1;
 }
 
-static __inline__ void tcp_event_ack_sent(struct sock *sk)
+static __inline__ void tcp_event_ack_sent(struct sock *sk, unsigned int pkts)
 {
        struct tcp_sock *tp = tcp_sk(sk);
 
-       tcp_dec_quickack_mode(tp);
+       tcp_dec_quickack_mode(tp, pkts);
        tcp_clear_xmit_timer(sk, TCP_TIME_DACK);
 }
 
                tp->af_specific->send_check(sk, th, skb->len, skb);
 
                if (tcb->flags & TCPCB_FLAG_ACK)
-                       tcp_event_ack_sent(sk);
+                       tcp_event_ack_sent(sk, tcp_skb_pcount(skb));
 
                if (skb->len != tcp_header_size)
                        tcp_event_data_sent(tp, skb, sk);