]> err.no Git - linux-2.6/blobdiff - net/ipv4/tcp_output.c
mib: add struct net to ICMPMSGIN_INC_STATS_BH
[linux-2.6] / net / ipv4 / tcp_output.c
index 76b3653e9b4cc54318c768410ff60e923e57b3b0..edef2afe905e14ebccf5b5e7b98eaf84363775ba 100644 (file)
@@ -5,8 +5,6 @@
  *
  *             Implementation of the Transmission Control Protocol(TCP).
  *
- * Version:    $Id: tcp_output.c,v 1.146 2002/02/01 22:01:04 davem Exp $
- *
  * Authors:    Ross Biro
  *             Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  *             Mark Evans, <evansmp@uhura.aston.ac.uk>
@@ -607,7 +605,6 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
                                               md5,
                                               sk, NULL, NULL,
                                               tcp_hdr(skb),
-                                              sk->sk_protocol,
                                               skb->len);
        }
 #endif
@@ -1057,7 +1054,7 @@ static unsigned int tcp_mss_split_point(struct sock *sk, struct sk_buff *skb,
 
        needed = min(skb->len, window);
 
-       if (skb == tcp_write_queue_tail(sk) && cwnd_len <= needed)
+       if (cwnd_len <= needed)
                return cwnd_len;
 
        return needed - needed % mss_now;
@@ -1808,6 +1805,9 @@ void tcp_simple_retransmit(struct sock *sk)
        if (!lost)
                return;
 
+       if (tcp_is_reno(tp))
+               tcp_limit_reno_sacked(tp);
+
        tcp_verify_left_out(tp);
 
        /* Don't muck with the congestion window here.
@@ -1833,7 +1833,7 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct inet_connection_sock *icsk = inet_csk(sk);
-       unsigned int cur_mss = tcp_current_mss(sk, 0);
+       unsigned int cur_mss;
        int err;
 
        /* Inconslusive MTU probe */
@@ -1855,6 +1855,11 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
                        return -ENOMEM;
        }
 
+       if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk))
+               return -EHOSTUNREACH; /* Routing failure or similar. */
+
+       cur_mss = tcp_current_mss(sk, 0);
+
        /* If receiver has shrunk his window, and skb is out of
         * new window, do not retransmit it. The exception is the
         * case, when window is shrunk to zero. In this case
@@ -1881,9 +1886,6 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
            (sysctl_tcp_retrans_collapse != 0))
                tcp_retrans_try_collapse(sk, skb, cur_mss);
 
-       if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk))
-               return -EHOSTUNREACH; /* Routing failure or similar. */
-
        /* Some Solaris stacks overoptimize and ignore the FIN on a
         * retransmit when old data is attached.  So strip it off
         * since it is cheap to do so and saves bytes on the network.
@@ -1983,14 +1985,17 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
 
                        if (sacked & TCPCB_LOST) {
                                if (!(sacked & (TCPCB_SACKED_ACKED|TCPCB_SACKED_RETRANS))) {
+                                       int mib_idx;
+
                                        if (tcp_retransmit_skb(sk, skb)) {
                                                tp->retransmit_skb_hint = NULL;
                                                return;
                                        }
                                        if (icsk->icsk_ca_state != TCP_CA_Loss)
-                                               NET_INC_STATS_BH(LINUX_MIB_TCPFASTRETRANS);
+                                               mib_idx = LINUX_MIB_TCPFASTRETRANS;
                                        else
-                                               NET_INC_STATS_BH(LINUX_MIB_TCPSLOWSTARTRETRANS);
+                                               mib_idx = LINUX_MIB_TCPSLOWSTARTRETRANS;
+                                       NET_INC_STATS_BH(mib_idx);
 
                                        if (skb == tcp_write_queue_head(sk))
                                                inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS,
@@ -2126,6 +2131,8 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority)
        TCP_SKB_CB(skb)->when = tcp_time_stamp;
        if (tcp_transmit_skb(sk, skb, 0, priority))
                NET_INC_STATS(LINUX_MIB_TCPABORTFAILED);
+
+       TCP_INC_STATS(TCP_MIB_OUTRSTS);
 }
 
 /* WARNING: This routine must only be called when we have already sent
@@ -2259,7 +2266,7 @@ struct sk_buff *tcp_make_synack(struct sock *sk, struct dst_entry *dst,
                tp->af_specific->calc_md5_hash(md5_hash_location,
                                               md5,
                                               NULL, dst, req,
-                                              tcp_hdr(skb), sk->sk_protocol,
+                                              tcp_hdr(skb),
                                               skb->len);
        }
 #endif