aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 2a62b55b15f1..f19f5fb361b5 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -236,7 +236,7 @@ static u16 tcp_select_window(struct sock *sk)
236 u32 new_win = __tcp_select_window(sk); 236 u32 new_win = __tcp_select_window(sk);
237 237
238 /* Never shrink the offered window */ 238 /* Never shrink the offered window */
239 if(new_win < cur_win) { 239 if (new_win < cur_win) {
240 /* Danger Will Robinson! 240 /* Danger Will Robinson!
241 * Don't update rcv_wup/rcv_wnd here or else 241 * Don't update rcv_wup/rcv_wnd here or else
242 * we will not be able to advertise a zero 242 * we will not be able to advertise a zero
@@ -287,10 +287,12 @@ static void tcp_build_and_update_options(__be32 *ptr, struct tcp_sock *tp,
287 (TCPOPT_SACK << 8) | 287 (TCPOPT_SACK << 8) |
288 (TCPOLEN_SACK_BASE + (tp->rx_opt.eff_sacks * 288 (TCPOLEN_SACK_BASE + (tp->rx_opt.eff_sacks *
289 TCPOLEN_SACK_PERBLOCK))); 289 TCPOLEN_SACK_PERBLOCK)));
290 for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) { 290
291 for (this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) {
291 *ptr++ = htonl(sp[this_sack].start_seq); 292 *ptr++ = htonl(sp[this_sack].start_seq);
292 *ptr++ = htonl(sp[this_sack].end_seq); 293 *ptr++ = htonl(sp[this_sack].end_seq);
293 } 294 }
295
294 if (tp->rx_opt.dsack) { 296 if (tp->rx_opt.dsack) {
295 tp->rx_opt.dsack = 0; 297 tp->rx_opt.dsack = 0;
296 tp->rx_opt.eff_sacks--; 298 tp->rx_opt.eff_sacks--;
@@ -335,7 +337,7 @@ static void tcp_syn_build_options(__be32 *ptr, int mss, int ts, int sack,
335 */ 337 */
336 *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss); 338 *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss);
337 if (ts) { 339 if (ts) {
338 if(sack) 340 if (sack)
339 *ptr++ = htonl((TCPOPT_SACK_PERM << 24) | 341 *ptr++ = htonl((TCPOPT_SACK_PERM << 24) |
340 (TCPOLEN_SACK_PERM << 16) | 342 (TCPOLEN_SACK_PERM << 16) |
341 (TCPOPT_TIMESTAMP << 8) | 343 (TCPOPT_TIMESTAMP << 8) |
@@ -347,7 +349,7 @@ static void tcp_syn_build_options(__be32 *ptr, int mss, int ts, int sack,
347 TCPOLEN_TIMESTAMP); 349 TCPOLEN_TIMESTAMP);
348 *ptr++ = htonl(tstamp); /* TSVAL */ 350 *ptr++ = htonl(tstamp); /* TSVAL */
349 *ptr++ = htonl(ts_recent); /* TSECR */ 351 *ptr++ = htonl(ts_recent); /* TSECR */
350 } else if(sack) 352 } else if (sack)
351 *ptr++ = htonl((TCPOPT_NOP << 24) | 353 *ptr++ = htonl((TCPOPT_NOP << 24) |
352 (TCPOPT_NOP << 16) | 354 (TCPOPT_NOP << 16) |
353 (TCPOPT_SACK_PERM << 8) | 355 (TCPOPT_SACK_PERM << 8) |
@@ -428,7 +430,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
428 sysctl_flags = 0; 430 sysctl_flags = 0;
429 if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) { 431 if (unlikely(tcb->flags & TCPCB_FLAG_SYN)) {
430 tcp_header_size = sizeof(struct tcphdr) + TCPOLEN_MSS; 432 tcp_header_size = sizeof(struct tcphdr) + TCPOLEN_MSS;
431 if(sysctl_tcp_timestamps) { 433 if (sysctl_tcp_timestamps) {
432 tcp_header_size += TCPOLEN_TSTAMP_ALIGNED; 434 tcp_header_size += TCPOLEN_TSTAMP_ALIGNED;
433 sysctl_flags |= SYSCTL_FLAG_TSTAMPS; 435 sysctl_flags |= SYSCTL_FLAG_TSTAMPS;
434 } 436 }
@@ -1618,7 +1620,7 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m
1618 u16 flags = TCP_SKB_CB(skb)->flags; 1620 u16 flags = TCP_SKB_CB(skb)->flags;
1619 1621
1620 /* Also punt if next skb has been SACK'd. */ 1622 /* Also punt if next skb has been SACK'd. */
1621 if(TCP_SKB_CB(next_skb)->sacked & TCPCB_SACKED_ACKED) 1623 if (TCP_SKB_CB(next_skb)->sacked & TCPCB_SACKED_ACKED)
1622 return; 1624 return;
1623 1625
1624 /* Next skb is out of window. */ 1626 /* Next skb is out of window. */
@@ -1778,13 +1780,13 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1778 } 1780 }
1779 1781
1780 /* Collapse two adjacent packets if worthwhile and we can. */ 1782 /* Collapse two adjacent packets if worthwhile and we can. */
1781 if(!(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_SYN) && 1783 if (!(TCP_SKB_CB(skb)->flags & TCPCB_FLAG_SYN) &&
1782 (skb->len < (cur_mss >> 1)) && 1784 (skb->len < (cur_mss >> 1)) &&
1783 (tcp_write_queue_next(sk, skb) != tcp_send_head(sk)) && 1785 (tcp_write_queue_next(sk, skb) != tcp_send_head(sk)) &&
1784 (!tcp_skb_is_last(sk, skb)) && 1786 (!tcp_skb_is_last(sk, skb)) &&
1785 (skb_shinfo(skb)->nr_frags == 0 && skb_shinfo(tcp_write_queue_next(sk, skb))->nr_frags == 0) && 1787 (skb_shinfo(skb)->nr_frags == 0 && skb_shinfo(tcp_write_queue_next(sk, skb))->nr_frags == 0) &&
1786 (tcp_skb_pcount(skb) == 1 && tcp_skb_pcount(tcp_write_queue_next(sk, skb)) == 1) && 1788 (tcp_skb_pcount(skb) == 1 && tcp_skb_pcount(tcp_write_queue_next(sk, skb)) == 1) &&
1787 (sysctl_tcp_retrans_collapse != 0)) 1789 (sysctl_tcp_retrans_collapse != 0))
1788 tcp_retrans_try_collapse(sk, skb, cur_mss); 1790 tcp_retrans_try_collapse(sk, skb, cur_mss);
1789 1791
1790 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk)) 1792 if (inet_csk(sk)->icsk_af_ops->rebuild_header(sk))
@@ -1794,9 +1796,9 @@ int tcp_retransmit_skb(struct sock *sk, struct sk_buff *skb)
1794 * retransmit when old data is attached. So strip it off 1796 * retransmit when old data is attached. So strip it off
1795 * since it is cheap to do so and saves bytes on the network. 1797 * since it is cheap to do so and saves bytes on the network.
1796 */ 1798 */
1797 if(skb->len > 0 && 1799 if (skb->len > 0 &&
1798 (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) && 1800 (TCP_SKB_CB(skb)->flags & TCPCB_FLAG_FIN) &&
1799 tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) { 1801 tp->snd_una == (TCP_SKB_CB(skb)->end_seq - 1)) {
1800 if (!pskb_trim(skb, 0)) { 1802 if (!pskb_trim(skb, 0)) {
1801 TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1; 1803 TCP_SKB_CB(skb)->seq = TCP_SKB_CB(skb)->end_seq - 1;
1802 skb_shinfo(skb)->gso_segs = 1; 1804 skb_shinfo(skb)->gso_segs = 1;