diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 00e5a300ddb9..c4172c1fb198 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -160,7 +160,8 @@ static void tcp_event_data_sent(struct tcp_sock *tp, | |||
160 | } | 160 | } |
161 | 161 | ||
162 | /* Account for an ACK we sent. */ | 162 | /* Account for an ACK we sent. */ |
163 | static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts) | 163 | static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts, |
164 | u32 rcv_nxt) | ||
164 | { | 165 | { |
165 | struct tcp_sock *tp = tcp_sk(sk); | 166 | struct tcp_sock *tp = tcp_sk(sk); |
166 | 167 | ||
@@ -171,6 +172,9 @@ static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts) | |||
171 | if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) == 1) | 172 | if (hrtimer_try_to_cancel(&tp->compressed_ack_timer) == 1) |
172 | __sock_put(sk); | 173 | __sock_put(sk); |
173 | } | 174 | } |
175 | |||
176 | if (unlikely(rcv_nxt != tp->rcv_nxt)) | ||
177 | return; /* Special ACK sent by DCTCP to reflect ECN */ | ||
174 | tcp_dec_quickack_mode(sk, pkts); | 178 | tcp_dec_quickack_mode(sk, pkts); |
175 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); | 179 | inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); |
176 | } | 180 | } |
@@ -1023,8 +1027,8 @@ static void tcp_update_skb_after_send(struct tcp_sock *tp, struct sk_buff *skb) | |||
1023 | * We are working here with either a clone of the original | 1027 | * We are working here with either a clone of the original |
1024 | * SKB, or a fresh unique copy made by the retransmit engine. | 1028 | * SKB, or a fresh unique copy made by the retransmit engine. |
1025 | */ | 1029 | */ |
1026 | static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | 1030 | static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, |
1027 | gfp_t gfp_mask) | 1031 | int clone_it, gfp_t gfp_mask, u32 rcv_nxt) |
1028 | { | 1032 | { |
1029 | const struct inet_connection_sock *icsk = inet_csk(sk); | 1033 | const struct inet_connection_sock *icsk = inet_csk(sk); |
1030 | struct inet_sock *inet; | 1034 | struct inet_sock *inet; |
@@ -1100,7 +1104,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
1100 | th->source = inet->inet_sport; | 1104 | th->source = inet->inet_sport; |
1101 | th->dest = inet->inet_dport; | 1105 | th->dest = inet->inet_dport; |
1102 | th->seq = htonl(tcb->seq); | 1106 | th->seq = htonl(tcb->seq); |
1103 | th->ack_seq = htonl(tp->rcv_nxt); | 1107 | th->ack_seq = htonl(rcv_nxt); |
1104 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | | 1108 | *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | |
1105 | tcb->tcp_flags); | 1109 | tcb->tcp_flags); |
1106 | 1110 | ||
@@ -1141,7 +1145,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
1141 | icsk->icsk_af_ops->send_check(sk, skb); | 1145 | icsk->icsk_af_ops->send_check(sk, skb); |
1142 | 1146 | ||
1143 | if (likely(tcb->tcp_flags & TCPHDR_ACK)) | 1147 | if (likely(tcb->tcp_flags & TCPHDR_ACK)) |
1144 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); | 1148 | tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt); |
1145 | 1149 | ||
1146 | if (skb->len != tcp_header_size) { | 1150 | if (skb->len != tcp_header_size) { |
1147 | tcp_event_data_sent(tp, sk); | 1151 | tcp_event_data_sent(tp, sk); |
@@ -1178,6 +1182,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | |||
1178 | return err; | 1182 | return err; |
1179 | } | 1183 | } |
1180 | 1184 | ||
1185 | static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, | ||
1186 | gfp_t gfp_mask) | ||
1187 | { | ||
1188 | return __tcp_transmit_skb(sk, skb, clone_it, gfp_mask, | ||
1189 | tcp_sk(sk)->rcv_nxt); | ||
1190 | } | ||
1191 | |||
1181 | /* This routine just queues the buffer for sending. | 1192 | /* This routine just queues the buffer for sending. |
1182 | * | 1193 | * |
1183 | * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames, | 1194 | * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames, |
@@ -3571,7 +3582,7 @@ void tcp_send_delayed_ack(struct sock *sk) | |||
3571 | } | 3582 | } |
3572 | 3583 | ||
3573 | /* This routine sends an ack and also updates the window. */ | 3584 | /* This routine sends an ack and also updates the window. */ |
3574 | void tcp_send_ack(struct sock *sk) | 3585 | void __tcp_send_ack(struct sock *sk, u32 rcv_nxt) |
3575 | { | 3586 | { |
3576 | struct sk_buff *buff; | 3587 | struct sk_buff *buff; |
3577 | 3588 | ||
@@ -3604,9 +3615,14 @@ void tcp_send_ack(struct sock *sk) | |||
3604 | skb_set_tcp_pure_ack(buff); | 3615 | skb_set_tcp_pure_ack(buff); |
3605 | 3616 | ||
3606 | /* Send it off, this clears delayed acks for us. */ | 3617 | /* Send it off, this clears delayed acks for us. */ |
3607 | tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0); | 3618 | __tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0, rcv_nxt); |
3619 | } | ||
3620 | EXPORT_SYMBOL_GPL(__tcp_send_ack); | ||
3621 | |||
3622 | void tcp_send_ack(struct sock *sk) | ||
3623 | { | ||
3624 | __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt); | ||
3608 | } | 3625 | } |
3609 | EXPORT_SYMBOL_GPL(tcp_send_ack); | ||
3610 | 3626 | ||
3611 | /* This routine sends a packet with an out of date sequence | 3627 | /* This routine sends a packet with an out of date sequence |
3612 | * number. It assumes the other end will try to ack it. | 3628 | * number. It assumes the other end will try to ack it. |