[TCP]: Remove superflucious FLAG_DATA_SACKED
[deliverable/linux.git] / net / ipv4 / tcp_input.c
index 3ad6a19ad30f027a9245da5455fd7e44c0e8b2de..871110842809d0c61dcc30eb1084b4763c8b927a 100644 (file)
@@ -1118,12 +1118,11 @@ static int tcp_is_sackblock_valid(struct tcp_sock *tp, int is_dsack,
  * highest SACK block). Also calculate the lowest snd_nxt among the remaining
  * retransmitted skbs to avoid some costly processing per ACKs.
  */
-static int tcp_mark_lost_retrans(struct sock *sk)
+static void tcp_mark_lost_retrans(struct sock *sk)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
        struct sk_buff *skb;
-       int flag = 0;
        int cnt = 0;
        u32 new_low_seq = tp->snd_nxt;
        u32 received_upto = TCP_SKB_CB(tp->highest_sack)->end_seq;
@@ -1131,7 +1130,7 @@ static int tcp_mark_lost_retrans(struct sock *sk)
        if (!tcp_is_fack(tp) || !tp->retrans_out ||
            !after(received_upto, tp->lost_retrans_low) ||
            icsk->icsk_ca_state != TCP_CA_Recovery)
-               return flag;
+               return;
 
        tcp_for_write_queue(skb, sk) {
                u32 ack_seq = TCP_SKB_CB(skb)->ack_seq;
@@ -1159,9 +1158,8 @@ static int tcp_mark_lost_retrans(struct sock *sk)
                        if (!(TCP_SKB_CB(skb)->sacked & (TCPCB_LOST|TCPCB_SACKED_ACKED))) {
                                tp->lost_out += tcp_skb_pcount(skb);
                                TCP_SKB_CB(skb)->sacked |= TCPCB_LOST;
-                               flag |= FLAG_DATA_SACKED;
-                               NET_INC_STATS_BH(LINUX_MIB_TCPLOSTRETRANSMIT);
                        }
+                       NET_INC_STATS_BH(LINUX_MIB_TCPLOSTRETRANSMIT);
                } else {
                        if (before(ack_seq, new_low_seq))
                                new_low_seq = ack_seq;
@@ -1171,8 +1169,6 @@ static int tcp_mark_lost_retrans(struct sock *sk)
 
        if (tp->retrans_out)
                tp->lost_retrans_low = new_low_seq;
-
-       return flag;
 }
 
 static int tcp_check_dsack(struct tcp_sock *tp, struct sk_buff *ack_skb,
@@ -1384,7 +1380,7 @@ static struct sk_buff *tcp_sacktag_skip(struct sk_buff *skb, struct sock *sk,
                if (skb == tcp_send_head(sk))
                        break;
 
-               if (before(TCP_SKB_CB(skb)->end_seq, skip_to_seq))
+               if (!before(TCP_SKB_CB(skb)->end_seq, skip_to_seq))
                        break;
        }
        return skb;
@@ -1554,20 +1550,15 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                        }
 
                        /* Rest of the block already fully processed? */
-                       if (!after(end_seq, cache->end_seq)) {
-                               skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, cache->end_seq,
-                                                              &fack_count, &reord, &flag);
+                       if (!after(end_seq, cache->end_seq))
                                goto advance_sp;
-                       }
+
+                       skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, cache->end_seq,
+                                                      &fack_count, &reord, &flag);
 
                        /* ...tail remains todo... */
                        if (TCP_SKB_CB(tp->highest_sack)->end_seq == cache->end_seq) {
-                               /* ...but better entrypoint exists! Check that DSACKs are
-                                * properly accounted while skipping here
-                                */
-                               tcp_maybe_skipping_dsack(skb, sk, next_dup, cache->end_seq,
-                                                        &fack_count, &reord, &flag);
-
+                               /* ...but better entrypoint exists! */
                                skb = tcp_write_queue_next(sk, tp->highest_sack);
                                fack_count = tp->fackets_out;
                                cache++;
@@ -1580,7 +1571,7 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
                        continue;
                }
 
-               if (!before(start_seq, tcp_highest_sack_seq(tp))) {
+               if (tp->sacked_out && !before(start_seq, tcp_highest_sack_seq(tp))) {
                        skb = tcp_write_queue_next(sk, tp->highest_sack);
                        fack_count = tp->fackets_out;
                }
@@ -1608,7 +1599,7 @@ advance_sp:
        for (j = 0; j < used_sacks; j++)
                tp->recv_sack_cache[i++] = sp[j];
 
-       flag |= tcp_mark_lost_retrans(sk);
+       tcp_mark_lost_retrans(sk);
 
        tcp_verify_left_out(tp);
 
@@ -3600,9 +3591,9 @@ static void tcp_fin(struct sk_buff *skb, struct sock *sk, struct tcphdr *th)
                /* Do not send POLL_HUP for half duplex close. */
                if (sk->sk_shutdown == SHUTDOWN_MASK ||
                    sk->sk_state == TCP_CLOSE)
-                       sk_wake_async(sk, 1, POLL_HUP);
+                       sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_HUP);
                else
-                       sk_wake_async(sk, 1, POLL_IN);
+                       sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN);
        }
 }
 
@@ -4961,7 +4952,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
 
                if (!sock_flag(sk, SOCK_DEAD)) {
                        sk->sk_state_change(sk);
-                       sk_wake_async(sk, 0, POLL_OUT);
+                       sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT);
                }
 
                if (sk->sk_write_pending ||
@@ -5191,9 +5182,9 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
                                 * are not waked up, because sk->sk_sleep ==
                                 * NULL and sk->sk_socket == NULL.
                                 */
-                               if (sk->sk_socket) {
-                                       sk_wake_async(sk,0,POLL_OUT);
-                               }
+                               if (sk->sk_socket)
+                                       sk_wake_async(sk,
+                                                       SOCK_WAKE_IO, POLL_OUT);
 
                                tp->snd_una = TCP_SKB_CB(skb)->ack_seq;
                                tp->snd_wnd = ntohs(th->window) <<
This page took 0.118724 seconds and 5 git commands to generate.