]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/tcp_output.c
[TCP]: Rewrite SACK block processing & sack_recv_cache use
[linux-2.6-omap-h63xx.git] / net / ipv4 / tcp_output.c
index e5130a7fe181865f70476f402007d941b37af707..030fc69ea217b9495b87b706ba4e35e28ce412d4 100644 (file)
@@ -653,23 +653,18 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned
 }
 
 /* When a modification to fackets out becomes necessary, we need to check
- * skb is counted to fackets_out or not. Another important thing is to
- * tweak SACK fastpath hint too as it would overwrite all changes unless
- * hint is also changed.
+ * skb is counted to fackets_out or not.
  */
-static void tcp_adjust_fackets_out(struct tcp_sock *tp, struct sk_buff *skb,
+static void tcp_adjust_fackets_out(struct sock *sk, struct sk_buff *skb,
                                   int decr)
 {
+       struct tcp_sock *tp = tcp_sk(sk);
+
        if (!tp->sacked_out || tcp_is_reno(tp))
                return;
 
-       if (!before(tp->highest_sack, TCP_SKB_CB(skb)->seq))
+       if (!before(tcp_highest_sack_seq(tp), TCP_SKB_CB(skb)->seq))
                tp->fackets_out -= decr;
-
-       /* cnt_hint is "off-by-one" compared with fackets_out (see sacktag) */
-       if (tp->fastpath_skb_hint != NULL &&
-           after(TCP_SKB_CB(tp->fastpath_skb_hint)->seq, TCP_SKB_CB(skb)->seq))
-               tp->fastpath_cnt_hint -= decr;
 }
 
 /* Function to create two new TCP segments.  Shrinks the given segment
@@ -712,9 +707,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
        TCP_SKB_CB(buff)->end_seq = TCP_SKB_CB(skb)->end_seq;
        TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(buff)->seq;
 
-       if (tcp_is_sack(tp) && tp->sacked_out &&
-           (TCP_SKB_CB(skb)->seq == tp->highest_sack))
-               tp->highest_sack = TCP_SKB_CB(buff)->seq;
+       if (tcp_is_sack(tp) && tp->sacked_out && (skb == tp->highest_sack))
+               tp->highest_sack = buff;
 
        /* PSH and FIN should only be set in the second packet. */
        flags = TCP_SKB_CB(skb)->flags;
@@ -772,7 +766,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
                        tcp_dec_pcount_approx_int(&tp->sacked_out, diff);
                        tcp_verify_left_out(tp);
                }
-               tcp_adjust_fackets_out(tp, skb, diff);
+               tcp_adjust_fackets_out(sk, skb, diff);
        }
 
        /* Link BUFF into the send queue. */
@@ -1162,8 +1156,7 @@ int tcp_may_send_now(struct sock *sk)
        return (skb &&
                tcp_snd_test(sk, skb, tcp_current_mss(sk, 1),
                             (tcp_skb_is_last(sk, skb) ?
-                             TCP_NAGLE_PUSH :
-                             tp->nonagle)));
+                             tp->nonagle : TCP_NAGLE_PUSH)));
 }
 
 /* Trim TSO SKB to LEN bytes, put the remaining data into a new packet
@@ -1713,7 +1706,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
                       tcp_skb_pcount(next_skb) != 1);
 
                if (WARN_ON(tcp_is_sack(tp) && tp->sacked_out &&
-                   (TCP_SKB_CB(next_skb)->seq == tp->highest_sack)))
+                   (next_skb == tp->highest_sack)))
                        return;
 
                /* Ok.  We will be able to collapse the packet. */
@@ -1748,16 +1741,11 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
                if (tcp_is_reno(tp) && tp->sacked_out)
                        tcp_dec_pcount_approx(&tp->sacked_out, next_skb);
 
-               tcp_adjust_fackets_out(tp, next_skb, tcp_skb_pcount(next_skb));
+               tcp_adjust_fackets_out(sk, next_skb, tcp_skb_pcount(next_skb));
                tp->packets_out -= tcp_skb_pcount(next_skb);
 
                /* changed transmit queue under us so clear hints */
                tcp_clear_retrans_hints_partial(tp);
-               /* manually tune sacktag skb hint */
-               if (tp->fastpath_skb_hint == next_skb) {
-                       tp->fastpath_skb_hint = skb;
-                       tp->fastpath_cnt_hint -= tcp_skb_pcount(skb);
-               }
 
                sk_stream_free_skb(sk, next_skb);
        }
@@ -2029,7 +2017,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
                        break;
                tp->forward_skb_hint = skb;
 
-               if (after(TCP_SKB_CB(skb)->seq, tp->highest_sack))
+               if (after(TCP_SKB_CB(skb)->seq, tcp_highest_sack_seq(tp)))
                        break;
 
                if (tcp_packets_in_flight(tp) >= tp->snd_cwnd)