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.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 6cbab56e7407..490df62f26d4 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. */
163static inline void tcp_event_ack_sent(struct sock *sk, unsigned int pkts) 163static 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}
@@ -1009,8 +1013,8 @@ static void tcp_update_skb_after_send(struct tcp_sock *tp, struct sk_buff *skb)
1009 * We are working here with either a clone of the original 1013 * We are working here with either a clone of the original
1010 * SKB, or a fresh unique copy made by the retransmit engine. 1014 * SKB, or a fresh unique copy made by the retransmit engine.
1011 */ 1015 */
1012static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it, 1016static int __tcp_transmit_skb(struct sock *sk, struct sk_buff *skb,
1013 gfp_t gfp_mask) 1017 int clone_it, gfp_t gfp_mask, u32 rcv_nxt)
1014{ 1018{
1015 const struct inet_connection_sock *icsk = inet_csk(sk); 1019 const struct inet_connection_sock *icsk = inet_csk(sk);
1016 struct inet_sock *inet; 1020 struct inet_sock *inet;
@@ -1086,7 +1090,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1086 th->source = inet->inet_sport; 1090 th->source = inet->inet_sport;
1087 th->dest = inet->inet_dport; 1091 th->dest = inet->inet_dport;
1088 th->seq = htonl(tcb->seq); 1092 th->seq = htonl(tcb->seq);
1089 th->ack_seq = htonl(tp->rcv_nxt); 1093 th->ack_seq = htonl(rcv_nxt);
1090 *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) | 1094 *(((__be16 *)th) + 6) = htons(((tcp_header_size >> 2) << 12) |
1091 tcb->tcp_flags); 1095 tcb->tcp_flags);
1092 1096
@@ -1127,7 +1131,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1127 icsk->icsk_af_ops->send_check(sk, skb); 1131 icsk->icsk_af_ops->send_check(sk, skb);
1128 1132
1129 if (likely(tcb->tcp_flags & TCPHDR_ACK)) 1133 if (likely(tcb->tcp_flags & TCPHDR_ACK))
1130 tcp_event_ack_sent(sk, tcp_skb_pcount(skb)); 1134 tcp_event_ack_sent(sk, tcp_skb_pcount(skb), rcv_nxt);
1131 1135
1132 if (skb->len != tcp_header_size) { 1136 if (skb->len != tcp_header_size) {
1133 tcp_event_data_sent(tp, sk); 1137 tcp_event_data_sent(tp, sk);
@@ -1164,6 +1168,13 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1164 return err; 1168 return err;
1165} 1169}
1166 1170
1171static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
1172 gfp_t gfp_mask)
1173{
1174 return __tcp_transmit_skb(sk, skb, clone_it, gfp_mask,
1175 tcp_sk(sk)->rcv_nxt);
1176}
1177
1167/* This routine just queues the buffer for sending. 1178/* This routine just queues the buffer for sending.
1168 * 1179 *
1169 * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames, 1180 * NOTE: probe0 timer is not checked, do not forget tcp_push_pending_frames,
@@ -3557,7 +3568,7 @@ void tcp_send_delayed_ack(struct sock *sk)
3557} 3568}
3558 3569
3559/* This routine sends an ack and also updates the window. */ 3570/* This routine sends an ack and also updates the window. */
3560void tcp_send_ack(struct sock *sk) 3571void __tcp_send_ack(struct sock *sk, u32 rcv_nxt)
3561{ 3572{
3562 struct sk_buff *buff; 3573 struct sk_buff *buff;
3563 3574
@@ -3590,9 +3601,14 @@ void tcp_send_ack(struct sock *sk)
3590 skb_set_tcp_pure_ack(buff); 3601 skb_set_tcp_pure_ack(buff);
3591 3602
3592 /* Send it off, this clears delayed acks for us. */ 3603 /* Send it off, this clears delayed acks for us. */
3593 tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0); 3604 __tcp_transmit_skb(sk, buff, 0, (__force gfp_t)0, rcv_nxt);
3605}
3606EXPORT_SYMBOL_GPL(__tcp_send_ack);
3607
3608void tcp_send_ack(struct sock *sk)
3609{
3610 __tcp_send_ack(sk, tcp_sk(sk)->rcv_nxt);
3594} 3611}
3595EXPORT_SYMBOL_GPL(tcp_send_ack);
3596 3612
3597/* This routine sends a packet with an out of date sequence 3613/* This routine sends a packet with an out of date sequence
3598 * number. It assumes the other end will try to ack it. 3614 * number. It assumes the other end will try to ack it.