aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2006-07-03 10:25:08 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2006-07-03 10:25:08 -0400
commit0a1340c185734a57fbf4775927966ad4a1347b02 (patch)
treed9ed8f0dd809a7c542a3356601125ea5b5aaa804 /net/ipv4/tcp_output.c
parentaf18ddb8864b096e3ed4732e2d4b21c956dcfe3a (diff)
parent29454dde27d8e340bb1987bad9aa504af7081eba (diff)
Merge rsync://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: include/linux/kernel.h
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 07bb5a2b375e..5c08ea20a18d 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -510,20 +510,21 @@ static void tcp_queue_skb(struct sock *sk, struct sk_buff *skb)
510 510
511static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now) 511static void tcp_set_skb_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int mss_now)
512{ 512{
513 if (skb->len <= mss_now || 513 if (skb->len <= mss_now || !sk_can_gso(sk)) {
514 !(sk->sk_route_caps & NETIF_F_TSO)) {
515 /* Avoid the costly divide in the normal 514 /* Avoid the costly divide in the normal
516 * non-TSO case. 515 * non-TSO case.
517 */ 516 */
518 skb_shinfo(skb)->tso_segs = 1; 517 skb_shinfo(skb)->gso_segs = 1;
519 skb_shinfo(skb)->tso_size = 0; 518 skb_shinfo(skb)->gso_size = 0;
519 skb_shinfo(skb)->gso_type = 0;
520 } else { 520 } else {
521 unsigned int factor; 521 unsigned int factor;
522 522
523 factor = skb->len + (mss_now - 1); 523 factor = skb->len + (mss_now - 1);
524 factor /= mss_now; 524 factor /= mss_now;
525 skb_shinfo(skb)->tso_segs = factor; 525 skb_shinfo(skb)->gso_segs = factor;
526 skb_shinfo(skb)->tso_size = mss_now; 526 skb_shinfo(skb)->gso_size = mss_now;
527 skb_shinfo(skb)->gso_type = sk->sk_gso_type;
527 } 528 }
528} 529}
529 530
@@ -822,9 +823,7 @@ unsigned int tcp_current_mss(struct sock *sk, int large_allowed)
822 823
823 mss_now = tp->mss_cache; 824 mss_now = tp->mss_cache;
824 825
825 if (large_allowed && 826 if (large_allowed && sk_can_gso(sk) && !tp->urg_mode)
826 (sk->sk_route_caps & NETIF_F_TSO) &&
827 !tp->urg_mode)
828 doing_tso = 1; 827 doing_tso = 1;
829 828
830 if (dst) { 829 if (dst) {
@@ -914,7 +913,7 @@ static int tcp_init_tso_segs(struct sock *sk, struct sk_buff *skb, unsigned int
914 913
915 if (!tso_segs || 914 if (!tso_segs ||
916 (tso_segs > 1 && 915 (tso_segs > 1 &&
917 skb_shinfo(skb)->tso_size != mss_now)) { 916 tcp_skb_mss(skb) != mss_now)) {
918 tcp_set_skb_tso_segs(sk, skb, mss_now); 917 tcp_set_skb_tso_segs(sk, skb, mss_now);
919 tso_segs = tcp_skb_pcount(skb); 918 tso_segs = tcp_skb_pcount(skb);
920 } 919 }
@@ -1724,8 +1723,9 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1724 tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) { 1723 tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) {
1725 if (!pskb_trim(skb, 0)) { 1724 if (!pskb_trim(skb, 0)) {
1726 TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1; 1725 TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1;
1727 skb_shinfo(skb)->tso_segs = 1; 1726 skb_shinfo(skb)->gso_segs = 1;
1728 skb_shinfo(skb)->tso_size = 0; 1727 skb_shinfo(skb)->gso_size = 0;
1728 skb_shinfo(skb)->gso_type = 0;
1729 skb->ip_summed = CHECKSUM_NONE; 1729 skb->ip_summed = CHECKSUM_NONE;
1730 skb->csum = 0; 1730 skb->csum = 0;
1731 } 1731 }
@@ -1930,8 +1930,9 @@ void tcp_send_fin(struct sock *sk)
1930 skb->csum = 0; 1930 skb->csum = 0;
1931 TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN); 1931 TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_FIN);
1932 TCP_SKB_CB(skb)->sacked = 0; 1932 TCP_SKB_CB(skb)->sacked = 0;
1933 skb_shinfo(skb)->tso_segs = 1; 1933 skb_shinfo(skb)->gso_segs = 1;
1934 skb_shinfo(skb)->tso_size = 0; 1934 skb_shinfo(skb)->gso_size = 0;
1935 skb_shinfo(skb)->gso_type = 0;
1935 1936
1936 /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */ 1937 /* FIN eats a sequence byte, write_seq advanced by tcp_queue_skb(). */
1937 TCP_SKB_CB(skb)->seq = tp->write_seq; 1938 TCP_SKB_CB(skb)->seq = tp->write_seq;
@@ -1963,8 +1964,9 @@ void tcp_send_active_reset(struct sock *sk, gfp_t priority)
1963 skb->csum = 0; 1964 skb->csum = 0;
1964 TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST); 1965 TCP_SKB_CB(skb)->flags = (TCPCB_FLAG_ACK | TCPCB_FLAG_RST);
1965 TCP_SKB_CB(skb)->sacked = 0; 1966 TCP_SKB_CB(skb)->sacked = 0;
1966 skb_shinfo(skb)->tso_segs = 1; 1967 skb_shinfo(skb)->gso_segs = 1;
1967 skb_shinfo(skb)->tso_size = 0; 1968 skb_shinfo(skb)->gso_size = 0;
1969 skb_shinfo(skb)->gso_type = 0;
1968 1970
1969 /* Send it off. */ 1971 /* Send it off. */
1970 TCP_SKB_CB(skb)->seq = tcp_acceptable_seq(sk, tp); 1972 TCP_SKB_CB(skb)->seq = tcp_acceptable_seq(sk, tp);
@@ -2039,16 +2041,15 @@ struct sk_buff * tcp_make_synack(struct sock *sk, struct dst_entry *dst,
2039 memset(th, 0, sizeof(struct tcphdr)); 2041 memset(th, 0, sizeof(struct tcphdr));
2040 th->syn = 1; 2042 th->syn = 1;
2041 th->ack = 1; 2043 th->ack = 1;
2042 if (dst->dev->features&NETIF_F_TSO)
2043 ireq->ecn_ok = 0;
2044 TCP_ECN_make_synack(req, th); 2044 TCP_ECN_make_synack(req, th);
2045 th->source = inet_sk(sk)->sport; 2045 th->source = inet_sk(sk)->sport;
2046 th->dest = ireq->rmt_port; 2046 th->dest = ireq->rmt_port;
2047 TCP_SKB_CB(skb)->seq = tcp_rsk(req)->snt_isn; 2047 TCP_SKB_CB(skb)->seq = tcp_rsk(req)->snt_isn;
2048 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + 1; 2048 TCP_SKB_CB(skb)->end_seq = TCP_SKB_CB(skb)->seq + 1;
2049 TCP_SKB_CB(skb)->sacked = 0; 2049 TCP_SKB_CB(skb)->sacked = 0;
2050 skb_shinfo(skb)->tso_segs = 1; 2050 skb_shinfo(skb)->gso_segs = 1;
2051 skb_shinfo(skb)->tso_size = 0; 2051 skb_shinfo(skb)->gso_size = 0;
2052 skb_shinfo(skb)->gso_type = 0;
2052 th->seq = htonl(TCP_SKB_CB(skb)->seq); 2053 th->seq = htonl(TCP_SKB_CB(skb)->seq);
2053 th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1); 2054 th->ack_seq = htonl(tcp_rsk(req)->rcv_isn + 1);
2054 if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */ 2055 if (req->rcv_wnd == 0) { /* ignored for retransmitted syns */
@@ -2152,8 +2153,9 @@ int tcp_connect(struct sock *sk)
2152 TCP_SKB_CB(buff)->flags = TCPCB_FLAG_SYN; 2153 TCP_SKB_CB(buff)->flags = TCPCB_FLAG_SYN;
2153 TCP_ECN_send_syn(sk, tp, buff); 2154 TCP_ECN_send_syn(sk, tp, buff);
2154 TCP_SKB_CB(buff)->sacked = 0; 2155 TCP_SKB_CB(buff)->sacked = 0;
2155 skb_shinfo(buff)->tso_segs = 1; 2156 skb_shinfo(buff)->gso_segs = 1;
2156 skb_shinfo(buff)->tso_size = 0; 2157 skb_shinfo(buff)->gso_size = 0;
2158 skb_shinfo(buff)->gso_type = 0;
2157 buff->csum = 0; 2159 buff->csum = 0;
2158 TCP_SKB_CB(buff)->seq = tp->write_seq++; 2160 TCP_SKB_CB(buff)->seq = tp->write_seq++;
2159 TCP_SKB_CB(buff)->end_seq = tp->write_seq; 2161 TCP_SKB_CB(buff)->end_seq = tp->write_seq;
@@ -2257,8 +2259,9 @@ void tcp_send_ack(struct sock *sk)
2257 buff->csum = 0; 2259 buff->csum = 0;
2258 TCP_SKB_CB(buff)->flags = TCPCB_FLAG_ACK; 2260 TCP_SKB_CB(buff)->flags = TCPCB_FLAG_ACK;
2259 TCP_SKB_CB(buff)->sacked = 0; 2261 TCP_SKB_CB(buff)->sacked = 0;
2260 skb_shinfo(buff)->tso_segs = 1; 2262 skb_shinfo(buff)->gso_segs = 1;
2261 skb_shinfo(buff)->tso_size = 0; 2263 skb_shinfo(buff)->gso_size = 0;
2264 skb_shinfo(buff)->gso_type = 0;
2262 2265
2263 /* Send it off, this clears delayed acks for us. */ 2266 /* Send it off, this clears delayed acks for us. */
2264 TCP_SKB_CB(buff)->seq = TCP_SKB_CB(buff)->end_seq = tcp_acceptable_seq(sk, tp); 2267 TCP_SKB_CB(buff)->seq = TCP_SKB_CB(buff)->end_seq = tcp_acceptable_seq(sk, tp);
@@ -2293,8 +2296,9 @@ static int tcp_xmit_probe_skb(struct sock *sk, int urgent)
2293 skb->csum = 0; 2296 skb->csum = 0;
2294 TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK; 2297 TCP_SKB_CB(skb)->flags = TCPCB_FLAG_ACK;
2295 TCP_SKB_CB(skb)->sacked = urgent; 2298 TCP_SKB_CB(skb)->sacked = urgent;
2296 skb_shinfo(skb)->tso_segs = 1; 2299 skb_shinfo(skb)->gso_segs = 1;
2297 skb_shinfo(skb)->tso_size = 0; 2300 skb_shinfo(skb)->gso_size = 0;
2301 skb_shinfo(skb)->gso_type = 0;
2298 2302
2299 /* Use a previous sequence. This should cause the other 2303 /* Use a previous sequence. This should cause the other
2300 * end to send an ack. Don't queue or clone SKB, just 2304 * end to send an ack. Don't queue or clone SKB, just