aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorIlpo Järvinen <ilpo.jarvinen@helsinki.fi>2007-11-15 22:41:46 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 17:54:03 -0500
commita47e5a988a575e64c8c9bae65a1dfe3dca7cba32 (patch)
tree30c389efb3a98a7af24150e5f6462f3c379d1e63 /net/ipv4/tcp_output.c
parent85cc391c0e4584db594bfc4005c63c07c76c5077 (diff)
[TCP]: Convert highest_sack to sk_buff to allow direct access
It is going to replace the sack fastpath hint quite soon... :-) Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index f4c1eef89af0..ce506af5ce07 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -657,13 +657,15 @@ static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned
657 * tweak SACK fastpath hint too as it would overwrite all changes unless 657 * tweak SACK fastpath hint too as it would overwrite all changes unless
658 * hint is also changed. 658 * hint is also changed.
659 */ 659 */
660static void tcp_adjust_fackets_out(struct tcp_sock *tp, struct sk_buff *skb, 660static void tcp_adjust_fackets_out(struct sock *sk, struct sk_buff *skb,
661 int decr) 661 int decr)
662{ 662{
663 struct tcp_sock *tp = tcp_sk(sk);
664
663 if (!tp->sacked_out || tcp_is_reno(tp)) 665 if (!tp->sacked_out || tcp_is_reno(tp))
664 return; 666 return;
665 667
666 if (!before(tp->highest_sack, TCP_SKB_CB(skb)->seq)) 668 if (!before(tcp_highest_sack_seq(tp), TCP_SKB_CB(skb)->seq))
667 tp->fackets_out -= decr; 669 tp->fackets_out -= decr;
668 670
669 /* cnt_hint is "off-by-one" compared with fackets_out (see sacktag) */ 671 /* cnt_hint is "off-by-one" compared with fackets_out (see sacktag) */
@@ -712,9 +714,8 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
712 TCP_SKB_CB(buff)->end_seq = TCP_SKB_CB(skb)->end_seq; 714 TCP_SKB_CB(buff)->end_seq = TCP_SKB_CB(skb)->end_seq;
713 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(buff)->seq; 715 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(buff)->seq;
714 716
715 if (tcp_is_sack(tp) && tp->sacked_out && 717 if (tcp_is_sack(tp) && tp->sacked_out && (skb == tp->highest_sack))
716 (TCP_SKB_CB(skb)->seq == tp->highest_sack)) 718 tp->highest_sack = buff;
717 tp->highest_sack = TCP_SKB_CB(buff)->seq;
718 719
719 /* PSH and FIN should only be set in the second packet. */ 720 /* PSH and FIN should only be set in the second packet. */
720 flags = TCP_SKB_CB(skb)->flags; 721 flags = TCP_SKB_CB(skb)->flags;
@@ -772,7 +773,7 @@ int tcp_fragment(struct sock *sk, struct sk_buff *skb, u32 len, unsigned int mss
772 tcp_dec_pcount_approx_int(&tp->sacked_out, diff); 773 tcp_dec_pcount_approx_int(&tp->sacked_out, diff);
773 tcp_verify_left_out(tp); 774 tcp_verify_left_out(tp);
774 } 775 }
775 tcp_adjust_fackets_out(tp, skb, diff); 776 tcp_adjust_fackets_out(sk, skb, diff);
776 } 777 }
777 778
778 /* Link BUFF into the send queue. */ 779 /* Link BUFF into the send queue. */
@@ -1712,7 +1713,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1712 tcp_skb_pcount(next_skb) != 1); 1713 tcp_skb_pcount(next_skb) != 1);
1713 1714
1714 if (WARN_ON(tcp_is_sack(tp) && tp->sacked_out && 1715 if (WARN_ON(tcp_is_sack(tp) && tp->sacked_out &&
1715 (TCP_SKB_CB(next_skb)->seq == tp->highest_sack))) 1716 (next_skb == tp->highest_sack)))
1716 return; 1717 return;
1717 1718
1718 /* Ok. We will be able to collapse the packet. */ 1719 /* Ok. We will be able to collapse the packet. */
@@ -1747,7 +1748,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1747 if (tcp_is_reno(tp) && tp->sacked_out) 1748 if (tcp_is_reno(tp) && tp->sacked_out)
1748 tcp_dec_pcount_approx(&tp->sacked_out, next_skb); 1749 tcp_dec_pcount_approx(&tp->sacked_out, next_skb);
1749 1750
1750 tcp_adjust_fackets_out(tp, next_skb, tcp_skb_pcount(next_skb)); 1751 tcp_adjust_fackets_out(sk, next_skb, tcp_skb_pcount(next_skb));
1751 tp->packets_out -= tcp_skb_pcount(next_skb); 1752 tp->packets_out -= tcp_skb_pcount(next_skb);
1752 1753
1753 /* changed transmit queue under us so clear hints */ 1754 /* changed transmit queue under us so clear hints */
@@ -2028,7 +2029,7 @@ void tcp_xmit_retransmit_queue(struct sock *sk)
2028 break; 2029 break;
2029 tp->forward_skb_hint = skb; 2030 tp->forward_skb_hint = skb;
2030 2031
2031 if (after(TCP_SKB_CB(skb)->seq, tp->highest_sack)) 2032 if (after(TCP_SKB_CB(skb)->seq, tcp_highest_sack_seq(tp)))
2032 break; 2033 break;
2033 2034
2034 if (tcp_packets_in_flight(tp) >= tp->snd_cwnd) 2035 if (tcp_packets_in_flight(tp) >= tp->snd_cwnd)