diff options
author | Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> | 2007-12-31 07:43:57 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:00:21 -0500 |
commit | 66f5fe624fa5f1d4574d2dd2bc0c72a17a92079c (patch) | |
tree | b869d6f061b10d0a1a7b5de87583f2400ae667f0 | |
parent | 3ccd3130b3f681a4aef6392327256786b3b6aa04 (diff) |
[TCP]: Rename update_send_head & include related increment to it
There's very little need to have the packets_out incrementing in
a separate function. Also name the combined function
appropriately.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/tcp_output.c | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 7a4834a2ae84..1ca638b83168 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -61,29 +61,22 @@ int sysctl_tcp_base_mss __read_mostly = 512; | |||
61 | /* By default, RFC2861 behavior. */ | 61 | /* By default, RFC2861 behavior. */ |
62 | int sysctl_tcp_slow_start_after_idle __read_mostly = 1; | 62 | int sysctl_tcp_slow_start_after_idle __read_mostly = 1; |
63 | 63 | ||
64 | static inline void tcp_packets_out_inc(struct sock *sk, | 64 | static void tcp_event_new_data_sent(struct sock *sk, struct sk_buff *skb) |
65 | const struct sk_buff *skb) | ||
66 | { | ||
67 | struct tcp_sock *tp = tcp_sk(sk); | ||
68 | int orig = tp->packets_out; | ||
69 | |||
70 | tp->packets_out += tcp_skb_pcount(skb); | ||
71 | if (!orig) | ||
72 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | ||
73 | inet_csk(sk)->icsk_rto, TCP_RTO_MAX); | ||
74 | } | ||
75 | |||
76 | static void update_send_head(struct sock *sk, struct sk_buff *skb) | ||
77 | { | 65 | { |
78 | struct tcp_sock *tp = tcp_sk(sk); | 66 | struct tcp_sock *tp = tcp_sk(sk); |
67 | unsigned int prior_packets = tp->packets_out; | ||
79 | 68 | ||
80 | tcp_advance_send_head(sk, skb); | 69 | tcp_advance_send_head(sk, skb); |
81 | tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; | 70 | tp->snd_nxt = TCP_SKB_CB(skb)->end_seq; |
82 | tcp_packets_out_inc(sk, skb); | ||
83 | 71 | ||
84 | /* Don't override Nagle indefinately with F-RTO */ | 72 | /* Don't override Nagle indefinately with F-RTO */ |
85 | if (tp->frto_counter == 2) | 73 | if (tp->frto_counter == 2) |
86 | tp->frto_counter = 3; | 74 | tp->frto_counter = 3; |
75 | |||
76 | tp->packets_out += tcp_skb_pcount(skb); | ||
77 | if (!prior_packets) | ||
78 | inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, | ||
79 | inet_csk(sk)->icsk_rto, TCP_RTO_MAX); | ||
87 | } | 80 | } |
88 | 81 | ||
89 | /* SND.NXT, if window was not shrunk. | 82 | /* SND.NXT, if window was not shrunk. |
@@ -1410,7 +1403,7 @@ static int tcp_mtu_probe(struct sock *sk) | |||
1410 | /* Decrement cwnd here because we are sending | 1403 | /* Decrement cwnd here because we are sending |
1411 | * effectively two packets. */ | 1404 | * effectively two packets. */ |
1412 | tp->snd_cwnd--; | 1405 | tp->snd_cwnd--; |
1413 | update_send_head(sk, nskb); | 1406 | tcp_event_new_data_sent(sk, nskb); |
1414 | 1407 | ||
1415 | icsk->icsk_mtup.probe_size = tcp_mss_to_mtu(sk, nskb->len); | 1408 | icsk->icsk_mtup.probe_size = tcp_mss_to_mtu(sk, nskb->len); |
1416 | tp->mtu_probe.probe_seq_start = TCP_SKB_CB(nskb)->seq; | 1409 | tp->mtu_probe.probe_seq_start = TCP_SKB_CB(nskb)->seq; |
@@ -1494,7 +1487,7 @@ static int tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle) | |||
1494 | /* Advance the send_head. This one is sent out. | 1487 | /* Advance the send_head. This one is sent out. |
1495 | * This call will increment packets_out. | 1488 | * This call will increment packets_out. |
1496 | */ | 1489 | */ |
1497 | update_send_head(sk, skb); | 1490 | tcp_event_new_data_sent(sk, skb); |
1498 | 1491 | ||
1499 | tcp_minshall_update(tp, mss_now, skb); | 1492 | tcp_minshall_update(tp, mss_now, skb); |
1500 | sent_pkts++; | 1493 | sent_pkts++; |
@@ -1553,7 +1546,7 @@ void tcp_push_one(struct sock *sk, unsigned int mss_now) | |||
1553 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 1546 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
1554 | 1547 | ||
1555 | if (likely(!tcp_transmit_skb(sk, skb, 1, sk->sk_allocation))) { | 1548 | if (likely(!tcp_transmit_skb(sk, skb, 1, sk->sk_allocation))) { |
1556 | update_send_head(sk, skb); | 1549 | tcp_event_new_data_sent(sk, skb); |
1557 | tcp_cwnd_validate(sk); | 1550 | tcp_cwnd_validate(sk); |
1558 | return; | 1551 | return; |
1559 | } | 1552 | } |
@@ -2528,9 +2521,8 @@ int tcp_write_wakeup(struct sock *sk) | |||
2528 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; | 2521 | TCP_SKB_CB(skb)->flags |= TCPCB_FLAG_PSH; |
2529 | TCP_SKB_CB(skb)->when = tcp_time_stamp; | 2522 | TCP_SKB_CB(skb)->when = tcp_time_stamp; |
2530 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); | 2523 | err = tcp_transmit_skb(sk, skb, 1, GFP_ATOMIC); |
2531 | if (!err) { | 2524 | if (!err) |
2532 | update_send_head(sk, skb); | 2525 | tcp_event_new_data_sent(sk, skb); |
2533 | } | ||
2534 | return err; | 2526 | return err; |
2535 | } else { | 2527 | } else { |
2536 | if (tp->urg_mode && | 2528 | if (tp->urg_mode && |