aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2005-07-05 18:19:06 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-05 18:19:06 -0400
commit92df7b518dcb113de8bc2494e3cd275ad887f12b (patch)
tree7632352e63b1a414844c02c929c95cf20121653e
parenta762a9800752f05fa8768bb0ac35d0e7f1bcfe7f (diff)
[TCP]: tcp_write_xmit() tabbing cleanup
Put the main basic block of work at the top-level of tabbing, and mark the TCP_CLOSE test with unlikely(). Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/tcp_output.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index a6375ca2a59e..2a8409c3af1a 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -842,54 +842,54 @@ static inline void tcp_cwnd_validate(struct sock *sk, struct tcp_sock *tp)
842static int tcp_write_xmit(struct sock *sk, int nonagle) 842static int tcp_write_xmit(struct sock *sk, int nonagle)
843{ 843{
844 struct tcp_sock *tp = tcp_sk(sk); 844 struct tcp_sock *tp = tcp_sk(sk);
845 struct sk_buff *skb;
845 unsigned int mss_now; 846 unsigned int mss_now;
847 int sent_pkts;
846 848
847 /* If we are closed, the bytes will have to remain here. 849 /* If we are closed, the bytes will have to remain here.
848 * In time closedown will finish, we empty the write queue and all 850 * In time closedown will finish, we empty the write queue and all
849 * will be happy. 851 * will be happy.
850 */ 852 */
851 if (sk->sk_state != TCP_CLOSE) { 853 if (unlikely(sk->sk_state == TCP_CLOSE))
852 struct sk_buff *skb; 854 return 0;
853 int sent_pkts = 0;
854 855
855 /* Account for SACKS, we may need to fragment due to this.
856 * It is just like the real MSS changing on us midstream.
857 * We also handle things correctly when the user adds some
858 * IP options mid-stream. Silly to do, but cover it.
859 */
860 mss_now = tcp_current_mss(sk, 1);
861
862 while ((skb = sk->sk_send_head) &&
863 tcp_snd_test(sk, skb, mss_now,
864 tcp_skb_is_last(sk, skb) ? nonagle :
865 TCP_NAGLE_PUSH)) {
866 if (skb->len > mss_now) {
867 if (tcp_fragment(sk, skb, mss_now))
868 break;
869 }
870 856
871 TCP_SKB_CB(skb)->when = tcp_time_stamp; 857 /* Account for SACKS, we may need to fragment due to this.
872 tcp_tso_set_push(skb); 858 * It is just like the real MSS changing on us midstream.
873 if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC))) 859 * We also handle things correctly when the user adds some
860 * IP options mid-stream. Silly to do, but cover it.
861 */
862 mss_now = tcp_current_mss(sk, 1);
863 sent_pkts = 0;
864 while ((skb = sk->sk_send_head) &&
865 tcp_snd_test(sk, skb, mss_now,
866 tcp_skb_is_last(sk, skb) ? nonagle :
867 TCP_NAGLE_PUSH)) {
868 if (skb->len > mss_now) {
869 if (tcp_fragment(sk, skb, mss_now))
874 break; 870 break;
871 }
875 872
876 /* Advance the send_head. This one is sent out. 873 TCP_SKB_CB(skb)->when = tcp_time_stamp;
877 * This call will increment packets_out. 874 tcp_tso_set_push(skb);
878 */ 875 if (tcp_transmit_skb(sk, skb_clone(skb, GFP_ATOMIC)))
879 update_send_head(sk, tp, skb); 876 break;
880 877
881 tcp_minshall_update(tp, mss_now, skb); 878 /* Advance the send_head. This one is sent out.
882 sent_pkts = 1; 879 * This call will increment packets_out.
883 } 880 */
881 update_send_head(sk, tp, skb);
884 882
885 if (sent_pkts) { 883 tcp_minshall_update(tp, mss_now, skb);
886 tcp_cwnd_validate(sk, tp); 884 sent_pkts = 1;
887 return 0; 885 }
888 }
889 886
890 return !tp->packets_out && sk->sk_send_head; 887 if (sent_pkts) {
888 tcp_cwnd_validate(sk, tp);
889 return 0;
891 } 890 }
892 return 0; 891
892 return !tp->packets_out && sk->sk_send_head;
893} 893}
894 894
895/* Push out any pending frames which were held back due to 895/* Push out any pending frames which were held back due to