]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/tcp_output.c
[IPV4]: no need pass pointer to a default into fib_detect_death
[linux-2.6-omap-h63xx.git] / net / ipv4 / tcp_output.c
index f4c1eef89af0b3ac1e63ed91ecf3725a761d6949..9a985b55e7d8d06af3c5e9170621ea94b8eb1f98 100644 (file)
@@ -80,6 +80,10 @@ static void update_send_head(struct sock *sk, struct sk_buff *skb)
        tcp_advance_send_head(sk, skb);
        tp->snd_nxt = TCP_SKB_CB(skb)->end_seq;
        tcp_packets_out_inc(sk, skb);
+
+       /* Don't override Nagle indefinately with F-RTO */
+       if (tp->frto_counter == 2)
+               tp->frto_counter = 3;
 }
 
 /* SND.NXT, if window was not shrunk.
@@ -653,23 +657,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 (after(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,10 +711,6 @@ 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;
-
        /* PSH and FIN should only be set in the second packet. */
        flags = TCP_SKB_CB(skb)->flags;
        TCP_SKB_CB(skb)->flags = flags & ~(TCPCB_FLAG_FIN|TCPCB_FLAG_PSH);
@@ -772,7 +767,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. */
@@ -1182,7 +1177,7 @@ static int tso_fragment(struct sock *sk, struct sk_buff *skb, unsigned int len,
        if (skb->len != skb->data_len)
                return tcp_fragment(sk, skb, len, mss_now);
 
-       buff = sk_stream_alloc_pskb(sk, 0, 0, GFP_ATOMIC);
+       buff = sk_stream_alloc_skb(sk, 0, GFP_ATOMIC);
        if (unlikely(buff == NULL))
                return -ENOMEM;
 
@@ -1295,7 +1290,6 @@ static int tcp_mtu_probe(struct sock *sk)
        int len;
        int probe_size;
        int size_needed;
-       unsigned int pif;
        int copy;
        int mss_now;
 
@@ -1328,11 +1322,9 @@ static int tcp_mtu_probe(struct sock *sk)
        if (after(tp->snd_nxt + size_needed, tp->snd_una + tp->snd_wnd))
                return 0;
 
-       /* Do we need to wait to drain cwnd? */
-       pif = tcp_packets_in_flight(tp);
-       if (pif + 2 > tp->snd_cwnd) {
-               /* With no packets in flight, don't stall. */
-               if (pif == 0)
+       /* Do we need to wait to drain cwnd? With none in flight, don't stall */
+       if (tcp_packets_in_flight(tp) + 2 > tp->snd_cwnd) {
+               if (!tcp_packets_in_flight(tp))
                        return -1;
                else
                        return 0;
@@ -1344,7 +1336,6 @@ static int tcp_mtu_probe(struct sock *sk)
        sk_charge_skb(sk, nskb);
 
        skb = tcp_send_head(sk);
-       tcp_insert_write_queue_before(nskb, skb, sk);
 
        TCP_SKB_CB(nskb)->seq = TCP_SKB_CB(skb)->seq;
        TCP_SKB_CB(nskb)->end_seq = TCP_SKB_CB(skb)->seq + probe_size;
@@ -1353,10 +1344,10 @@ static int tcp_mtu_probe(struct sock *sk)
        nskb->csum = 0;
        nskb->ip_summed = skb->ip_summed;
 
-       len = 0;
-       while (len < probe_size) {
-               next = tcp_write_queue_next(sk, skb);
+       tcp_insert_write_queue_before(nskb, skb, sk);
 
+       len = 0;
+       tcp_for_write_queue_from_safe(skb, next, sk) {
                copy = min_t(int, skb->len, probe_size - len);
                if (nskb->ip_summed)
                        skb_copy_bits(skb, 0, skb_put(nskb, copy), copy);
@@ -1385,7 +1376,9 @@ static int tcp_mtu_probe(struct sock *sk)
                }
 
                len += copy;
-               skb = next;
+
+               if (len >= probe_size)
+                       break;
        }
        tcp_init_tso_segs(sk, nskb, nskb->len);
 
@@ -1711,9 +1704,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
                BUG_ON(tcp_skb_pcount(skb) != 1 ||
                       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)))
-                       return;
+               tcp_highest_sack_combine(sk, next_skb, skb);
 
                /* Ok.  We will be able to collapse the packet. */
                tcp_unlink_write_queue(next_skb, sk);
@@ -1747,16 +1738,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);
        }
@@ -2028,7 +2014,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 (!before(TCP_SKB_CB(skb)->seq, tcp_highest_sack_seq(tp)))
                        break;
 
                if (tcp_packets_in_flight(tp) >= tp->snd_cwnd)